From cfca06d7963fa0909f90483b42a6d7d194d01e08 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 26 Jul 2020 19:36:28 +0000 Subject: Vendor import of llvm-project master 2e10b7a39b9, the last commit before the llvmorg-12-init tag, from which release/11.x was branched. --- llvm/lib/Object/ObjectFile.cpp | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'llvm/lib/Object/ObjectFile.cpp') diff --git a/llvm/lib/Object/ObjectFile.cpp b/llvm/lib/Object/ObjectFile.cpp index 098b3d8f8dd0..61b36ea0f448 100644 --- a/llvm/lib/Object/ObjectFile.cpp +++ b/llvm/lib/Object/ObjectFile.cpp @@ -54,12 +54,15 @@ bool SectionRef::containsSymbol(SymbolRef S) const { return *this == **SymSec; } -uint64_t ObjectFile::getSymbolValue(DataRefImpl Ref) const { - uint32_t Flags = getSymbolFlags(Ref); - if (Flags & SymbolRef::SF_Undefined) - return 0; - if (Flags & SymbolRef::SF_Common) - return getCommonSymbolSize(Ref); +Expected ObjectFile::getSymbolValue(DataRefImpl Ref) const { + if (Expected FlagsOrErr = getSymbolFlags(Ref)) { + if (*FlagsOrErr & SymbolRef::SF_Undefined) + return 0; + if (*FlagsOrErr & SymbolRef::SF_Common) + return getCommonSymbolSize(Ref); + } else + // TODO: Test this error. + return FlagsOrErr.takeError(); return getSymbolValueImpl(Ref); } @@ -91,6 +94,10 @@ bool ObjectFile::isBerkeleyData(DataRefImpl Sec) const { return isSectionData(Sec); } +bool ObjectFile::isDebugSection(StringRef SectionName) const { + return false; +} + Expected ObjectFile::getRelocatedSection(DataRefImpl Sec) const { return section_iterator(SectionRef(Sec, this)); @@ -108,14 +115,17 @@ Triple ObjectFile::makeTriple() const { setARMSubArch(TheTriple); // TheTriple defaults to ELF, and COFF doesn't have an environment: - // the best we can do here is indicate that it is mach-o. - if (isMachO()) + // something we can do here is indicate that it is mach-o. + if (isMachO()) { TheTriple.setObjectFormat(Triple::MachO); - - if (isCOFF()) { + } else if (isCOFF()) { const auto COFFObj = cast(this); if (COFFObj->getArch() == Triple::thumb) TheTriple.setTriple("thumbv7-windows"); + } else if (isXCOFF()) { + // XCOFF implies AIX. + TheTriple.setOS(Triple::AIX); + TheTriple.setObjectFormat(Triple::XCOFF); } return TheTriple; -- cgit v1.2.3