X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FTargetLoweringObjectFileImpl.cpp;h=9f1e06b4725d2e894e4d3a16b448fe35dcf384fa;hb=d8f69a72018761fbd4d02505890422b26d0f16dc;hp=6d5e27c00e80ef29f62c435f663fb857c276b3b5;hpb=3f34ae97b90c0d9373f3ad2be3f769d8ea206302;p=oota-llvm.git diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index 6d5e27c00e8..9f1e06b4725 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -464,14 +464,15 @@ emitModuleFlags(MCStreamer &Streamer, continue; StringRef Key = MFE.Key->getString(); - Value *Val = MFE.Val; + Metadata *Val = MFE.Val; if (Key == "Objective-C Image Info Version") { - VersionVal = cast(Val)->getZExtValue(); + VersionVal = mdconst::extract(Val)->getZExtValue(); } else if (Key == "Objective-C Garbage Collection" || Key == "Objective-C GC Only" || - Key == "Objective-C Is Simulated") { - ImageInfoFlags |= cast(Val)->getZExtValue(); + Key == "Objective-C Is Simulated" || + Key == "Objective-C Image Swift Version") { + ImageInfoFlags |= mdconst::extract(Val)->getZExtValue(); } else if (Key == "Objective-C Image Info Section") { SectionVal = cast(Val)->getString(); } else if (Key == "Linker Options") { @@ -572,41 +573,6 @@ const MCSection *TargetLoweringObjectFileMachO::getExplicitSectionGlobal( return S; } -bool TargetLoweringObjectFileMachO::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.getKind().isMergeable1ByteCString()) - return false; - - if (SMO.getSegmentName() == "__DATA" && - SMO.getSectionName() == "__cfstring") - 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; - } -} - const MCSection *TargetLoweringObjectFileMachO:: SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, Mangler &Mang, const TargetMachine &TM) const { @@ -865,9 +831,9 @@ static const char *getCOFFSectionNameForUniqueGlobal(SectionKind Kind) { return ".bss"; if (Kind.isThreadLocal()) return ".tls$"; - if (Kind.isWriteable()) - return ".data"; - return ".rdata"; + if (Kind.isReadOnly() || Kind.isReadOnlyWithRel()) + return ".rdata"; + return ".data"; } @@ -915,7 +881,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind, if (Kind.isThreadLocal()) return TLSDataSection; - if (Kind.isReadOnly()) + if (Kind.isReadOnly() || Kind.isReadOnlyWithRel()) return ReadOnlySection; // Note: we claim that common symbols are put in BSSSection, but they are @@ -946,7 +912,7 @@ emitModuleFlags(MCStreamer &Streamer, i = ModuleFlags.begin(), e = ModuleFlags.end(); i != e; ++i) { const Module::ModuleFlagEntry &MFE = *i; StringRef Key = MFE.Key->getString(); - Value *Val = MFE.Val; + Metadata *Val = MFE.Val; if (Key == "Linker Options") { LinkerOptions = cast(Val); break; @@ -966,7 +932,7 @@ emitModuleFlags(MCStreamer &Streamer, StringRef Op = MDOption->getString(); // Lead with a space for consistency with our dllexport implementation. std::string Escaped(" "); - if (Op.find(" ") != StringRef::npos) { + if (!Op.startswith("\"") && (Op.find(" ") != StringRef::npos)) { // The PE-COFF spec says args with spaces must be quoted. It doesn't say // how to escape quotes, but it probably uses this algorithm: // http://msdn.microsoft.com/en-us/library/17w5ykft(v=vs.85).aspx