From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9371 invoked by alias); 12 Jan 2012 18:29:03 -0000 Received: (qmail 9359 invoked by uid 22791); 12 Jan 2012 18:29:01 -0000 X-SWARE-Spam-Status: No, hits=-0.1 required=5.0 tests=AWL,BAYES_20,KAM_STOCKGEN,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from c2beaomr10.btconnect.com (HELO mail.btconnect.com) (213.123.26.188) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Jan 2012 18:28:45 +0000 Received: from host81-138-1-83.in-addr.btopenworld.com (EHLO thor.office) ([81.138.1.83]) by c2beaomr10.btconnect.com with ESMTP id FUG11659; Thu, 12 Jan 2012 18:28:44 +0000 (GMT) Message-Id: <79D2A42E-1056-4ED2-B0C2-7E097C3844AE@sandoe-acoustics.co.uk> From: Iain Sandoe To: binutils Development Content-Type: multipart/mixed; boundary=Apple-Mail-138-193372493 Mime-Version: 1.0 (Apple Message framework v936) Subject: [Patch mach-o/bfd/gas] handle ABS indirect_symbols. Date: Thu, 12 Jan 2012 18:29:00 -0000 Cc: Tristan Gingold X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A0B0303.4F0F265B.0097, actions=tag X-Junkmail-Premium-Raw: score=7/50, refid=2.7.2:2012.1.11.215414:17:7.763, ip=81.138.1.83, rules=__HAS_MSGID, __SANE_MSGID, __MSGID_APPLEMAIL, __TO_MALFORMED_2, __CT, __CTYPE_HAS_BOUNDARY, __CTYPE_MULTIPART, CTYPE_MULTIPART_NO_QUOTE, __CTYPE_MULTIPART_MIXED, __MIME_VERSION, __MIME_VERSION_APPLEMAIL, __HAS_X_MAILER, __X_MAILER_APPLEMAIL, TXT_ATTACHED, BODY_SIZE_4000_4999, BODYTEXTP_SIZE_3000_LESS, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, __USER_AGENT_APPLEMAIL, RDNS_SUSP, BODY_SIZE_7000_LESS, NO_URI_FOUND, MIME_TEXT_ONLY_MP_MIXED X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A0B0201.4F0F265C.0106,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2011-07-25 19:15:43, dmn=2011-05-27 18:58:46, mode=multiengine X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2012-01/txt/msg00167.txt.bz2 --Apple-Mail-138-193372493 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Content-length: 1979 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 ... */ --Apple-Mail-138-193372493 Content-Disposition: attachment; filename=12011218-dysym-abs-test.txt Content-Type: text/plain; x-unix-mode=0644; name="12011218-dysym-abs-test.txt" Content-Transfer-Encoding: 7bit Content-length: 1960 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 --Apple-Mail-138-193372493 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Content-length: 3 --Apple-Mail-138-193372493--