diff options
author | Reid Kleckner <rnk@google.com> | 2019-11-07 09:27:43 -0800 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2019-11-07 09:29:48 -0800 |
commit | c989993ba1a666f04f7aee7df51d9f4de0588b71 (patch) | |
tree | c10fbd2bd485ee82f1afe764ff8594252b3aaf30 /llvm/lib/Object/XCOFFObjectFile.cpp | |
parent | 7d2b0ec345487537e37a24b323d612c7c06295cd (diff) | |
download | llvm-c989993ba1a666f04f7aee7df51d9f4de0588b71.zip llvm-c989993ba1a666f04f7aee7df51d9f4de0588b71.tar.gz llvm-c989993ba1a666f04f7aee7df51d9f4de0588b71.tar.bz2 |
[XCOFF] Fix link errors from explicit template instantiation
I happen to be using clang-cl+lld-link locally, and I get these link
errors:
lld-link: error: undefined symbol: public: unsigned short __cdecl llvm::object::XCOFFSectionHeader<struct llvm::object::XCOFFSectionHeader64>::getSectionType(void) const
>>> referenced by C:\src\llvm-project\llvm\tools\llvm-readobj\XCOFFDumper.cpp:106
>>> tools\llvm-readobj\CMakeFiles\llvm-readobj.dir\XCOFFDumper.cpp.obj:(public: virtual void __cdecl `anonymous namespace'::XCOFFDumper::printSectionHeaders(void))
I suspect this is because the explicit template instaniation appears
before the inline method definitions in the .cpp file, so they aren't
available at the point of instantiation. Move the explicit instantiation
later.
Also, forward declare the explicit instantiation for good measure.
Diffstat (limited to 'llvm/lib/Object/XCOFFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/XCOFFObjectFile.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Object/XCOFFObjectFile.cpp b/llvm/lib/Object/XCOFFObjectFile.cpp index 5ca2a6a..3ea42bb 100644 --- a/llvm/lib/Object/XCOFFObjectFile.cpp +++ b/llvm/lib/Object/XCOFFObjectFile.cpp @@ -61,6 +61,10 @@ bool XCOFFSectionHeader<T>::isReservedSectionType() const { return getSectionType() & SectionFlagsReservedMask; } +// Explictly instantiate template classes. +template struct XCOFFSectionHeader<XCOFFSectionHeader32>; +template struct XCOFFSectionHeader<XCOFFSectionHeader64>; + bool XCOFFRelocation32::isRelocationSigned() const { return Info & XR_SIGN_INDICATOR_MASK; } |