public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Kris Van Hees <kris.van.hees@oracle.com>
To: binutils@sourceware.org
Cc: Ian Lance Taylor <iant@google.com>
Subject: [PATCH gold/6859] Symbols specified as -u <symbol> may erroneously 	get added to dynsym
Date: Tue, 26 Aug 2008 14:18:00 -0000	[thread overview]
Message-ID: <20080826141248.GB16080@oracle.com> (raw)
In-Reply-To: <20080826140138.GA16080@oracle.com>

Oracle has a full copyright assignment in place with the FSF.

This patch provides the fix for PR 6859 'Symbols specified as -u <symbol> may erroneously get added to the dynsym table'.  The problem turns out to be the
following:

Gold handles explicitly undefined symbols (-u <symbol>) differently from      
how the old GNU linker handles then.  With gold, if the symbol does not       
appear defined in any input object, it is added to both the symtab (symbol    
table) and the dynsym (dynamic symbol table) as an undefined symbol.  The     
old linker (correctly) only adds the symbol to the symtab in that case.  It   
works fine if the symbol gets defined in an input object.                     
                                                                             
The reason for this problem turns out to be the fact that during input object 
processing, "-u" symbols are checked as symbol tables are processed.  Then,   
all "-u" symbols are added as undefined symbols unless they were already      
seen (i.e. it adds all symbols that didn't appear in input object symbol      
tables).                                                                      
                                                                             
The fix for this problem turns out to be very easy: mark the "-u" symbols     
that are added after input object processing as not needing dynsym entries.

The patch below corrects this problem.  It was generated against cvs HEAD.

Testsuite execution has been verified to be identical between the unpatched and
the patched version.  No regressions were found.


	Cheers,
	Kris

ChangeLog entry:
================
2008-08-26  Kris Van Hees  <kris.van.hees@oracle.com>

	PR 6859
        * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
	symbols as not needing a dynsym entry.

Patch:
======
Index: gold/symtab.cc
===================================================================
RCS file: /cvs/src/src/gold/symtab.cc,v
retrieving revision 1.107
diff -r1.107 symtab.cc
176a177
>   this->dynsym_index_ = -1;

  reply	other threads:[~2008-08-26 14:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-29 20:52 [PATCH #6407] Patch to resolve issue of non-booting Linux kernel Kris Van Hees
2008-05-29 21:26 ` Kris Van Hees
2008-05-29 23:27 ` Ian Lance Taylor
2008-05-29 23:52   ` Kris Van Hees
2008-05-30 13:42     ` Ian Lance Taylor
2008-06-05 17:30 ` [PATCH gold/6584]] Bad gzip magic number on boot of x86_64 kernel Kris Van Hees
2008-06-06  5:32   ` Kris Van Hees
2008-06-06  7:14   ` Ian Lance Taylor
2008-08-26 14:09 ` [PATCH gold/6858] Patch to correctly handle undefined symbols in shlibs when linking -shared Kris Van Hees
2008-08-26 14:18   ` Kris Van Hees [this message]
2008-08-27 16:22     ` [PATCH gold/6859] Symbols specified as -u <symbol> may erroneously get added to dynsym Ian Lance Taylor
     [not found]       ` <20080826191944.GC16080@oracle.com>
2008-08-28  8:02         ` Kris Van Hees
2008-08-27 16:10   ` [PATCH gold/6858] Patch to correctly handle undefined symbols in shlibs when linking -shared Ian Lance Taylor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080826141248.GB16080@oracle.com \
    --to=kris.van.hees@oracle.com \
    --cc=binutils@sourceware.org \
    --cc=iant@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).