X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FMC%2FMCAsmInfoDarwin.cpp;h=ae9486d3db4de9c535af8cc9c0c1667faaa45559;hb=c6ac80b70108edb2d04b6da306e81724eb3df5cb;hp=fea1548f4621108aacc81ba0b99d44eb1102eef6;hpb=a0057ca13f06b8de08483c3e3a143a7236c67097;p=oota-llvm.git diff --git a/lib/MC/MCAsmInfoDarwin.cpp b/lib/MC/MCAsmInfoDarwin.cpp index fea1548f462..ae9486d3db4 100644 --- a/lib/MC/MCAsmInfoDarwin.cpp +++ b/lib/MC/MCAsmInfoDarwin.cpp @@ -15,58 +15,82 @@ #include "llvm/MC/MCAsmInfoDarwin.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCExpr.h" -#include "llvm/MC/MCStreamer.h" +#include "llvm/MC/MCSectionMachO.h" using namespace llvm; +bool MCAsmInfoDarwin::isSectionAtomizableBySymbols( + const MCSection &Section) const { + const MCSectionMachO &SMO = static_cast(Section); + + // Sections holding 1 byte strings are atomized based on the data they + // contain. + // Sections holding 2 byte strings require symbols in order to be atomized. + // There is no dedicated section for 4 byte strings. + if (SMO.getType() == MachO::S_CSTRING_LITERALS) + return false; + + if (SMO.getSegmentName() == "__DATA" && SMO.getSectionName() == "__cfstring") + return false; + + if (SMO.getSegmentName() == "__DATA" && + SMO.getSectionName() == "__objc_classrefs") + return false; + + switch (SMO.getType()) { + default: + return true; + + // These sections are atomized at the element boundaries without using + // symbols. + case MachO::S_4BYTE_LITERALS: + case MachO::S_8BYTE_LITERALS: + case MachO::S_16BYTE_LITERALS: + case MachO::S_LITERAL_POINTERS: + case MachO::S_NON_LAZY_SYMBOL_POINTERS: + case MachO::S_LAZY_SYMBOL_POINTERS: + case MachO::S_MOD_INIT_FUNC_POINTERS: + case MachO::S_MOD_TERM_FUNC_POINTERS: + case MachO::S_INTERPOSING: + return false; + } +} + MCAsmInfoDarwin::MCAsmInfoDarwin() { // Common settings for all Darwin targets. // Syntax: - GlobalPrefix = "_"; - PrivateGlobalPrefix = "L"; LinkerPrivateGlobalPrefix = "l"; - AllowQuotesInName = true; HasSingleParameterDotFile = false; HasSubsectionsViaSymbols = true; AlignmentIsInBytes = false; COMMDirectiveAlignmentIsInBytes = false; + LCOMMDirectiveAlignmentType = LCOMM::Log2Alignment; InlineAsmStart = " InlineAsm Start"; InlineAsmEnd = " InlineAsm End"; // Directives: - WeakDefDirective = "\t.weak_definition "; + HasWeakDefDirective = true; + HasWeakDefCanBeHiddenDirective = true; WeakRefDirective = "\t.weak_reference "; ZeroDirective = "\t.space\t"; // ".space N" emits N zeros. HasMachoZeroFillDirective = true; // Uses .zerofill HasMachoTBSSDirective = true; // Uses .tbss HasStaticCtorDtorReferenceInStaticMode = true; - // FIXME: Darwin 10 and newer don't need this. - LinkerRequiresNonEmptyDwarfLines = true; - // FIXME: Change this once MC is the system assembler. HasAggressiveSymbolFolding = false; HiddenVisibilityAttr = MCSA_PrivateExtern; HiddenDeclarationVisibilityAttr = MCSA_Invalid; + // Doesn't support protected visibility. - ProtectedVisibilityAttr = MCSA_Global; - + ProtectedVisibilityAttr = MCSA_Invalid; + HasDotTypeDotSizeDirective = false; HasNoDeadStrip = true; - HasSymbolResolver = true; - DwarfUsesAbsoluteLabelForStmtList = false; - DwarfUsesLabelOffsetForRanges = false; -} + DwarfUsesRelocationsAcrossSections = false; -const MCExpr * -MCAsmInfoDarwin::getExprForFDESymbol(const MCSymbol *Sym, - MCStreamer &Streamer) const { - MCContext &Context = Streamer.getContext(); - const MCExpr *Res = MCSymbolRefExpr::Create(Sym, Context); - MCSymbol *PCSym = Context.CreateTempSymbol(); - Streamer.EmitLabel(PCSym); - const MCExpr *PC = MCSymbolRefExpr::Create(PCSym, Context); - return MCBinaryExpr::CreateSub(Res, PC, Context); + UseIntegratedAssembler = true; + SetDirectiveSuppressesReloc = true; }