public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: Alan Modra <amodra@bigpond.net.au>, paul@codesourcery.com
Cc: binutils@sources.redhat.com
Subject: PATCH: Linker is broken due to _bfd_elf_merge_symbol change
Date: Wed, 04 May 2005 06:18:00 -0000	[thread overview]
Message-ID: <20050504061302.GA27031@lucon.org> (raw)
In-Reply-To: <20050504054323.GA26693@lucon.org>

On Tue, May 03, 2005 at 10:43:23PM -0700, H. J. Lu wrote:
> I got extra libstc++ failures in gcc 3.4 on ia32, ia64 and x86_64:
> 
> FAIL: 21_strings/basic_string/append/char/1.cc execution test
> FAIL: 21_strings/basic_string/append/wchar_t/1.cc execution test
> FAIL: gctest
> FAIL: 21_strings/basic_string/cons/char/1.cc execution test
> FAIL: 21_strings/basic_string/cons/wchar_t/1.cc execution test
> FAIL: 21_strings/basic_string/element_access/char/1.cc execution test
> FAIL: 21_strings/basic_string/element_access/wchar_t/1.cc execution
> test
> FAIL: 21_strings/basic_string/insert/char/1.cc execution test
> FAIL: 21_strings/basic_string/insert/wchar_t/1.cc execution test
> FAIL: 21_strings/basic_string/substr/char/1.cc execution test
> FAIL: 21_strings/basic_string/substr/wchar_t/1.cc execution test
> FAIL: 23_containers/bitset/cons/1.cc execution test
> FAIL: 23_containers/bitset/cons/6282.cc execution test
> FAIL: 23_containers/bitset/test/1.cc execution test
> FAIL: 23_containers/vector/capacity/8230.cc execution test
> FAIL: 23_containers/vector/element_access/1.cc execution test
> 
> due to
> 
> http://sourceware.org/ml/binutils/2005-05/msg00018.html
> 
> I will revert it if it is't fixed soon.
> 

This patch seems to work. Paul, I tried your testcase. It looks OK:

gnu-10:pts/3[86]> gcc x.o y.o -B/export/build/gnu/binutils-import/build-i686-linux/ld/
gnu-10:pts/3[82]> readelf -s x.o | grep foo
     7: 00000000     5 FUNC    GLOBAL DEFAULT    1 foo
gnu-10:pts/3[83]> readelf -s y.o | grep foo
     8: 00000000    40 FUNC    WEAK   DEFAULT    1 foo
gnu-10:pts/3[84]> readelf -s a.out| grep foo
    60: 08048368     5 FUNC    GLOBAL DEFAULT   12 foo

Paul, could you please provide a patch of a simple testcase for your
problem?


H.J.
----
2005-05-03  H.J. Lu  <hongjiu.lu@intel.com>

	* elflink.c (_bfd_elf_merge_symbol): Only skip weak definitions
	at the end, if a strong definition has already been seen.

--- bfd/elflink.c.weak	2005-05-02 08:34:48.000000000 -0700
+++ bfd/elflink.c	2005-05-03 22:47:58.000000000 -0700
@@ -1078,13 +1078,6 @@ _bfd_elf_merge_symbol (bfd *abfd,
       || h->root.type == bfd_link_hash_undefined)
     *size_change_ok = TRUE;
 
-  /* Skip weak definitions of symbols that are already defined.  */
-  if (newdef && olddef && newweak && !oldweak)
-    {
-      *skip = TRUE;
-      return TRUE;
-    }
-
   /* NEWDYNCOMMON and OLDDYNCOMMON indicate whether the new or old
      symbol, respectively, appears to be a common symbol in a dynamic
      object.  If a symbol appears in an uninitialized section, and is
@@ -1211,6 +1204,10 @@ _bfd_elf_merge_symbol (bfd *abfd,
       *size_change_ok = TRUE;
     }
 
+  /* Skip weak definitions of symbols that are already defined.  */
+  if (newdef && olddef && newweak && !oldweak)
+    *skip = TRUE;
+
   /* If the old symbol is from a dynamic object, and the new symbol is
      a definition which is not from a dynamic object, then the new
      symbol overrides the old symbol.  Symbols from regular files

  parent reply	other threads:[~2005-05-04  6:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-04  6:11 H. J. Lu
2005-05-04  6:13 ` Alan Modra
2005-05-04  6:24   ` H. J. Lu
2005-05-04  6:18 ` H. J. Lu [this message]
2005-05-04  8:06   ` PATCH: " Alan Modra
2005-05-04 13:10   ` Paul Brook
2005-05-04 13:23     ` H. J. Lu
2005-05-05  2:37       ` 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=20050504061302.GA27031@lucon.org \
    --to=hjl@lucon.org \
    --cc=amodra@bigpond.net.au \
    --cc=binutils@sources.redhat.com \
    --cc=paul@codesourcery.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).