[libcxx-commits] [PATCH] D81190: [libc++] Link against libatomic when it is found

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 22 09:42:00 PDT 2021


ldionne added a comment.

In D81190#2587483 <https://reviews.llvm.org/D81190#2587483>, @loic.yhuel wrote:

> On which platform does this commit work ?
>
> On Linux, the test program would still need an explicit `-latomic`, since indirect dependencies are not used to resolve undefined symbols from the program.
> For this to work, it would need `PUBLIC atomic` instead of `PRIVATE atomic`, so that `libcxx/cmake/Modules/DefineLinkerScript.cmake` would add it to the linker script (`libc++.so`).
> It would be even better with `AS_NEEDED` in the linker script, and `-Wl,--as-needed` for the lib, in order to only load the library when it is actually used.

Does this commit not work on your system? It has been working on our Linux bots since it was committed.

Regarding adding `-latomic` to the linker script, I don't know that we actually want to do that. I think the Clang driver should probably be the one to pass the correct `-latomic` or `-l<library-for-builtins>` depending on what builtin library we're using.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81190



More information about the libcxx-commits mailing list