[all-commits] [llvm/llvm-project] 49d8a5: [LinkerWrapper] Fix resolution of weak symbols dur...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed Oct 4 12:14:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 49d8a559d35b5b144d61c8d96b0538db7f719de4
      https://github.com/llvm/llvm-project/commit/49d8a559d35b5b144d61c8d96b0538db7f719de4
  Author: Joseph Huber <35342157+jhuber6 at users.noreply.github.com>
  Date:   2023-10-04 (Wed, 04 Oct 2023)

  Changed paths:
    M clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
    A openmp/libomptarget/test/offloading/weak.c

  Log Message:
  -----------
  [LinkerWrapper] Fix resolution of weak symbols during LTO (#68215)

Summary:
Weak symbols are supposed to have the semantics that they can be
overriden by a strong (i.e. global) definition. This wasn't being
respected by the LTO pass because we simply used the first definition
that was available. This patch fixes that logic by doing a first pass
over the symbols to check for strong resolutions that could override a
weak one.

A lot of fake linker logic is ending up in the linker wrapper. If there
were an option to handle this in `lld` it would be a lot cleaner, but
unfortunately supporting NVPTX is a big restriction as their binaries
require the `nvlink` tool.




More information about the All-commits mailing list