Auto-generated .rodata contents and __attribute__((section))

Florian Weimer fweimer@redhat.com
Thu May 24 12:14:00 GMT 2018


On 05/23/2018 02:55 PM, Michael Matz wrote:
> On Fri, 18 May 2018, Richard Biener wrote:
> 
>> Interesting.  Do they allow merging across such sections?  Consider a 8
>> byte entity 0x12345678 and 4 byte entities 0x1234 0x5678, will the 4
>> byte entities share the rodata with the 8 byte one?

> There's no language to forbid this (as long as the alignments
> are respected), but at least GNU ld currently only merges same-sized
> entities.

I'm not entirely sure if this is valid for C, particularly if the 
objects have the same address, but not the same type.

There is a discussion on the generic-abi list about providing 
information to the linker about when it is safe to do such merging:

https://groups.google.com/forum/#!topic/generic-abi/MPr8TVtnVn4

Thanks,
Florian



More information about the Gcc mailing list