This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold] Merging string literals with bigger alignment
- From: Cary Coutant <ccoutant at google dot com>
- To: Alexander Ivchenko <aivchenk at gmail dot com>
- Cc: Ian Lance Taylor <iant at google dot com>, binutils <binutils at sourceware dot org>, Sriraman Tallam <tmsriram at google dot com>
- Date: Thu, 21 Mar 2013 09:43:12 -0700
- Subject: Re: [gold] Merging string literals with bigger alignment
- References: <CACysShhXDPxUsqdUprwhyGcaNiS9X_ODbrW847wHHiwbUh4LhA at mail dot gmail dot com> <CAKOQZ8xROxuJMD19P7JoM084LDyDKk_anwiuoWRpS+2MLeThnA at mail dot gmail dot com> <CACysShhaCv68A39oTk5FfmsdRFjhoOjQEzEZys4U0-sZs-x+4A at mail dot gmail dot com> <CAKOQZ8ypF=yCMmrwn-8jSp_WBMdrNi6NqwJRqabG7ZUwV2yMhg at mail dot gmail dot com> <CACysShhyE2G_8fz1pLSjTdJ_f9OYdSHHB9zvydWPaJNHjFkQ8g at mail dot gmail dot com> <CAKOQZ8wd_7bfSfMsm_WmJnSdT_J4qF-JM+3Ex=tU0iDJCOWETQ at mail dot gmail dot com> <CACysShh22grCuoa7-b3QV7D_Q-RBYrtLH8ifr2yRcS93+GRk1g at mail dot gmail dot com>
> Please, take a look at the attached patch that enables merging
> of string literals with alignment bigger than the char size (alignment
> is preserved).
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).
One nit:
+Stringpool_template<Stringpool_char>::new_key_offset(size_t length,
uint64_t addralign)
This line is too long.
-cary