diff --git a/0001-SystemZ-Improve-error-messages-for-unsupported-reloc.patch b/0001-SystemZ-Improve-error-messages-for-unsupported-reloc.patch new file mode 100644 index 0000000000000000000000000000000000000000..34128b62698f8b6652a4598285cb117859b9b212 --- /dev/null +++ b/0001-SystemZ-Improve-error-messages-for-unsupported-reloc.patch @@ -0,0 +1,184 @@ +From efbaf8bc61f4c0e29a3eaafb11ac0ddda8bd3dff Mon Sep 17 00:00:00 2001 +From: Ulrich Weigand +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 + diff --git a/0001-cmake-Add-LLVM_UNITTEST_LINK_FLAGS-option.patch b/0001-cmake-Add-LLVM_UNITTEST_LINK_FLAGS-option.patch new file mode 100644 index 0000000000000000000000000000000000000000..192ca92922549027129b67d6fc0049619c659d0e --- /dev/null +++ b/0001-cmake-Add-LLVM_UNITTEST_LINK_FLAGS-option.patch @@ -0,0 +1,39 @@ +From cf35b4622d31701d0c79e0441931518726f997f2 Mon Sep 17 00:00:00 2001 +From: Nikita Popov +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 + diff --git a/0001-llvm-Add-install-targets-for-gtest.patch b/0001-llvm-Add-install-targets-for-gtest.patch new file mode 100644 index 0000000000000000000000000000000000000000..e84c44402ffbd5c0262f0399c61d687de2d42a80 --- /dev/null +++ b/0001-llvm-Add-install-targets-for-gtest.patch @@ -0,0 +1,32 @@ +From 8cc3870f09d728d9017c72eba9520117a4283fee Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Thu, 17 Nov 2022 09:01:10 +0000 +Subject: Add install targets for gtest + +Stand-alone builds need an installed version of gtest in order to run +the unittests. + +Differential Revision: https://reviews.llvm.org/D137890 +--- + llvm/CMakeLists.txt | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt +index 60e1f29620af..d91338532815 100644 +--- a/llvm/CMakeLists.txt ++++ b/llvm/CMakeLists.txt +@@ -693,6 +693,11 @@ option(LLVM_BUILD_TESTS + "Build LLVM unit tests. If OFF, just generate build targets." OFF) + option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON) + ++option(LLVM_INSTALL_GTEST ++ "Install the llvm gtest library. This should be on if you want to do ++ stand-alone builds of the other projects and run their unit tests." OFF) ++ ++ + option(LLVM_BUILD_BENCHMARKS "Add LLVM benchmark targets to the list of default + targets. If OFF, benchmarks still could be built using Benchmarks target." OFF) + option(LLVM_INCLUDE_BENCHMARKS "Generate benchmark targets. If OFF, benchmarks can't be built." ON) +-- +2.34.3 + diff --git a/0201-third-party-Add-install-targets-for-gtest.patch b/0201-third-party-Add-install-targets-for-gtest.patch new file mode 100644 index 0000000000000000000000000000000000000000..5c8613057f4ab45a7562fc1055bcf6ac2d1f3ac0 --- /dev/null +++ b/0201-third-party-Add-install-targets-for-gtest.patch @@ -0,0 +1,47 @@ +From 8cc3870f09d728d9017c72eba9520117a4283fee Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Thu, 17 Nov 2022 09:01:10 +0000 +Subject: Add install targets for gtest + +Stand-alone builds need an installed version of gtest in order to run +the unittests. + +Differential Revision: https://reviews.llvm.org/D137890 +--- + third-party/unittest/CMakeLists.txt | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/third-party/unittest/CMakeLists.txt b/third-party/unittest/CMakeLists.txt +index 0e54e0e57c35..1d2a52730d7d 100644 +--- a/third-party/unittest/CMakeLists.txt ++++ b/third-party/unittest/CMakeLists.txt +@@ -65,12 +65,25 @@ if (NOT LLVM_ENABLE_THREADS) + endif () + + target_include_directories(llvm_gtest +- PUBLIC googletest/include googlemock/include ++ PUBLIC $ ++ $ ++ $ ++ $ + PRIVATE googletest googlemock + ) + + add_subdirectory(UnitTestMain) + ++if (LLVM_INSTALL_GTEST) ++export(TARGETS llvm_gtest llvm_gtest_main LLVMTestingSupport FILE LLVMGTestConfig.cmake) ++install(TARGETS llvm_gtest llvm_gtest_main LLVMTestingSupport EXPORT LLVMGTestConfig ++ ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}" COMPONENT llvm_gtest) ++ install(EXPORT LLVMGTestConfig DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} COMPONENT llvm_gtest) ++ add_llvm_install_targets(install-llvm_gtest COMPONENT llvm_gtest DEPENDS llvm_gtest LLVMGTestConfig.cmake) ++ install(DIRECTORY googletest/include/gtest/ DESTINATION include/llvm-gtest/gtest/ COMPONENT llvm_gtest) ++ install(DIRECTORY googlemock/include/gmock/ DESTINATION include/llvm-gmock/gmock/ COMPONENT llvm_gtest) ++endif() ++ + # When LLVM_LINK_LLVM_DYLIB is enabled, libLLVM.so is added to the interface + # link libraries for gtest and gtest_main. This means that any target, like + # unittests for example, that links against gtest will be forced to link +-- +2.34.3 + diff --git a/Disable-INSTANTIATE_TEST_SUITE_P-OnAarch64.patch b/Disable-INSTANTIATE_TEST_SUITE_P-OnAarch64.patch index 8297ef77f34d17af30d057d758f614d0d0efe8c1..661c03e10435bb0768ef79ee44ca96ad0539b519 100644 --- a/Disable-INSTANTIATE_TEST_SUITE_P-OnAarch64.patch +++ b/Disable-INSTANTIATE_TEST_SUITE_P-OnAarch64.patch @@ -1,6 +1,6 @@ -diff -Nuar llvm-14.0.5.src/unittests/Analysis/ValueTrackingTest.cpp llvm-14.0.5.src-new/unittests/Analysis/ValueTrackingTest.cpp ---- llvm-14.0.5.src/unittests/Analysis/ValueTrackingTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/Analysis/ValueTrackingTest.cpp 2023-01-05 21:05:15.794281130 +0800 +diff -Nuar llvm-16.0.6.src/unittests/Analysis/ValueTrackingTest.cpp llvm-16.0.6.src-new/unittests/Analysis/ValueTrackingTest.cpp +--- llvm-16.0.6.src/unittests/Analysis/ValueTrackingTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/Analysis/ValueTrackingTest.cpp 2023-01-05 21:05:15.794281130 +0800 @@ -1964,6 +1964,7 @@ }, }; @@ -26,9 +26,9 @@ diff -Nuar llvm-14.0.5.src/unittests/Analysis/ValueTrackingTest.cpp llvm-14.0.5. ::testing::ValuesIn(FindAllocaForValueTests)); +#endif + -diff -Nuar llvm-14.0.5.src/unittests/CodeGen/DIETest.cpp llvm-14.0.5.src-new/unittests/CodeGen/DIETest.cpp ---- llvm-14.0.5.src/unittests/CodeGen/DIETest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/CodeGen/DIETest.cpp 2023-01-05 21:43:00.894659613 +0800 +diff -Nuar llvm-16.0.6.src/unittests/CodeGen/DIETest.cpp llvm-16.0.6.src-new/unittests/CodeGen/DIETest.cpp +--- llvm-16.0.6.src/unittests/CodeGen/DIETest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/CodeGen/DIETest.cpp 2023-01-05 21:43:00.894659613 +0800 @@ -64,6 +64,7 @@ Tst.emitValue(TestPrinter->getAP(), Form); } @@ -44,9 +44,9 @@ diff -Nuar llvm-14.0.5.src/unittests/CodeGen/DIETest.cpp llvm-14.0.5.src-new/uni - +#endif } // end namespace -diff -Nuar llvm-14.0.5.src/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp llvm-14.0.5.src-new/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp ---- llvm-14.0.5.src/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp 2023-01-05 22:53:19.184800856 +0800 +diff -Nuar llvm-16.0.6.src/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp llvm-16.0.6.src-new/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp +--- llvm-16.0.6.src/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp 2023-01-05 22:53:19.184800856 +0800 @@ -379,6 +379,7 @@ std::to_string(Version))); } @@ -62,9 +62,9 @@ diff -Nuar llvm-14.0.5.src/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp llvm +#endif } // end anonymous namespace -diff -Nuar llvm-14.0.5.src/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp llvm-14.0.5.src-new/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp ---- llvm-14.0.5.src/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp 2023-01-06 08:56:56.406882999 +0800 +diff -Nuar llvm-16.0.6.src/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp llvm-16.0.6.src-new/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp +--- llvm-16.0.6.src/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp 2023-01-06 08:56:56.406882999 +0800 @@ -186,7 +186,7 @@ struct FormSkipValueFixture2 : FormSkipValueFixtureBase {}; TEST_P(FormSkipValueFixture1, skipValuePart1) { doSkipValueTest(); } @@ -81,9 +81,9 @@ diff -Nuar llvm-14.0.5.src/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp llvm +#endif } // end anonymous namespace -diff -Nuar llvm-14.0.5.src/unittests/Demangle/DLangDemangleTest.cpp llvm-14.0.5.src-new/unittests/Demangle/DLangDemangleTest.cpp ---- llvm-14.0.5.src/unittests/Demangle/DLangDemangleTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/Demangle/DLangDemangleTest.cpp 2023-01-06 08:55:40.010196291 +0800 +diff -Nuar llvm-16.0.6.src/unittests/Demangle/DLangDemangleTest.cpp llvm-16.0.6.src-new/unittests/Demangle/DLangDemangleTest.cpp +--- llvm-16.0.6.src/unittests/Demangle/DLangDemangleTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/Demangle/DLangDemangleTest.cpp 2023-01-06 08:55:40.010196291 +0800 @@ -26,6 +26,7 @@ EXPECT_STREQ(Demangled, GetParam().second); } @@ -97,9 +97,9 @@ diff -Nuar llvm-14.0.5.src/unittests/Demangle/DLangDemangleTest.cpp llvm-14.0.5. std::make_pair("_D8demangle5recurQa", nullptr))); // invalid type back reference (recursive). +#endif -diff -Nuar llvm-14.0.5.src/unittests/FileCheck/FileCheckTest.cpp llvm-14.0.5.src-new/unittests/FileCheck/FileCheckTest.cpp ---- llvm-14.0.5.src/unittests/FileCheck/FileCheckTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/FileCheck/FileCheckTest.cpp 2023-01-06 08:58:47.331880016 +0800 +diff -Nuar llvm-16.0.6.src/unittests/FileCheck/FileCheckTest.cpp llvm-16.0.6.src-new/unittests/FileCheck/FileCheckTest.cpp +--- llvm-16.0.6.src/unittests/FileCheck/FileCheckTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/FileCheck/FileCheckTest.cpp 2023-01-06 08:58:47.331880016 +0800 @@ -330,6 +330,7 @@ EXPECT_TRUE(bool(Format)); } @@ -116,9 +116,9 @@ diff -Nuar llvm-14.0.5.src/unittests/FileCheck/FileCheckTest.cpp llvm-14.0.5.src template static Expected doValueOperation(binop_eval_t Operation, -diff -Nuar llvm-14.0.5.src/unittests/Frontend/OpenMPIRBuilderTest.cpp llvm-14.0.5.src-new/unittests/Frontend/OpenMPIRBuilderTest.cpp ---- llvm-14.0.5.src/unittests/Frontend/OpenMPIRBuilderTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/Frontend/OpenMPIRBuilderTest.cpp 2023-01-06 08:54:45.937710269 +0800 +diff -Nuar llvm-16.0.6.src/unittests/Frontend/OpenMPIRBuilderTest.cpp llvm-16.0.6.src-new/unittests/Frontend/OpenMPIRBuilderTest.cpp +--- llvm-16.0.6.src/unittests/Frontend/OpenMPIRBuilderTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/Frontend/OpenMPIRBuilderTest.cpp 2023-01-06 08:54:45.937710269 +0800 @@ -2050,7 +2050,7 @@ OMPBuilder.finalize(); EXPECT_FALSE(verifyModule(*M, &errs())); @@ -127,17 +127,16 @@ diff -Nuar llvm-14.0.5.src/unittests/Frontend/OpenMPIRBuilderTest.cpp llvm-14.0. +#if 0 INSTANTIATE_TEST_SUITE_P( OpenMPWSLoopSchedulingTypes, OpenMPIRBuilderTestWithParams, - ::testing::Values(omp::OMPScheduleType::DynamicChunked, -@@ -3950,5 +3950,6 @@ - EXPECT_EQ(MapperCall->getOperand(7), MapnamesArg); - EXPECT_TRUE(MapperCall->getOperand(8)->getType()->isPointerTy()); + ::testing::Values(omp::OMPScheduleType::UnorderedDynamicChunked, +@@ -5506,4 +5506,5 @@ + GlobalValue::WeakAnyLinkage); + EXPECT_TRUE(InfoManager.hasDeviceGlobalVarEntryInfo("gvar")); } +#endif - } // namespace -diff -Nuar llvm-14.0.5.src/unittests/ProfileData/CoverageMappingTest.cpp llvm-14.0.5.src-new/unittests/ProfileData/CoverageMappingTest.cpp ---- llvm-14.0.5.src/unittests/ProfileData/CoverageMappingTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/ProfileData/CoverageMappingTest.cpp 2023-01-06 09:04:53.615172318 +0800 +diff -Nuar llvm-16.0.6.src/unittests/ProfileData/CoverageMappingTest.cpp llvm-16.0.6.src-new/unittests/ProfileData/CoverageMappingTest.cpp +--- llvm-16.0.6.src/unittests/ProfileData/CoverageMappingTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/ProfileData/CoverageMappingTest.cpp 2023-01-06 09:04:53.615172318 +0800 @@ -920,6 +920,7 @@ ASSERT_EQ(3U, NumFuncs); } @@ -153,9 +152,9 @@ diff -Nuar llvm-14.0.5.src/unittests/ProfileData/CoverageMappingTest.cpp llvm-14 +#endif } // end anonymous namespace -diff -Nuar llvm-14.0.5.src/unittests/ProfileData/InstrProfTest.cpp llvm-14.0.5.src-new/unittests/ProfileData/InstrProfTest.cpp ---- llvm-14.0.5.src/unittests/ProfileData/InstrProfTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/ProfileData/InstrProfTest.cpp 2023-01-06 09:04:15.098826114 +0800 +diff -Nuar llvm-16.0.6.src/unittests/ProfileData/InstrProfTest.cpp llvm-16.0.6.src-new/unittests/ProfileData/InstrProfTest.cpp +--- llvm-16.0.6.src/unittests/ProfileData/InstrProfTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/ProfileData/InstrProfTest.cpp 2023-01-06 09:04:15.098826114 +0800 @@ -1040,9 +1040,10 @@ auto I = Reader->begin(), E = Reader->end(); ASSERT_TRUE(I == E); @@ -168,9 +167,9 @@ diff -Nuar llvm-14.0.5.src/unittests/ProfileData/InstrProfTest.cpp llvm-14.0.5.s #if defined(_LP64) && defined(EXPENSIVE_CHECKS) TEST(ProfileReaderTest, ReadsLargeFiles) { -diff -Nuar llvm-14.0.5.src/unittests/Support/MemoryTest.cpp llvm-14.0.5.src-new/unittests/Support/MemoryTest.cpp ---- llvm-14.0.5.src/unittests/Support/MemoryTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/Support/MemoryTest.cpp 2023-01-06 08:59:21.828190091 +0800 +diff -Nuar llvm-16.0.6.src/unittests/Support/MemoryTest.cpp llvm-16.0.6.src-new/unittests/Support/MemoryTest.cpp +--- llvm-16.0.6.src/unittests/Support/MemoryTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/Support/MemoryTest.cpp 2023-01-06 08:59:21.828190091 +0800 @@ -427,8 +427,9 @@ Memory::MF_READ|Memory::MF_EXEC, Memory::MF_READ|Memory::MF_WRITE|Memory::MF_EXEC @@ -182,11 +181,11 @@ diff -Nuar llvm-14.0.5.src/unittests/Support/MemoryTest.cpp llvm-14.0.5.src-new/ +#endif } // anonymous namespace -diff -Nuar llvm-14.0.5.src/unittests/Support/TargetParserTest.cpp llvm-14.0.5.src-new/unittests/Support/TargetParserTest.cpp ---- llvm-14.0.5.src/unittests/Support/TargetParserTest.cpp 2022-06-10 22:47:36.000000000 +0800 -+++ llvm-14.0.5.src-new/unittests/Support/TargetParserTest.cpp 2023-01-06 09:44:14.688482267 +0800 + diff -Nuar llvm-16.0.6.src/unittests/TargetParser/TargetParserTest.cpp llvm-16.0.6.src-new/unittests/TargetParser/TargetParserTest.cpp +--- llvm-16.0.6.src/unittests/TargetParser/TargetParserTest.cpp 2022-06-10 22:47:36.000000000 +0800 ++++ llvm-16.0.6.src-new/unittests/TargetParser/TargetParserTest.cpp 2023-01-06 09:44:14.688482267 +0800 @@ -116,7 +116,7 @@ - + EXPECT_EQ(params.CPUAttr, ARM::getCPUAttr(AK)); } - @@ -199,14 +198,13 @@ diff -Nuar llvm-14.0.5.src/unittests/Support/TargetParserTest.cpp llvm-14.0.5.sr ARMBuildAttrs::CPUArch::v7)); } +#endif - + bool testARMExtension(StringRef CPUName,ARM::ArchKind ArchKind, StringRef ArchExt) { return ARM::getDefaultExtensions(CPUName, ArchKind) & -@@ -893,7 +894,7 @@ - - EXPECT_EQ(params.CPUAttr, AArch64::getCPUAttr(AK)); +@@ -971,6 +972,7 @@ + params.ExpectedFlags, default_extensions); } -- + +#if 0 INSTANTIATE_TEST_SUITE_P( AArch64CPUTests, AArch64CPUTestFixture, diff --git a/llvm.spec b/llvm.spec index 6791c413ba4b17b9a82578659b03126295b7e33f..cda8fc461667f17af225ab616067855daf2462d4 100644 --- a/llvm.spec +++ b/llvm.spec @@ -1,18 +1,24 @@ %global toolchain clang -%global maj_ver 14 -%global min_ver 0 -%global patch_ver 5 -%global llvm_srcdir llvm-%{maj_ver}.%{min_ver}.%{patch_ver}.src - Name: llvm -Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 4%{?dist} +Version: 16.0.6 +Release: 1%{?dist} Summary: Low Level Virtual Machine, modular and reusable compiler and toolchain License: Apache License v2.0 with LLVM Exceptions URL: http://llvm.org -Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}/%{llvm_srcdir}.tar.xz -Patch5000: Disable-INSTANTIATE_TEST_SUITE_P-OnAarch64.patch +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/llvm-%{version}.src.tar.xz +Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/cmake-%{version}.src.tar.xz +Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/third-party-%{version}.src.tar.xz + +Patch0001: 0001-SystemZ-Improve-error-messages-for-unsupported-reloc.patch +Patch0002: 0001-cmake-Add-LLVM_UNITTEST_LINK_FLAGS-option.patch +Patch3001: 0001-llvm-Add-install-targets-for-gtest.patch +Patch3002: 0201-third-party-Add-install-targets-for-gtest.patch +Patch5000: Disable-INSTANTIATE_TEST_SUITE_P-OnAarch64.patch + +%define maj_ver %(echo %{version} | cut -d. -f1) +%define min_ver %(echo %{version} | cut -d. -f2) +%define patch_ver %(echo %{version} | cut -d. -f3) BuildRequires: gcc gcc-c++ clang cmake ninja-build BuildRequires: zlib-devel libffi-devel ncurses-devel binutils-devel libedit-devel @@ -57,6 +63,12 @@ Summary: LLVM shared libraries %description libs Shared libraries for LLVM. +%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. %package test Summary: LLVM regression tests @@ -70,10 +82,21 @@ LLVM regression tests adn LLVM's modified googletest sources. %prep +%setup -T -q -b 1 -n cmake-%{version}.src +cd .. +mv cmake-%{version}.src cmake + +%setup -T -q -b 2 -n third-party-%{version}.src +%patch3002 -p2 +cd .. +mv third-party-%{version}.src third-party + +%setup -T -q -b 0 -n llvm-%{version}.src +%patch0001 -p2 +%patch0002 -p2 +%patch3001 -p2 %ifarch aarch64 -%autosetup -n %{llvm_srcdir} -p1 -%else -%autosetup -n %{llvm_srcdir} -N +%patch5000 -p1 %endif pathfix.py -i %{__python3} -p -n -k -as \ @@ -105,6 +128,7 @@ pathfix.py -i %{__python3} -p -n -k -as \ -DLLVM_BUILD_TOOLS:BOOL=ON \ -DLLVM_INCLUDE_TESTS:BOOL=ON \ -DLLVM_BUILD_TESTS:BOOL=ON \ + -DLLVM_INSTALL_GTEST:BOOL=ON \ -DLLVM_LIT_ARGS=-v \ -DLLVM_INCLUDE_EXAMPLES:BOOL=ON \ -DLLVM_BUILD_EXAMPLES:BOOL=OFF \ @@ -126,7 +150,8 @@ pathfix.py -i %{__python3} -p -n -k -as \ -DCMAKE_INSTALL_PREFIX=/usr \ -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 to help reduce OOM errors during concurrent building. %cmake_build --target LLVM @@ -143,14 +168,7 @@ install -m 0755 %{_vpath_builddir}/bin/llvm-opt-fuzzer %{buildroot}%{_bindir} rm -rf test/tools/UpdateTestChecks install %{_vpath_builddir}/lib64/libLLVMTestingSupport.a %{buildroot}%{_libdir} - -# clang can use these for gtest and lit tests -%global install_srcdir %{buildroot}%{_datadir}/llvm/src -install -d %{install_srcdir} -install -d %{install_srcdir}/utils/ -cp -R utils/unittest %{install_srcdir}/utils/ -cp utils/update_cc_test_checks.py %{install_srcdir}/utils/ -cp -R utils/UpdateTestChecks %{install_srcdir}/utils/ +install %{_vpath_builddir}/lib64/libLLVMTestingAnnotations.a %{buildroot}%{_libdir} # Add symlink to lto plugin in the binutils plugin directory mkdir -p %{buildroot}%{_libdir}/bfd-plugins/ @@ -160,6 +178,8 @@ ln -s -t %{buildroot}%{_libdir}/bfd-plugins/ ../LLVMgold.so cp -Rv ../cmake/Modules/* %{buildroot}%{_libdir}/cmake/llvm +mkdir -p %{buildroot}%{_datadir}/llvm/cmake +cp -Rv ../cmake/* %{buildroot}%{_datadir}/llvm/cmake %check @@ -202,6 +222,10 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %{__ninja} check-all -C %{_vpath_buildd %{_includedir}/llvm-c %{_mandir}/man1/llvm-config* +%files cmake-utils +%license LICENSE.TXT +%{_datadir}/llvm/cmake + %files test %license LICENSE.TXT %{_bindir}/not @@ -210,11 +234,17 @@ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %{__ninja} check-all -C %{_vpath_buildd %{_bindir}/lli-child-target %{_bindir}/llvm-isel-fuzzer %{_bindir}/llvm-opt-fuzzer -%{_datadir}/llvm/src/utils %{_libdir}/libLLVMTestingSupport.a - +%{_libdir}/libLLVMTestingAnnotations.a +%{_libdir}/libllvm_gtest.a +%{_libdir}/libllvm_gtest_main.a +%{_includedir}/llvm-gtest +%{_includedir}/llvm-gmock %changelog +* Fri Jun 30 2023 kianli - 16.0.6-1 +- Upgrade to 16.0.6 + * Fri Apr 28 2023 OpenCloudOS Release Engineering - 14.0.5-4 - Rebuilt for OpenCloudOS Stream 23.05 diff --git a/sources b/sources index a8201bd7fd203a7a6c6c36a1f45f45bad7d59be5..d19ab72cd60e55da5a2b624995179b9175387c06 100644 --- a/sources +++ b/sources @@ -1 +1,3 @@ -SHA512 (llvm-14.0.5.src.tar.xz) = 03b9ecedd14eb034d16fde945d395672990b2140bff713a65e701711ef5934b967850762fcb2d75db72abb56ad0354d4f5d768f1005add979a859c93565004d2 +SHA512 (llvm-16.0.6.src.tar.xz) = 8d4cdadc9a1ad249fbf9248c8e56f3bcafab73a473a0b0ca73499ed8825c62e27668aac4f1d03341631e5ad93701621e834e9e196ca32eac3ef805cf1c860083 +SHA512 (cmake-16.0.6.src.tar.xz) = 52ecd941d2d85a5b668caa5d0d40480cb6a97b3bf1174e634c2a93e9ef6d03670ca7e96abb0a60cb33ba537b93d5788754dab1f2f45c1f623f788162717d088b +SHA512 (third-party-16.0.6.src.tar.xz) = 51683e92953eb57ed36ebc8a43cb688863edf4f24ba71965d57016cfdc17bad10f8f3942e9597a729329f89489597e79bb4653445ff1ec36ec03077adb1dd7b9