[llvm-commits] [llvm] r81294 - /llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
Chris Lattner
sabre at nondot.org
Tue Sep 8 17:10:15 PDT 2009
Author: lattner
Date: Tue Sep 8 19:10:14 2009
New Revision: 81294
URL: http://llvm.org/viewvc/llvm-project?rev=81294&view=rev
Log:
add support for @PLT and friends on external symbols, fixes
x86-64-pic-11.ll with the new asmprinter.
Modified:
llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
Modified: llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp?rev=81294&r1=81293&r2=81294&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmPrinter/X86MCInstLower.cpp Tue Sep 8 19:10:14 2009
@@ -112,12 +112,37 @@
}
MCSymbol *X86ATTAsmPrinter::GetExternalSymbolSymbol(const MachineOperand &MO) {
- std::string Name = Mang->makeNameProper(MO.getSymbolName());
+ std::string Name = MO.getSymbolName();
if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
- FnStubs[Name+"$stub"] = Name;
Name += "$stub";
}
+
+ switch (MO.getTargetFlags()) {
+ default: llvm_unreachable("Unknown target flag on GV operand");
+ case X86II::MO_NO_FLAG: // No flag.
+ case X86II::MO_GOT_ABSOLUTE_ADDRESS: // Doesn't modify symbol name.
+ case X86II::MO_PIC_BASE_OFFSET: // Doesn't modify symbol name.
+ break;
+ case X86II::MO_DLLIMPORT:
+ // Handle dllimport linkage.
+ Name = "__imp_" + Name;
+ break;
+ case X86II::MO_DARWIN_STUB:
+ FnStubs[Name] = MO.getSymbolName();
+ break;
+ // FIXME: These probably should be a modifier on the symbol or something??
+ case X86II::MO_TLSGD: Name += "@TLSGD"; break;
+ case X86II::MO_GOTTPOFF: Name += "@GOTTPOFF"; break;
+ case X86II::MO_INDNTPOFF: Name += "@INDNTPOFF"; break;
+ case X86II::MO_TPOFF: Name += "@TPOFF"; break;
+ case X86II::MO_NTPOFF: Name += "@NTPOFF"; break;
+ case X86II::MO_GOTPCREL: Name += "@GOTPCREL"; break;
+ case X86II::MO_GOT: Name += "@GOT"; break;
+ case X86II::MO_GOTOFF: Name += "@GOTOFF"; break;
+ case X86II::MO_PLT: Name += "@PLT"; break;
+ }
+
return OutContext.GetOrCreateSymbol(Name);
}
More information about the llvm-commits
mailing list