From 79ef803233edc35e65fec5c8d012dd1c0513dab0 Mon Sep 17 00:00:00 2001 From: Jeremy Newton Date: Sep 19 2022 21:31:57 +0000 Subject: Rebuild against LLVM 15 Signed-off-by: Jeremy Newton --- diff --git a/0001-Comgr-changes-needed-for-https-github.com-llvm-llvm-.patch b/0001-Comgr-changes-needed-for-https-github.com-llvm-llvm-.patch new file mode 100644 index 0000000..fa53d27 --- /dev/null +++ b/0001-Comgr-changes-needed-for-https-github.com-llvm-llvm-.patch @@ -0,0 +1,36 @@ +From 11bf5dfe1ad1c7f6801e9c23bc32dd9532d8d877 Mon Sep 17 00:00:00 2001 +From: Ethan Stewart +Date: Thu, 17 Feb 2022 19:33:01 -0600 +Subject: [PATCH 1/4] Comgr changes needed for + https://github.com/llvm/llvm-project/commit/2aed07e96c7a4f777e854fec619842c4289f8fbd + +Change-Id: I9a81efb7f08c24be1f1a09e5dbe5ab6587efa09c +--- + lib/comgr/src/comgr-compiler.cpp | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/comgr/src/comgr-compiler.cpp b/lib/comgr/src/comgr-compiler.cpp +index db4c8d5..465187e 100644 +--- a/lib/comgr/src/comgr-compiler.cpp ++++ b/lib/comgr/src/comgr-compiler.cpp +@@ -453,7 +453,7 @@ static bool executeAssemblerImpl(AssemblerInvocation &Opts, + std::unique_ptr MCE; + std::unique_ptr MAB; + if (Opts.ShowEncoding) { +- MCE.reset(TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx)); ++ MCE.reset(TheTarget->createMCCodeEmitter(*MCII, Ctx)); + MCTargetOptions Options; + MAB.reset(TheTarget->createMCAsmBackend(*STI, *MRI, Options)); + } +@@ -472,7 +472,7 @@ static bool executeAssemblerImpl(AssemblerInvocation &Opts, + Out = BOS.get(); + } + +- MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx); ++ MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, Ctx); + MCTargetOptions Options; + MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*STI, *MRI, Options); + Triple T(Opts.Triple); +-- +2.37.2 + diff --git a/0001-Revert-Add-gfx1036.patch b/0001-Revert-Add-gfx1036.patch deleted file mode 100644 index 21f63fd..0000000 --- a/0001-Revert-Add-gfx1036.patch +++ /dev/null @@ -1,39 +0,0 @@ -From a98767e16aaa3dfaa46b4363c33fca25193d5fd3 Mon Sep 17 00:00:00 2001 -From: Jeremy Newton -Date: Sun, 3 Jul 2022 15:47:19 -0400 -Subject: [PATCH] Revert "Add gfx1036" - -This reverts commit 2841ad1b1a2697a7df4a81b53d23a5fc3d90c112. - -Fix llvm 14 build, gfx1036 will be in llvm 15 or later. ---- - lib/comgr/src/comgr-isa-metadata.def | 1 - - lib/comgr/test/get_data_isa_name_test.c | 1 - - 2 files changed, 2 deletions(-) - -diff --git a/lib/comgr/src/comgr-isa-metadata.def b/lib/comgr/src/comgr-isa-metadata.def -index 1323e66..62c3838 100644 ---- a/lib/comgr/src/comgr-isa-metadata.def -+++ b/lib/comgr/src/comgr-isa-metadata.def -@@ -79,6 +79,5 @@ HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1032", false, false, EF_AMDGPU_MACH_AMDGCN - HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1033", false, false, EF_AMDGPU_MACH_AMDGCN_GFX1033, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 8, 256, 256) - HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1034", false, false, EF_AMDGPU_MACH_AMDGCN_GFX1034, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 8, 256, 256) - HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1035", false, false, EF_AMDGPU_MACH_AMDGCN_GFX1035, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 8, 256, 256) --HANDLE_ISA("amdgcn-amd-amdhsa-", "gfx1036", false, false, EF_AMDGPU_MACH_AMDGCN_GFX1036, true, 65536, 32, 4, 40, 1024, 106, 800, 106, 8, 256, 256) - - #undef HANDLE_ISA -diff --git a/lib/comgr/test/get_data_isa_name_test.c b/lib/comgr/test/get_data_isa_name_test.c -index 90f069f..b4afa89 100644 ---- a/lib/comgr/test/get_data_isa_name_test.c -+++ b/lib/comgr/test/get_data_isa_name_test.c -@@ -94,7 +94,6 @@ static isa_features_t IsaFeatures[] = { - {"amdgcn-amd-amdhsa--gfx1033", false, false, none, false, none}, - {"amdgcn-amd-amdhsa--gfx1034", false, false, none, false, none}, - {"amdgcn-amd-amdhsa--gfx1035", false, false, none, false, none}, -- {"amdgcn-amd-amdhsa--gfx1036", false, false, none, false, none}, - }; - - static size_t IsaFeaturesSize = sizeof(IsaFeatures) / sizeof(IsaFeatures[0]); --- -2.34.1 - diff --git a/0002-Cleanup-after-https-reviews.llvm.org-D120433.patch b/0002-Cleanup-after-https-reviews.llvm.org-D120433.patch new file mode 100644 index 0000000..7469075 --- /dev/null +++ b/0002-Cleanup-after-https-reviews.llvm.org-D120433.patch @@ -0,0 +1,61 @@ +From ee0230ccbb8a9027734fd543818cd6e124c4bf3e Mon Sep 17 00:00:00 2001 +From: Scott Linder +Date: Fri, 25 Feb 2022 18:57:29 +0000 +Subject: [PATCH 2/4] Cleanup after https://reviews.llvm.org/D120433 + +The implementations of the constructor/destructor for Symbolizer depend +on the full definition of SymbolizableObjectFile, which is no longer +included upstream via just ObjectFile.h + +Move the implementations into the .cpp file and include the +SymbolizableObjectFile.h header directly. + +Change-Id: I5cd869a472e847dc02e472b3a150199d9f3e813a +--- + lib/comgr/src/comgr-symbolizer.cpp | 7 +++++++ + lib/comgr/src/comgr-symbolizer.h | 4 ++-- + 2 files changed, 9 insertions(+), 2 deletions(-) + +diff --git a/lib/comgr/src/comgr-symbolizer.cpp b/lib/comgr/src/comgr-symbolizer.cpp +index bbbfbd4..a24dc26 100644 +--- a/lib/comgr/src/comgr-symbolizer.cpp ++++ b/lib/comgr/src/comgr-symbolizer.cpp +@@ -36,6 +36,8 @@ + * + ******************************************************************************/ + ++ ++#include "llvm/DebugInfo/Symbolize/SymbolizableObjectFile.h" + #include "comgr-symbolizer.h" + #include "llvm/BinaryFormat/Magic.h" + #include "llvm/Support/Error.h" +@@ -55,6 +57,11 @@ static llvm::symbolize::PrinterConfig getDefaultPrinterConfig() { + return Config; + } + ++Symbolizer::Symbolizer(std::unique_ptr &&CodeObject, ++ PrintSymbolCallback PrintSymbol) ++ : CodeObject(std::move(CodeObject)), PrintSymbol(PrintSymbol) {} ++Symbolizer::~Symbolizer() = default; ++ + amd_comgr_status_t + Symbolizer::create(DataObject *CodeObjectP, PrintSymbolCallback PrintSymbol, + amd_comgr_symbolizer_info_t *SymbolizeInfo) { +diff --git a/lib/comgr/src/comgr-symbolizer.h b/lib/comgr/src/comgr-symbolizer.h +index 3777790..cecaff0 100644 +--- a/lib/comgr/src/comgr-symbolizer.h ++++ b/lib/comgr/src/comgr-symbolizer.h +@@ -54,8 +54,8 @@ typedef void (*PrintSymbolCallback)(const char *, void *); + + struct Symbolizer { + Symbolizer(std::unique_ptr &&CodeObject, +- PrintSymbolCallback PrintSymbol) +- : CodeObject(std::move(CodeObject)), PrintSymbol(PrintSymbol) {} ++ PrintSymbolCallback PrintSymbol); ++ ~Symbolizer(); + + static amd_comgr_symbolizer_info_t convert(Symbolizer *SymbolizerObj) { + amd_comgr_symbolizer_info_t Handle = { +-- +2.37.2 + diff --git a/0003-Changes-required-for-the-following-llvm-commit.patch b/0003-Changes-required-for-the-following-llvm-commit.patch new file mode 100644 index 0000000..2ff367e --- /dev/null +++ b/0003-Changes-required-for-the-following-llvm-commit.patch @@ -0,0 +1,75 @@ +From 469a17ab7eda6ec6d447db5a15efaffcc6aafb90 Mon Sep 17 00:00:00 2001 +From: Konstantin Zhuravlyov +Date: Tue, 10 May 2022 23:51:06 -0400 +Subject: [PATCH 3/4] Changes required for the following llvm-commit: + + - https://github.com/llvm/llvm-project/commit/bc150a07f1a14a7923a29499b568d799f7214912 + +Change-Id: Iee54505365c838b89c5e69a661f276e50ea5d213 +--- + lib/comgr/test/demangle_test.c | 26 +++++++++++++------------- + 1 file changed, 13 insertions(+), 13 deletions(-) + +diff --git a/lib/comgr/test/demangle_test.c b/lib/comgr/test/demangle_test.c +index 05c504e..3042bac 100644 +--- a/lib/comgr/test/demangle_test.c ++++ b/lib/comgr/test/demangle_test.c +@@ -63,42 +63,42 @@ int main(int argc, char *argv[]) { + test("_Znwm", "operator new(unsigned long)"); + test("_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_", + "std::__cxx11::basic_string, " +- "std::allocator >::operator=(std::__cxx11::basic_string, std::allocator > const&)"); ++ "std::allocator>::operator=(std::__cxx11::basic_string, std::allocator> const&)"); + test("_ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_", + "std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, " + "std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)"); + test("_ZSt17__throw_bad_allocv", "std::__throw_bad_alloc()"); + test("_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev", + "std::__cxx11::basic_string, " +- "std::allocator >::~basic_string()"); ++ "std::allocator>::~basic_string()"); + test("_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED1Ev", + "std::__cxx11::basic_string, " +- "std::allocator >::~basic_string()"); ++ "std::allocator>::~basic_string()"); + test("_ZSt18_Rb_tree_incrementPSt18_Rb_tree_node_base", + "std::_Rb_tree_increment(std::_Rb_tree_node_base*)"); + test("_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev", + "std::__cxx11::basic_string, " +- "std::allocator >::basic_string()"); ++ "std::allocator>::basic_string()"); + test("_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__" + "cxx1112basic_stringIS4_S5_T1_EE", +- "std::basic_ostream >& std::operator<<" +- ", std::allocator " +- ">(std::basic_ostream >&, " ++ "std::basic_ostream>& std::operator<<" ++ ", std::allocator" ++ ">(std::basic_ostream>&, " + "std::__cxx11::basic_string, " +- "std::allocator > const&)"); ++ "std::allocator> const&)"); + test("_ZdlPv", "operator delete(void*)"); + test("_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc", +- "std::basic_ostream >& std::operator<<" +- " >(std::basic_ostream >&, char const*)"); ++ "std::basic_ostream>& std::operator<<" ++ ">(std::basic_ostream>&, char const*)"); + test("_ZdlPvm", "operator delete(void*, unsigned long)"); + test("_ZSt18_Rb_tree_decrementPSt18_Rb_tree_node_base", + "std::_Rb_tree_decrement(std::_Rb_tree_node_base*)"); + test("_ZNSaIcED1Ev", "std::allocator::~allocator()"); + test("_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EPKcRKS3_", + "std::__cxx11::basic_string, " +- "std::allocator >::basic_string(char const*, std::allocator " ++ "std::allocator>::basic_string(char const*, std::allocator " + "const&)"); + test("_ZNSt8ios_base4InitC1Ev", "std::ios_base::Init::Init()"); + test("_ZNSolsEi", "std::ostream::operator<<(int)"); +-- +2.37.2 + diff --git a/0004-remove-references-to-GNU-for-compression-type-per-up.patch b/0004-remove-references-to-GNU-for-compression-type-per-up.patch new file mode 100644 index 0000000..f0df781 --- /dev/null +++ b/0004-remove-references-to-GNU-for-compression-type-per-up.patch @@ -0,0 +1,35 @@ +From 8181b164e7e96d6f1f3f52a36bdcdbba607ca778 Mon Sep 17 00:00:00 2001 +From: Ron Lieberman +Date: Sun, 24 Jul 2022 10:03:47 -0500 +Subject: [PATCH 4/4] remove references to GNU for compression type , per + upstream + +see: [MC] Delete dead zlib-gnu code and simplify writeSectionData + +Change-Id: I571ceb9c3b54aff12b8366327c48e1a4669951c1 +--- + lib/comgr/src/comgr-compiler.cpp | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/lib/comgr/src/comgr-compiler.cpp b/lib/comgr/src/comgr-compiler.cpp +index 465187e..23fcb9d 100644 +--- a/lib/comgr/src/comgr-compiler.cpp ++++ b/lib/comgr/src/comgr-compiler.cpp +@@ -244,13 +244,12 @@ bool AssemblerInvocation::createFromArgs(AssemblerInvocation &Opts, + OPT_compress_debug_sections_EQ)) { + if (A->getOption().getID() == OPT_compress_debug_sections) { + // TODO: be more clever about the compression type auto-detection +- Opts.CompressDebugSections = llvm::DebugCompressionType::GNU; ++ Opts.CompressDebugSections = llvm::DebugCompressionType::Z; + } else { + Opts.CompressDebugSections = + llvm::StringSwitch(A->getValue()) + .Case("none", llvm::DebugCompressionType::None) + .Case("zlib", llvm::DebugCompressionType::Z) +- .Case("zlib-gnu", llvm::DebugCompressionType::GNU) + .Default(llvm::DebugCompressionType::None); + } + } +-- +2.37.2 + diff --git a/rocm-compilersupport.spec b/rocm-compilersupport.spec index bb4e650..28d35f7 100644 --- a/rocm-compilersupport.spec +++ b/rocm-compilersupport.spec @@ -5,7 +5,7 @@ Name: rocm-compilersupport Version: %{rocm_version} -Release: 2%{?dist} +Release: 3%{?dist} Summary: Various AMD ROCm LLVM related services Url: https://github.com/RadeonOpenCompute/ROCm-CompilerSupport @@ -15,14 +15,20 @@ Source0: https://github.com/RadeonOpenCompute/%{upstreamname}/archive/ref #https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/commit/5495595234e8fb7b1715429cfa41fe6d9c0e710c Patch0: 0001-Detect-if-clang-is-static-or-shared.patch -#Revert one patch to avoid compilation issue: -# gfx1036 defines are not present in llvm 14 (should be in 15) -Patch100: 0001-Revert-Add-gfx1036.patch +#LLVM 15 patches cherry-picked from upstream's amd-stg-open branch: +#https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/commit/47fe512bd69dfb43a701ab3747cd7475c30b78fc +Patch1: 0001-Comgr-changes-needed-for-https-github.com-llvm-llvm-.patch +#https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/commit/d2318e14dd6f9172a392d40521d7e38c5e0de9e7 +Patch2: 0002-Cleanup-after-https-reviews.llvm.org-D120433.patch +#https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/commit/47ce7412513149525760fe30e0a6d8b2470cbbc9 +Patch3: 0003-Changes-required-for-the-following-llvm-commit.patch +#https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/commit/ec7df87560359d70559c214f102cce02358b7369 +Patch4: 0004-remove-references-to-GNU-for-compression-type-per-up.patch BuildRequires: cmake -BuildRequires: clang-devel >= 14.0.0 +BuildRequires: clang-devel >= 15.0.0 BuildRequires: lld-devel -BuildRequires: llvm-devel >= 14.0.0 +BuildRequires: llvm-devel >= 15.0.0 BuildRequires: rocm-device-libs >= %(echo %{version} | sed 's/\.[0-9]*$/.0/') BuildRequires: zlib-devel @@ -94,6 +100,9 @@ sed -i 's/lib\(\/clang\)/%{_lib}\1/' lib/comgr/src/comgr-compiler.cpp %{_libdir}/cmake/amd_comgr %changelog +* Mon Sep 19 2022 Jeremy Newton - 5.2.0-3 +- Rebuilt against LLVM 15 + * Sat Jul 23 2022 Fedora Release Engineering - 5.2.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild