This revision was automatically updated to reflect the committed changes. Closed by commit rL336037: Driver: Don't mix system tools with devtoolset tools on RHEL (authored by tstellar, committed by ). Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D34848?vs=142294&id=153608#toc Repository: rL LLVM https://reviews.llvm.org/D34848 Files: cfe/trunk/lib/Driver/ToolChains/Linux.cpp cfe/trunk/test/Driver/linux-ld.c Index: cfe/trunk/test/Driver/linux-ld.c =================================================================== --- cfe/trunk/test/Driver/linux-ld.c +++ cfe/trunk/test/Driver/linux-ld.c @@ -1782,3 +1782,12 @@ // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" // CHECK-LD-GENTOO-X32: "-lc" // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \ +// RUN: --sysroot=%S/Inputs/rhel_7_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-RHEL7-DTS %s +// CHECK-LD-RHEL7-DTS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-RHLE7-DTS: Selected GCC installation: [[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]] +// CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld +// CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld Index: cfe/trunk/lib/Driver/ToolChains/Linux.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/Linux.cpp +++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp @@ -238,6 +238,15 @@ ExtraOpts.push_back("relro"); } + if (GCCInstallation.getParentLibPath().find("opt/rh/devtoolset") != + StringRef::npos) + // With devtoolset on RHEL, we want to add a bin directory that is relative + // to the detected gcc install, because if we are using devtoolset gcc then + // we want to use other tools from devtoolset (e.g. ld) instead of the + // standard system tools. + PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + + "/../bin").str()); + if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) ExtraOpts.push_back("-X");
Index: cfe/trunk/test/Driver/linux-ld.c =================================================================== --- cfe/trunk/test/Driver/linux-ld.c +++ cfe/trunk/test/Driver/linux-ld.c @@ -1782,3 +1782,12 @@ // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" // CHECK-LD-GENTOO-X32: "-lc" // CHECK-LD-GENTOO-X32: "-lgcc" "--as-needed" "-lgcc_s" "--no-as-needed" + +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --gcc-toolchain="%S/Inputs/rhel_7_tree/opt/rh/devtoolset-7/root/usr" \ +// RUN: --sysroot=%S/Inputs/rhel_7_tree \ +// RUN: | FileCheck --check-prefix=CHECK-LD-RHEL7-DTS %s +// CHECK-LD-RHEL7-DTS: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-LD-RHLE7-DTS: Selected GCC installation: [[GCC_INSTALL:[[SYSROOT]]/lib/gcc/x86_64-redhat-linux/7]] +// CHECK-LD-RHEL7-DTS-NOT: /usr/bin/ld +// CHECK-LD-RHLE7-DTS: [[GCC_INSTALL]/../../../bin/ld Index: cfe/trunk/lib/Driver/ToolChains/Linux.cpp =================================================================== --- cfe/trunk/lib/Driver/ToolChains/Linux.cpp +++ cfe/trunk/lib/Driver/ToolChains/Linux.cpp @@ -238,6 +238,15 @@ ExtraOpts.push_back("relro"); } + if (GCCInstallation.getParentLibPath().find("opt/rh/devtoolset") != + StringRef::npos) + // With devtoolset on RHEL, we want to add a bin directory that is relative + // to the detected gcc install, because if we are using devtoolset gcc then + // we want to use other tools from devtoolset (e.g. ld) instead of the + // standard system tools. + PPaths.push_back(Twine(GCCInstallation.getParentLibPath() + + "/../bin").str()); + if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb) ExtraOpts.push_back("-X");
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits