* [Patch mach-o/bfd/gas] handle ABS indirect_symbols.
@ 2012-01-12 18:29 Iain Sandoe
2012-01-13 8:17 ` Tristan Gingold
0 siblings, 1 reply; 3+ messages in thread
From: Iain Sandoe @ 2012-01-12 18:29 UTC (permalink / raw)
To: binutils Development; +Cc: Tristan Gingold
[-- Attachment #1: Type: text/plain, Size: 1979 bytes --]
a minor update to handle ABS symbols in the indirect symbol table.
tests attached
OK?
Iain
bfd:
* mach-o.c (bfd_mach_o_build_dysymtab_command): Handle ABS symbols.
gas:
* config/obj-macho.c (obj_mach_o_set_indirect_symbols): Handle ABS
symbols.
bfd/mach-o.c | 3 +++
gas/config/obj-macho.c | 10 +++++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index c519663..0846fe6 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -2199,6 +2199,9 @@ bfd_mach_o_build_dysymtab_command (bfd *abfd,
{
if (isyms[j] == NULL)
dsym->indirect_syms[n] = BFD_MACH_O_INDIRECT_SYM_LOCAL;
+ else if (isyms[j]->symbol.section == bfd_abs_section_ptr)
+ dsym->indirect_syms[n] = BFD_MACH_O_INDIRECT_SYM_LOCAL
+ | BFD_MACH_O_INDIRECT_SYM_ABS;
else
dsym->indirect_syms[n] = isyms[j]->symbol.udata.i;
}
diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index 61e6771..c381dbe 100644
--- a/gas/config/obj-macho.c
+++ b/gas/config/obj-macho.c
@@ -1545,14 +1545,18 @@ obj_mach_o_set_indirect_symbols (bfd *abfd,
asection *sec,
for (isym = list, n = 0; isym != NULL; isym = isym->next, n++)
{
+ sym = (bfd_mach_o_asymbol *)symbol_get_bfdsym (isym->sym);
/* Array is init to NULL & NULL signals a local symbol
If the section is lazy-bound, we need to keep the
- reference to the symbol, since dyld can override. */
- if (S_IS_LOCAL (isym->sym) && ! lazy)
+ reference to the symbol, since dyld can override.
+
+ Absolute symbols are handled specially. */
+ if (sym->symbol.section == bfd_abs_section_ptr)
+ ms->indirect_syms[n] = sym;
+ else if (S_IS_LOCAL (isym->sym) && ! lazy)
;
else
{
- sym = (bfd_mach_o_asymbol *)symbol_get_bfdsym (isym->sym);
if (sym == NULL)
;
/* If the symbols is external ... */
[-- Attachment #2: 12011218-dysym-abs-test.txt --]
[-- Type: text/plain, Size: 1960 bytes --]
gas/testsuite/gas/mach-o/dysymtab-3.d | 22 ++++++++++++++++++++++
gas/testsuite/gas/mach-o/symbols-7.s | 27 +++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/gas/testsuite/gas/mach-o/dysymtab-3.d b/gas/testsuite/gas/mach-o/dysymtab-3.d
new file mode 100644
index 0000000..b2bf2b2
--- /dev/null
+++ b/gas/testsuite/gas/mach-o/dysymtab-3.d
@@ -0,0 +1,22 @@
+#as: -L
+#objdump: -P dysymtab
+#target: i?86-*-darwin* powerpc-*-darwin*
+#source: symbols-7.s
+.*: +file format mach-o.*
+#...
+Load command dysymtab:
+( )+local symbols: idx:( )+0 num: 4( )+\(nxtidx: 4\)
+( )+external symbols: idx:( )+4 num: 1( )+\(nxtidx: 5\)
+( )+undefined symbols: idx:( )+5 num: 0( )+\(nxtidx: 5\)
+( )+table of content: off: 0x00000000 num: 0( )+\(endoff: 0x00000000\)
+( )+module table: off: 0x00000000 num: 0( )+\(endoff: 0x00000000\)
+( )+external reference table: off: 0x00000000 num: 0( )+\(endoff: 0x00000000\)
+( )+indirect symbol table: off: 0x00000168 num: 4( )+\(endoff: 0x00000178\)
+( )+external relocation table: off: 0x00000000 num: 0( )+\(endoff: 0x00000000\)
+( )+local relocation table: off: 0x00000000 num: 0( )+\(endoff: 0x00000000\)
+( )+indirect symbols:
+( )+for section __DATA.__nl_symbol_ptr:
+( )+0000000000000000( )+0: 0xc0000000 LOCAL ABSOLUTE
+( )+0000000000000004( )+1: 0x80000000 LOCAL
+( )+0000000000000008( )+2: 0xc0000000 LOCAL ABSOLUTE
+( )+000000000000000c( )+3: 0xc0000000 LOCAL ABSOLUTE
diff --git a/gas/testsuite/gas/mach-o/symbols-7.s b/gas/testsuite/gas/mach-o/symbols-7.s
new file mode 100644
index 0000000..a4ffb66
--- /dev/null
+++ b/gas/testsuite/gas/mach-o/symbols-7.s
@@ -0,0 +1,27 @@
+
+L01: .space 10
+
+L02: .space 10
+
+
+ .non_lazy_symbol_pointer
+
+ a = 5
+ .indirect_symbol a
+ .space 4
+
+ .indirect_symbol L01
+ .long L01-.
+
+ .indirect_symbol b
+ .space 4
+
+ b = 10
+
+ .globl c
+ c = 20
+ .indirect_symbol c
+ .space 4
+
+
+
\ No newline at end of file
[-- Attachment #3: Type: text/plain, Size: 3 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch mach-o/bfd/gas] handle ABS indirect_symbols.
2012-01-12 18:29 [Patch mach-o/bfd/gas] handle ABS indirect_symbols Iain Sandoe
@ 2012-01-13 8:17 ` Tristan Gingold
2012-01-13 13:12 ` Iain Sandoe
0 siblings, 1 reply; 3+ messages in thread
From: Tristan Gingold @ 2012-01-13 8:17 UTC (permalink / raw)
To: Iain Sandoe; +Cc: binutils Development
On Jan 12, 2012, at 7:28 PM, Iain Sandoe wrote:
> a minor update to handle ABS symbols in the indirect symbol table.
> tests attached
>
> OK?
Ok.
Thanks,
Tristan.
> Iain
>
> bfd:
>
> * mach-o.c (bfd_mach_o_build_dysymtab_command): Handle ABS symbols.
>
> gas:
>
> * config/obj-macho.c (obj_mach_o_set_indirect_symbols): Handle ABS symbols.
>
> bfd/mach-o.c | 3 +++
> gas/config/obj-macho.c | 10 +++++++---
> 2 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/bfd/mach-o.c b/bfd/mach-o.c
> index c519663..0846fe6 100644
> --- a/bfd/mach-o.c
> +++ b/bfd/mach-o.c
> @@ -2199,6 +2199,9 @@ bfd_mach_o_build_dysymtab_command (bfd *abfd,
> {
> if (isyms[j] == NULL)
> dsym->indirect_syms[n] = BFD_MACH_O_INDIRECT_SYM_LOCAL;
> + else if (isyms[j]->symbol.section == bfd_abs_section_ptr)
> + dsym->indirect_syms[n] = BFD_MACH_O_INDIRECT_SYM_LOCAL
> + | BFD_MACH_O_INDIRECT_SYM_ABS;
> else
> dsym->indirect_syms[n] = isyms[j]->symbol.udata.i;
> }
> diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
> index 61e6771..c381dbe 100644
> --- a/gas/config/obj-macho.c
> +++ b/gas/config/obj-macho.c
> @@ -1545,14 +1545,18 @@ obj_mach_o_set_indirect_symbols (bfd *abfd, asection *sec,
>
> for (isym = list, n = 0; isym != NULL; isym = isym->next, n++)
> {
> + sym = (bfd_mach_o_asymbol *)symbol_get_bfdsym (isym->sym);
> /* Array is init to NULL & NULL signals a local symbol
> If the section is lazy-bound, we need to keep the
> - reference to the symbol, since dyld can override. */
> - if (S_IS_LOCAL (isym->sym) && ! lazy)
> + reference to the symbol, since dyld can override.
> +
> + Absolute symbols are handled specially. */
> + if (sym->symbol.section == bfd_abs_section_ptr)
> + ms->indirect_syms[n] = sym;
> + else if (S_IS_LOCAL (isym->sym) && ! lazy)
> ;
> else
> {
> - sym = (bfd_mach_o_asymbol *)symbol_get_bfdsym (isym->sym);
> if (sym == NULL)
> ;
> /* If the symbols is external ... */
>
>
> <12011218-dysym-abs-test.txt>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch mach-o/bfd/gas] handle ABS indirect_symbols.
2012-01-13 8:17 ` Tristan Gingold
@ 2012-01-13 13:12 ` Iain Sandoe
0 siblings, 0 replies; 3+ messages in thread
From: Iain Sandoe @ 2012-01-13 13:12 UTC (permalink / raw)
To: Tristan Gingold; +Cc: binutils Development
On 13 Jan 2012, at 08:17, Tristan Gingold wrote:
>> a minor update to handle ABS symbols in the indirect symbol table.
>> tests attached
>>
>> OK?
>
> Ok.
thanks, committed.
Iain
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-01-13 13:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-12 18:29 [Patch mach-o/bfd/gas] handle ABS indirect_symbols Iain Sandoe
2012-01-13 8:17 ` Tristan Gingold
2012-01-13 13:12 ` Iain Sandoe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).