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: Adding custom sections to default linker script


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


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