This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gold] Merging string literals with bigger alignment


Hi,

Both Intel compiler and GNU compiler put string literals into special
sections: .rodata.str1.X. ICC puts literals to .rodata.str1.4 and
.rodata.str1.32. GCC puts them to .rodata.str1.1 and .rodata.str1.4.
Gold linker merges strings only from .rodata.str1.1, BFD linker
processes all sections.

Lost merging capability increased the size of the ICC+gold
libwebcore.so build in 1.5 times against the build with BFD. I believe
we can find the same results for GCC.

Also it is needed for correct inline work: when function is inlined
into two different files, string literals that this function uses will
also be put into two different object files. Therefore the inlined
body of the function will use different string literals, which doesn't
sound correct.

Seems that the only thing that blocks string literals from, say,
.rodata.str1.4 to be merged is this:

// We only merge strings if the alignment is not more than the
// character size. This could be handled, but it's unusual.
if (is_string && addralign > entsize)
return false;

I'm not sure what was the reason for this..
After deleting that check we got needed string literals merging and
all gold-check tests pass.

I also added the testcase for checking whether the string literals are
getting merged.

Could you please take a look at the attached patch?

thank you,
Alexander

Attachment: merging_string_literals_1.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]