From 044eb2f6afba375a914ac9d8024f8f5142bb912e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 18 Dec 2017 20:10:56 +0000 Subject: Vendor import of llvm trunk r321017: https://llvm.org/svn/llvm-project/llvm/trunk@321017 --- include/llvm/Object/ObjectFile.h | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'include/llvm/Object/ObjectFile.h') diff --git a/include/llvm/Object/ObjectFile.h b/include/llvm/Object/ObjectFile.h index afcad3090703b..079a59468156d 100644 --- a/include/llvm/Object/ObjectFile.h +++ b/include/llvm/Object/ObjectFile.h @@ -15,6 +15,7 @@ #define LLVM_OBJECT_OBJECTFILE_H #include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Triple.h" #include "llvm/ADT/iterator_range.h" #include "llvm/BinaryFormat/Magic.h" #include "llvm/MC/SubtargetFeature.h" @@ -23,7 +24,6 @@ #include "llvm/Object/SymbolicFile.h" #include "llvm/Support/Casting.h" #include "llvm/Support/Error.h" -#include "llvm/Support/ErrorOr.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/MemoryBuffer.h" #include @@ -109,6 +109,7 @@ public: bool isBSS() const; bool isVirtual() const; bool isBitcode() const; + bool isStripped() const; bool containsSymbol(SymbolRef S) const; @@ -236,6 +237,7 @@ protected: // A section is 'virtual' if its contents aren't present in the object image. virtual bool isSectionVirtual(DataRefImpl Sec) const = 0; virtual bool isSectionBitcode(DataRefImpl Sec) const; + virtual bool isSectionStripped(DataRefImpl Sec) const; virtual relocation_iterator section_rel_begin(DataRefImpl Sec) const = 0; virtual relocation_iterator section_rel_end(DataRefImpl Sec) const = 0; virtual section_iterator getRelocatedSection(DataRefImpl Sec) const; @@ -278,10 +280,13 @@ public: virtual uint8_t getBytesInAddress() const = 0; virtual StringRef getFileFormatName() const = 0; - virtual /* Triple::ArchType */ unsigned getArch() const = 0; + virtual Triple::ArchType getArch() const = 0; virtual SubtargetFeatures getFeatures() const = 0; virtual void setARMSubArch(Triple &TheTriple) const { } + /// @brief Create a triple from the data in this object file. + Triple makeTriple() const; + /// Returns platform-specific object flags, if any. virtual std::error_code getPlatformFlags(unsigned &Result) const { Result = 0; @@ -317,10 +322,10 @@ public: return v->isObject(); } - static ErrorOr> + static Expected> createCOFFObjectFile(MemoryBufferRef Object); - static ErrorOr> + static Expected> createELFObjectFile(MemoryBufferRef Object); static Expected> @@ -439,6 +444,10 @@ inline bool SectionRef::isBitcode() const { return OwningObject->isSectionBitcode(SectionPimpl); } +inline bool SectionRef::isStripped() const { + return OwningObject->isSectionStripped(SectionPimpl); +} + inline relocation_iterator SectionRef::relocation_begin() const { return OwningObject->section_rel_begin(SectionPimpl); } -- cgit v1.2.3