This week's experiment build gdc with tls disabled.

Johannes Pfau nospam at example.com
Fri Dec 20 01:13:46 PST 2013


Am Fri, 20 Dec 2013 08:40:28 +0100
schrieb Jacob Carlborg <doob at me.com>:

> > I think asking the binutils maintainers to add __tdata_begin,
> > __tdata_end, __tbss_begin and __tbss_end markers to the tdata and
> > tbss sections would be a nice long-term solution, or is there some
> > issue with that?
> 
> How does that work? Do people need to update their linkers for that
> to work?
> 

Likely yes, that's why I said 'longterm' solution. You need to edit the
default linker script. Then there are 2 options: We can force certain
object files to be at the start or the end of the section. So we could
introduce dso_start.o and dso_end.o files containing the start/end
sections and those would always be placed as the first/last objects in
a section. (This is how the C++/C runtime calls the constructors in the
.ctors section: crtbegin.o contains a __CTOR_LIST__ symbol)

It's also possible to directly instruct the linker to insert a symbol
at the start of the section and at the end of the section. This way you
don't need special object files but the symbols will appear always,
even for C/C++ programs.

In theory it's always possible to use your own linker script without
updating the compiler, but that's not a practical solution. Implicit
linker-script which only extend the default script can be used for
custom sections, but AFAIK this doesn't work for standard sections.


More information about the D.gnu mailing list