public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Cc: amodra@bigpond.net.au
Subject: ELF linker is broken
Date: Mon, 31 Jan 2005 21:22:00 -0000	[thread overview]
Message-ID: <20050131212203.GA27701@lucon.org> (raw)
In-Reply-To: <20050131071308.GH11595@bubble.modra.org>

[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]

On Mon, Jan 31, 2005 at 05:43:08PM +1030, Alan Modra wrote:
> On Mon, Jan 31, 2005 at 10:32:27AM +1030, Alan Modra wrote:
> > On Sun, Jan 30, 2005 at 11:22:49AM -0800, H. J. Lu wrote:
> > > /usr/lib/crt1.o:(.dynamic+0x0): multiple definition of `_DYNAMIC'
> > [snip]
> > > The 2005-01-24 binutils is OK. It may have something to do with
> > > 
> > > http://sources.redhat.com/ml/binutils/2005-01/msg00405.html
> > 
> > Possible, I suppose.  An as-needed shared lib will define syms whether
> > or not the lib is actually linked.  It will be linked if any symbol it
> > defines satisfies an undefined reference, and conversely it isn't linked
> > then there are no references to its symbols.  That should make it safe
> > to leave its symbols in the symbol table, so long as we properly treat
> > them in _bfd_elf_merge_symbol.  If there is a problem, it's likely to be
> > in _bfd_elf_merge_symbol.
> 
> I'm testing the following on powerpc and x86 to ensure I haven't made
> any silly mistakes.  It's a big hammer approach but cleaner than what we
> had before, I think.  Rather than tweaking _bfd_elf_merge_symbol and
> other places to specially handle symbols defined in unused --as-needed
> libs, I've munged all such symbols back to their new state.  Hopefully
> this won't break too many back-end elf_link_hash_traverse functions..
> 
> Would you please test this on ia64?  I don't have access to ia64
> hardware, so testing this isn't so easy.

I am enclosing a testcase here. I saw the same problem on ia32, ia64
and x86_64:

[hjl@gnu-4 needed]$ make
gcc    -c -o foo.o foo.c
gcc -shared -fPIC -o libneeded.so needed.c
gcc -o foo foo.o \
        -Wl,--as-needed -lneeded -L. -Wl,--no-as-needed
/usr/lib/gcc-lib/ia64-redhat-linux/3.2.3/../../../crt1.o:(.dynamic+0x0):
multiple definition of `_DYNAMIC'
collect2: ld returned 1 exit status
make: *** [foo] Error 1


H.J.

[-- Attachment #2: bug.tar.gz --]
[-- Type: application/x-gzip, Size: 354 bytes --]

  parent reply	other threads:[~2005-01-31 21:22 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-30 19:22 IA64 " H. J. Lu
2005-01-31  0:02 ` Alan Modra
2005-01-31  7:13   ` Alan Modra
2005-01-31  8:29     ` Alan Modra
2005-01-31 18:38       ` H. J. Lu
2005-01-31 21:22     ` H. J. Lu [this message]
2005-01-31 22:02       ` PATCH: ELF " H. J. Lu
2005-02-01  0:08         ` Alan Modra
2005-02-01  5:56           ` IA64 linker is totally broken (Re: PATCH: ELF linker is broken) H. J. Lu
2005-02-01  6:18             ` H. J. Lu
2005-02-01  7:16               ` Alan Modra
2005-02-01 22:46                 ` H. J. Lu
2005-02-01 23:57                   ` Alan Modra
2005-02-02  0:39                     ` H. J. Lu
2005-02-02  1:12                       ` Alan Modra
2005-02-02  1:37                         ` Alan Modra
2005-02-02  2:23                     ` H. J. Lu
2005-01-31 23:16       ` ELF linker is broken Alan Modra
2005-02-01  1:41     ` IA64 " Alan Modra

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=20050131212203.GA27701@lucon.org \
    --to=hjl@lucon.org \
    --cc=amodra@bigpond.net.au \
    --cc=binutils@sources.redhat.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).