summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MachObjectWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/MC/MachObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/MachObjectWriter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index 8ce6127e386..d7934ad80c6 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/lib/MC/MachObjectWriter.cpp
@@ -565,7 +565,8 @@ void MachObjectWriter::computeSymbolTable(
MachSymbolData MSD;
MSD.Symbol = &Symbol;
- MSD.StringIndex = StringTable.getOffset(Symbol.getName());
+ StringRef Name = Symbol.getName();
+ MSD.StringIndex = Name.empty() ? 0 : StringTable.getOffset(Name);
if (Symbol.isAbsolute()) {
MSD.SectionIndex = 0;
OpenPOWER on IntegriCloud