[all-commits] [llvm/llvm-project] c98999: [XCOFF] Fix link errors from explicit template ins...

Reid Kleckner via All-commits all-commits at lists.llvm.org
Thu Nov 7 09:29:52 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: c989993ba1a666f04f7aee7df51d9f4de0588b71
      https://github.com/llvm/llvm-project/commit/c989993ba1a666f04f7aee7df51d9f4de0588b71
  Author: Reid Kleckner <rnk at google.com>
  Date:   2019-11-07 (Thu, 07 Nov 2019)

  Changed paths:
    M llvm/include/llvm/Object/XCOFFObjectFile.h
    M llvm/lib/Object/XCOFFObjectFile.cpp

  Log Message:
  -----------
  [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.




More information about the All-commits mailing list