From 6d86492f5ed0f9853ddd3b24e1aa037e305e1784 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 6 Dec 2010 15:35:15 +0000 Subject: [PATCH] Revert previous two patches while I try to find out how to make both linux and darwin assemblers happy :-( git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121004 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCStreamer.h | 5 ----- lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp | 2 +- lib/MC/MCDwarf.cpp | 11 +++++++++-- lib/MC/MCStreamer.cpp | 6 ------ test/CodeGen/X86/aliases.ll | 2 +- 5 files changed, 11 insertions(+), 15 deletions(-) diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h index fce076a57eb..d89ee9ae126 100644 --- a/include/llvm/MC/MCStreamer.h +++ b/include/llvm/MC/MCStreamer.h @@ -249,11 +249,6 @@ namespace llvm { virtual void EmitIntValue(uint64_t Value, unsigned Size, unsigned AddrSpace = 0); - /// EmitAbsValue - Emit the Value, but try to avoid relocations. On MachO - /// this is done by producing - /// foo = value - /// .long foo - void EmitAbsValue(const MCExpr *Value, unsigned Size); virtual void EmitULEB128Value(const MCExpr *Value, unsigned AddrSpace = 0) = 0; diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp index 1f7ac95f7b3..f737e90b155 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -156,7 +156,7 @@ void AsmPrinter::EmitReference(const MCSymbol *Sym, unsigned Encoding) const { const MCExpr *Exp = TLOF.getExprForDwarfReference(Sym, Mang, MMI, Encoding, OutStreamer); - OutStreamer.EmitAbsValue(Exp, GetSizeOfEncodedValue(Encoding)); + OutStreamer.EmitValue(Exp, GetSizeOfEncodedValue(Encoding), /*addrspace*/0); } void AsmPrinter::EmitReference(const GlobalValue *GV, unsigned Encoding)const{ diff --git a/lib/MC/MCDwarf.cpp b/lib/MC/MCDwarf.cpp index 5d36ee3e626..53731dca7eb 100644 --- a/lib/MC/MCDwarf.cpp +++ b/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->EmitAbsValue(MakeStartMinusEndExpr(MCOS, LineStartSym, LineEndSym,4), - 4); + // 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); diff --git a/lib/MC/MCStreamer.cpp b/lib/MC/MCStreamer.cpp index b9d59056f3b..6df4ae44e40 100644 --- a/lib/MC/MCStreamer.cpp +++ b/lib/MC/MCStreamer.cpp @@ -72,12 +72,6 @@ void MCStreamer::EmitSLEB128IntValue(int64_t Value, unsigned AddrSpace) { EmitBytes(OSE.str(), AddrSpace); } -void MCStreamer::EmitAbsValue(const MCExpr *Value, unsigned Size) { - MCSymbol *ABS = getContext().CreateTempSymbol(); - EmitAssignment(ABS, Value); - EmitSymbolValue(ABS, Size, 0); -} - void MCStreamer::EmitSymbolValue(const MCSymbol *Sym, unsigned Size, unsigned AddrSpace) { EmitValue(MCSymbolRefExpr::Create(Sym, getContext()), Size, AddrSpace); diff --git a/test/CodeGen/X86/aliases.ll b/test/CodeGen/X86/aliases.ll index 33a659dfd3f..3ed3bd67cef 100644 --- a/test/CodeGen/X86/aliases.ll +++ b/test/CodeGen/X86/aliases.ll @@ -1,5 +1,5 @@ ; RUN: llc < %s -mtriple=i686-pc-linux-gnu -asm-verbose=false -o %t -; RUN: grep { = } %t | count 17 +; RUN: grep { = } %t | count 16 ; RUN: grep set %t | count 18 ; RUN: grep globl %t | count 6 ; RUN: grep weak %t | count 1