[PATCH] D125092: [OpenMP] Add basic support for properly handling static libraries

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 6 09:49:53 PDT 2022


jhuber6 added a comment.

In D125092#3497033 <https://reviews.llvm.org/D125092#3497033>, @saiislam wrote:

>> Ideally we could just put this on the linker itself, but nvlink doesn't seem to support .a files.
>
> Yes, nvlink does not support archives. So we used a wrapper to extract cubin files from the archive and pass them to nvlink. Please see, Clang Nvlink Wrapper <https://clang.llvm.org/docs/ClangNvlinkWrapper.html>.

Yeah, it seems we'll need to do a manual work-around later to handle the following case:

  // foo.o
  void foo() { return; }

  //libfoo.a
  void foo() { return; }

  clang foo.o libfoo.a // no conflict, symbol foo isn't undefined in foo.o so libfoo.a is never loaded

  nvlink foo.cubin libfoo.cubin // conflict, both are loaded and linked together

This is a little bit of an edge-case so I just went for the basic support here, since AMD just uses `lld` we could just pass in `libfoo.a` and it should handle it correctly for us. Add it to the list of Nvidia problems we need to work around externally.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125092/new/

https://reviews.llvm.org/D125092



More information about the cfe-commits mailing list