[PATCH] D143306: [Driver] Default to -fno-openmp-implicit-rpath
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 22 11:34:41 PST 2023
MaskRay added a comment.
In D143306#4144396 <https://reviews.llvm.org/D143306#4144396>, @JonChesterfield wrote:
> So what is this configuration file? Joseph found a Gentoo blog post https://blogs.gentoo.org/mgorny/2022/10/07/clang-in-gentoo-now-sets-default-runtimes-via-config-file/ and I don't have a clang.cfg file in my install dir
`clang.cfg` is not provided by default. You can create it for your needs. The official doc is https://clang.llvm.org/docs/UsersManual.html#configuration-files
> Tests in clang look like it's a text file that you write command line flags into and hopefully clang applies them, so if we write `-Wl, rpath` etc in that text file and successfully distribute it to users, it'll behave identically to setting rpath from clang and fedora will still be unhappy (I don't see how to scope a flag to only -fopenmp, so it might set rpath on every executable clang builds instead of only openmp ones, which will break some applications and fail the rpm build check on all of them)
>
> I don't see how this helps anything?
It's different. With the current status quo, `-fopenmp-implicit-rpath` is the default and affects all distributions which include users adverse to magic `DT_RUNPATH` tags.
If you specify `-Wl,-rpath=...` in your build (possibly HPC related), it just affects your system, and Fedora and others (like I) won't complain.
`clang -fuse-ld=lld -fopenmp=libgomp -fno-openmp-implicit-rpath a.c -o a`
> I'm trying to work out how this works for libc++ and the like and as far as I can see it doesn't - I think the binaries I've built go looking for libc++ in the system libraries and totally ignore the one built as part of the toolchain. I never noticed this because I statically link everything, am I missing something here?
This is the point. Specifying a driver option to use libc++/libc++abi/libunwind doesn't magically change `DT_RUNPATH`. This is exactly the behavior a user wants for a system Clang.
It does make users with a non-system Clang inconvenient but that's the point that such users should specify rpath by themselves.
openmp should not diverge from libc++/libc++abi/libunwind in this regard.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143306/new/
https://reviews.llvm.org/D143306
More information about the cfe-commits
mailing list