aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-02-18 14:59:14 -0800
committerFangrui Song <i@maskray.me>2022-02-18 14:59:14 -0800
commit42a797ef011bd920bb7b781a752b925362b9754c (patch)
treec2383da84eb40fa1a91616e132720b5b421427b8
parent4dc3cb8e325525214fccef33e32891e5dccc9540 (diff)
downloadllvm-origin/release/14.x.zip
llvm-origin/release/14.x.tar.gz
llvm-origin/release/14.x.tar.bz2
[ELF] Fix .strtab corruption when a symbol name is emptyorigin/release/14.x
This is a simplified c12d49c4e286fa108d4d69f1c6d2b8d691993ffd in main which just fixes the bug but does not affect the -O2 deduplication.
-rw-r--r--lld/ELF/SyntheticSections.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 986c130..ccf0c5f 100644
--- a/lld/ELF/SyntheticSections.cpp
+++ b/lld/ELF/SyntheticSections.cpp
@@ -1231,6 +1231,7 @@ StringTableSection::StringTableSection(StringRef name, bool dynamic)
dynamic(dynamic) {
// ELF string tables start with a NUL byte.
strings.push_back("");
+ stringMap.try_emplace(CachedHashStringRef(""), 0);
size = 1;
}