This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: 32-bit PowerPC sdata linker problem
- From: Alan Modra <amodra at gmail dot com>
- To: Sebastian Huber <sebastian dot huber at embedded-brains dot de>, binutils at sourceware dot org
- Date: Sat, 7 Jun 2014 22:17:11 +0930
- Subject: Re: 32-bit PowerPC sdata linker problem
- Authentication-results: sourceware.org; auth=none
- References: <53918356 dot 3040102 at embedded-brains dot de> <20140606105420 dot GH5592 at bubble dot grove dot modra dot org> <5391A4BF dot 2030308 at embedded-brains dot de> <20140606121659 dot GJ5592 at bubble dot grove dot modra dot org>
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