Update to LLVM 16.0.1

This commit is contained in:
Tulio Magno Quites Machado Filho 2023-04-13 18:55:46 -03:00
parent 9324cd72ed
commit 5a99404fbf
6 changed files with 64 additions and 177 deletions

View File

@ -1,137 +0,0 @@
From 9921197920fc3e9ad9605bd8fe0e835ca2dd41a5 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <spop@amazon.com>
Date: Wed, 25 Jan 2023 18:40:48 +0000
Subject: [PATCH] [AArch64] fix bug #55005 handle DW_CFA_GNU_NegateRAState
GCC on AArch64 uses DW_CFA_GNU_NegateRAState for return address signing.
Differential Revision: https://reviews.llvm.org/D142572
---
bolt/lib/Core/Exceptions.cpp | 19 ++++--
.../Inputs/dw_cfa_gnu_window_save.yaml | 62 +++++++++++++++++++
bolt/test/AArch64/dw_cfa_gnu_window_save.test | 8 +++
3 files changed, 83 insertions(+), 6 deletions(-)
create mode 100644 bolt/test/AArch64/Inputs/dw_cfa_gnu_window_save.yaml
create mode 100644 bolt/test/AArch64/dw_cfa_gnu_window_save.test
diff --git a/bolt/lib/Core/Exceptions.cpp b/bolt/lib/Core/Exceptions.cpp
index f8eabcf48f83..34e7454abfb0 100644
--- a/bolt/lib/Core/Exceptions.cpp
+++ b/bolt/lib/Core/Exceptions.cpp
@@ -626,18 +626,25 @@ bool CFIReaderWriter::fillCFIInfoFor(BinaryFunction &Function) const {
errs() << "BOLT-WARNING: DW_CFA_MIPS_advance_loc unimplemented\n";
return false;
case DW_CFA_GNU_window_save:
+ // DW_CFA_GNU_window_save and DW_CFA_GNU_NegateRAState just use the same
+ // id but mean different things. The latter is used in AArch64.
+ if (Function.getBinaryContext().isAArch64()) {
+ Function.addCFIInstruction(
+ Offset, MCCFIInstruction::createNegateRAState(nullptr));
+ break;
+ }
+ if (opts::Verbosity >= 1)
+ errs() << "BOLT-WARNING: DW_CFA_GNU_window_save unimplemented\n";
+ return false;
case DW_CFA_lo_user:
case DW_CFA_hi_user:
- if (opts::Verbosity >= 1) {
- errs() << "BOLT-WARNING: DW_CFA_GNU_* and DW_CFA_*_user "
- "unimplemented\n";
- }
+ if (opts::Verbosity >= 1)
+ errs() << "BOLT-WARNING: DW_CFA_*_user unimplemented\n";
return false;
default:
- if (opts::Verbosity >= 1) {
+ if (opts::Verbosity >= 1)
errs() << "BOLT-WARNING: Unrecognized CFI instruction: " << Instr.Opcode
<< '\n';
- }
return false;
}
diff --git a/bolt/test/AArch64/Inputs/dw_cfa_gnu_window_save.yaml b/bolt/test/AArch64/Inputs/dw_cfa_gnu_window_save.yaml
new file mode 100644
index 000000000000..faa32e0897c6
--- /dev/null
+++ b/bolt/test/AArch64/Inputs/dw_cfa_gnu_window_save.yaml
@@ -0,0 +1,62 @@
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+ Machine: EM_AARCH64
+ Entry: 0x4100C0
+ProgramHeaders:
+ - Type: PT_LOAD
+ Flags: [ PF_X, PF_R ]
+ FirstSec: .init
+ LastSec: .fini
+ VAddr: 0x410000
+ Align: 0x10000
+Sections:
+ - Name: .init
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x410000
+ AddressAlign: 0x4
+ Offset: 0x10000
+ Content: 3F2303D5FD7BBFA9FD0300913F000094FD7BC1A8BF2303D5C0035FD6
+ - Name: .plt
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x410020
+ AddressAlign: 0x10
+ Content: F07BBFA9700100F011FE47F910E23F9120021FD61F2003D51F2003D51F2003D590010090110240F91002009120021FD690010090110640F91022009120021FD690010090110A40F91042009120021FD6
+ - Name: .text
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x410080
+ AddressAlign: 0x40
+ Content: 00008052C0035FD61F2003D51F2003D51F2003D51F2003D51F2003D51F2003D51F2003D51F2003D51F2003D51F2003D51F2003D51F2003D51F2003D51F2003D55F2403D51D0080D21E0080D2E50300AAE10340F9E2230091E60300910000009000D00391030080D2040080D2D5FFFF97D8FFFF975F2403D5E2FFFF171F2003D55F2403D5C0035FD6600100F000F047F9400000B4D3FFFF17C0035FD61F2003D5800100908101009000800091218000913F0000EBC000005481000090210840F9610000B4F00301AA00021FD6C0035FD680010090810100900080009121800091210000CB22FC7FD3410C818B21FC4193C10000B482000090420C40F9620000B4F00302AA00021FD6C0035FD63F2303D5FD7BBEA9FD030091F30B00F9930100906082403980000035DEFFFF972000805260820039F30B40F9FD7BC2A8BF2303D5C0035FD65F2403D5E2FFFF17
+ - Name: .fini
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
+ Address: 0x4101CC
+ AddressAlign: 0x4
+ Content: 3F2303D5FD7BBFA9FD030091FD7BC1A8BF2303D5C0035FD6
+ - Name: .eh_frame
+ Type: SHT_PROGBITS
+ Flags: [ SHF_ALLOC ]
+ Address: 0x420068
+ AddressAlign: 0x8
+ Content: 1000000000000000017A520004781E011B0C1F0010000000180000003C00FFFF3C0000000041071E140000002C0000006800FFFF08000000000000000000000010000000440000007000FFFF300000000000000010000000580000008C00FFFF3C00000000000000240000006C000000B400FFFF3800000000412D410E209D049E0342930248DEDDD30E00412D0000001400000094000000C400FFFF08000000000000000000000010000000AC00000068FFFEFF080000000000000000000000
+ - Name: .rela.text
+ Type: SHT_RELA
+ Flags: [ SHF_INFO_LINK ]
+ Link: .symtab
+ AddressAlign: 0x8
+ Info: .text
+Symbols:
+ - Name: .text
+ Type: STT_SECTION
+ Section: .text
+ Value: 0x410080
+ - Name: _ITM_deregisterTMCloneTable
+ Binding: STB_WEAK
+ - Name: _ITM_registerTMCloneTable
+ Binding: STB_WEAK
+...
diff --git a/bolt/test/AArch64/dw_cfa_gnu_window_save.test b/bolt/test/AArch64/dw_cfa_gnu_window_save.test
new file mode 100644
index 000000000000..2e044b399720
--- /dev/null
+++ b/bolt/test/AArch64/dw_cfa_gnu_window_save.test
@@ -0,0 +1,8 @@
+# Check that llvm-bolt can handle DW_CFA_GNU_window_save on AArch64.
+
+RUN: yaml2obj %p/Inputs/dw_cfa_gnu_window_save.yaml &> %t.exe
+RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
+
+CHECK-NOT: paciasp
+CHECK-NOT: autiasp
+CHECK-NOT: ERROR: unable to fill CFI.
--
2.39.2

View File

@ -0,0 +1,25 @@
From fd47ab05e5abd98254d2bba012d81dbb00217812 Mon Sep 17 00:00:00 2001
From: Amy Huang <akhuang@google.com>
Date: Wed, 22 Mar 2023 15:55:18 -0700
Subject: [PATCH] Add "REQUIRES: asserts" to test that uses --debug-only flag
---
bolt/test/X86/section-end-sym.s | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bolt/test/X86/section-end-sym.s b/bolt/test/X86/section-end-sym.s
index a9bca5604ec1..38517bf7e071 100644
--- a/bolt/test/X86/section-end-sym.s
+++ b/bolt/test/X86/section-end-sym.s
@@ -1,7 +1,7 @@
## Check that BOLT doesn't consider end-of-section symbols (e.g., _etext) as
## functions.
-# REQUIRES: system-linux
+# REQUIRES: system-linux, asserts
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t.exe -q
--
2.39.2

View File

@ -0,0 +1,28 @@
From 1a8f3f96c2ff17b1404f4f748abeb9c5f69b6852 Mon Sep 17 00:00:00 2001
From: Muhammad Omair Javaid <omair.javaid@linaro.org>
Date: Wed, 12 Apr 2023 17:11:58 +0500
Subject: [PATCH] [BOLT] Fix section-end-sym.s test to only run x86/Linux
section-end-sym.s contains x86_64 assembly instruction execution on target.
I have changed REQURIES: field system-linux --> x86_64-linux
This came up while testing LLVM 16.0.1 release on AArch64 Linux.
---
bolt/test/X86/section-end-sym.s | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bolt/test/X86/section-end-sym.s b/bolt/test/X86/section-end-sym.s
index 38517bf7e071..cf1723c2563a 100644
--- a/bolt/test/X86/section-end-sym.s
+++ b/bolt/test/X86/section-end-sym.s
@@ -1,7 +1,7 @@
## Check that BOLT doesn't consider end-of-section symbols (e.g., _etext) as
## functions.
-# REQUIRES: system-linux, asserts
+# REQUIRES: x86_64-linux, asserts
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-linux %s -o %t.o
# RUN: ld.lld %t.o -o %t.exe -q
--
2.39.2

View File

@ -1,33 +0,0 @@
From 7768f63e5b7adc8a92b8f8041e9c1d298b011128 Mon Sep 17 00:00:00 2001
From: Rafael Auler <rafaelauler@fb.com>
Date: Wed, 25 Jan 2023 11:38:07 -0800
Subject: [PATCH] [BOLT][NFC] Remove C-style out of bounds array ref
Old code breaks build with libstdc++ with assertions. Fix it.
---
bolt/lib/Core/JumpTable.cpp | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/bolt/lib/Core/JumpTable.cpp b/bolt/lib/Core/JumpTable.cpp
index 2b1035d6ab71..65e1032c579b 100644
--- a/bolt/lib/Core/JumpTable.cpp
+++ b/bolt/lib/Core/JumpTable.cpp
@@ -70,12 +70,10 @@ bool bolt::JumpTable::replaceDestination(uint64_t JTAddress,
MCSymbol *NewDest) {
bool Patched = false;
const std::pair<size_t, size_t> Range = getEntriesForAddress(JTAddress);
- for (auto I = &Entries[Range.first], E = &Entries[Range.second]; I != E;
- ++I) {
- MCSymbol *&Entry = *I;
- if (Entry == OldDest) {
+ for (auto I = Range.first; I != Range.second; ++I) {
+ if (Entries[I] == OldDest) {
Patched = true;
- Entry = NewDest;
+ Entries[I] = NewDest;
}
}
return Patched;
--
2.39.2

View File

@ -7,7 +7,7 @@
%global maj_ver 16
%global min_ver 0
#global rc_ver 4
%global patch_ver 0
%global patch_ver 1
%global bolt_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global bolt_srcdir llvm-project-%{bolt_version}%{?rc_ver:rc%{rc_ver}}.src
@ -25,10 +25,11 @@ Source2: release-keys.asc
# BOLT is not respecting the component split of LLVM and requires some private
# header to be able in order to compile. Try to disable as much libraries as
# possible in order to reduce build time.
Patch12: rm-llvm-libs.diff
# Backports from LLVM 17.
Patch13: 0001-BOLT-NFC-Remove-C-style-out-of-bounds-array-ref.patch
Patch14: 0001-AArch64-fix-bug-55005-handle-DW_CFA_GNU_NegateRAStat.patch
Patch0: rm-llvm-libs.diff
# Backports from LLVM 17:
Patch1: 0001-Add-REQUIRES-asserts-to-test-that-uses-debug-only-fl.patch
Patch2: 0001-BOLT-Fix-section-end-sym.s-test-to-only-run-x86-Linu.patch
BuildRequires: gcc
BuildRequires: gcc-c++
@ -160,6 +161,9 @@ rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib}/lib*.a
%doc %{_pkgdocdir}
%changelog
* Thu Apr 13 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.1-1
- Update to LLVM 16.0.1
* Tue Mar 21 2023 Tulio Magno Quites Machado Filho <tuliom@redhat.com> - 16.0.0-1
- Update to LLVM 16.0.0

View File

@ -1,2 +1,2 @@
SHA512 (llvm-project-16.0.0.src.tar.xz) = 3f040abc1b03205693824aeff2ee6efb0cff25fe04bd5265141c093f294655a1f3fcda73cab9c57cbed7523c8f186a7e2484afce0792c55e90e3fb80450fabb7
SHA512 (llvm-project-16.0.0.src.tar.xz.sig) = 38e2449dce20cfbf813d1a9a68b36807722ac8ebb5ee07360fa215b2de8534d2329d3e41cfc3ed33e59e36714b94a6683a6d8077950bcf0037973492e0820fb3
SHA512 (llvm-project-16.0.1.src.tar.xz) = 98fc11c0ad90d5e5a2cb123b497b89a1583fe7f91b3ff05c335037801ef66cbfab08f6d2eff539f0da238e9685d4bc7a9fb2578e28864fc9e9357b84129cefaa
SHA512 (llvm-project-16.0.1.src.tar.xz.sig) = f42db28eb8280db06b1c78fa7a7aaea3a79499cecee1a64ce18c49b90c755b3a78fc93f01d1855887c7918ccc927c3b6147cfc916520f05d4cef65381ca6fe60