diff --git a/.clang.metadata b/.clang.metadata index 33bc102..a41b878 100644 --- a/.clang.metadata +++ b/.clang.metadata @@ -1,3 +1,3 @@ -cfaa4c4e89a45b604e6f3057f984d73365074727 SOURCES/clang-10.0.0.src.tar.xz -e41467d4e8c6afe917c9f9c44b1d6a95a85adadb SOURCES/clang-tools-extra-10.0.0.src.tar.xz +02c87f5e07f2a1c1e2dbb8ce8328f0106d70b10d SOURCES/clang-11.0.0.src.tar.xz +b77dc0494894b997c8f4012debbf0bf469462386 SOURCES/clang-tools-extra-11.0.0.src.tar.xz 32fa4b0193960f05064f2ab31b5a89c7cf48a0b9 SOURCES/hans-gpg-key.asc diff --git a/.gitignore b/.gitignore index 8c8f23b..5665b65 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -SOURCES/clang-10.0.0.src.tar.xz -SOURCES/clang-tools-extra-10.0.0.src.tar.xz +SOURCES/clang-11.0.0.src.tar.xz +SOURCES/clang-tools-extra-11.0.0.src.tar.xz SOURCES/hans-gpg-key.asc diff --git a/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch b/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch new file mode 100644 index 0000000..0050b40 --- /dev/null +++ b/SOURCES/0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch @@ -0,0 +1,132 @@ +From 67013ee5feecca0c1e1dd8a149b20779a9b6c12a Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Wed, 23 Sep 2020 12:47:30 +0000 +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. +--- + lib/Driver/ToolChains/Gnu.cpp | 16 ++++++++++++++-- + 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 + .../lib/gcc/x86_64-redhat-linux/7/libgcc_s.so | 0 + test/Driver/linux-ld.c | 12 ++++++++++++ + 6 files changed, 29 insertions(+), 3 deletions(-) + create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o + create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o + create mode 100644 test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so + +diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp +index c8a7fce0..f28792b7 100644 +--- a/lib/Driver/ToolChains/Gnu.cpp ++++ b/lib/Driver/ToolChains/Gnu.cpp +@@ -2500,6 +2500,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; +@@ -2517,8 +2519,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)) +@@ -2532,6 +2543,7 @@ void Generic_GCC::GCCInstallationDetector::ScanLibDirForGCCTriple( + GCCInstallPath = (LibDir + "/" + LibSuffix + "/" + VersionText).str(); + GCCParentLibPath = (GCCInstallPath + "/../" + Suffix.ReversePath).str(); + IsValid = true; ++ HasLibGccShared = CandidateHasLibGccShared; + } + } + } +diff --git a/lib/Driver/ToolChains/Gnu.h b/lib/Driver/ToolChains/Gnu.h +index 52690ab4..2a4452d9 100644 +--- a/lib/Driver/ToolChains/Gnu.h ++++ b/lib/Driver/ToolChains/Gnu.h +@@ -190,6 +190,7 @@ public: + /// Driver, and has logic for fuzzing that where appropriate. + class GCCInstallationDetector { + bool IsValid; ++ bool HasLibGccShared; + llvm::Triple GCCTriple; + const Driver &D; + +@@ -213,7 +214,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 ExtraTripleAliases = None); + +diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-linux-gnu/7/crtbegin.o +new file mode 100644 +index 00000000..e69de29b +diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/crtbegin.o +new file mode 100644 +index 00000000..e69de29b +diff --git a/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so b/test/Driver/Inputs/fedora_28_tree/usr/lib/gcc/x86_64-redhat-linux/7/libgcc_s.so +new file mode 100644 +index 00000000..e69de29b +diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c +index ec539522..95725d5c 100644 +--- a/test/Driver/linux-ld.c ++++ b/test/Driver/linux-ld.c +@@ -784,6 +784,18 @@ + // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtend.o" + // CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}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 -rtlib=platform \ + // RUN: --gcc-toolchain="" \ +-- +2.25.2 + diff --git a/SOURCES/0001-clang-Don-t-install-static-libraries.patch b/SOURCES/0001-clang-Don-t-install-static-libraries.patch index 4bf7d35..8c80dd3 100644 --- a/SOURCES/0001-clang-Don-t-install-static-libraries.patch +++ b/SOURCES/0001-clang-Don-t-install-static-libraries.patch @@ -1,4 +1,4 @@ -From 856b789b9de0895786ba23681c4337172676e01e Mon Sep 17 00:00:00 2001 +From 8097a9d4295dbc39cbd541ccace7bc5884852366 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 31 Jan 2020 11:04:57 -0800 Subject: [PATCH] clang: Don't install static libraries @@ -8,18 +8,18 @@ Subject: [PATCH] clang: Don't install static libraries 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake -index cbd618e..9cf076a 100644 +index 704278a0e93..1737b24a2bc 100644 --- a/clang/cmake/modules/AddClang.cmake +++ b/clang/cmake/modules/AddClang.cmake -@@ -97,7 +97,7 @@ macro(add_clang_library name) - if(TARGET ${name}) - target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS}) +@@ -111,7 +111,7 @@ macro(add_clang_library name) + if(TARGET ${lib}) + target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS}) -- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN) -+ if (ARG_SHARED AND (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)) - set(export_to_clangtargets) - if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR - "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR +- if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN) ++ if (ARG_SHARED AND (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)) + set(export_to_clangtargets) + if(${lib} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR + "clang-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR -- -1.8.3.1 +2.18.1 diff --git a/SOURCES/0001-clang-Fix-spurious-test-failure.patch b/SOURCES/0001-clang-Fix-spurious-test-failure.patch new file mode 100644 index 0000000..07c45b6 --- /dev/null +++ b/SOURCES/0001-clang-Fix-spurious-test-failure.patch @@ -0,0 +1,25 @@ +From 5bfce60443b1c3f4066f506e47cbdc7c4263bb10 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Tue, 11 Aug 2020 18:32:08 -0700 +Subject: [PATCH] clang: Fix spurious test failure + +--- + clang/test/Driver/crash-report-modules.m | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/clang/test/Driver/crash-report-modules.m b/clang/test/Driver/crash-report-modules.m +index e6d03353379..9519adf6f4b 100644 +--- a/clang/test/Driver/crash-report-modules.m ++++ b/clang/test/Driver/crash-report-modules.m +@@ -19,7 +19,7 @@ + @import simple; + const int x = MODULE_MACRO; + +-// CHECK: PLEASE submit a bug report to {{.*}} and include the crash backtrace, preprocessed source, and associated run script. ++// CHECK: PLEASE submit a bug report to {{.*}}and include the crash backtrace, preprocessed source, and associated run script. + // CHECK: Preprocessed source(s) and associated run script(s) are located at: + // CHECK-NEXT: note: diagnostic msg: {{.*}}.m + // CHECK-NEXT: note: diagnostic msg: {{.*}}.cache +-- +2.18.1 + diff --git a/SOURCES/clang-10.0.0.src.tar.xz.sig b/SOURCES/clang-10.0.0.src.tar.xz.sig deleted file mode 100644 index 1fd2d98..0000000 Binary files a/SOURCES/clang-10.0.0.src.tar.xz.sig and /dev/null differ diff --git a/SOURCES/clang-11.0.0.src.tar.xz.sig b/SOURCES/clang-11.0.0.src.tar.xz.sig new file mode 100644 index 0000000..b5378e0 Binary files /dev/null and b/SOURCES/clang-11.0.0.src.tar.xz.sig differ diff --git a/SOURCES/clang-tools-extra-10.0.0.src.tar.xz.sig b/SOURCES/clang-tools-extra-10.0.0.src.tar.xz.sig deleted file mode 100644 index 70b6c07..0000000 Binary files a/SOURCES/clang-tools-extra-10.0.0.src.tar.xz.sig and /dev/null differ diff --git a/SOURCES/clang-tools-extra-11.0.0.src.tar.xz.sig b/SOURCES/clang-tools-extra-11.0.0.src.tar.xz.sig new file mode 100644 index 0000000..5ff2b0a Binary files /dev/null and b/SOURCES/clang-tools-extra-11.0.0.src.tar.xz.sig differ diff --git a/SPECS/clang.spec b/SPECS/clang.spec index a9af51b..fa6c2e3 100644 --- a/SPECS/clang.spec +++ b/SPECS/clang.spec @@ -1,6 +1,6 @@ %global compat_build 0 -%global maj_ver 10 +%global maj_ver 11 %global min_ver 0 %global patch_ver 0 #%%global rc_ver 6 @@ -13,7 +13,6 @@ %{_bindir}/clang-doc \ %{_bindir}/clang-extdef-mapping \ %{_bindir}/clang-format \ - %{_bindir}/clang-import-test \ %{_bindir}/clang-include-fixer \ %{_bindir}/clang-move \ %{_bindir}/clang-offload-bundler \ @@ -62,10 +61,8 @@ %global build_install_prefix %{buildroot}%{install_prefix} -%ifarch ppc64le -# Too many threads on ppc64 systems causes OOM errors. +# Too many threads causes OOM errors. %global _smp_mflags -j8 -%endif %global clang_srcdir clang-%{version}%{?rc_ver:rc%{rc_ver}}.src %global clang_tools_srcdir clang-tools-extra-%{version}%{?rc_ver:rc%{rc_ver}}.src @@ -77,21 +74,11 @@ Summary: A C language family front-end for LLVM License: NCSA URL: http://llvm.org -%if 0%{?rc_ver:1} -Source0: https://prereleases.llvm.org/%{version}/rc%{rc_ver}/%{clang_srcdir}.tar.xz -Source3: https://prereleases.llvm.org/%{version}/rc%{rc_ver}/%{clang_srcdir}.tar.xz.sig -%else -Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{clang_srcdir}.tar.xz -Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{clang_srcdir}.tar.xz.sig -%endif +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz +Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz.sig %if !0%{?compat_build} -%if 0%{?rc_ver:1} -Source1: https://prereleases.llvm.org/%{version}/rc%{rc_ver}/%{clang_tools_srcdir}.tar.xz -Source2: https://prereleases.llvm.org/%{version}/rc%{rc_ver}/%{clang_tools_srcdir}.tar.xz.sig -%else -Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{clang_tools_srcdir}.tar.xz -Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{clang_tools_srcdir}.tar.xz.sig -%endif +Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz +Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig %endif Source4: https://prereleases.llvm.org/%{version}/hans-gpg-key.asc @@ -99,11 +86,10 @@ Patch4: 0002-gtest-reorg.patch Patch11: 0001-ToolChain-Add-lgcc_s-to-the-linker-flags-when-using-.patch Patch13: 0001-Make-funwind-tables-the-default-for-all-archs.patch -### Fix crash with kernel bpf self-tests -##Patch14: 0001-BPF-annotate-DIType-metadata-for-builtin-preseve_arr.patch - # Not Upstream Patch15: 0001-clang-Don-t-install-static-libraries.patch +Patch16: 0001-clang-Fix-spurious-test-failure.patch +Patch17: 0001-Driver-Prefer-gcc-toolchains-with-libgcc_s.so-when-n.patch BuildRequires: gcc BuildRequires: gcc-c++ @@ -144,7 +130,20 @@ BuildRequires: python3-devel # Needed for %%multilib_fix_c_header BuildRequires: multilib-rpm-config -BuildRequires: chrpath + +# scan-build uses these perl modules so they need to be installed in order +# to run the tests. +BuildRequires: perl(Digest::MD5) +BuildRequires: perl(File::Copy) +BuildRequires: perl(File::Find) +BuildRequires: perl(File::Path) +BuildRequires: perl(File::Temp) +BuildRequires: perl(FindBin) +BuildRequires: perl(Hash::Util) +BuildRequires: perl(lib) +BuildRequires: perl(Term::ANSIColor) +BuildRequires: perl(Text::ParseWords) +BuildRequires: perl(Sys::Hostname) Requires: %{name}-libs%{?_isa} = %{version}-%{release} @@ -154,8 +153,6 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release} Requires: libstdc++-devel Requires: gcc-c++ -Requires: emacs-filesystem - Provides: clang(major) = %{maj_ver} Conflicts: compiler-rt < %{version} @@ -256,9 +253,8 @@ pathfix.py -i %{__python3} -pn \ %patch11 -p1 -b .libcxx-fix %patch13 -p2 -b .unwind-all %patch15 -p2 -b .no-install-static - - -#%patch14 -p2 -b .bpf-fix +%patch16 -p2 -b .test-fix2 +%patch17 -p1 -b .check-gcc_s mv ../%{clang_tools_srcdir} tools/extra @@ -392,8 +388,20 @@ ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver} # Fix permission chmod u-x %{buildroot}%{_mandir}/man1/scan-build.1* +# create a link to clang's resource directory that is "constant" across minor +# version bumps +# this is required for packages like ccls that hardcode the link to clang's +# resource directory to not require rebuilds on minor version bumps +# Fix for bugs like rhbz#1807574 +pushd %{buildroot}%{_libdir}/clang/ +ln -s %{version} %{maj_ver} +popd + %endif +# Remove clang-tidy headers. We don't ship the libraries for these. +rm -Rvf %{buildroot}%{_includedir}/clang-tidy/ + %check %if !0%{?compat_build} # requires lit.py from LLVM utilities @@ -413,6 +421,7 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ninja check-all -C _build || \ %if !0%{?compat_build} %files +%license LICENSE.TXT %{clang_binaries} %{_mandir}/man1/clang.1.gz %{_mandir}/man1/clang++.1.gz @@ -476,8 +485,18 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ninja check-all -C _build || \ %files -n python3-clang %{python3_sitelib}/clang/ + %endif %changelog +* Thu Oct 29 2020 sguelton@redhat.com - 11.0.0-1 +- 11.0.0 final release + +* Thu Sep 17 2020 sguelton@redhat.com - 11.0.0-0.1.rc2 +- 11.0.0-rc2 Release + +* Fri Jul 24 2020 sguelton@redhat.com - 10.0.1-1 +- 10.0.1 release + * Thu Apr 9 2020 sguelton@redhat.com - 10.0.0-1 - 10.0.0 final