This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Adding custom sections to default linker script
- From: Alan Modra <amodra at gmail dot com>
- To: Jonas Maebe <jonas dot maebe at elis dot ugent dot be>
- Cc: binutils at sourceware dot org
- Date: Mon, 14 Sep 2015 09:01:20 +0930
- Subject: Re: Adding custom sections to default linker script
- Authentication-results: sourceware.org; auth=none
- References: <55E1BBA7 dot 7080202 at elis dot ugent dot be> <20150830132130 dot GA3518 at ratatosk> <55E33208 dot 8030602 at elis dot ugent dot be> <20150831095144 dot GA3518 at ratatosk> <55E80AE9 dot 5080603 at elis dot ugent dot be> <20150904122519 dot GC3455 at ratatosk> <55F5D809 dot 4010303 at elis dot ugent dot be>
On Sun, Sep 13, 2015 at 10:09:45PM +0200, Jonas Maebe wrote:
> The linker script fragment I add is:
>
> ***
> SECTIONS
> {
> .fpcdata :
> {
> KEEP (*(.fpc .fpc.n_version .fpc.n_links))
> }
> .threadvar _edata : { *(.threadvar .threadvar.* .gnu.linkonce.tv.*) }
> }
> INSERT AFTER .data;
> ***
[snip]
> With the non-working one:
>
> ***
> [Nr] Name Type Address Off Size
> ES Flg Lk Inf Al
> ...
> [21] .got.plt PROGBITS 0000000000767258 167258 000058
> 08 WA 0 0 8
> [22] .data PROGBITS 00000000007672b0 1672b0 037de0
> 00 WA 0 0 16
> [23] .fpcdata PROGBITS 000000000079f090 19f090 000030
> 00 WA 0 0 8
> [24] .bss NOBITS 000000000079f090 39f090 0042c8
> 00 WA 0 0 16
No wonder it crashes. You have .fpcdata and .bss at the same address.
This is because you told the linker to put .threadvar at _edata. Now
it seems that .threadvar is empty and stripped from the output. If
I'm remembering correctly, this explains why an old linker worked for
you. Old linkers ignore address assignments to empty and stripped
sections. Newer linkers don't, thus affecting following sections.
--
Alan Modra
Australia Development Lab, IBM