Propagating addresses from linker to the runtie

Josef Wolf jw@raven.inka.de
Fri Oct 18 13:30:00 GMT 2019


On Fri, Oct 18, 2019 at 07:51:38AM -0500, Segher Boessenkool wrote:
[ ... ]
> Using reserved names (like those starting with two underscores) is UB
> already.

What does "UB" mean?

> > > To get this conforming, the linker would need to export a symbol to the start
> > > of the section and the length of the section, IMHO.
> > 
> > Right, but we do not have that today. 8-(
> 
> We have had it since over 25 years:
> 
> Thu Aug 18 15:37:45 1994  Ian Lance Taylor  (ian@sanguine.cygnus.com)
> 
> 	Make the ELF linker handle orphaned sections reasonably.  Also,
> 	define __start_SECNAME and __stop_SECNAME around sections whose
> 	names can be represented in C, for the benefit of symbol sets in
> 	glibc.

???

I was talking about exporting start+length instead of start+stop.

Having start+length would allow a confirming implementation, because pointer
arithmetic on unrelated objects would no longer be needed:

    unsigned long *dst = &_s_bss;
    for (n = 0; n < _l_bss / sizeof (unsigned long); n++)
        dst[n] = 0;


-- 
Josef Wolf
jw@raven.inka.de



More information about the Gcc-help mailing list