[PATCH] D119590: exclude openembedded distributions from setting rpath on openmp executables

Khem Raj via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 11 13:31:36 PST 2022

raj.khem created this revision.
raj.khem added reviewers: jhuber6, JonChesterfield.
Herald added subscribers: guansong, yaxunl.
raj.khem requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: cfe-commits, sstefan1.
Herald added a project: clang.

OpenEmbedded based SDKs stage toolchains outsides the target rootfs and
libomp.so is part of the target rootfs and not part of compiler
toolchain install or relative to it. It finds the libraries via
--sysroot during compile. This ensures that -rpath is not added for such
systems, since it is adding cross-compile paths to rpath which is not
correct when the binaries are run on real targets.

  rG LLVM Github Monorepo



Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -648,6 +648,11 @@
 void tools::addOpenMPRuntimeSpecificRPath(const ToolChain &TC,
                                           const ArgList &Args,
                                           ArgStringList &CmdArgs) {
+  // OpenEmbedded/Yocto installs libomp.so into <sysroot>/usr/lib
+  // therefore using -rpath is not needed, on the contrary it adds
+  // paths from cross compiler install location which is not correct
+  if (TC.getTriple().getVendor() == llvm::Triple::OpenEmbedded)
+    return;
   if (Args.hasFlag(options::OPT_fopenmp_implicit_rpath,
                    options::OPT_fno_openmp_implicit_rpath, true)) {

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119590.407996.patch
Type: text/x-patch
Size: 841 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220211/a98f7dcf/attachment.bin>

More information about the cfe-commits mailing list