diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-04 03:21:47 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-04 03:21:47 +0000 |
commit | 1c8ac8f027d4a7af830e91513f37a2139c684f19 (patch) | |
tree | 55a7d4f84240669759d3fbb0f15e301960e720fb /llvm/lib/MC/MCDwarf.cpp | |
parent | 4fb115d2f3e353f1c3fdba2a2e060c5d7dfb9f40 (diff) | |
download | bcm5719-llvm-1c8ac8f027d4a7af830e91513f37a2139c684f19.tar.gz bcm5719-llvm-1c8ac8f027d4a7af830e91513f37a2139c684f19.zip |
There are two reasons why we might want to use
foo = a - b
.long foo
instead of just
.long a - b
First, on darwin9 64 bits the assembler produces the wrong result. Second,
if "a" is the end of the section all darwin assemblers (9, 10 and mc) will not
consider a - b to be a constant but will if the dummy foo is created.
Split how we handle these cases. The first one is something MC should take care
of. The second one has to be handled by the caller.
llvm-svn: 120889
Diffstat (limited to 'llvm/lib/MC/MCDwarf.cpp')
-rw-r--r-- | llvm/lib/MC/MCDwarf.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/llvm/lib/MC/MCDwarf.cpp b/llvm/lib/MC/MCDwarf.cpp index a33b0c596ba..1b1d5097042 100644 --- a/llvm/lib/MC/MCDwarf.cpp +++ b/llvm/lib/MC/MCDwarf.cpp @@ -213,8 +213,15 @@ void MCDwarfFileTable::Emit(MCStreamer *MCOS, // The first 4 bytes is the total length of the information for this // compilation unit (not including these 4 bytes for the length). - MCOS->EmitValue(MakeStartMinusEndExpr(MCOS, LineStartSym, LineEndSym, 4), - 4, 0, true /*UseSet*/); + // FIXME: We create the dummy TotalLength variable because LineEndSym points + // to the end of the section and the darwin assembler doesn't consider that + // difference an assembly time constant. It might be better for this to be + // proected by a flag. + MCSymbol *TotalLength = MCOS->getContext().CreateTempSymbol(); + MCOS->EmitAssignment(TotalLength, + MakeStartMinusEndExpr(MCOS, LineStartSym, LineEndSym, + 4)); + MCOS->EmitSymbolValue(TotalLength, 4, 0); // Next 2 bytes is the Version, which is Dwarf 2. MCOS->EmitIntValue(2, 2); @@ -228,7 +235,7 @@ void MCDwarfFileTable::Emit(MCStreamer *MCOS, // length of the prologue. MCOS->EmitValue(MakeStartMinusEndExpr(MCOS, LineStartSym, ProEndSym, (4 + 2 + 4)), - 4, 0, true /*UseSet*/); + 4, 0); // Parameters of the state machine, are next. MCOS->EmitIntValue(DWARF2_LINE_MIN_INSN_LENGTH, 1); |