Compare commits

...

8 Commits

Author SHA1 Message Date
David Abdurachmanov 3aa5bc2f58
Fix how riscv64 backports are applied
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2020-03-31 20:54:55 +03:00
David Abdurachmanov 7d6179247e
Backport upstream patches (riscv64
- Add riscv64 redhat triplet
- Fix atomic check

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2020-03-31 20:42:18 +03:00
David Abdurachmanov adef55cfd9
Remove obsolete patches
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2020-03-31 20:28:50 +03:00
David Abdurachmanov 98f194dc4a
Merge remote-tracking branch 'up/master' into master-riscv64
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2020-03-31 20:28:14 +03:00
David Abdurachmanov db7bd1baa9
Add -latomic to LDFLAGS
We failed to link due to missing -latomic

/usr/bin/ld: tools/extra/clangd/CMakeFiles/obj.clangDaemon.dir/ClangdLSPServer.cpp.o: in function `std::__atomic_base<bool>::exchange(bool, std::memory_order)':
/usr/include/llvm/Support/FormatVariadic.h:148: undefined reference to `__atomic_exchange_1'

Again -lpthread not -pthread used.

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-26 16:54:12 -07:00
David Abdurachmanov 37e90d4cf7
Add missing patch
This patch seems to be: https://reviews.llvm.org/D66176

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-25 12:41:30 -07:00
David Abdurachmanov 7779f53776
Add support for RISC-V (riscv64)
Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-24 08:04:38 -07:00
David Abdurachmanov 1ffa649c13
Rebase to Clang 9.0.0 RC2
Changes imported from:

https://src.fedoraproject.org/rpms/clang/pull-request/39

Signed-off-by: David Abdurachmanov <david.abdurachmanov@sifive.com>
2019-08-24 08:02:08 -07:00
3 changed files with 137 additions and 4 deletions

View File

@ -0,0 +1,39 @@
From 1d40c4150630729a9c1ce5119a8027dac93a5b2d Mon Sep 17 00:00:00 2001
From: Gokturk Yuksek <gokturk@binghamton.edu>
Date: Fri, 14 Feb 2020 14:12:45 +0000
Subject: [PATCH] [clang-tools-extra] fix the check for if '-latomic' is
necessary
Summary:
The CheckAtomic module performs two tests to determine if passing
'-latomic' to the linker is required: one for 64-bit atomics, and
another for non-64-bit atomics. clangd only uses the result from
HAVE_CXX_ATOMICS64_WITHOUT_LIB. This is incomplete because there are
uses of non-64-bit atomics in the code, such as the ReplyOnce::Replied
of type std::atomic<bool> defined in clangd/ClangdLSPServer.cpp.
Fix by also checking for the result of HAVE_CXX_ATOMICS_WITHOUT_LIB.
See also: https://reviews.llvm.org/D68964
Reviewers: ilya-biryukov, nridge, kadircet, beanz, compnerd, luismarques
Reviewed By: luismarques
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69869
---
clang-tools-extra/clangd/CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt
index e3eccb50a496..fc5a07e69e9d 100644
--- a/clang-tools-extra/clangd/CMakeLists.txt
+++ b/clang-tools-extra/clangd/CMakeLists.txt
@@ -30,7 +30,7 @@ if(CLANG_BUILT_STANDALONE)
endif()
set(CLANGD_ATOMIC_LIB "")
-if(NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
+if(NOT HAVE_CXX_ATOMICS_WITHOUT_LIB OR NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB)
list(APPEND CLANGD_ATOMIC_LIB "atomic")
endif()

View File

@ -0,0 +1,82 @@
From 9816e726e747d72e0c5ac92aa20e652031a10448 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lu=C3=ADs=20Marques?= <luismarques@lowrisc.org>
Date: Fri, 14 Feb 2020 13:44:42 +0000
Subject: [PATCH] [Driver][RISCV] Add RedHat Linux RISC-V triple
Summary: Adds the RedHat Linux triple to the list of 64-bit RISC-V triples.
Without this the gcc libraries wouldn't be found by clang on a redhat/fedora
system, as the search list included `/usr/lib/gcc/riscv64-redhat-linux-gnu`
but the correct path didn't include the `-gnu` suffix.
Reviewers: lenary, asb, dlj
Reviewed By: lenary
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74399
---
clang/lib/Driver/ToolChains/Gnu.cpp | 1 +
.../usr/lib/gcc/riscv64-redhat-linux/9/crtbegin.o | 0
.../usr/lib/gcc/riscv64-redhat-linux/9/crtend.o | 0
.../usr/lib/gcc/riscv64-redhat-linux/9/crti.o | 0
.../usr/lib/gcc/riscv64-redhat-linux/9/crtn.o | 0
.../fedora_31_riscv64_tree/usr/lib64/crt1.o | 0
clang/test/Driver/linux-ld.c | 15 +++++++++++++++
7 files changed, 16 insertions(+)
create mode 100644 clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtbegin.o
create mode 100644 clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtend.o
create mode 100644 clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crti.o
create mode 100644 clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtn.o
create mode 100644 clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crt1.o
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index bc67a7e0cdf9..dadbfa288a03 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2090,6 +2090,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
"riscv64-linux-gnu",
"riscv64-unknown-elf",
+ "riscv64-redhat-linux",
"riscv64-suse-linux"};
static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
diff --git a/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtbegin.o b/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtbegin.o
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtend.o b/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtend.o
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crti.o b/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crti.o
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtn.o b/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib/gcc/riscv64-redhat-linux/9/crtn.o
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crt1.o b/clang/test/Driver/Inputs/fedora_31_riscv64_tree/usr/lib64/crt1.o
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/clang/test/Driver/linux-ld.c b/clang/test/Driver/linux-ld.c
index 51227550b528..ec539522c25d 100644
--- a/clang/test/Driver/linux-ld.c
+++ b/clang/test/Driver/linux-ld.c
@@ -769,6 +769,21 @@
// 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 Fedora 31 on riscv64.
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
+// RUN: --target=riscv64-redhat-linux -rtlib=platform \
+// RUN: --gcc-toolchain="" \
+// RUN: --sysroot=%S/Inputs/fedora_31_riscv64_tree \
+// RUN: | FileCheck --check-prefix=CHECK-FEDORA-31-RISCV64 %s
+// CHECK-FEDORA-31-RISCV64: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64{{/|\\\\}}crt1.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crti.o"
+// CHECK-FEDORA-31-RISCV64: "{{.*}}/usr/lib/gcc/riscv64-redhat-linux/9{{/|\\\\}}crtbegin.o"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9"
+// CHECK-FEDORA-31-RISCV64: "-L[[SYSROOT]]/usr/lib/gcc/riscv64-redhat-linux/9/../../../../lib64"
+// 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"
+//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: --target=arm-unknown-linux-gnueabi -rtlib=platform \
// RUN: --gcc-toolchain="" \

View File

@ -72,7 +72,7 @@
Name: %pkg_name
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}%{?dist}
Release: %{baserelease}%{?rc_ver:.rc%{rc_ver}}.0.riscv64%{?dist}
Summary: A C language family front-end for LLVM
License: NCSA
@ -99,6 +99,9 @@ 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
Patch6: D69869-1d40c4150630729a9c1ce5119a8027dac93a5b2d.patch
Patch7: D74399-9816e726e747d72e0c5ac92aa20e652031a10448.patch
# Not Upstream
Patch15: 0001-clang-Don-t-install-static-libraries.patch
@ -252,8 +255,14 @@ pathfix.py -i %{__python3} -pn \
%patch13 -p2 -b .unwind-all
%patch15 -p2 -b .no-install-static
%patch7 -p2 -b .riscv64-redhat-triplet
mv ../%{clang_tools_srcdir} tools/extra
pushd tools/extra
%patch6 -p2 -b .fix-atomic-check
popd
pathfix.py -i %{__python3} -pn \
tools/clang-format/*.py \
tools/clang-format/git-clang-format \
@ -272,7 +281,7 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
mkdir -p _build
cd _build
%ifarch s390 s390x %{arm} %ix86 ppc64le
%ifarch s390 s390x %{arm} %ix86 ppc64le riscv64
# Decrease debuginfo verbosity to reduce memory consumption during final library linking
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif
@ -287,7 +296,7 @@ cd _build
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPYTHON_EXECUTABLE=%{__python3} \
-DCMAKE_INSTALL_RPATH:BOOL=";" \
%ifarch s390 s390x %{arm} %ix86 ppc64le
%ifarch s390 s390x %{arm} %ix86 ppc64le riscv64
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
%endif
@ -392,7 +401,7 @@ chmod u-x %{buildroot}%{_mandir}/man1/scan-build.1*
# FIXME: Fix failing ARM tests, s390x i686 and ppc64le tests
# FIXME: Ignore test failures until rhbz#1715016 is fixed.
LD_LIBRARY_PATH=%{buildroot}%{_libdir} ninja check-all -C _build || \
%ifarch s390x i686 ppc64le %{arm}
%ifarch s390x i686 ppc64le %{arm} riscv64
:
%else
:
@ -469,6 +478,9 @@ LD_LIBRARY_PATH=%{buildroot}%{_libdir} ninja check-all -C _build || \
%endif
%changelog
* Tue Mar 31 2020 David Abdurachmanov <david.abdurachmanov@sifive.com> - 10.0.0-1.0.riscv64
- Add support for RISC-V (riscv64)
* Thu Mar 26 2020 sguelton@redhat.com - 10.0.0-1
- 10.0.0 final