[PATCH] D151839: [LinkerWrapper] Fix static library symbol resolution

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 31 13:48:11 PDT 2023


jhuber6 created this revision.
jhuber6 added reviewers: jdoerfert, tianshilei1992, JonChesterfield, tra, yaxunl.
Herald added a project: All.
jhuber6 requested review of this revision.
Herald added subscribers: cfe-commits, jplehr, sstefan1.
Herald added a project: clang.

The linker wrapper performs its own very basic symbol resolution for the
purpose of supporting standard static library semantics. We do this here
because the Nvidia `nvlink` wrapper does not support static linking and
we have some offloading specific extensions.

Currently, we always place symbols in the "table" even if they aren't
extracted. This caused the logic to fail when many files were used that
referenced the same undefined variable. This patch changes the pass to
only add the symbols to the global "table" if the file is actually
extracted.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151839

Files:
  clang/test/Driver/linker-wrapper-libs.c
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151839.527193.patch
Type: text/x-patch
Size: 7495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230531/591e59dd/attachment-0001.bin>


More information about the cfe-commits mailing list