[llvm-branch-commits] [lld] 42a797e - [ELF] Fix .strtab corruption when a symbol name is empty
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Feb 18 15:00:53 PST 2022
Author: Fangrui Song
Date: 2022-02-18T14:59:14-08:00
New Revision: 42a797ef011bd920bb7b781a752b925362b9754c
URL: https://github.com/llvm/llvm-project/commit/42a797ef011bd920bb7b781a752b925362b9754c
DIFF: https://github.com/llvm/llvm-project/commit/42a797ef011bd920bb7b781a752b925362b9754c.diff
LOG: [ELF] Fix .strtab corruption when a symbol name is empty
This is a simplified c12d49c4e286fa108d4d69f1c6d2b8d691993ffd in main
which just fixes the bug but does not affect the -O2 deduplication.
Added:
Modified:
lld/ELF/SyntheticSections.cpp
Removed:
################################################################################
diff --git a/lld/ELF/SyntheticSections.cpp b/lld/ELF/SyntheticSections.cpp
index 986c1308cbaf6..ccf0c5fd65da2 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;
}
More information about the llvm-branch-commits
mailing list