forked from OSchip/llvm-project
MC: Remove superfluous section attribute flag definitions
Summary: llvm/MC/MCSectionMachO.h and llvm/Support/MachO.h both had the same definitions for the section flags. Instead, grab the definitions out of support. No functionality change. Reviewers: grosbach, Bigcheese, rafael Reviewed By: rafael CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2998 llvm-svn: 203211
This commit is contained in:
parent
198c168518
commit
7b58305ff6
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/MC/MCSection.h"
|
||||
#include "llvm/Support/MachO.h"
|
||||
|
||||
namespace llvm {
|
||||
|
||||
|
@ -39,99 +40,6 @@ class MCSectionMachO : public MCSection {
|
|||
friend class MCContext;
|
||||
public:
|
||||
|
||||
/// These are the section type and attributes fields. A MachO section can
|
||||
/// have only one Type, but can have any of the attributes specified.
|
||||
enum : uint32_t {
|
||||
// TypeAndAttributes bitmasks.
|
||||
SECTION_TYPE = 0x000000FFU,
|
||||
SECTION_ATTRIBUTES = 0xFFFFFF00U,
|
||||
|
||||
// Valid section types.
|
||||
|
||||
/// S_REGULAR - Regular section.
|
||||
S_REGULAR = 0x00U,
|
||||
/// S_ZEROFILL - Zero fill on demand section.
|
||||
S_ZEROFILL = 0x01U,
|
||||
/// S_CSTRING_LITERALS - Section with literal C strings.
|
||||
S_CSTRING_LITERALS = 0x02U,
|
||||
/// S_4BYTE_LITERALS - Section with 4 byte literals.
|
||||
S_4BYTE_LITERALS = 0x03U,
|
||||
/// S_8BYTE_LITERALS - Section with 8 byte literals.
|
||||
S_8BYTE_LITERALS = 0x04U,
|
||||
/// S_LITERAL_POINTERS - Section with pointers to literals.
|
||||
S_LITERAL_POINTERS = 0x05U,
|
||||
/// S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
|
||||
S_NON_LAZY_SYMBOL_POINTERS = 0x06U,
|
||||
/// S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
|
||||
S_LAZY_SYMBOL_POINTERS = 0x07U,
|
||||
/// S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in
|
||||
/// the Reserved2 field.
|
||||
S_SYMBOL_STUBS = 0x08U,
|
||||
/// S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for
|
||||
/// initialization.
|
||||
S_MOD_INIT_FUNC_POINTERS = 0x09U,
|
||||
/// S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for
|
||||
/// termination.
|
||||
S_MOD_TERM_FUNC_POINTERS = 0x0AU,
|
||||
/// S_COALESCED - Section contains symbols that are to be coalesced.
|
||||
S_COALESCED = 0x0BU,
|
||||
/// S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4
|
||||
/// gigabytes).
|
||||
S_GB_ZEROFILL = 0x0CU,
|
||||
/// S_INTERPOSING - Section with only pairs of function pointers for
|
||||
/// interposing.
|
||||
S_INTERPOSING = 0x0DU,
|
||||
/// S_16BYTE_LITERALS - Section with only 16 byte literals.
|
||||
S_16BYTE_LITERALS = 0x0EU,
|
||||
/// S_DTRACE_DOF - Section contains DTrace Object Format.
|
||||
S_DTRACE_DOF = 0x0FU,
|
||||
/// S_LAZY_DYLIB_SYMBOL_POINTERS - Section with lazy symbol pointers to
|
||||
/// lazy loaded dylibs.
|
||||
S_LAZY_DYLIB_SYMBOL_POINTERS = 0x10U,
|
||||
/// S_THREAD_LOCAL_REGULAR - Section with ....
|
||||
S_THREAD_LOCAL_REGULAR = 0x11U,
|
||||
/// S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
|
||||
S_THREAD_LOCAL_ZEROFILL = 0x12U,
|
||||
/// S_THREAD_LOCAL_VARIABLES - Section with thread local variable structure
|
||||
/// data.
|
||||
S_THREAD_LOCAL_VARIABLES = 0x13U,
|
||||
/// S_THREAD_LOCAL_VARIABLE_POINTERS - Section with ....
|
||||
S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14U,
|
||||
/// S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local
|
||||
/// variable initialization pointers to functions.
|
||||
S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15U,
|
||||
|
||||
LAST_KNOWN_SECTION_TYPE = S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
|
||||
|
||||
|
||||
// Valid section attributes.
|
||||
|
||||
/// S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine
|
||||
/// instructions.
|
||||
S_ATTR_PURE_INSTRUCTIONS = 1U << 31,
|
||||
/// S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be
|
||||
/// in a ranlib table of contents.
|
||||
S_ATTR_NO_TOC = 1U << 30,
|
||||
/// S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section
|
||||
/// in files with the MY_DYLDLINK flag.
|
||||
S_ATTR_STRIP_STATIC_SYMS = 1U << 29,
|
||||
/// S_ATTR_NO_DEAD_STRIP - No dead stripping.
|
||||
S_ATTR_NO_DEAD_STRIP = 1U << 28,
|
||||
/// S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
|
||||
S_ATTR_LIVE_SUPPORT = 1U << 27,
|
||||
/// S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by
|
||||
/// dyld.
|
||||
S_ATTR_SELF_MODIFYING_CODE = 1U << 26,
|
||||
/// S_ATTR_DEBUG - A debug section.
|
||||
S_ATTR_DEBUG = 1U << 25,
|
||||
/// S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
|
||||
S_ATTR_SOME_INSTRUCTIONS = 1U << 10,
|
||||
/// S_ATTR_EXT_RELOC - Section has external relocation entries.
|
||||
S_ATTR_EXT_RELOC = 1U << 9,
|
||||
/// S_ATTR_LOC_RELOC - Section has local relocation entries.
|
||||
S_ATTR_LOC_RELOC = 1U << 8
|
||||
};
|
||||
|
||||
StringRef getSegmentName() const {
|
||||
// SegmentName is not necessarily null terminated!
|
||||
if (SegmentName[15])
|
||||
|
@ -156,7 +64,7 @@ public:
|
|||
unsigned getTypeAndAttributes() const { return TypeAndAttributes; }
|
||||
unsigned getStubSize() const { return Reserved2; }
|
||||
|
||||
unsigned getType() const { return TypeAndAttributes & SECTION_TYPE; }
|
||||
unsigned getType() const { return TypeAndAttributes & MachO::SECTION_TYPE; }
|
||||
bool hasAttribute(unsigned Value) const {
|
||||
return (TypeAndAttributes & Value) != 0;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,9 @@ namespace llvm {
|
|||
SECTION_ATTRIBUTES_SYS = 0x00ffff00u // SECTION_ATTRIBUTES_SYS
|
||||
};
|
||||
|
||||
enum SectionType {
|
||||
/// These are the section type and attributes fields. A MachO section can
|
||||
/// have only one Type, but can have any of the attributes specified.
|
||||
enum SectionType : uint32_t {
|
||||
// Constant masks for the "flags[7:0]" field in llvm::MachO::section and
|
||||
// llvm::MachO::section_64 (mask "flags" with SECTION_TYPE)
|
||||
S_REGULAR = 0x00u,
|
||||
|
@ -171,7 +173,9 @@ namespace llvm {
|
|||
S_THREAD_LOCAL_ZEROFILL = 0x12u,
|
||||
S_THREAD_LOCAL_VARIABLES = 0x13u,
|
||||
S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14u,
|
||||
S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15u
|
||||
S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15u,
|
||||
|
||||
LAST_KNOWN_SECTION_TYPE = S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
|
||||
};
|
||||
|
||||
enum : uint32_t {
|
||||
|
|
|
@ -548,15 +548,15 @@ bool TargetLoweringObjectFileMachO::isSectionAtomizableBySymbols(
|
|||
|
||||
// These sections are atomized at the element boundaries without using
|
||||
// symbols.
|
||||
case MCSectionMachO::S_4BYTE_LITERALS:
|
||||
case MCSectionMachO::S_8BYTE_LITERALS:
|
||||
case MCSectionMachO::S_16BYTE_LITERALS:
|
||||
case MCSectionMachO::S_LITERAL_POINTERS:
|
||||
case MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS:
|
||||
case MCSectionMachO::S_LAZY_SYMBOL_POINTERS:
|
||||
case MCSectionMachO::S_MOD_INIT_FUNC_POINTERS:
|
||||
case MCSectionMachO::S_MOD_TERM_FUNC_POINTERS:
|
||||
case MCSectionMachO::S_INTERPOSING:
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
|
|||
|
||||
TextSection // .text
|
||||
= Ctx->getMachOSection("__TEXT", "__text",
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
SectionKind::getText());
|
||||
DataSection // .data
|
||||
= Ctx->getMachOSection("__DATA", "__data", 0,
|
||||
|
@ -45,43 +45,43 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
|
|||
|
||||
TLSDataSection // .tdata
|
||||
= Ctx->getMachOSection("__DATA", "__thread_data",
|
||||
MCSectionMachO::S_THREAD_LOCAL_REGULAR,
|
||||
MachO::S_THREAD_LOCAL_REGULAR,
|
||||
SectionKind::getDataRel());
|
||||
TLSBSSSection // .tbss
|
||||
= Ctx->getMachOSection("__DATA", "__thread_bss",
|
||||
MCSectionMachO::S_THREAD_LOCAL_ZEROFILL,
|
||||
MachO::S_THREAD_LOCAL_ZEROFILL,
|
||||
SectionKind::getThreadBSS());
|
||||
|
||||
// TODO: Verify datarel below.
|
||||
TLSTLVSection // .tlv
|
||||
= Ctx->getMachOSection("__DATA", "__thread_vars",
|
||||
MCSectionMachO::S_THREAD_LOCAL_VARIABLES,
|
||||
MachO::S_THREAD_LOCAL_VARIABLES,
|
||||
SectionKind::getDataRel());
|
||||
|
||||
TLSThreadInitSection
|
||||
= Ctx->getMachOSection("__DATA", "__thread_init",
|
||||
MCSectionMachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
|
||||
MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS,
|
||||
SectionKind::getDataRel());
|
||||
|
||||
CStringSection // .cstring
|
||||
= Ctx->getMachOSection("__TEXT", "__cstring",
|
||||
MCSectionMachO::S_CSTRING_LITERALS,
|
||||
MachO::S_CSTRING_LITERALS,
|
||||
SectionKind::getMergeable1ByteCString());
|
||||
UStringSection
|
||||
= Ctx->getMachOSection("__TEXT","__ustring", 0,
|
||||
SectionKind::getMergeable2ByteCString());
|
||||
FourByteConstantSection // .literal4
|
||||
= Ctx->getMachOSection("__TEXT", "__literal4",
|
||||
MCSectionMachO::S_4BYTE_LITERALS,
|
||||
MachO::S_4BYTE_LITERALS,
|
||||
SectionKind::getMergeableConst4());
|
||||
EightByteConstantSection // .literal8
|
||||
= Ctx->getMachOSection("__TEXT", "__literal8",
|
||||
MCSectionMachO::S_8BYTE_LITERALS,
|
||||
MachO::S_8BYTE_LITERALS,
|
||||
SectionKind::getMergeableConst8());
|
||||
|
||||
SixteenByteConstantSection // .literal16
|
||||
= Ctx->getMachOSection("__TEXT", "__literal16",
|
||||
MCSectionMachO::S_16BYTE_LITERALS,
|
||||
MachO::S_16BYTE_LITERALS,
|
||||
SectionKind::getMergeableConst16());
|
||||
|
||||
ReadOnlySection // .const
|
||||
|
@ -90,36 +90,36 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
|
|||
|
||||
TextCoalSection
|
||||
= Ctx->getMachOSection("__TEXT", "__textcoal_nt",
|
||||
MCSectionMachO::S_COALESCED |
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
MachO::S_COALESCED |
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
SectionKind::getText());
|
||||
ConstTextCoalSection
|
||||
= Ctx->getMachOSection("__TEXT", "__const_coal",
|
||||
MCSectionMachO::S_COALESCED,
|
||||
MachO::S_COALESCED,
|
||||
SectionKind::getReadOnly());
|
||||
ConstDataSection // .const_data
|
||||
= Ctx->getMachOSection("__DATA", "__const", 0,
|
||||
SectionKind::getReadOnlyWithRel());
|
||||
DataCoalSection
|
||||
= Ctx->getMachOSection("__DATA","__datacoal_nt",
|
||||
MCSectionMachO::S_COALESCED,
|
||||
MachO::S_COALESCED,
|
||||
SectionKind::getDataRel());
|
||||
DataCommonSection
|
||||
= Ctx->getMachOSection("__DATA","__common",
|
||||
MCSectionMachO::S_ZEROFILL,
|
||||
MachO::S_ZEROFILL,
|
||||
SectionKind::getBSS());
|
||||
DataBSSSection
|
||||
= Ctx->getMachOSection("__DATA","__bss", MCSectionMachO::S_ZEROFILL,
|
||||
= Ctx->getMachOSection("__DATA","__bss", MachO::S_ZEROFILL,
|
||||
SectionKind::getBSS());
|
||||
|
||||
|
||||
LazySymbolPointerSection
|
||||
= Ctx->getMachOSection("__DATA", "__la_symbol_ptr",
|
||||
MCSectionMachO::S_LAZY_SYMBOL_POINTERS,
|
||||
MachO::S_LAZY_SYMBOL_POINTERS,
|
||||
SectionKind::getMetadata());
|
||||
NonLazySymbolPointerSection
|
||||
= Ctx->getMachOSection("__DATA", "__nl_symbol_ptr",
|
||||
MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS,
|
||||
MachO::S_NON_LAZY_SYMBOL_POINTERS,
|
||||
SectionKind::getMetadata());
|
||||
|
||||
if (RelocM == Reloc::Static) {
|
||||
|
@ -132,11 +132,11 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
|
|||
} else {
|
||||
StaticCtorSection
|
||||
= Ctx->getMachOSection("__DATA", "__mod_init_func",
|
||||
MCSectionMachO::S_MOD_INIT_FUNC_POINTERS,
|
||||
MachO::S_MOD_INIT_FUNC_POINTERS,
|
||||
SectionKind::getDataRel());
|
||||
StaticDtorSection
|
||||
= Ctx->getMachOSection("__DATA", "__mod_term_func",
|
||||
MCSectionMachO::S_MOD_TERM_FUNC_POINTERS,
|
||||
MachO::S_MOD_TERM_FUNC_POINTERS,
|
||||
SectionKind::getDataRel());
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
|
|||
if (T.isMacOSX() && !T.isMacOSXVersionLT(10, 6)) {
|
||||
CompactUnwindSection =
|
||||
Ctx->getMachOSection("__LD", "__compact_unwind",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getReadOnly());
|
||||
|
||||
if (T.getArch() == Triple::x86_64 || T.getArch() == Triple::x86)
|
||||
|
@ -159,77 +159,77 @@ void MCObjectFileInfo::InitMachOMCObjectFileInfo(Triple T) {
|
|||
// Debug Information.
|
||||
DwarfAccelNamesSection =
|
||||
Ctx->getMachOSection("__DWARF", "__apple_names",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfAccelObjCSection =
|
||||
Ctx->getMachOSection("__DWARF", "__apple_objc",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
// 16 character section limit...
|
||||
DwarfAccelNamespaceSection =
|
||||
Ctx->getMachOSection("__DWARF", "__apple_namespac",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfAccelTypesSection =
|
||||
Ctx->getMachOSection("__DWARF", "__apple_types",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
|
||||
DwarfAbbrevSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_abbrev",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfInfoSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_info",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfLineSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_line",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfFrameSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_frame",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfPubNamesSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_pubnames",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfPubTypesSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_pubtypes",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfGnuPubNamesSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_gnu_pubn",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfGnuPubTypesSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_gnu_pubt",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfStrSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_str",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfLocSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_loc",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfARangesSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_aranges",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfRangesSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_ranges",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfMacroInfoSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_macinfo",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
DwarfDebugInlineSection =
|
||||
Ctx->getMachOSection("__DWARF", "__debug_inlined",
|
||||
MCSectionMachO::S_ATTR_DEBUG,
|
||||
MachO::S_ATTR_DEBUG,
|
||||
SectionKind::getMetadata());
|
||||
StackMapSection =
|
||||
Ctx->getMachOSection("__LLVM_STACKMAPS", "__llvm_stackmaps", 0,
|
||||
|
@ -765,10 +765,10 @@ void MCObjectFileInfo::InitEHFrameSection() {
|
|||
if (Env == IsMachO)
|
||||
EHFrameSection =
|
||||
Ctx->getMachOSection("__TEXT", "__eh_frame",
|
||||
MCSectionMachO::S_COALESCED |
|
||||
MCSectionMachO::S_ATTR_NO_TOC |
|
||||
MCSectionMachO::S_ATTR_STRIP_STATIC_SYMS |
|
||||
MCSectionMachO::S_ATTR_LIVE_SUPPORT,
|
||||
MachO::S_COALESCED |
|
||||
MachO::S_ATTR_NO_TOC |
|
||||
MachO::S_ATTR_STRIP_STATIC_SYMS |
|
||||
MachO::S_ATTR_LIVE_SUPPORT,
|
||||
SectionKind::getReadOnly());
|
||||
else if (Env == IsELF)
|
||||
EHFrameSection =
|
||||
|
|
|
@ -195,19 +195,19 @@ public:
|
|||
}
|
||||
bool ParseSectionDirectiveCString(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT","__cstring",
|
||||
MCSectionMachO::S_CSTRING_LITERALS);
|
||||
MachO::S_CSTRING_LITERALS);
|
||||
}
|
||||
bool ParseSectionDirectiveLiteral4(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT", "__literal4",
|
||||
MCSectionMachO::S_4BYTE_LITERALS, 4);
|
||||
MachO::S_4BYTE_LITERALS, 4);
|
||||
}
|
||||
bool ParseSectionDirectiveLiteral8(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT", "__literal8",
|
||||
MCSectionMachO::S_8BYTE_LITERALS, 8);
|
||||
MachO::S_8BYTE_LITERALS, 8);
|
||||
}
|
||||
bool ParseSectionDirectiveLiteral16(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT","__literal16",
|
||||
MCSectionMachO::S_16BYTE_LITERALS, 16);
|
||||
MachO::S_16BYTE_LITERALS, 16);
|
||||
}
|
||||
bool ParseSectionDirectiveConstructor(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT","__constructor");
|
||||
|
@ -223,15 +223,15 @@ public:
|
|||
}
|
||||
bool ParseSectionDirectiveSymbolStub(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT","__symbol_stub",
|
||||
MCSectionMachO::S_SYMBOL_STUBS |
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
MachO::S_SYMBOL_STUBS |
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
// FIXME: Different on PPC and ARM.
|
||||
0, 16);
|
||||
}
|
||||
bool ParseSectionDirectivePICSymbolStub(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT","__picsymbol_stub",
|
||||
MCSectionMachO::S_SYMBOL_STUBS |
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS, 0, 26);
|
||||
MachO::S_SYMBOL_STUBS |
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS, 0, 26);
|
||||
}
|
||||
bool ParseSectionDirectiveData(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__data");
|
||||
|
@ -241,115 +241,115 @@ public:
|
|||
}
|
||||
bool ParseSectionDirectiveNonLazySymbolPointers(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__nl_symbol_ptr",
|
||||
MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS, 4);
|
||||
MachO::S_NON_LAZY_SYMBOL_POINTERS, 4);
|
||||
}
|
||||
bool ParseSectionDirectiveLazySymbolPointers(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__la_symbol_ptr",
|
||||
MCSectionMachO::S_LAZY_SYMBOL_POINTERS, 4);
|
||||
MachO::S_LAZY_SYMBOL_POINTERS, 4);
|
||||
}
|
||||
bool ParseSectionDirectiveDyld(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__dyld");
|
||||
}
|
||||
bool ParseSectionDirectiveModInitFunc(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__mod_init_func",
|
||||
MCSectionMachO::S_MOD_INIT_FUNC_POINTERS, 4);
|
||||
MachO::S_MOD_INIT_FUNC_POINTERS, 4);
|
||||
}
|
||||
bool ParseSectionDirectiveModTermFunc(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__mod_term_func",
|
||||
MCSectionMachO::S_MOD_TERM_FUNC_POINTERS, 4);
|
||||
MachO::S_MOD_TERM_FUNC_POINTERS, 4);
|
||||
}
|
||||
bool ParseSectionDirectiveConstData(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__const");
|
||||
}
|
||||
bool ParseSectionDirectiveObjCClass(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__class",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCMetaClass(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__meta_class",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCCatClsMeth(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__cat_cls_meth",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCCatInstMeth(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__cat_inst_meth",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCProtocol(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__protocol",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCStringObject(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__string_object",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCClsMeth(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__cls_meth",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCInstMeth(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__inst_meth",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCClsRefs(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__cls_refs",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP |
|
||||
MCSectionMachO::S_LITERAL_POINTERS, 4);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP |
|
||||
MachO::S_LITERAL_POINTERS, 4);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCMessageRefs(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__message_refs",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP |
|
||||
MCSectionMachO::S_LITERAL_POINTERS, 4);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP |
|
||||
MachO::S_LITERAL_POINTERS, 4);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCSymbols(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__symbols",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCCategory(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__category",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCClassVars(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__class_vars",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCInstanceVars(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__instance_vars",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCModuleInfo(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__module_info",
|
||||
MCSectionMachO::S_ATTR_NO_DEAD_STRIP);
|
||||
MachO::S_ATTR_NO_DEAD_STRIP);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCClassNames(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT", "__cstring",
|
||||
MCSectionMachO::S_CSTRING_LITERALS);
|
||||
MachO::S_CSTRING_LITERALS);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCMethVarTypes(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT", "__cstring",
|
||||
MCSectionMachO::S_CSTRING_LITERALS);
|
||||
MachO::S_CSTRING_LITERALS);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCMethVarNames(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT", "__cstring",
|
||||
MCSectionMachO::S_CSTRING_LITERALS);
|
||||
MachO::S_CSTRING_LITERALS);
|
||||
}
|
||||
bool ParseSectionDirectiveObjCSelectorStrs(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__OBJC", "__selector_strs",
|
||||
MCSectionMachO::S_CSTRING_LITERALS);
|
||||
MachO::S_CSTRING_LITERALS);
|
||||
}
|
||||
bool ParseSectionDirectiveTData(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__thread_data",
|
||||
MCSectionMachO::S_THREAD_LOCAL_REGULAR);
|
||||
MachO::S_THREAD_LOCAL_REGULAR);
|
||||
}
|
||||
bool ParseSectionDirectiveText(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__TEXT", "__text",
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS);
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS);
|
||||
}
|
||||
bool ParseSectionDirectiveTLV(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__thread_vars",
|
||||
MCSectionMachO::S_THREAD_LOCAL_VARIABLES);
|
||||
MachO::S_THREAD_LOCAL_VARIABLES);
|
||||
}
|
||||
bool ParseSectionDirectiveIdent(StringRef, SMLoc) {
|
||||
// Darwin silently ignores the .ident directive.
|
||||
|
@ -358,7 +358,7 @@ public:
|
|||
}
|
||||
bool ParseSectionDirectiveThreadInitFunc(StringRef, SMLoc) {
|
||||
return ParseSectionSwitch("__DATA", "__thread_init",
|
||||
MCSectionMachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS);
|
||||
MachO::S_THREAD_LOCAL_INIT_FUNCTION_POINTERS);
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -374,7 +374,7 @@ bool DarwinAsmParser::ParseSectionSwitch(const char *Segment,
|
|||
Lex();
|
||||
|
||||
// FIXME: Arch specific.
|
||||
bool isText = TAA & MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS;
|
||||
bool isText = TAA & MachO::S_ATTR_PURE_INSTRUCTIONS;
|
||||
getStreamer().SwitchSection(getContext().getMachOSection(
|
||||
Segment, Section, TAA, StubSize,
|
||||
isText ? SectionKind::getText()
|
||||
|
@ -429,9 +429,9 @@ bool DarwinAsmParser::ParseDirectiveIndirectSymbol(StringRef, SMLoc Loc) {
|
|||
const MCSectionMachO *Current = static_cast<const MCSectionMachO*>(
|
||||
getStreamer().getCurrentSection().first);
|
||||
unsigned SectionType = Current->getType();
|
||||
if (SectionType != MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS &&
|
||||
SectionType != MCSectionMachO::S_LAZY_SYMBOL_POINTERS &&
|
||||
SectionType != MCSectionMachO::S_SYMBOL_STUBS)
|
||||
if (SectionType != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
|
||||
SectionType != MachO::S_LAZY_SYMBOL_POINTERS &&
|
||||
SectionType != MachO::S_SYMBOL_STUBS)
|
||||
return Error(Loc, "indirect symbol not in a symbol pointer or stub "
|
||||
"section");
|
||||
|
||||
|
@ -729,7 +729,7 @@ bool DarwinAsmParser::ParseDirectiveTBSS(StringRef, SMLoc) {
|
|||
|
||||
getStreamer().EmitTBSSSymbol(getContext().getMachOSection(
|
||||
"__DATA", "__thread_bss",
|
||||
MCSectionMachO::S_THREAD_LOCAL_ZEROFILL,
|
||||
MachO::S_THREAD_LOCAL_ZEROFILL,
|
||||
0, SectionKind::getThreadBSS()),
|
||||
Sym, Size, 1 << Pow2Alignment);
|
||||
|
||||
|
@ -758,7 +758,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) {
|
|||
if (getLexer().is(AsmToken::EndOfStatement)) {
|
||||
// Create the zerofill section but no symbol
|
||||
getStreamer().EmitZerofill(getContext().getMachOSection(
|
||||
Segment, Section, MCSectionMachO::S_ZEROFILL,
|
||||
Segment, Section, MachO::S_ZEROFILL,
|
||||
0, SectionKind::getBSS()));
|
||||
return false;
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ bool DarwinAsmParser::ParseDirectiveZerofill(StringRef, SMLoc) {
|
|||
//
|
||||
// FIXME: Arch specific.
|
||||
getStreamer().EmitZerofill(getContext().getMachOSection(
|
||||
Segment, Section, MCSectionMachO::S_ZEROFILL,
|
||||
Segment, Section, MachO::S_ZEROFILL,
|
||||
0, SectionKind::getBSS()),
|
||||
Sym, Size, 1 << Pow2Alignment);
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ using namespace llvm;
|
|||
/// section type list.
|
||||
static const struct {
|
||||
const char *AssemblerName, *EnumName;
|
||||
} SectionTypeDescriptors[MCSectionMachO::LAST_KNOWN_SECTION_TYPE+1] = {
|
||||
} SectionTypeDescriptors[MachO::LAST_KNOWN_SECTION_TYPE+1] = {
|
||||
{ "regular", "S_REGULAR" }, // 0x00
|
||||
{ 0, "S_ZEROFILL" }, // 0x01
|
||||
{ "cstring_literals", "S_CSTRING_LITERALS" }, // 0x02
|
||||
|
@ -55,7 +55,7 @@ static const struct {
|
|||
const char *AssemblerName, *EnumName;
|
||||
} SectionAttrDescriptors[] = {
|
||||
#define ENTRY(ASMNAME, ENUM) \
|
||||
{ MCSectionMachO::ENUM, ASMNAME, #ENUM },
|
||||
{ MachO::ENUM, ASMNAME, #ENUM },
|
||||
ENTRY("pure_instructions", S_ATTR_PURE_INSTRUCTIONS)
|
||||
ENTRY("no_toc", S_ATTR_NO_TOC)
|
||||
ENTRY("strip_static_syms", S_ATTR_STRIP_STATIC_SYMS)
|
||||
|
@ -102,8 +102,8 @@ void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI,
|
|||
return;
|
||||
}
|
||||
|
||||
unsigned SectionType = TAA & MCSectionMachO::SECTION_TYPE;
|
||||
assert(SectionType <= MCSectionMachO::LAST_KNOWN_SECTION_TYPE &&
|
||||
unsigned SectionType = getType();
|
||||
assert(SectionType <= MachO::LAST_KNOWN_SECTION_TYPE &&
|
||||
"Invalid SectionType specified!");
|
||||
|
||||
if (SectionTypeDescriptors[SectionType].AssemblerName) {
|
||||
|
@ -116,7 +116,7 @@ void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI,
|
|||
}
|
||||
|
||||
// If we don't have any attributes, we're done.
|
||||
unsigned SectionAttrs = TAA & MCSectionMachO::SECTION_ATTRIBUTES;
|
||||
unsigned SectionAttrs = TAA & MachO::SECTION_ATTRIBUTES;
|
||||
if (SectionAttrs == 0) {
|
||||
// If we have a S_SYMBOL_STUBS size specified, print it along with 'none' as
|
||||
// the attribute specifier.
|
||||
|
@ -155,13 +155,13 @@ void MCSectionMachO::PrintSwitchToSection(const MCAsmInfo &MAI,
|
|||
}
|
||||
|
||||
bool MCSectionMachO::UseCodeAlign() const {
|
||||
return hasAttribute(MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS);
|
||||
return hasAttribute(MachO::S_ATTR_PURE_INSTRUCTIONS);
|
||||
}
|
||||
|
||||
bool MCSectionMachO::isVirtualSection() const {
|
||||
return (getType() == MCSectionMachO::S_ZEROFILL ||
|
||||
getType() == MCSectionMachO::S_GB_ZEROFILL ||
|
||||
getType() == MCSectionMachO::S_THREAD_LOCAL_ZEROFILL);
|
||||
return (getType() == MachO::S_ZEROFILL ||
|
||||
getType() == MachO::S_GB_ZEROFILL ||
|
||||
getType() == MachO::S_THREAD_LOCAL_ZEROFILL);
|
||||
}
|
||||
|
||||
/// StripSpaces - This removes leading and trailing spaces from the StringRef.
|
||||
|
@ -228,13 +228,13 @@ std::string MCSectionMachO::ParseSectionSpecifier(StringRef Spec, // In.
|
|||
|
||||
// Figure out which section type it is.
|
||||
unsigned TypeID;
|
||||
for (TypeID = 0; TypeID !=MCSectionMachO::LAST_KNOWN_SECTION_TYPE+1; ++TypeID)
|
||||
for (TypeID = 0; TypeID != MachO::LAST_KNOWN_SECTION_TYPE + 1; ++TypeID)
|
||||
if (SectionTypeDescriptors[TypeID].AssemblerName &&
|
||||
SectionType == SectionTypeDescriptors[TypeID].AssemblerName)
|
||||
break;
|
||||
|
||||
// If we didn't find the section type, reject it.
|
||||
if (TypeID > MCSectionMachO::LAST_KNOWN_SECTION_TYPE)
|
||||
if (TypeID > MachO::LAST_KNOWN_SECTION_TYPE)
|
||||
return "mach-o section specifier uses an unknown section type";
|
||||
|
||||
// Remember the TypeID.
|
||||
|
@ -244,7 +244,7 @@ std::string MCSectionMachO::ParseSectionSpecifier(StringRef Spec, // In.
|
|||
// If we have no comma after the section type, there are no attributes.
|
||||
if (Comma.second.empty()) {
|
||||
// S_SYMBOL_STUBS always require a symbol stub size specifier.
|
||||
if (TAA == MCSectionMachO::S_SYMBOL_STUBS)
|
||||
if (TAA == MachO::S_SYMBOL_STUBS)
|
||||
return "mach-o section specifier of type 'symbol_stubs' requires a size "
|
||||
"specifier";
|
||||
return "";
|
||||
|
@ -281,14 +281,14 @@ std::string MCSectionMachO::ParseSectionSpecifier(StringRef Spec, // In.
|
|||
// Okay, we've parsed the section attributes, see if we have a stub size spec.
|
||||
if (Comma.second.empty()) {
|
||||
// S_SYMBOL_STUBS always require a symbol stub size specifier.
|
||||
if (TAA == MCSectionMachO::S_SYMBOL_STUBS)
|
||||
if (TAA == MachO::S_SYMBOL_STUBS)
|
||||
return "mach-o section specifier of type 'symbol_stubs' requires a size "
|
||||
"specifier";
|
||||
return "";
|
||||
}
|
||||
|
||||
// If we have a stub size spec, we must have a sectiontype of S_SYMBOL_STUBS.
|
||||
if ((TAA & MCSectionMachO::SECTION_TYPE) != MCSectionMachO::S_SYMBOL_STUBS)
|
||||
if ((TAA & MachO::SECTION_TYPE) != MachO::S_SYMBOL_STUBS)
|
||||
return "mach-o section specifier cannot have a stub size specified because "
|
||||
"it does not have type 'symbol_stubs'";
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ void MachObjectWriter::WriteSection(const MCAssembler &Asm,
|
|||
|
||||
unsigned Flags = Section.getTypeAndAttributes();
|
||||
if (SD.hasInstructions())
|
||||
Flags |= MCSectionMachO::S_ATTR_SOME_INSTRUCTIONS;
|
||||
Flags |= MachO::S_ATTR_SOME_INSTRUCTIONS;
|
||||
|
||||
assert(isPowerOf2_32(SD.getAlignment()) && "Invalid alignment!");
|
||||
Write32(Log2_32(SD.getAlignment()));
|
||||
|
@ -437,9 +437,9 @@ void MachObjectWriter::BindIndirectSymbols(MCAssembler &Asm) {
|
|||
const MCSectionMachO &Section =
|
||||
cast<MCSectionMachO>(it->SectionData->getSection());
|
||||
|
||||
if (Section.getType() != MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS &&
|
||||
Section.getType() != MCSectionMachO::S_LAZY_SYMBOL_POINTERS &&
|
||||
Section.getType() != MCSectionMachO::S_SYMBOL_STUBS) {
|
||||
if (Section.getType() != MachO::S_NON_LAZY_SYMBOL_POINTERS &&
|
||||
Section.getType() != MachO::S_LAZY_SYMBOL_POINTERS &&
|
||||
Section.getType() != MachO::S_SYMBOL_STUBS) {
|
||||
MCSymbol &Symbol = *it->Symbol;
|
||||
report_fatal_error("indirect symbol '" + Symbol.getName() +
|
||||
"' not in a symbol pointer or stub section");
|
||||
|
@ -453,7 +453,7 @@ void MachObjectWriter::BindIndirectSymbols(MCAssembler &Asm) {
|
|||
const MCSectionMachO &Section =
|
||||
cast<MCSectionMachO>(it->SectionData->getSection());
|
||||
|
||||
if (Section.getType() != MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS)
|
||||
if (Section.getType() != MachO::S_NON_LAZY_SYMBOL_POINTERS)
|
||||
continue;
|
||||
|
||||
// Initialize the section indirect symbol base, if necessary.
|
||||
|
@ -469,8 +469,8 @@ void MachObjectWriter::BindIndirectSymbols(MCAssembler &Asm) {
|
|||
const MCSectionMachO &Section =
|
||||
cast<MCSectionMachO>(it->SectionData->getSection());
|
||||
|
||||
if (Section.getType() != MCSectionMachO::S_LAZY_SYMBOL_POINTERS &&
|
||||
Section.getType() != MCSectionMachO::S_SYMBOL_STUBS)
|
||||
if (Section.getType() != MachO::S_LAZY_SYMBOL_POINTERS &&
|
||||
Section.getType() != MachO::S_SYMBOL_STUBS)
|
||||
continue;
|
||||
|
||||
// Initialize the section indirect symbol base, if necessary.
|
||||
|
@ -921,7 +921,7 @@ void MachObjectWriter::WriteObject(MCAssembler &Asm,
|
|||
// special handling.
|
||||
const MCSectionMachO &Section =
|
||||
static_cast<const MCSectionMachO&>(it->SectionData->getSection());
|
||||
if (Section.getType() == MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS) {
|
||||
if (Section.getType() == MachO::S_NON_LAZY_SYMBOL_POINTERS) {
|
||||
// If this symbol is defined and internal, mark it as such.
|
||||
if (it->Symbol->isDefined() &&
|
||||
!Asm.getSymbolData(*it->Symbol).isExternal()) {
|
||||
|
|
|
@ -422,20 +422,20 @@ void ARMAsmPrinter::EmitStartOfAsmFile(Module &M) {
|
|||
if (RelocM == Reloc::DynamicNoPIC) {
|
||||
const MCSection *sect =
|
||||
OutContext.getMachOSection("__TEXT", "__symbol_stub4",
|
||||
MCSectionMachO::S_SYMBOL_STUBS,
|
||||
MachO::S_SYMBOL_STUBS,
|
||||
12, SectionKind::getText());
|
||||
OutStreamer.SwitchSection(sect);
|
||||
} else {
|
||||
const MCSection *sect =
|
||||
OutContext.getMachOSection("__TEXT", "__picsymbolstub4",
|
||||
MCSectionMachO::S_SYMBOL_STUBS,
|
||||
MachO::S_SYMBOL_STUBS,
|
||||
16, SectionKind::getText());
|
||||
OutStreamer.SwitchSection(sect);
|
||||
}
|
||||
const MCSection *StaticInitSect =
|
||||
OutContext.getMachOSection("__TEXT", "__StaticInit",
|
||||
MCSectionMachO::S_REGULAR |
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
MachO::S_REGULAR |
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
SectionKind::getText());
|
||||
OutStreamer.SwitchSection(StaticInitSect);
|
||||
}
|
||||
|
|
|
@ -865,14 +865,14 @@ void PPCDarwinAsmPrinter::EmitStartOfAsmFile(Module &M) {
|
|||
if (TM.getRelocationModel() == Reloc::PIC_) {
|
||||
OutStreamer.SwitchSection(
|
||||
OutContext.getMachOSection("__TEXT", "__picsymbolstub1",
|
||||
MCSectionMachO::S_SYMBOL_STUBS |
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
MachO::S_SYMBOL_STUBS |
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
32, SectionKind::getText()));
|
||||
} else if (TM.getRelocationModel() == Reloc::DynamicNoPIC) {
|
||||
OutStreamer.SwitchSection(
|
||||
OutContext.getMachOSection("__TEXT","__symbol_stub1",
|
||||
MCSectionMachO::S_SYMBOL_STUBS |
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
MachO::S_SYMBOL_STUBS |
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
16, SectionKind::getText()));
|
||||
}
|
||||
OutStreamer.SwitchSection(getObjFileLowering().getTextSection());
|
||||
|
@ -904,8 +904,8 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
|||
if (TM.getRelocationModel() == Reloc::PIC_) {
|
||||
const MCSection *StubSection =
|
||||
OutContext.getMachOSection("__TEXT", "__picsymbolstub1",
|
||||
MCSectionMachO::S_SYMBOL_STUBS |
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
MachO::S_SYMBOL_STUBS |
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
32, SectionKind::getText());
|
||||
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
|
||||
OutStreamer.SwitchSection(StubSection);
|
||||
|
@ -972,8 +972,8 @@ EmitFunctionStubs(const MachineModuleInfoMachO::SymbolListTy &Stubs) {
|
|||
|
||||
const MCSection *StubSection =
|
||||
OutContext.getMachOSection("__TEXT","__symbol_stub1",
|
||||
MCSectionMachO::S_SYMBOL_STUBS |
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
MachO::S_SYMBOL_STUBS |
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
16, SectionKind::getText());
|
||||
for (unsigned i = 0, e = Stubs.size(); i != e; ++i) {
|
||||
MCSymbol *Stub = Stubs[i].first;
|
||||
|
|
|
@ -758,7 +758,7 @@ public:
|
|||
//
|
||||
// See <rdar://problem/4765733>.
|
||||
const MCSectionMachO &SMO = static_cast<const MCSectionMachO&>(Section);
|
||||
return SMO.getType() == MCSectionMachO::S_CSTRING_LITERALS;
|
||||
return SMO.getType() == MachO::S_CSTRING_LITERALS;
|
||||
}
|
||||
|
||||
virtual bool isSectionAtomizable(const MCSection &Section) const {
|
||||
|
@ -768,15 +768,15 @@ public:
|
|||
default:
|
||||
return true;
|
||||
|
||||
case MCSectionMachO::S_4BYTE_LITERALS:
|
||||
case MCSectionMachO::S_8BYTE_LITERALS:
|
||||
case MCSectionMachO::S_16BYTE_LITERALS:
|
||||
case MCSectionMachO::S_LITERAL_POINTERS:
|
||||
case MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS:
|
||||
case MCSectionMachO::S_LAZY_SYMBOL_POINTERS:
|
||||
case MCSectionMachO::S_MOD_INIT_FUNC_POINTERS:
|
||||
case MCSectionMachO::S_MOD_TERM_FUNC_POINTERS:
|
||||
case MCSectionMachO::S_INTERPOSING:
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ void X86MachObjectWriter::RecordX86_64Relocation(MachObjectWriter *Writer,
|
|||
if (Symbol->isInSection()) {
|
||||
const MCSectionMachO &Section = static_cast<const MCSectionMachO&>(
|
||||
Fragment->getParent()->getSection());
|
||||
if (Section.hasAttribute(MCSectionMachO::S_ATTR_DEBUG))
|
||||
if (Section.hasAttribute(MachO::S_ATTR_DEBUG))
|
||||
Base = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -541,9 +541,9 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||
if (!Stubs.empty()) {
|
||||
const MCSection *TheSection =
|
||||
OutContext.getMachOSection("__IMPORT", "__jump_table",
|
||||
MCSectionMachO::S_SYMBOL_STUBS |
|
||||
MCSectionMachO::S_ATTR_SELF_MODIFYING_CODE |
|
||||
MCSectionMachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
MachO::S_SYMBOL_STUBS |
|
||||
MachO::S_ATTR_SELF_MODIFYING_CODE |
|
||||
MachO::S_ATTR_PURE_INSTRUCTIONS,
|
||||
5, SectionKind::getMetadata());
|
||||
OutStreamer.SwitchSection(TheSection);
|
||||
|
||||
|
@ -567,7 +567,7 @@ void X86AsmPrinter::EmitEndOfAsmFile(Module &M) {
|
|||
if (!Stubs.empty()) {
|
||||
const MCSection *TheSection =
|
||||
OutContext.getMachOSection("__IMPORT", "__pointers",
|
||||
MCSectionMachO::S_NON_LAZY_SYMBOL_POINTERS,
|
||||
MachO::S_NON_LAZY_SYMBOL_POINTERS,
|
||||
SectionKind::getMetadata());
|
||||
OutStreamer.SwitchSection(TheSection);
|
||||
|
||||
|
|
Loading…
Reference in New Issue