Confused about TLS handling

Nathan Sidwell nathan@codesourcery.com
Tue Feb 17 20:09:00 GMT 2004


Hi,
I'm doing a binutils port to an embedded system where we want some
kind of thread-local storage mechanism. I'm using the elf TLS stuff
for that, as it seems appropriate, but I'm getting confused because
both bfd and ld have some strange handling of .tbss like sections.
See the attached partial diff for the hacks I've done to get things
to work.  AFAICT, binutils is trying to treat .tbss sections
as if they are initialized data, and take up space in the executable.

Also, being an embedded system, I'm generating a single ROM image, which
gets parts of itself copied during the boot process, to set up .data
and the like, hence the linker script has liberal uses of LOADADDR and
AT. However, the relevent TLS point is that the image of .tdata is located
somewhere within the ROM, not as a separate thread local elf segment.
Infact, I'm trying to map all the sections into a single loadable segment,
corresponding to the ROM image.

Am I going about this in the right way? Would it be better to define
an architecturally special section attribute to sort-of mimic TLS behaviour?

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binutils-2_14.diff
URL: <https://sourceware.org/pipermail/binutils/attachments/20040217/d9cc3d6a/attachment.ksh>


More information about the Binutils mailing list