summaryrefslogtreecommitdiff
path: root/.gitignore
diff options
context:
space:
mode:
authorTom Scogland <tom.scogland@gmail.com>2022-11-05 00:09:35 -1000
committerGitHub <noreply@github.com>2022-11-05 11:09:35 +0100
commit3346c0918bb939f3e82033ddde0a2378c602650d (patch)
tree66552915f3a353061fcf89633dc8531ee6c1e946 /.gitignore
parent71d480515b098118c5f1d84f255c4080f55c62e8 (diff)
downloadspack-3346c0918bb939f3e82033ddde0a2378c602650d.tar.gz
spack-3346c0918bb939f3e82033ddde0a2378c602650d.tar.bz2
spack-3346c0918bb939f3e82033ddde0a2378c602650d.tar.xz
spack-3346c0918bb939f3e82033ddde0a2378c602650d.zip
Fix relocation to avoid overwriting merged constant strings (#32253)
Compilers and linker optimize string constants for space by aliasing them when one is a suffix of another. For gcc / binutils this happens already at -O1, due to -fmerge-constants. This means that we have to take care during relocation to always preserve a certain length of the suffix of those prefixes that are C-strings. In this commit we pick length 7 as a safe suffix length, assuming the suffix is typically the 7 characters from the hash (i.e. random), so it's unlikely to alias with any string constant used in the sources. In general we now pad shortened strings from the left with leading dir seperators, but in the case of C-strings that are much shorter and don't share a common suffix (due to projections), we do allow shrinking the C-string, appending a null, and retaining the old part of the prefix. Also when rewiring, we ensure that the new hash preserves the last 7 bytes of the old hash. Co-authored-by: Harmen Stoppels <harmenstoppels@gmail.com>
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions