The package rpms/clang.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/clang.git/commit/?id=d6ec18079c5c....
Change:
+%ifarch s390 s390x %{arm} %ix86 ppc64le
Thanks.
Full change:
============
commit 8de8874e619c30bc465e7306af45c8b2f21e74e5
Author: Tom Stellard <tstellar(a)redhat.com>
Date: Sat Sep 7 04:20:00 2019 +0000
Fix gcc detection when cross-compiler is installed
Fixes rhbz#1749971
diff --git a/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch
b/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch
new file mode 100644
index 0000000..a93b1b6
--- /dev/null
+++ b/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch
@@ -0,0 +1,132 @@
+From dcd2244fa2db0acc9d8e43d251ec33f1224f7bcf Mon Sep 17 00:00:00 2001
+From: Tom Stellard <tstellar(a)redhat.com>
+Date: Fri, 6 Sep 2019 20:35:06 -0700
+Subject: [PATCH] Driver: Prefer gcc toolchains with libgcc_s.so when not
+ static linking libgcc
+
+Fedora ships cross-compilers on all platforms, so a user could end up
+with a gcc x86_64 cross-compiler installed on an x86_64 system. clang
+maintains a list of supported triples for each target and when all
+else is equal will prefer toolchains with triples that appear earlier
+in the list.
+
+The cross-compiler triple on Fedora is x86_64-linux-gnu and this comes
+before the Fedora system compiler's triple: x86_64-redhat-linux in
+the triples list, so the cross compiler is always preferred. This
+is a problem, because the cross compiler is missing libraries, like
+libgcc_s.so, that clang expects to be there so linker invocations
+will fail.
+
+This patch fixes this by checking for the existence of libgcc_s.so
+when it is required and taking that into account when selecting a
+toolchain.
+---
+ clang/lib/Driver/ToolChains/Gnu.cpp | 16 ++++++++++++++--
+ clang/lib/Driver/ToolChains/Gnu.h | 4 +++-
+ .../usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o | 0
+ .../usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o | 0
+ .../usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so | 0
+ clang/test/Driver/linux-ld.c | 12 ++++++++++++
+ 6 files changed, 29 insertions(+), 3 deletions(-)
+ create mode 100644
clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o
+ create mode 100644
clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o
+ create mode 100644
clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so
+
+diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
+index 2ad4509..0306828 100644
+--- a/clang/lib/Driver/ToolChains/Gnu.cpp
++++ b/clang/lib/Driver/ToolChains/Gnu.cpp
+@@ -2299,6 +2299,8 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
+ (TargetArch == llvm::Triple::x86 &&
+ TargetTriple.getOS() != llvm::Triple::Solaris)}};
+
++ bool NeedLibgccShared = !Args.hasArg(options::OPT_static_libgcc) &&
++ !Args.hasArg(options::OPT_static);
+ for (auto &Suffix : Suffixes) {
+ if (!Suffix.Active)
+ continue;
+@@ -2316,8 +2318,17 @@ void
Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
+ continue; // Saw this path before; no need to look at it again.
+ if (CandidateVersion.isOlderThan(4, 1, 1))
+ continue;
+- if (CandidateVersion <= Version)
+- continue;
++
++ bool CandidateHasLibGccShared = false;
++ if (CandidateVersion <= Version) {
++ if (NeedLibgccShared && !HasLibGccShared) {
++ CandidateHasLibGccShared =
++ D.getVFS().exists(LI->path() + "/libgcc_s.so");
++
++ }
++ if (HasLibGccShared || !CandidateHasLibGccShared)
++ continue;
++ }
+
+ if (!ScanGCCForMultilibs(TargetTriple, Args, LI->path(),
+ NeedsBiarchSuffix))
+@@ -2331,6 +2342,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple(
+ GCCInstallPath = (LibDir + "/" + LibSuffix + "/" +
VersionText).str();
+ GCCParentLibPath = (GCCInstallPath + "/../" +
Suffix.ReversePath).str();
+ IsValid = true;
++ HasLibGccShared = CandidateHasLibGccShared;
+ }
+ }
+ }
+diff --git a/clang/lib/Driver/ToolChains/Gnu.h b/clang/lib/Driver/ToolChains/Gnu.h
+index e8e74e4..e9c598d 100644
+--- a/clang/lib/Driver/ToolChains/Gnu.h
++++ b/clang/lib/Driver/ToolChains/Gnu.h
+@@ -186,6 +186,7 @@ public:
+ /// Driver, and has logic for fuzzing that where appropriate.
+ class GCCInstallationDetector {
+ bool IsValid;
++ bool HasLibGccShared;
+ llvm::Triple GCCTriple;
+ const Driver &D;
+
+@@ -209,7 +210,8 @@ public:
+ MultilibSet Multilibs;
+
+ public:
+- explicit GCCInstallationDetector(const Driver &D) : IsValid(false), D(D) {}
++ explicit GCCInstallationDetector(const Driver &D)
++ : IsValid(false), HasLibGccShared(false), D(D) {}
+ void init(const llvm::Triple &TargetTriple, const llvm::opt::ArgList &Args,
+ ArrayRef<std::string> ExtraTripleAliases = None);
+
+diff --git
a/clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o
b/clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o
+new file mode 100644
+index 0000000..e69de29
+diff --git
a/clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o
b/clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o
+new file mode 100644
+index 0000000..e69de29
+diff --git
a/clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so
b/clang/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so
+new file mode 100644
+index 0000000..e69de29
+diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
+index 3ab81be..45a56bc 100644
+--- a/clang/test/Driver/linux-ld.c
++++ b/clang/test/Driver/linux-ld.c
+@@ -712,6 +712,18 @@
+ // CHECK-FEDORA-21-AARCH64:
"{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0{{/|\\\\}}crtend.o"
+ // CHECK-FEDORA-21-AARCH64:
"{{.*}}/usr/lib/gcc/aarch64-redhat-linux/4.9.0/../../../../lib64{{/|\\\\}}crtn.o"
+ //
++// Check that clang does not select the cross compiler by default on Fedora 28.
++//
++// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
++// RUN: --target=x86_64-unknown-linux-gnu \
++// RUN: --gcc-toolchain="" \
++// RUN: --sysroot=%S/Inputs/fedora_28_tree \
++// RUN: | FileCheck --check-prefix=CHECK-FEDORA-28-X86_64 %s
++//
++// CHECK-FEDORA-28-X86_64: "{{.*}}ld{{(.exe)?}}"
"--sysroot=[[SYSROOT:[^"]+]]"
++// CHECK-FEDORA-28-X86_64:
"[[SYSROOT]]/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o"
++// CHECK-FEDORA-28-X86_64: "-L[[SYSROOT]]/usr/lib/gcc/x86_64-redhat-linux/7"
++//
+ // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+ // RUN: --target=arm-unknown-linux-gnueabi \
+ // RUN: --gcc-toolchain="" \
+--
+1.8.3.1
+
diff --git a/clang.spec b/clang.spec
index c4437cc..c3dea9e 100644
--- a/clang.spec
+++ b/clang.spec
@@ -61,7 +61,7 @@
Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
-Release: 2%{?rc_ver:.rc%{rc_ver}}%{?dist}
+Release: 3%{?rc_ver:.rc%{rc_ver}}%{?dist}
Summary: A C language family front-end for LLVM
License: NCSA
@@ -75,6 +75,7 @@ Patch4: 0002-gtest-reorg.patch
Patch9: 0001-Fix-uninitialized-value-in-ABIArgInfo.patch
Patch10: 0001-Workaround-GCC-9-bug-when-handling-bitfields.patch
Patch11: 0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch
+Patch12: 0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@@ -218,6 +219,7 @@ pathfix.py -i %{__python3} -pn \
%patch9 -p1 -b .abi-arginfo
%patch10 -p1 -b .bitfields
%patch11 -p1 -b .libcxx-fix
+%patch12 -p2 -b .gcc-detection
mv ../%{clang_tools_srcdir} tools/extra
@@ -424,6 +426,9 @@ false
%endif
%changelog
+* Tue Sep 24 2019 Tom Stellard <tstellar(a)redhat.com> - 8.0.0-3
+- Fix gcc detection when cross-compiler is installed
+
* Wed Sep 11 2019 Tom Stellard <tstellar(a)redhat.com> - 8.0.0-2
- Reduce debug info verbosity on ppc64le to avoid OOM errors in koji
commit d6ec18079c5c21931c12d9dd8bbb750b89f7095e
Author: Tom Stellard <tstellar(a)redhat.com>
Date: Wed Sep 11 19:58:15 2019 +0000
Reduce debug info verbosity on ppc64le to avoid OOM errors in koji
diff --git a/clang.spec b/clang.spec
index c6276bd..c4437cc 100644
--- a/clang.spec
+++ b/clang.spec
@@ -61,7 +61,7 @@
Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
-Release: 1%{?rc_ver:.rc%{rc_ver}}%{?dist}
+Release: 2%{?rc_ver:.rc%{rc_ver}}%{?dist}
Summary: A C language family front-end for LLVM
License: NCSA
@@ -239,7 +239,7 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
mkdir -p _build
cd _build
-%ifarch s390 s390x %{arm} %ix86
+%ifarch s390 s390x %{arm} %ix86 ppc64le
# Decrease debuginfo verbosity to reduce memory consumption during final library linking
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif
@@ -251,6 +251,10 @@ cd _build
-DPYTHON_EXECUTABLE=%{__python3} \
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DCMAKE_INSTALL_RPATH:BOOL=OFF \
+%ifarch s390 s390x %{arm} %ix86 ppc64le
+ -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
+ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
+%endif
%if 0%{?compat_build}
-DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}.%{min_ver}-%{__isa_bits} \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
@@ -420,6 +424,9 @@ false
%endif
%changelog
+* Wed Sep 11 2019 Tom Stellard <tstellar(a)redhat.com> - 8.0.0-2
+- Reduce debug info verbosity on ppc64le to avoid OOM errors in koji
+
* Wed Mar 20 2019 sguelton(a)redhat.com - 8.0.0-1
- 8.0.0 final