This is the mail archive of the 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: 32-bit PowerPC sdata linker problem

On Fri, Jun 06, 2014 at 09:46:59PM +0930, Alan Modra wrote:
> Ah, light dawns.  I'm guessing you still have a definition for
> _SDA_BASE_ in your linker script, but using PROVIDE.  Due to the way I
> implemented the automatic define of _SDA_BASE_, PROVIDE in a linker
> script won't override the automatic define.  That's a bug.

Fixed like this.  Will fail to work if crt1.o happens to have a
.sdata section, due to the necessity of defining _SDA_BASE_ on the
first .sdata section.

	* ldexp.c (exp_fold_tree_1 <etree_provide>): Make PROVIDEd
	linker script symbol value override a built-in linker symbol.
diff --git a/ld/ldexp.c b/ld/ldexp.c
index d573fb7..5c4f8dd 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -1001,7 +1001,10 @@ exp_fold_tree_1 (etree_type *tree)
 	      if (h == NULL
 		  || (h->type != bfd_link_hash_new
 		      && h->type != bfd_link_hash_undefined
-		      && h->type != bfd_link_hash_common))
+		      && h->type != bfd_link_hash_common
+		      && !(h->type == bfd_link_hash_defined
+			   && (h->u.def.section->flags
+			       & SEC_LINKER_CREATED) != 0)))
 		  /* Do nothing.  The symbol was never referenced, or was
 		     defined by some object.  */

Alan Modra
Australia Development Lab, IBM

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