diff options
author | Charles Davis <cdavis5x@gmail.com> | 2013-08-27 05:00:13 +0000 |
---|---|---|
committer | Charles Davis <cdavis5x@gmail.com> | 2013-08-27 05:00:13 +0000 |
commit | bf778d0546a4d8814339d946ca5c7e52291cc00c (patch) | |
tree | c98b02ef136f3b0b7378b2e883faae39c6177679 /lib/Object | |
parent | 442d5f6c4b2395914c5970012916ce3746a39c39 (diff) | |
download | external_llvm-bf778d0546a4d8814339d946ca5c7e52291cc00c.zip external_llvm-bf778d0546a4d8814339d946ca5c7e52291cc00c.tar.gz external_llvm-bf778d0546a4d8814339d946ca5c7e52291cc00c.tar.bz2 |
Support/MachO: Add a bunch of defines.
Right now we have two headers for the Mach-O format. I'd like to get rid
of one. Since the other object formats are all in Support, I chose to
keep the Mach-O header in Support, and discard the other one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r-- | lib/Object/MachOObjectFile.cpp | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp index 4bc9b4d..37d6c21 100644 --- a/lib/Object/MachOObjectFile.cpp +++ b/lib/Object/MachOObjectFile.cpp @@ -568,16 +568,16 @@ error_code MachOObjectFile::getSymbolType(DataRefImpl Symb, Res = SymbolRef::ST_Other; // If this is a STAB debugging symbol, we can do nothing more. - if (n_type & MachO::NlistMaskStab) { + if (n_type & MachO::N_STAB) { Res = SymbolRef::ST_Debug; return object_error::success; } - switch (n_type & MachO::NlistMaskType) { - case MachO::NListTypeUndefined : + switch (n_type & MachO::N_TYPE) { + case MachO::N_UNDF : Res = SymbolRef::ST_Unknown; break; - case MachO::NListTypeSection : + case MachO::N_SECT : Res = SymbolRef::ST_Function; break; } @@ -620,15 +620,15 @@ error_code MachOObjectFile::getSymbolFlags(DataRefImpl DRI, // TODO: Correctly set SF_ThreadLocal Result = SymbolRef::SF_None; - if ((MachOType & MachO::NlistMaskType) == MachO::NListTypeUndefined) + if ((MachOType & MachO::N_TYPE) == MachO::N_UNDF) Result |= SymbolRef::SF_Undefined; if (MachOFlags & macho::STF_StabsEntryMask) Result |= SymbolRef::SF_FormatSpecific; - if (MachOType & MachO::NlistMaskExternal) { + if (MachOType & MachO::N_EXT) { Result |= SymbolRef::SF_Global; - if ((MachOType & MachO::NlistMaskType) == MachO::NListTypeUndefined) { + if ((MachOType & MachO::N_TYPE) == MachO::N_UNDF) { uint64_t Value; getSymbolAddress(DRI, Value); if (Value) @@ -636,10 +636,10 @@ error_code MachOObjectFile::getSymbolFlags(DataRefImpl DRI, } } - if (MachOFlags & (MachO::NListDescWeakRef | MachO::NListDescWeakDef)) + if (MachOFlags & (MachO::N_WEAK_REF | MachO::N_WEAK_DEF)) Result |= SymbolRef::SF_Weak; - if ((MachOType & MachO::NlistMaskType) == MachO::NListTypeAbsolute) + if ((MachOType & MachO::N_TYPE) == MachO::N_ABS) Result |= SymbolRef::SF_Absolute; return object_error::success; @@ -777,9 +777,9 @@ error_code MachOObjectFile::isSectionVirtual(DataRefImpl Sec, error_code MachOObjectFile::isSectionZeroInit(DataRefImpl Sec, bool &Res) const { uint32_t Flags = getSectionFlags(this, Sec); - unsigned SectionType = Flags & MachO::SectionFlagMaskSectionType; - Res = SectionType == MachO::SectionTypeZeroFill || - SectionType == MachO::SectionTypeZeroFillLarge; + unsigned SectionType = Flags & MachO::SECTION_TYPE; + Res = SectionType == MachO::S_ZEROFILL || + SectionType == MachO::S_GB_ZEROFILL; return object_error::success; } @@ -1272,28 +1272,28 @@ StringRef MachOObjectFile::getFileFormatName() const { unsigned CPUType = getCPUType(this); if (!is64Bit()) { switch (CPUType) { - case llvm::MachO::CPUTypeI386: + case llvm::MachO::CPU_TYPE_I386: return "Mach-O 32-bit i386"; - case llvm::MachO::CPUTypeARM: + case llvm::MachO::CPU_TYPE_ARM: return "Mach-O arm"; - case llvm::MachO::CPUTypePowerPC: + case llvm::MachO::CPU_TYPE_POWERPC: return "Mach-O 32-bit ppc"; default: - assert((CPUType & llvm::MachO::CPUArchABI64) == 0 && + assert((CPUType & llvm::MachO::CPU_ARCH_ABI64) == 0 && "64-bit object file when we're not 64-bit?"); return "Mach-O 32-bit unknown"; } } // Make sure the cpu type has the correct mask. - assert((CPUType & llvm::MachO::CPUArchABI64) - == llvm::MachO::CPUArchABI64 && + assert((CPUType & llvm::MachO::CPU_ARCH_ABI64) + == llvm::MachO::CPU_ARCH_ABI64 && "32-bit object file when we're 64-bit?"); switch (CPUType) { - case llvm::MachO::CPUTypeX86_64: + case llvm::MachO::CPU_TYPE_X86_64: return "Mach-O 64-bit x86-64"; - case llvm::MachO::CPUTypePowerPC64: + case llvm::MachO::CPU_TYPE_POWERPC64: return "Mach-O 64-bit ppc64"; default: return "Mach-O 64-bit unknown"; @@ -1302,15 +1302,15 @@ StringRef MachOObjectFile::getFileFormatName() const { Triple::ArchType MachOObjectFile::getArch(uint32_t CPUType) { switch (CPUType) { - case llvm::MachO::CPUTypeI386: + case llvm::MachO::CPU_TYPE_I386: return Triple::x86; - case llvm::MachO::CPUTypeX86_64: + case llvm::MachO::CPU_TYPE_X86_64: return Triple::x86_64; - case llvm::MachO::CPUTypeARM: + case llvm::MachO::CPU_TYPE_ARM: return Triple::arm; - case llvm::MachO::CPUTypePowerPC: + case llvm::MachO::CPU_TYPE_POWERPC: return Triple::ppc; - case llvm::MachO::CPUTypePowerPC64: + case llvm::MachO::CPU_TYPE_POWERPC64: return Triple::ppc64; default: return Triple::UnknownArch; @@ -1382,7 +1382,7 @@ MachOObjectFile::getSectionRawFinalSegmentName(DataRefImpl Sec) const { bool MachOObjectFile::isRelocationScattered(const macho::RelocationEntry &RE) const { - if (getCPUType(this) == llvm::MachO::CPUTypeX86_64) + if (getCPUType(this) == llvm::MachO::CPU_TYPE_X86_64) return false; return getPlainRelocationAddress(RE) & macho::RF_Scattered; } |