[gold] Merging string literals with bigger alignment

Alexander Ivchenko aivchenk@gmail.com
Fri Mar 22 14:39:00 GMT 2013

> Presumably the compiler aligns each string within the input section to
> the section's alignment, but your patch doesn't check for that. If you
> find a string in the input section that doesn't begin at an alignment
> boundary, you should either refuse to merge that section, or preserve
> that string's alignment modulo the alignment boundary (e.g., if a
> string in the .rodata.str1.8 section begins at offset 0x14, you should
> ensure that the string's new offset is at an offset that is 4 modulo
> 8).

But isn't that defined that if the string is placed in, say,
rodata.1.8 section, than
we can count that its alignment is 8? If the user doesn't want that string to
be 8-aligned or wants  4 modulo 8 then he\she should not put that string in
8-aligned section. As far as I understand BFD merge code is not checking that
(why should it?) and we are compatible

> One nit:
> +Stringpool_template<Stringpool_char>::new_key_offset(size_t length,
> uint64_t addralign)
> This line is too long.
> -cary

Missed that, thanks.

More information about the Binutils mailing list