Thread specific data sections

Geoff Keating geoffk@cygnus.com
Thu Aug 17 13:12:00 GMT 2000


> Date: Thu, 17 Aug 2000 16:01:25 -0400
> From: "J. Johnston" <jjohnstn@cygnus.com>

>   I am working on a port whereby the default elf script isn't quite
> suitable.  In addition to the reugular contents, I need to have a
> fixed number of additional data sections added.  Each of the new
> data sections corresponds to a unique thread and each has a
> corresponding named variable so that startup code can locate the
> start of the section.  I would like the sections to precede the
> current .data section so that all the data sections are contiguous
> with the normal .data section being last.

>   What is the recommended way to add this to the generic elf script
> or should I simply create my own script?

If it wasn't for the way you wanted these sections first, you could
simply add them to OTHER_READWRITE_SECTIONS.

Now, the reason OTHER_READWRITE_SECTIONS is where it is is that if you
put sections before .data, then when people write

ld -Tdata=0x12340000

then these sections won't be shifted and there will be a hole.  This
is bad, it typically causes the link to fail.

It's not clear when you say 'port' whether you mean a new processor or
a single application.  If you mean just one application, I'd recommend
using your own private linker script.  If you mean a new processor or OS,
I'd recommend against adding another kind of linker script to ld,
because history shows that these scripts need continual maintenance as
new features are added.

So if you're porting to a new processor or OS, and you really must do
this, add a new shell variable to the default elf script that can be
used to add sections where you want them.

-- 
- Geoffrey Keating <geoffk@cygnus.com>


More information about the Binutils mailing list