Compare commits

...

3 Commits

Author SHA1 Message Date
4b68896ed6
Add support for riscv64
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2024-12-21 20:10:27 +02:00
Tom Stellard
c813fe2a69 Add symbol versions to libclang-cpp.so
This should help fix issues with applications loading two different
versions of the library.
2024-10-03 06:06:16 +00:00
Fedora Release Engineering
ac6fc67782 Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild 2024-07-17 19:23:49 +00:00
3 changed files with 87 additions and 6 deletions

View File

@ -0,0 +1,39 @@
From 59673ed97d92df34d6f662da5a51f6e28806b5af Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Thu, 26 Sep 2024 13:53:18 +0000
Subject: [PATCH] [clang-shlib] Add symbol versioning to all symbols
We do the same thing for libLLVM.so. This should help avoid issues
when an applications loads two different versions of the library at
the same time.
---
clang/tools/clang-shlib/CMakeLists.txt | 7 +++++++
clang/tools/clang-shlib/simple_version_script.map.in | 1 +
2 files changed, 8 insertions(+)
create mode 100644 clang/tools/clang-shlib/simple_version_script.map.in
diff --git a/clang/tools/clang-shlib/CMakeLists.txt b/clang/tools/clang-shlib/CMakeLists.txt
index 298d3a9d18fe..004ce2897960 100644
--- a/clang/tools/clang-shlib/CMakeLists.txt
+++ b/clang/tools/clang-shlib/CMakeLists.txt
@@ -61,3 +61,10 @@ if (MINGW OR CYGWIN)
# make sure we export all symbols despite potential dllexports.
target_link_options(clang-cpp PRIVATE LINKER:--export-all-symbols)
endif()
+
+# Solaris ld does not accept global: *; so there is no way to version *all* global symbols
+if (NOT LLVM_LINKER_IS_SOLARISLD AND NOT MINGW)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/simple_version_script.map.in
+ ${CMAKE_CURRENT_BINARY_DIR}/simple_version_script.map)
+ target_link_options(clang-cpp PRIVATE -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/simple_version_script.map)
+endif()
diff --git a/clang/tools/clang-shlib/simple_version_script.map.in b/clang/tools/clang-shlib/simple_version_script.map.in
new file mode 100644
index 000000000000..cb2306d1f596
--- /dev/null
+++ b/clang/tools/clang-shlib/simple_version_script.map.in
@@ -0,0 +1 @@
+@LLVM_SHLIB_SYMBOL_VERSION@ { global: *; };
--
2.46.0

View File

@ -0,0 +1,23 @@
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 4325cbb4..86ae0f21 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -2065,6 +2065,7 @@ static llvm::StringRef getGCCToolchainDir(const ArgList &Args,
/// triple.
static const char *ConvertToGccTriple(StringRef CandidateTriple) {
return llvm::StringSwitch<const char *>(CandidateTriple)
+ .Case("riscv64-redhat-linux-gnu", "riscv64-redhat-linux")
.Case("aarch64-redhat-linux-gnu", "aarch64-redhat-linux")
.Case("i686-redhat-linux-gnu", "i686-redhat-linux")
.Case("ppc64le-redhat-linux-gnu", "ppc64le-redhat-linux")
@@ -2426,7 +2427,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"};
static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
"riscv64-linux-gnu",
- "riscv64-unknown-elf"};
+ "riscv64-unknown-elf",
+ "riscv64-redhat-linux-gnu",
+ "riscv64-redhat-linux"};
static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",

View File

@ -67,7 +67,7 @@
Name: %pkg_name
Version: %{clang_version}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
Release: 7%{?dist}
Release: 9.0.riscv64%{?dist}
Summary: A C language family front-end for LLVM
License: Apache-2.0 WITH LLVM-exception OR NCSA
@ -104,7 +104,11 @@ Patch6: cfg.patch
Patch7: tsa.patch
Patch8: 0001-Clang-Fix-build-with-GCC-14-on-ARM.patch
Patch9: 0001-Clang-Defer-the-instantiation-of-explicit-specifier-.patch
# https://github.com/llvm/llvm-project/pull/110758
Patch10: 0001-clang-shlib-Add-symbol-versioning-to-all-symbols.patch
# RISCV (riscv64)
Patch20: clang-fedora-riscv64.patch
# RHEL specific patches
# Avoid unwanted dependency on python-recommonmark
@ -335,7 +339,7 @@ rm test/CodeGen/profile-filter.c
%build
# And disable LTO on AArch64 entirely.
%ifarch aarch64
%ifarch aarch64 riscv64
%define _lto_cflags %{nil}
%endif
@ -344,13 +348,13 @@ rm test/CodeGen/profile-filter.c
%global _lto_cflags %nil
%endif
%ifarch s390 s390x aarch64 %ix86 ppc64le
%ifarch s390 s390x aarch64 %ix86 ppc64le riscv64
# Decrease debuginfo verbosity to reduce memory consumption during final library linking
%global optflags %(echo %{optflags} | sed 's/-g /-g1 /')
%endif
# Disable dwz on aarch64, because it takes a huge amount of time to decide not to optimize things.
%ifarch aarch64
%ifarch aarch64 riscv64
%define _find_debuginfo_dwz_opts %{nil}
%endif
@ -366,7 +370,7 @@ rm test/CodeGen/profile-filter.c
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DPYTHON_EXECUTABLE=%{__python3} \
-DCMAKE_SKIP_RPATH:BOOL=ON \
%ifarch s390 s390x %ix86 ppc64le
%ifarch s390 s390x %ix86 ppc64le riscv64
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
%endif
@ -411,6 +415,7 @@ rm test/CodeGen/profile-filter.c
\
-DCLANG_BUILD_EXAMPLES:BOOL=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_SHLIB_SYMBOL_VERSION=LLVM_%{maj_ver} \
-DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \
%if %{with compat_build}
-DCLANG_RESOURCE_DIR=../../../lib/clang/%{maj_ver} \
@ -520,7 +525,12 @@ mkdir -p %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/{bin,include,lib,share}/
%cmake_build --target clang-test-depends \
ExtraToolsUnitTests ClangdUnitTests ClangIncludeCleanerUnitTests ClangPseudoUnitTests
# requires lit.py from LLVM utilities
LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C %{__cmake_builddir}
LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C %{__cmake_builddiri} || \
%ifarch riscv64
:
%else
false
%endif
%endif
@ -692,6 +702,15 @@ LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C %{__cmake
%endif
%changelog
* Sat Dec 21 2024 David Abdurachmanov <davidlt@rivosinc.com> - 17.0.6-9.0.riscv64
- Add support for riscv64
* Thu Oct 03 2024 Tom Stellard <tstellar@redhat.com> - 17.0.6-9
- Add symbol versions to libclang-cpp.so
* Wed Jul 17 2024 Fedora Release Engineering <releng@fedoraproject.org> - 17.0.6-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild
* Wed Mar 06 2024 Tom Stellard <tstellar@redhat.com> - 17.0.6-7
- Fix clang resource directory to match compiler-rt
- Fix provides for clang-resource-filesystem