diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2012-06-22 01:25:12 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2012-06-22 01:25:12 +0000 |
commit | 33da33676fe3026fb8e1b237e845698bff42ffb0 (patch) | |
tree | 4dcaa8f76cb2edcf5f37dffca08ae40c1bb3fd91 /llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | |
parent | b8650f106a57891ce004996569f59dcce5b9982e (diff) | |
download | bcm5719-llvm-33da33676fe3026fb8e1b237e845698bff42ffb0.tar.gz bcm5719-llvm-33da33676fe3026fb8e1b237e845698bff42ffb0.zip |
Emit relocations for DW_AT_location entries on systems which need it. This is
a recommit of r127757. Fixes PR9493. Patch by Paul Robinson!
llvm-svn: 158957
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index eeacc43c097..2d6dc804635 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -1388,13 +1388,14 @@ void AsmPrinter::EmitLabelPlusOffset(const MCSymbol *Label, uint64_t Offset, unsigned Size) const { - // Emit Label+Offset - const MCExpr *Plus = - MCBinaryExpr::CreateAdd(MCSymbolRefExpr::Create(Label, OutContext), - MCConstantExpr::Create(Offset, OutContext), - OutContext); - - OutStreamer.EmitValue(Plus, 4, 0/*AddrSpace*/); + // Emit Label+Offset (or just Label if Offset is zero) + const MCExpr *Expr = MCSymbolRefExpr::Create(Label, OutContext); + if (Offset) + Expr = MCBinaryExpr::CreateAdd(Expr, + MCConstantExpr::Create(Offset, OutContext), + OutContext); + + OutStreamer.EmitValue(Expr, Size, 0/*AddrSpace*/); } |