[all-commits] [llvm/llvm-project] 36b87d: Set -rpath-link only if the path is nonempty.

Justin Lebar via All-commits all-commits at lists.llvm.org
Thu Sep 21 10:14:24 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 36b87d8043ee038b382fe734709ea1ab4b89238c
      https://github.com/llvm/llvm-project/commit/36b87d8043ee038b382fe734709ea1ab4b89238c
  Author: Justin Lebar <justin.lebar at gmail.com>
  Date:   2023-09-21 (Thu, 21 Sep 2023)

  Changed paths:
    M llvm/cmake/modules/AddLLVM.cmake

  Log Message:
  -----------
  Set -rpath-link only if the path is nonempty.

This cmake rule is used by external clients, who may or may not have
the LLVM_LIBRARY_OUTPUT_INTDIR variable set.

If it is not set, then we pass `-Wl,-rpath-link,` to the compiler.  It
turns out that gcc and clang interpret this differently.

  * gcc passes `-rpath-link ""` to the linker, which is what we want.

  * clang passes `-rpath-link` to the linker.  This is not what we want,
    because then the linker gobbles the next command-line argument,
    whatever it happens to be, and uses it as the -rpath-link target.

Fix this by passing -rpath-link only if we actually have a path we want.




More information about the All-commits mailing list