Use ld from gcc-toolset

Resolves: rhbz#2209283
This commit is contained in:
Nikita Popov 2023-05-25 16:06:30 +02:00
parent 5e3b48c191
commit 47aa2a71fc
2 changed files with 46 additions and 1 deletions

View File

@ -0,0 +1,41 @@
From 73d3b4047d757ef35850e2cef38285b96be82f0f Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Tue, 23 May 2023 12:17:29 +0200
Subject: [PATCH] [Driver] Give devtoolset path precedence over InstalledDir
This is a followup to the change from c5fe10f365247c3dd9416b7ec8bad73a60b5946e.
While that commit correctly adds the bindir from devtoolset to the
path, the driver dir / install dir still comes first. This means
we'll still end up picking /usr/bin/ld rather than the one from
devtoolset.
Unfortunately, I don't see any way to test this. In the environment
the tests are run, this would only result in a behavior difference
if there is an ld binary present in the LLVM build directory, which
isn't the case.
Differential Revision: https://reviews.llvm.org/D151203
---
clang/lib/Driver/ToolChains/Linux.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 853ff99d9fe5..aecabb46d4b9 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -244,9 +244,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
// 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());
+ // standard system tools. This should take precedence over InstalledDir.
+ PPaths.insert(PPaths.begin(),
+ Twine(GCCInstallation.getParentLibPath() + "/../bin").str());
if (Arch == llvm::Triple::arm || Arch == llvm::Triple::thumb)
ExtraOpts.push_back("-X");
--
2.40.1

View File

@ -45,7 +45,7 @@
Name: %pkg_name
Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A C language family front-end for LLVM
License: Apache-2.0 WITH LLVM-exception OR NCSA
@ -90,6 +90,7 @@ Patch11: 0001-Change-LLVM_COMMON_CMAKE_UTILS-usage.patch
# RHEL specific patch
Patch12: 0009-disable-recommonmark.patch
Patch13: 0001-Driver-Give-devtoolset-path-precedence-over-Installe.patch
%if %{without compat_build}
# Patches for clang-tools-extra
@ -677,6 +678,9 @@ mv ./libclang-cpp.so.%{compat_maj_ver} "$compat_lib"
%endif
%changelog
* Thu May 25 2023 Nikita Popov <npopov@redhat.com> - 16.0.1-3
- Use ld from gcc-toolset
* Tue Apr 18 2023 Nikita Popov <npopov@redhat.com> - 16.0.1-2
- Restore use of gcc-toolset-12