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: LD issue : Problem in NOCROSSREFS overlay check


On Fri, Feb 16, 2007 at 10:50:37AM -0800, Philippe Vandermersch wrote:
> The cross reference check is done at the section level.
> My object file after a "ld -r" contains multiple sections.
> One local symbol happens to have the same name in two different sections
> : that should not be a problem.

Agreed.  In my last email I was merely pointing out how the "ld -r"
link step uncovered a problem with the cross-reference checks.  I
wasn't trying to say that no bug existed.

> What I do not understand is that there is a specific test added in
> check_reloc_refs (ldcref.c) to actually test if 2 locals symbols
> collide.
> If I remove that test, it works.
> 
> I just want to know the reason why this test has been added.

I'm not sure which test you mean.  There is a test against defsec for
section symbols;  That should also happen for local symbols.

	* ldcref.c (check_reloc_refs): Compare section for locals.

Index: ld/ldcref.c
===================================================================
RCS file: /cvs/src/src/ld/ldcref.c,v
retrieving revision 1.15
diff -u -p -r1.15 ldcref.c
--- ld/ldcref.c	19 Jul 2006 01:50:23 -0000	1.15
+++ ld/ldcref.c	17 Feb 2007 00:15:12 -0000
@@ -710,11 +710,11 @@ check_reloc_refs (bfd *abfd, asection *s
 						   | BSF_WEAK)) != 0))
 	      || (!global
 		  && ((*q->sym_ptr_ptr)->flags & (BSF_LOCAL
-						  | BSF_SECTION_SYM)) != 0))
+						  | BSF_SECTION_SYM)) != 0
+		  && bfd_get_section (*q->sym_ptr_ptr) == info->defsec))
 	  && (symname != NULL
 	      ? strcmp (bfd_asymbol_name (*q->sym_ptr_ptr), symname) == 0
-	      : (((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0
-		 && bfd_get_section (*q->sym_ptr_ptr) == info->defsec)))
+	      : ((*q->sym_ptr_ptr)->flags & BSF_SECTION_SYM) != 0))
 	{
 	  /* We found a reloc for the symbol.  The symbol is defined
 	     in OUTSECNAME.  This reloc is from a section which is


-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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