Re: Propagating addresses from linker to the runtie

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Josef Wolf:

> Thanks for the reply, Florian!
>
> On Fri, Oct 18, 2019 at 11:15:22AM +0200, Florian Weimer wrote:
>> > So what would be the proper way to pass this information from the linker to the
>> > compiler?
>> 
>> In glibc, we use this:
>> 
>> [ ... ]
>>   uintptr_t section_length = __stop___libc_IO_vtables - __start___libc_IO_vtables;
>
>   #define symbol_set_declare(set) \
>     extern char const __start_##set[] __symbol_set_attribute; \
>     extern char const __stop_##set[] __symbol_set_attribute;
>
> Due to symbol_set_declare, those symbols expand to two unrelated
> symbols. Using unrelated symbols for pointer arithmetic again violates the
> standard.

Ah.  So we need more uintptr_t casts here.

> Thus, the issue that Martin mentioned applies here, too.
>
> 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-(

An explicit size also helps targets where there are restrictions on
alignment for global symbols, and the section size is actually measured
in bytes.  (Which of course leads to the old question whether an object
can have a size which is not a multiple of its alignment.)

Thanks,
Florian



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux