summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/ELFObjectWriter.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-06-22 17:52:52 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-06-22 17:52:52 +0000
commit2d6bae2e098ce3fef4f330edf4a53c396c6b9295 (patch)
tree30123d568be4e8978ead1c3bbcd9465b5d63f543 /llvm/lib/MC/ELFObjectWriter.cpp
parentee512e58a32f6a653ab47f2c8272e459b03c0bd8 (diff)
downloadbcm5719-llvm-2d6bae2e098ce3fef4f330edf4a53c396c6b9295.tar.gz
bcm5719-llvm-2d6bae2e098ce3fef4f330edf4a53c396c6b9295.zip
Bring r240130 back.
Now that pr23900 is fixed, we can bring it back with no changes. Original message: Make all temporary symbols unnamed. What this does is make all symbols that would otherwise start with a .L (or L on MachO) unnamed. Some of these symbols still show up in the symbol table, but we can just make them unnamed. In order to make sure we produce identical results when going thought assembly, all .L (not just the compiler produced ones), are now unnamed. Running llc on llvm-as.opt.bc, the peak memory usage goes from 208.24MB to 205.57MB. llvm-svn: 240302
Diffstat (limited to 'llvm/lib/MC/ELFObjectWriter.cpp')
-rw-r--r--llvm/lib/MC/ELFObjectWriter.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/MC/ELFObjectWriter.cpp b/llvm/lib/MC/ELFObjectWriter.cpp
index c9df8fcf441..e7f5265384b 100644
--- a/llvm/lib/MC/ELFObjectWriter.cpp
+++ b/llvm/lib/MC/ELFObjectWriter.cpp
@@ -787,10 +787,15 @@ void ELFObjectWriter::computeSymbolTable(
Renames.count(&Symbol)))
continue;
+ if (Symbol.isTemporary() && Symbol.isUndefined())
+ Ctx.reportFatalError(SMLoc(), "Undefined temporary");
+
ELFSymbolData MSD;
MSD.Symbol = cast<MCSymbolELF>(&Symbol);
bool Local = Symbol.getBinding() == ELF::STB_LOCAL;
+ assert(Local || !Symbol.isTemporary());
+
if (Symbol.isAbsolute()) {
MSD.SectionIndex = ELF::SHN_ABS;
} else if (Symbol.isCommon()) {
@@ -889,9 +894,11 @@ void ELFObjectWriter::computeSymbolTable(
unsigned Index = FileNames.size() + 1;
for (ELFSymbolData &MSD : LocalSymbolData) {
- unsigned StringIndex = MSD.Symbol->getType() == ELF::STT_SECTION
- ? 0
- : StrTabBuilder.getOffset(MSD.Name);
+ unsigned StringIndex;
+ if (MSD.Symbol->getType() == ELF::STT_SECTION || MSD.Name.empty())
+ StringIndex = 0;
+ else
+ StringIndex = StrTabBuilder.getOffset(MSD.Name);
MSD.Symbol->setIndex(Index++);
writeSymbol(Writer, StringIndex, MSD, Layout);
}
OpenPOWER on IntegriCloud