diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index 8a363741ee6287..6aff1e62276b03 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -21,6 +21,7 @@ #include "llvm/BinaryFormat/ELF.h" #include "llvm/Object/ELFTypes.h" #include "llvm/Object/Error.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/DataExtractor.h" #include "llvm/Support/Error.h" #include @@ -1367,6 +1368,11 @@ inline uint32_t hashGnu(StringRef Name) { return H; } +extern template class LLVM_TEMPLATE_ABI llvm::object::ELFFile; +extern template class LLVM_TEMPLATE_ABI llvm::object::ELFFile; +extern template class LLVM_TEMPLATE_ABI llvm::object::ELFFile; +extern template class LLVM_TEMPLATE_ABI llvm::object::ELFFile; + } // end namespace object } // end namespace llvm diff --git a/llvm/include/llvm/Object/XCOFFObjectFile.h b/llvm/include/llvm/Object/XCOFFObjectFile.h index 5a7cd8e38f2b76..ec48843cd5320b 100644 --- a/llvm/include/llvm/Object/XCOFFObjectFile.h +++ b/llvm/include/llvm/Object/XCOFFObjectFile.h @@ -18,6 +18,7 @@ #include "llvm/ADT/iterator_range.h" #include "llvm/BinaryFormat/XCOFF.h" #include "llvm/Object/ObjectFile.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/Endian.h" #include @@ -775,6 +776,13 @@ struct XCOFFSymbolEntry64 { uint8_t NumberOfAuxEntries; }; +extern template LLVM_TEMPLATE_ABI Expected> +XCOFFObjectFile::relocations( + const XCOFFSectionHeader32 &Sec) const; +extern template LLVM_TEMPLATE_ABI Expected> +XCOFFObjectFile::relocations( + const XCOFFSectionHeader64 &Sec) const; + class XCOFFSymbolRef : public SymbolRef { public: enum { NAME_IN_STR_TBL_MAGIC = 0x0 }; diff --git a/llvm/lib/Object/ELF.cpp b/llvm/lib/Object/ELF.cpp index c66736fb2c9194..9a9e762d1e51d6 100644 --- a/llvm/lib/Object/ELF.cpp +++ b/llvm/lib/Object/ELF.cpp @@ -9,6 +9,7 @@ #include "llvm/Object/ELF.h" #include "llvm/ADT/StringExtras.h" #include "llvm/BinaryFormat/ELF.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/DataExtractor.h" using namespace llvm; @@ -980,7 +981,7 @@ ELFFile::getSectionAndRelocations( return SecToRelocMap; } -template class llvm::object::ELFFile; -template class llvm::object::ELFFile; -template class llvm::object::ELFFile; -template class llvm::object::ELFFile; +template class LLVM_EXPORT_TEMPLATE llvm::object::ELFFile; +template class LLVM_EXPORT_TEMPLATE llvm::object::ELFFile; +template class LLVM_EXPORT_TEMPLATE llvm::object::ELFFile; +template class LLVM_EXPORT_TEMPLATE llvm::object::ELFFile; diff --git a/llvm/lib/Object/XCOFFObjectFile.cpp b/llvm/lib/Object/XCOFFObjectFile.cpp index 6efb8759d13fbd..cc0da5db524256 100644 --- a/llvm/lib/Object/XCOFFObjectFile.cpp +++ b/llvm/lib/Object/XCOFFObjectFile.cpp @@ -12,6 +12,7 @@ #include "llvm/Object/XCOFFObjectFile.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/Support/Compiler.h" #include "llvm/Support/DataExtractor.h" #include "llvm/TargetParser/SubtargetFeature.h" #include @@ -1060,9 +1061,9 @@ Expected> XCOFFObjectFile::getExceptionEntries() const { ExceptEntStart, ExceptEntStart + getSectionSize(DRI) / sizeof(ExceptEnt)); } -template Expected> +template LLVM_EXPORT_TEMPLATE Expected> XCOFFObjectFile::getExceptionEntries() const; -template Expected> +template LLVM_EXPORT_TEMPLATE Expected> XCOFFObjectFile::getExceptionEntries() const; Expected @@ -1376,14 +1377,16 @@ template struct XCOFFSectionHeader; template struct XCOFFRelocation; template struct XCOFFRelocation; -template llvm::Expected> -llvm::object::XCOFFObjectFile::relocations( - llvm::object::XCOFFSectionHeader64 const &) const; -template llvm::Expected> -llvm::object::XCOFFObjectFile::relocations( - llvm::object::XCOFFSectionHeader32 const &) const; +template LLVM_EXPORT_TEMPLATE + llvm::Expected> + llvm::object::XCOFFObjectFile::relocations< + llvm::object::XCOFFSectionHeader64, llvm::object::XCOFFRelocation64>( + llvm::object::XCOFFSectionHeader64 const &) const; +template LLVM_EXPORT_TEMPLATE + llvm::Expected> + llvm::object::XCOFFObjectFile::relocations< + llvm::object::XCOFFSectionHeader32, llvm::object::XCOFFRelocation32>( + llvm::object::XCOFFSectionHeader32 const &) const; bool doesXCOFFTracebackTableBegin(ArrayRef Bytes) { if (Bytes.size() < 4)