Compare commits

...

6 Commits

Author SHA1 Message Date
Fedora Release Engineering f9f0fb07de Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>
2023-07-20 12:55:16 +00:00
Tulio Magno Quites Machado Filho f9133b98bb Bump the release version 2023-07-10 18:38:50 -03:00
Nikita Popov bdb4929ebd Use LLVM_UNITTEST_LINK_FLAGS to reduce link times for unit tests
We currently spend a lot of time performing LTO on unit tests,
which is largely wasted effort. We can't disable LTO entirely,
because we don't have fat objects, but at least we can disable
post-link optimization.

For my local build, this reduces time in %build by about 30%.
2023-07-07 07:20:18 +00:00
Tulio Magno Quites Machado Filho cd99de7d35 Improve clang assembler error messages on s390x (rhbz#2216906)
Backport a patch from LLVM 17 that improves error messages from the
Clang assembler on s390x.

Also, disable LLVM_UNREACHABLE_OPTIMIZE in order to improve error
messages when llvm_unreachable() is called. There are many cases where
llvm_unreachable() is used as a error reporting function instead of the
recommended replacement for assert().

Fixes rhbz#2216906.
2023-07-03 15:09:05 -03:00
Tulio Magno Quites Machado Filho 61b03e8d59 Update to LLVM 16.0.6 2023-06-15 07:41:00 -03:00
Nikita Popov 236eac9d27 Split off llvm-cmake-utils package 2023-06-15 08:58:02 +02:00
4 changed files with 270 additions and 10 deletions

View File

@ -0,0 +1,184 @@
From efbaf8bc61f4c0e29a3eaafb11ac0ddda8bd3dff Mon Sep 17 00:00:00 2001
From: Ulrich Weigand <ulrich.weigand@de.ibm.com>
Date: Fri, 30 Jun 2023 16:02:56 +0200
Subject: [PATCH] [SystemZ] Improve error messages for unsupported relocations
In the SystemZMCObjectWriter, we currently just abort in case
some unsupported relocation in requested. However, as this
situation can be triggered by invalid (inline) assembler input,
we should really get a regular error message instead.
---
.../MCTargetDesc/SystemZMCObjectWriter.cpp | 59 +++++++++++--------
1 file changed, 35 insertions(+), 24 deletions(-)
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
index c23463ab9bde..0b11468afc52 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
@@ -9,6 +9,7 @@
#include "MCTargetDesc/SystemZMCFixups.h"
#include "MCTargetDesc/SystemZMCTargetDesc.h"
#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
@@ -40,7 +41,7 @@ SystemZObjectWriter::SystemZObjectWriter(uint8_t OSABI)
/*HasRelocationAddend_=*/ true) {}
// Return the relocation type for an absolute value of MCFixupKind Kind.
-static unsigned getAbsoluteReloc(unsigned Kind) {
+static unsigned getAbsoluteReloc(MCContext &Ctx, SMLoc Loc, unsigned Kind) {
switch (Kind) {
case FK_Data_1: return ELF::R_390_8;
case FK_Data_2: return ELF::R_390_16;
@@ -49,11 +50,12 @@ static unsigned getAbsoluteReloc(unsigned Kind) {
case SystemZ::FK_390_12: return ELF::R_390_12;
case SystemZ::FK_390_20: return ELF::R_390_20;
}
- llvm_unreachable("Unsupported absolute address");
+ Ctx.reportError(Loc, "Unsupported absolute address");
+ return 0;
}
// Return the relocation type for a PC-relative value of MCFixupKind Kind.
-static unsigned getPCRelReloc(unsigned Kind) {
+static unsigned getPCRelReloc(MCContext &Ctx, SMLoc Loc, unsigned Kind) {
switch (Kind) {
case FK_Data_2: return ELF::R_390_PC16;
case FK_Data_4: return ELF::R_390_PC32;
@@ -63,62 +65,69 @@ static unsigned getPCRelReloc(unsigned Kind) {
case SystemZ::FK_390_PC24DBL: return ELF::R_390_PC24DBL;
case SystemZ::FK_390_PC32DBL: return ELF::R_390_PC32DBL;
}
- llvm_unreachable("Unsupported PC-relative address");
+ Ctx.reportError(Loc, "Unsupported PC-relative address");
+ return 0;
}
// Return the R_390_TLS_LE* relocation type for MCFixupKind Kind.
-static unsigned getTLSLEReloc(unsigned Kind) {
+static unsigned getTLSLEReloc(MCContext &Ctx, SMLoc Loc, unsigned Kind) {
switch (Kind) {
case FK_Data_4: return ELF::R_390_TLS_LE32;
case FK_Data_8: return ELF::R_390_TLS_LE64;
}
- llvm_unreachable("Unsupported absolute address");
+ Ctx.reportError(Loc, "Unsupported thread-local address (local-exec)");
+ return 0;
}
// Return the R_390_TLS_LDO* relocation type for MCFixupKind Kind.
-static unsigned getTLSLDOReloc(unsigned Kind) {
+static unsigned getTLSLDOReloc(MCContext &Ctx, SMLoc Loc, unsigned Kind) {
switch (Kind) {
case FK_Data_4: return ELF::R_390_TLS_LDO32;
case FK_Data_8: return ELF::R_390_TLS_LDO64;
}
- llvm_unreachable("Unsupported absolute address");
+ Ctx.reportError(Loc, "Unsupported thread-local address (local-dynamic)");
+ return 0;
}
// Return the R_390_TLS_LDM* relocation type for MCFixupKind Kind.
-static unsigned getTLSLDMReloc(unsigned Kind) {
+static unsigned getTLSLDMReloc(MCContext &Ctx, SMLoc Loc, unsigned Kind) {
switch (Kind) {
case FK_Data_4: return ELF::R_390_TLS_LDM32;
case FK_Data_8: return ELF::R_390_TLS_LDM64;
case SystemZ::FK_390_TLS_CALL: return ELF::R_390_TLS_LDCALL;
}
- llvm_unreachable("Unsupported absolute address");
+ Ctx.reportError(Loc, "Unsupported thread-local address (local-dynamic)");
+ return 0;
}
// Return the R_390_TLS_GD* relocation type for MCFixupKind Kind.
-static unsigned getTLSGDReloc(unsigned Kind) {
+static unsigned getTLSGDReloc(MCContext &Ctx, SMLoc Loc, unsigned Kind) {
switch (Kind) {
case FK_Data_4: return ELF::R_390_TLS_GD32;
case FK_Data_8: return ELF::R_390_TLS_GD64;
case SystemZ::FK_390_TLS_CALL: return ELF::R_390_TLS_GDCALL;
}
- llvm_unreachable("Unsupported absolute address");
+ Ctx.reportError(Loc, "Unsupported thread-local address (general-dynamic)");
+ return 0;
}
// Return the PLT relocation counterpart of MCFixupKind Kind.
-static unsigned getPLTReloc(unsigned Kind) {
+static unsigned getPLTReloc(MCContext &Ctx, SMLoc Loc, unsigned Kind) {
switch (Kind) {
case SystemZ::FK_390_PC12DBL: return ELF::R_390_PLT12DBL;
case SystemZ::FK_390_PC16DBL: return ELF::R_390_PLT16DBL;
case SystemZ::FK_390_PC24DBL: return ELF::R_390_PLT24DBL;
case SystemZ::FK_390_PC32DBL: return ELF::R_390_PLT32DBL;
}
- llvm_unreachable("Unsupported absolute address");
+ Ctx.reportError(Loc, "Unsupported PC-relative PLT address");
+ return 0;
}
unsigned SystemZObjectWriter::getRelocType(MCContext &Ctx,
const MCValue &Target,
const MCFixup &Fixup,
bool IsPCRel) const {
+ SMLoc Loc = Fixup.getLoc();
unsigned Kind = Fixup.getKind();
if (Kind >= FirstLiteralRelocationKind)
return Kind - FirstLiteralRelocationKind;
@@ -126,38 +135,40 @@ unsigned SystemZObjectWriter::getRelocType(MCContext &Ctx,
switch (Modifier) {
case MCSymbolRefExpr::VK_None:
if (IsPCRel)
- return getPCRelReloc(Kind);
- return getAbsoluteReloc(Kind);
+ return getPCRelReloc(Ctx, Loc, Kind);
+ return getAbsoluteReloc(Ctx, Loc, Kind);
case MCSymbolRefExpr::VK_NTPOFF:
assert(!IsPCRel && "NTPOFF shouldn't be PC-relative");
- return getTLSLEReloc(Kind);
+ return getTLSLEReloc(Ctx, Loc, Kind);
case MCSymbolRefExpr::VK_INDNTPOFF:
if (IsPCRel && Kind == SystemZ::FK_390_PC32DBL)
return ELF::R_390_TLS_IEENT;
- llvm_unreachable("Only PC-relative INDNTPOFF accesses are supported for now");
+ Ctx.reportError(Loc, "Only PC-relative INDNTPOFF accesses are supported for now");
+ return 0;
case MCSymbolRefExpr::VK_DTPOFF:
assert(!IsPCRel && "DTPOFF shouldn't be PC-relative");
- return getTLSLDOReloc(Kind);
+ return getTLSLDOReloc(Ctx, Loc, Kind);
case MCSymbolRefExpr::VK_TLSLDM:
assert(!IsPCRel && "TLSLDM shouldn't be PC-relative");
- return getTLSLDMReloc(Kind);
+ return getTLSLDMReloc(Ctx, Loc, Kind);
case MCSymbolRefExpr::VK_TLSGD:
assert(!IsPCRel && "TLSGD shouldn't be PC-relative");
- return getTLSGDReloc(Kind);
+ return getTLSGDReloc(Ctx, Loc, Kind);
case MCSymbolRefExpr::VK_GOT:
if (IsPCRel && Kind == SystemZ::FK_390_PC32DBL)
return ELF::R_390_GOTENT;
- llvm_unreachable("Only PC-relative GOT accesses are supported for now");
+ Ctx.reportError(Loc, "Only PC-relative GOT accesses are supported for now");
+ return 0;
case MCSymbolRefExpr::VK_PLT:
- assert(IsPCRel && "@PLT shouldt be PC-relative");
- return getPLTReloc(Kind);
+ assert(IsPCRel && "@PLT shouldn't be PC-relative");
+ return getPLTReloc(Ctx, Loc, Kind);
default:
llvm_unreachable("Modifier not supported");
--
2.41.0

View File

@ -0,0 +1,39 @@
From cf35b4622d31701d0c79e0441931518726f997f2 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov@redhat.com>
Date: Fri, 30 Jun 2023 12:25:09 +0200
Subject: [PATCH] Add LLVM_UNITTEST_LINK_FLAGS option
This allows specifying linker flags that should only be applied
to unit tests, e.g. to disable LTO optimization for them.
---
llvm/cmake/modules/AddLLVM.cmake | 2 ++
llvm/cmake/modules/HandleLLVMOptions.cmake | 3 +++
2 files changed, 5 insertions(+)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 94fc83db9344..7cf75223ce38 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1592,6 +1592,8 @@ function(add_unittest test_suite test_name)
endif()
endif()
+ target_link_options(${test_name} PRIVATE "${LLVM_UNITTEST_LINK_FLAGS}")
+
set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
set_output_directory(${test_name} BINARY_DIR ${outdir} LIBRARY_DIR ${outdir})
# libpthreads overrides some standard library symbols, so main
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 6119ecdce0f4..eec98162c2d7 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -1274,3 +1274,6 @@ endif()
set(LLVM_THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../third-party CACHE STRING
"Directory containing third party software used by LLVM (e.g. googletest)")
+
+set(LLVM_UNITTEST_LINK_FLAGS "" CACHE STRING
+ "Additional linker flags for unit tests")
--
2.40.1

View File

@ -20,7 +20,7 @@
#global rc_ver 4
%global maj_ver 16
%global min_ver 0
%global patch_ver 5
%global patch_ver 6
%global llvm_srcdir llvm-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src
%global cmake_srcdir cmake-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src
%global third_party_srcdir third-party-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src
@ -37,12 +37,14 @@
%global pkg_bindir %{install_bindir}
%global pkg_includedir %{_includedir}/%{name}
%global pkg_libdir %{install_libdir}
%global pkg_datadir %{install_prefix}/share
%else
%global pkg_name llvm
%global install_prefix /usr
%global install_libdir %{_libdir}
%global pkg_bindir %{_bindir}
%global pkg_libdir %{install_libdir}
%global pkg_datadir %{_datadir}
%global exec_suffix %{nil}
%endif
@ -75,7 +77,7 @@
Name: %{pkg_name}
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}
Release: 1%{?dist}
Release: 5%{?dist}
Summary: The Low Level Virtual Machine
License: Apache-2.0 WITH LLVM-exception OR NCSA
@ -88,8 +90,13 @@ Source4: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ve
Source5: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{third_party_srcdir}.tar.xz.sig
Source6: release-keys.asc
# Backported from LLVM 17
Patch1: 0001-SystemZ-Improve-error-messages-for-unsupported-reloc.patch
# See https://reviews.llvm.org/D137890 for the next two patches
Patch2: 0001-llvm-Add-install-targets-for-gtest.patch
# Backport of https://reviews.llvm.org/D154212 from LLVM 17.
Patch3: 0001-cmake-Add-LLVM_UNITTEST_LINK_FLAGS-option.patch
# RHEL-specific patch to avoid unwanted recommonmark dep
Patch101: 0101-Deactivate-markdown-doc.patch
# Patching third-party dir with a 200 offset in patch number
@ -187,6 +194,13 @@ Provides: llvm-static(major) = %{maj_ver}
%description static
Static libraries for the LLVM compiler infrastructure.
%package cmake-utils
Summary: CMake utilities shared across LLVM subprojects
%description cmake-utils
CMake utilities shared across LLVM subprojects.
This is for internal use by LLVM packages only.
%if %{without compat_build}
%package test
@ -302,6 +316,7 @@ export ASMFLAGS=$CFLAGS
%if %{without compat_build}
-DLLVM_VERSION_SUFFIX='' \
%endif
-DLLVM_UNREACHABLE_OPTIMIZE:BOOL=OFF \
-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \
@ -311,7 +326,8 @@ export ASMFLAGS=$CFLAGS
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
-DLLVM_INSTALL_SPHINX_HTML_DIR=%{_pkgdocdir}/html \
-DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \
-DLLVM_INCLUDE_BENCHMARKS=OFF
-DLLVM_INCLUDE_BENCHMARKS=OFF \
-DLLVM_UNITTEST_LINK_FLAGS="-Wl,-plugin-opt=O0"
# Build libLLVM.so first. This ensures that when libLLVM.so is linking, there
# are no other compile jobs running. This will help reduce OOM errors on the
@ -418,7 +434,8 @@ rm %{buildroot}%{_bindir}/llvm-config%{exec_suffix}
# ghost presence
touch %{buildroot}%{_bindir}/llvm-config%{exec_suffix}
cp -Rv ../cmake/Modules/* %{buildroot}%{pkg_libdir}/cmake/llvm
mkdir -p %{buildroot}%{pkg_datadir}/llvm/cmake
cp -Rv ../cmake/* %{buildroot}%{pkg_datadir}/llvm/cmake
%check
# Disable check section on arm due to some kind of memory related failure.
@ -540,6 +557,10 @@ fi
%{_libdir}/%{name}/lib/*.a
%endif
%files cmake-utils
%license LICENSE.TXT
%{pkg_datadir}/llvm/cmake
%if %{without compat_build}
%files test
@ -563,6 +584,22 @@ fi
%endif
%changelog
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 16.0.6-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Mon Jul 10 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.6-4
- Use LLVM_UNITTEST_LINK_FLAGS to reduce link times for unit tests
* Mon Jul 03 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.6-3
- Improve error messages for unsupported relocs on s390x (rhbz#2216906)
- Disable LLVM_UNREACHABLE_OPTIMIZE
* Wed Jun 14 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.6-1
- Update to LLVM 16.0.6
* Fri Jun 09 2023 Nikita Popov <npopov@redhat.com> - 16.0.5-2
- Split off llvm-cmake-utils package
* Mon Jun 05 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.5-1
- Update to LLVM 16.0.5

12
sources
View File

@ -1,6 +1,6 @@
SHA512 (llvm-16.0.5.src.tar.xz) = f5fa671e16c4dfe4d506320cbe386261315c1cfd79ff70d0fcfbd945003c26a5f936249dd880ad86711015ff4d2e05d6102f96318a25d52cd1e9e316f6e4d685
SHA512 (llvm-16.0.5.src.tar.xz.sig) = f31bdd66b7c551fba531d77f089ed82fa23e84a61428bc599849f22c909c6eed36d015553902869329c14bf32e91574dd3549be0ec4fa306499d5e2cf70f711f
SHA512 (cmake-16.0.5.src.tar.xz) = 0b81399c872dc886f486568537dab7033de347ba9ea68243db7df6f5651b22c5e3034a5a505185e076de2091b0d8721d35136450d1e1d1ab821bfdd6c5992df2
SHA512 (cmake-16.0.5.src.tar.xz.sig) = 12659c47e1ff4215f0bfe2354bd3a07618f560df0c3098f469c06c04825112cd0bf5610f0e58d7de3ee84d57adbb57a60a5de20b2c8bad9ff70c64e78c3dc3e5
SHA512 (third-party-16.0.5.src.tar.xz) = a66caf8761d72e8c59ce87faea09f3d3f3ba17c92c1a07bae09304801b76d29962444a06b1fab61eeca085822ed7c14d0c41976c3493220ceff9877d63a85cef
SHA512 (third-party-16.0.5.src.tar.xz.sig) = 2ff778429cfff931dc9b8ebad977b83616f1e68d7653b79417403dc1237fe92a955c251c01acf4e4f17d3ef46d6b5a2c35bd5db8bea2fe954fb43a0e8fecd741
SHA512 (llvm-16.0.6.src.tar.xz) = 8d4cdadc9a1ad249fbf9248c8e56f3bcafab73a473a0b0ca73499ed8825c62e27668aac4f1d03341631e5ad93701621e834e9e196ca32eac3ef805cf1c860083
SHA512 (llvm-16.0.6.src.tar.xz.sig) = 9adda28085f4a2e2a64dab1d8e4ff23c5629bbb0bb6b34afc081e44f6f85ac4f3c6cd0c3488af98c0fad939c33f9d2a8a0cbef67a577cd7fe3013bc2200452b1
SHA512 (cmake-16.0.6.src.tar.xz) = 52ecd941d2d85a5b668caa5d0d40480cb6a97b3bf1174e634c2a93e9ef6d03670ca7e96abb0a60cb33ba537b93d5788754dab1f2f45c1f623f788162717d088b
SHA512 (cmake-16.0.6.src.tar.xz.sig) = d20c5e51315aa476775e6ce886684b9f882ce283fc40aa6c1b8f03964c77a1e745e2e1fb00b3488dddfe1a04378e2bfd090350de28e58088525a5305ecb1bea6
SHA512 (third-party-16.0.6.src.tar.xz) = 51683e92953eb57ed36ebc8a43cb688863edf4f24ba71965d57016cfdc17bad10f8f3942e9597a729329f89489597e79bb4653445ff1ec36ec03077adb1dd7b9
SHA512 (third-party-16.0.6.src.tar.xz.sig) = aefb22ee35b2299e77669d72557079630fba5df2c0031c72a025082de3c4ca56ea0e1ec870c42d9056752195ad0e5b68258b548caf801ef4269e2ec1cd9da513