This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Group common symbol checking together


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=202ac193bbbecc96a4978d1ac3d17148253f9b01

commit 202ac193bbbecc96a4978d1ac3d17148253f9b01
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Mar 8 05:28:55 2016 -0800

    Group common symbol checking together
    
    	PR ld/19579
    	* elflink.c (_bfd_elf_merge_symbol): Group common symbol checking
    	together.

Diff:
---
 bfd/ChangeLog |  6 ++++++
 bfd/elflink.c | 12 ++++++------
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 2b6cf15..c3b9132 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2016-03-08  H.J. Lu  <hongjiu.lu@intel.com>
+
+	PR ld/19579
+	* elflink.c (_bfd_elf_merge_symbol): Group common symbol checking
+	together.
+
 2016-03-08  Cupertino Miranda  <Cupertino.Miranda@synopsys.com>
 	    Andrew Burgess  <andrew.burgess@embecosm.com>
 
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 39157bf..ccff780 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1172,12 +1172,9 @@ _bfd_elf_merge_symbol (bfd *abfd,
 
   newdef = !bfd_is_und_section (sec) && !bfd_is_com_section (sec);
 
-  /* The old common symbol in executable is a definition if the new
-     definition comes from a shared library.  */
   olddef = (h->root.type != bfd_link_hash_undefined
 	    && h->root.type != bfd_link_hash_undefweak
-	    && (h->root.type != bfd_link_hash_common
-		|| (!olddyn && newdyn && bfd_link_executable (info))));
+	    && h->root.type != bfd_link_hash_common);
 
   /* NEWFUNC and OLDFUNC indicate whether the new or old symbol,
      respectively, appear to be a function.  */
@@ -1489,13 +1486,16 @@ _bfd_elf_merge_symbol (bfd *abfd,
      represent variables; this can cause confusion in principle, but
      any such confusion would seem to indicate an erroneous program or
      shared library.  We also permit a common symbol in a regular
-     object to override a weak symbol in a shared object.  */
+     object to override a weak symbol in a shared object.  A common
+     symbol in executable also overrides a symbol in a shared object.  */
 
   if (newdyn
       && newdef
       && (olddef
 	  || (h->root.type == bfd_link_hash_common
-	      && (newweak || newfunc))))
+	      && (newweak
+		  || newfunc
+		  || (!olddyn && bfd_link_executable (info))))))
     {
       *override = TRUE;
       newdef = FALSE;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]