This is the mail archive of the binutils@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]

Re: [RFA] Don't warn when using ld --wrap and code in Thumb-state on ARM


Alan,

On Tue, 2010-03-30 at 09:42 +1030, Alan Modra wrote:
> On Mon, Mar 29, 2010 at 04:48:27PM +0100, Matthew Gretton-Dann wrote:
> > However, this change in symbol type is usually allowed for function
> > symbols - _bfd_elf_merge_symbol indicates this.  But in this case this
> > hasn't been allowed because the test for both symbols being function
> > type symbols is done after an early exit for weak symbols.
> > 
> > The fix is to move the test for merging two function symbols, and so
> > whether to allow a symbol type change earlier in _bfd_elf_merge_symbol.
> 
> I'd rather see a fix to the check for weak versioned symbols.  Ian
> added that code here:
> cvs diff -r 1.10 -r 1.11 elflink.h
> 
> And made a fix here:
> cvs diff -r 1.19 -r 1.20 elflink.h
> 
> The test has remained functionally unchanged since.  Ian may have some
> old mail archived that can shed some light on exactly why the test was
> added.  I couldn't see anything for the first patch in the binutils
> mail archives, and the bug-gnu-utils archive doesn't go back far
> enough.

Thanks for your comments.  Please find attached a reworked patch that
tightens the test you are talking about to make sure that at least on of
the symbols being merged is weak (which is what the comment says we are
testing for).  However, I am aware that this may not be precisely what
you meant - so any further comments you have would be welcome.

I have tested this on arm-none-linux-gnueabi and x86_64-none-linux-gnu.

Proposed ChangeLog:

2010-04-01  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>

	* elflink.c (_bfd_elf_merge_symbol): Tighten up the test for
	early exit due to merging the same weak symbol to test that the
	symbols are actually weak.

Thanks,

Matt

-- 
Matthew Gretton-Dann
Principal Engineer - Tools, PD Software
ARM Limited
Index: bfd/elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.371
diff -u -p -u -p -r1.371 elflink.c
--- bfd/elflink.c	21 Mar 2010 23:26:33 -0000	1.371
+++ bfd/elflink.c	1 Apr 2010 15:46:51 -0000
@@ -1013,6 +1013,11 @@ _bfd_elf_merge_symbol (bfd *abfd,
       break;
     }
 
+  /* Differentiate strong and weak symbols.  */
+  newweak = bind == STB_WEAK;
+  oldweak = (h->root.type == bfd_link_hash_defweak
+	     || h->root.type == bfd_link_hash_undefweak);
+
   /* In cases involving weak versioned symbols, we may wind up trying
      to merge a symbol with itself.  Catch that here, to avoid the
      confusion that results if we try to override a symbol with
@@ -1020,6 +1025,7 @@ _bfd_elf_merge_symbol (bfd *abfd,
      _GLOBAL_OFFSET_TABLE_, which are regular symbols defined in a
      dynamic object, which we do want to handle here.  */
   if (abfd == oldbfd
+      && (newweak || oldweak)
       && ((abfd->flags & DYNAMIC) == 0
 	  || !h->def_regular))
     return TRUE;
@@ -1241,11 +1247,6 @@ _bfd_elf_merge_symbol (bfd *abfd,
       return TRUE;
     }
 
-  /* Differentiate strong and weak symbols.  */
-  newweak = bind == STB_WEAK;
-  oldweak = (h->root.type == bfd_link_hash_defweak
-	     || h->root.type == bfd_link_hash_undefweak);
-
   if (bind == STB_GNU_UNIQUE)
     h->unique_global = 1;
 

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