This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Auto-generated .rodata contents and __attribute__((section))
Hi,
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 believe GCC pulls off such tricks in its internal constant pool
> merging code.
>
> It might be worth gathering statistics on the size of constant pool
> entries for this.
>
> Now the question is of course if BFD contains support for optimizing
> those sections.
You mean to ask if GNU ld is actually uniquifying contents of such
mergable sections over object files? If so the answer is yes.
Ciao,
Michael.