diff options
author | Iain Sandoe <iain@codesourcery.com> | 2012-01-13 12:59:30 +0000 |
---|---|---|
committer | Iain Sandoe <iain@codesourcery.com> | 2012-01-13 12:59:30 +0000 |
commit | 687be931eb3d3064e1ae6026f0c415048d9914cf (patch) | |
tree | 19b174fba55baf271b2d3a25073b8a54bb0d47bd /gas | |
parent | bb76d9401ec780f95f7c13a93067ae030cb612e8 (diff) | |
download | binutils-687be931eb3d3064e1ae6026f0c415048d9914cf.zip binutils-687be931eb3d3064e1ae6026f0c415048d9914cf.tar.gz binutils-687be931eb3d3064e1ae6026f0c415048d9914cf.tar.bz2 |
handle absolute indirect syms in mach-o
bfd:
* mach-o.c (bfd_mach_o_build_dysymtab_command): Handle absolute
indirect symbols.
gas:
* config/obj-macho.c (obj_mach_o_set_indirect_symbols): Handle
absolute indirect symbols.
gas/testsuite:
* gas/mach-o/dysymtab-3.d: New.
* gas/mach-o/symbols-7.s: New.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/ChangeLog | 5 | ||||
-rw-r--r-- | gas/config/obj-macho.c | 10 | ||||
-rw-r--r-- | gas/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/mach-o/dysymtab-3.d | 22 | ||||
-rw-r--r-- | gas/testsuite/gas/mach-o/symbols-7.s | 24 |
5 files changed, 63 insertions, 3 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index befc7bf..9d40556 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,10 @@ 2012-01-13 Iain Sandoe <idsandoe@googlemail.com> + * config/obj-macho.c (obj_mach_o_set_indirect_symbols): Handle + absolute indirect symbols. + +2012-01-13 Iain Sandoe <idsandoe@googlemail.com> + * config/obj-macho.c (obj_mach_o_set_vma_data): New type. (obj_mach_o_set_section_vma): New. (obj_mach_o_post_relax_hook): New. diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index 988b098..ddf0988 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -1630,14 +1630,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 ... */ diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index cb0c64d..01418cb 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2012-01-13 Iain Sandoe <idsandoe@googlemail.com> + * gas/mach-o/dysymtab-3.d: New. + * gas/mach-o/symbols-7.s: New. + +2012-01-13 Iain Sandoe <idsandoe@googlemail.com> + * gas/mach-o/dysymtab-2.d: Update to include the set VMA. * gas/mach-o/symbols-1-64.d: Likewise. * gas/mach-o/symbols-1.d: Likewise. 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..6d2430f --- /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: 0x00000170 num: 4( )+\(endoff: 0x00000180\) +( )+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: +( )+0000000000000014( )+0: 0xc0000000 LOCAL ABSOLUTE +( )+0000000000000018( )+1: 0x80000000 LOCAL +( )+000000000000001c( )+2: 0xc0000000 LOCAL ABSOLUTE +( )+0000000000000020( )+3: 0x00000004 c 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..8df048d --- /dev/null +++ b/gas/testsuite/gas/mach-o/symbols-7.s @@ -0,0 +1,24 @@ + +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 |