X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FTarget%2FX86%2FX86MCAsmInfo.cpp;h=faf4f7ce64cf3bfeed41d9d3b47d55ce97fbbc19;hb=4d1a8dde2d9eea508f66d51428b4f155fa6a6756;hp=1ac2d7e6c6d476189c55acfb08df68349ee148f1;hpb=5d4918dbd116b0b5e561c431b1ea527ee1b9302a;p=oota-llvm.git diff --git a/lib/Target/X86/X86MCAsmInfo.cpp b/lib/Target/X86/X86MCAsmInfo.cpp index 1ac2d7e6c6d..faf4f7ce64c 100644 --- a/lib/Target/X86/X86MCAsmInfo.cpp +++ b/lib/Target/X86/X86MCAsmInfo.cpp @@ -15,8 +15,11 @@ #include "X86TargetMachine.h" #include "llvm/ADT/Triple.h" #include "llvm/MC/MCContext.h" +#include "llvm/MC/MCExpr.h" #include "llvm/MC/MCSectionELF.h" +#include "llvm/MC/MCStreamer.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/ELF.h" using namespace llvm; enum AsmWriterFlavorTy { @@ -42,13 +45,14 @@ static const char *const x86_asm_table[] = { "{flags}", "", "{dirflag}", "", "{fpsr}", "", + "{fpcr}", "", "{cc}", "cc", 0,0}; X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple) { AsmTransCBE = x86_asm_table; AssemblerDialect = AsmWriterFlavor; - + bool is64Bit = Triple.getArch() == Triple::x86_64; TextAlignFillValue = 0x90; @@ -56,10 +60,6 @@ X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple) { if (!is64Bit) Data64bitsDirective = 0; // we can't emit a 64-bit unit - // FIXME: Darwin 10 doesn't need this. - if (is64Bit) - NeedsSetToChangeDiffSize = true; - // Use ## as a comment string so that .s files generated by llvm can go // through the GCC preprocessor without causing an error. This is needed // because "clang foo.s" runs the C preprocessor, which is usually reserved @@ -72,7 +72,22 @@ X86MCAsmInfoDarwin::X86MCAsmInfoDarwin(const Triple &Triple) { DwarfUsesInlineInfoSection = true; // Exceptions handling - ExceptionsType = ExceptionHandling::Dwarf; + ExceptionsType = ExceptionHandling::DwarfCFI; +} + +const MCExpr * +X86_64MCAsmInfoDarwin::getExprForPersonalitySymbol(const MCSymbol *Sym, + unsigned Encoding, + MCStreamer &Streamer) const { + MCContext &Context = Streamer.getContext(); + const MCExpr *Res = + MCSymbolRefExpr::Create(Sym, MCSymbolRefExpr::VK_GOTPCREL, Context); + const MCExpr *Four = MCConstantExpr::Create(4, Context); + return MCBinaryExpr::CreateAdd(Res, Four, Context); +} + +X86_64MCAsmInfoDarwin::X86_64MCAsmInfoDarwin(const Triple &Triple) + : X86MCAsmInfoDarwin(Triple) { } X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) { @@ -92,8 +107,8 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) { SupportsDebugInformation = true; // Exceptions handling - ExceptionsType = ExceptionHandling::Dwarf; - + ExceptionsType = ExceptionHandling::DwarfCFI; + // OpenBSD has buggy support for .quad in 32-bit mode, just split into two // .words. if (T.getOS() == Triple::OpenBSD && T.getArch() == Triple::x86) @@ -102,13 +117,15 @@ X86ELFMCAsmInfo::X86ELFMCAsmInfo(const Triple &T) { const MCSection *X86ELFMCAsmInfo:: getNonexecutableStackSection(MCContext &Ctx) const { - return Ctx.getELFSection(".note.GNU-stack", MCSectionELF::SHT_PROGBITS, + return Ctx.getELFSection(".note.GNU-stack", ELF::SHT_PROGBITS, 0, SectionKind::getMetadata()); } X86MCAsmInfoCOFF::X86MCAsmInfoCOFF(const Triple &Triple) { - if (Triple.getArch() == Triple::x86_64) + if (Triple.getArch() == Triple::x86_64) { GlobalPrefix = ""; + PrivateGlobalPrefix = ".L"; + } AsmTransCBE = x86_asm_table; AssemblerDialect = AsmWriterFlavor;