aboutsummaryrefslogtreecommitdiff
path: root/lld/MachO
diff options
context:
space:
mode:
authorJez Ng <jezng@fb.com>2020-12-01 14:45:10 -0800
committerJez Ng <jezng@fb.com>2020-12-01 15:05:20 -0800
commitd0c4be42e35d8cff069f91a45b76ea24187c233d (patch)
tree27bb7a10b5043637ab4e5dc7b5bd611653594976 /lld/MachO
parent51629abce0e2f9d1376eb0b5070532a2bbec6766 (diff)
downloadllvm-project-d0c4be42e35d8cff069f91a45b76ea24187c233d.tar.gz
[lld-macho] Emit empty string as first entry of string table
ld64 emits string tables which start with a space and a zero byte. We match its behavior here since some tools depend on it. Similar rationale as {D89561}. Reviewed By: #lld-macho, smeenai Differential Revision: https://reviews.llvm.org/D89639
Diffstat (limited to 'lld/MachO')
-rw-r--r--lld/MachO/SyntheticSections.h9
1 files changed, 4 insertions, 5 deletions
diff --git a/lld/MachO/SyntheticSections.h b/lld/MachO/SyntheticSections.h
index e52bc480e9aa..56f4bf66ce23 100644
--- a/lld/MachO/SyntheticSections.h
+++ b/lld/MachO/SyntheticSections.h
@@ -398,11 +398,10 @@ public:
void writeTo(uint8_t *buf) const override;
private:
- // An n_strx value of 0 always indicates the empty string, so we must locate
- // our non-empty string values at positive offsets in the string table.
- // Therefore we insert a dummy value at position zero.
- std::vector<StringRef> strings{"\0"};
- size_t size = 1;
+ // ld64 emits string tables which start with a space and a zero byte. We
+ // match its behavior here since some tools depend on it.
+ std::vector<StringRef> strings{" "};
+ size_t size = 2;
};
struct SymtabEntry {