Set rpath on openmp executables
authorJon Chesterfield <jonathanchesterfield@gmail.com>
Mon, 31 Jan 2022 16:01:04 +0000 (16:01 +0000)
committerJon Chesterfield <jonathanchesterfield@gmail.com>
Mon, 31 Jan 2022 16:01:08 +0000 (16:01 +0000)
commita80d5c34e4b99f21fa371160ac7eb7e9db093997
tree13ea2435bba905f60bb8c567d6d14762f7251e60
parent6d22f0497531e981d03e1705705c635936d2e4a5
Set rpath on openmp executables

Openmp executables need to find libomp and libomptarget at runtime.
This currently requires LD_LIBRARY_PATH or the user to specify rpath. Change
that to set the expected location of the openmp libraries in the install tree.

Whether rpath means rpath or runpath is system dependent. The attached test
shows that the Wl,--disable-new-dtags control interacts correctly with this feature.

The implicit rpath field is appended to any user specified ones which is ideal.

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D118493
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/lib/Driver/ToolChains/CommonArgs.h
clang/test/OpenMP/Inputs/libomp.a [new file with mode: 0644]
clang/test/OpenMP/implicit_rpath.c [new file with mode: 0644]
openmp/libomptarget/test/lit.cfg