Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
b8e810229c
!67 [手工同步PR]riscv: 不打包个别文件
From: @laokz 
Reviewed-by: @cf-zhao 
Signed-off-by: @cf-zhao
2024-12-25 03:07:35 +00:00
laokz
883de9278f
riscv64: not package non-exist .a files 2024-12-22 09:06:57 +00:00
openeuler-ci-bot
af9482504e
!64 init for Multi-Version LLVM-18.1.8
From: @liyunfei33 
Reviewed-by: @eastb233 
Signed-off-by: @eastb233
2024-12-10 07:22:09 +00:00
liyunfei
5fe821c116 init for Multi-Version LLVM-18.1.8
Signed-off-by: liyunfei <liyunfei33@huawei.com>
2024-12-09 10:57:48 +08:00
openeuler-ci-bot
e4a863997f
!55 adopt to new cmake macro
From: @fundawang 
Reviewed-by: @liyunfei33 
Signed-off-by: @liyunfei33
2024-11-29 06:39:06 +00:00
Funda Wang
7f781ad8c0 adopt to new cmake macro 2024-11-27 10:43:58 +08:00
openeuler-ci-bot
73530ba624
!42 Add toolchain_clang build support
From: @liyunfei33 
Reviewed-by: @cf-zhao 
Signed-off-by: @cf-zhao
2024-07-12 13:54:14 +00:00
liyunfei
04a2d3b56a Add toolchain_clang build support
Signed-off-by: liyunfei <liyunfei33@huawei.com>
2024-07-08 11:44:15 +08:00
openeuler-ci-bot
36a1929a7d
!33 Remove unused patch file.
From: @xiongzhou4 
Reviewed-by: @cf-zhao 
Signed-off-by: @cf-zhao
2024-04-12 01:40:13 +00:00
xiongzhou4
a9528f0cef Remove unused patch file. 2024-04-01 15:03:59 +08:00
8 changed files with 82 additions and 137 deletions

View File

@ -1,109 +0,0 @@
From 963d19d86cca708957055f3072cbe8473c8e52e3 Mon Sep 17 00:00:00 2001
From: xiongzhou4 <xiongzhou4@huawei.com>
Date: Thu, 15 Jun 2023 20:34:42 +0800
Subject: [PATCH] [Backport] [BOLT] [AArch64] Handle data at the beginning of a
function when disassembling and building CFG.
---
bolt/src/BinaryFunction.cpp | 11 +++++++----
bolt/src/BinaryFunction.h | 9 +++++++++
bolt/src/Exceptions.cpp | 2 +-
bolt/test/AArch64/data-at-0-offset.c | 17 +++++++++++++++++
4 files changed, 34 insertions(+), 5 deletions(-)
create mode 100644 bolt/test/AArch64/data-at-0-offset.c
diff --git a/bolt/src/BinaryFunction.cpp b/bolt/src/BinaryFunction.cpp
index 9414b83ad..93de63d3f 100644
--- a/bolt/src/BinaryFunction.cpp
+++ b/bolt/src/BinaryFunction.cpp
@@ -1445,6 +1445,9 @@ add_instruction:
addInstruction(Offset, std::move(Instruction));
}
+ if (uint64_t Offset = getFirstInstructionOffset())
+ Labels[Offset] = BC.Ctx->createNamedTempSymbol();
+
clearList(Relocations);
if (!IsSimple) {
@@ -1987,7 +1990,7 @@ bool BinaryFunction::buildCFG(MCPlusBuilder::AllocatorIdTy AllocatorId) {
return false;
assert(BasicBlocks.empty() && "basic block list should be empty");
- assert((Labels.find(0) != Labels.end()) &&
+ assert((Labels.find(getFirstInstructionOffset()) != Labels.end()) &&
"first instruction should always have a label");
// Create basic blocks in the original layout order:
@@ -2087,9 +2090,9 @@ bool BinaryFunction::buildCFG(MCPlusBuilder::AllocatorIdTy AllocatorId) {
updateOffset(LastInstrOffset);
}
}
- if (Offset == 0) {
- // Add associated CFI pseudos in the first offset (0)
- addCFIPlaceholders(0, InsertBB);
+ if (Offset == getFirstInstructionOffset()) {
+ // Add associated CFI pseudos in the first offset.
+ addCFIPlaceholders(Offset, InsertBB);
}
const bool IsBlockEnd = MIB->isTerminator(Instr);
diff --git a/bolt/src/BinaryFunction.h b/bolt/src/BinaryFunction.h
index a824f3d58..3b435cfb3 100644
--- a/bolt/src/BinaryFunction.h
+++ b/bolt/src/BinaryFunction.h
@@ -967,6 +967,15 @@ public:
return const_cast<BinaryFunction *>(this)->getInstructionAtOffset(Offset);
}
+ /// Return offset for the first instruction. If there is data at the
+ /// beginning of a function then offset of the first instruction could
+ /// be different from 0.
+ uint64_t getFirstInstructionOffset() const {
+ if (Instructions.empty())
+ return 0;
+ return Instructions.begin()->first;
+ }
+
/// Return jump table that covers a given \p Address in memory.
JumpTable *getJumpTableContainingAddress(uint64_t Address) {
auto JTI = JumpTables.upper_bound(Address);
diff --git a/bolt/src/Exceptions.cpp b/bolt/src/Exceptions.cpp
index f73054aa8..0a64e3fca 100644
--- a/bolt/src/Exceptions.cpp
+++ b/bolt/src/Exceptions.cpp
@@ -499,7 +499,7 @@ bool CFIReaderWriter::fillCFIInfoFor(BinaryFunction &Function) const {
Optional<uint64_t> LSDA = CurFDE.getLSDAAddress();
Function.setLSDAAddress(LSDA ? *LSDA : 0);
- uint64_t Offset = 0;
+ uint64_t Offset = Function.getFirstInstructionOffset();
uint64_t CodeAlignment = CurFDE.getLinkedCIE()->getCodeAlignmentFactor();
uint64_t DataAlignment = CurFDE.getLinkedCIE()->getDataAlignmentFactor();
if (CurFDE.getLinkedCIE()->getPersonalityAddress()) {
diff --git a/bolt/test/AArch64/data-at-0-offset.c b/bolt/test/AArch64/data-at-0-offset.c
new file mode 100644
index 000000000..e0c689a19
--- /dev/null
+++ b/bolt/test/AArch64/data-at-0-offset.c
@@ -0,0 +1,17 @@
+// RUN: %clang %cflags -O2 -fPIE -Wl,-q -pie %s -o %t.exe
+// RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
+// CHECK-NOT: BOLT-WARNING: unable to disassemble instruction at offset
+
+void extra_space() {
+ asm volatile(".rept 256\n"
+ " .byte 0xff\n"
+ ".endr\n");
+ return;
+}
+
+int main(int argc, char **argv) {
+ void (*fn)(void);
+ fn = extra_space + 256;
+ fn();
+ return 0;
+}
--
2.33.0

View File

@ -1,9 +1,22 @@
# llvm-bolt
# llvm-bolt-latest
#### Description
BOLT is a post-link optimizer developed to speed up large applications.
It achieves the improvements by optimizing application's code layout based
on execution profile gathered by sampling profiler, such as Linux perf tool.
llvm-bolt is a post-link optimizer developed to speed up large applications
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution

View File

@ -1,9 +1,23 @@
# llvm-bolt
# llvm-bolt-latest
#### 介绍
BOLT is a post-link optimizer developed to speed up large applications.
It achieves the improvements by optimizing application's code layout based
on execution profile gathered by sampling profiler, such as Linux perf tool.
llvm-bolt is a post-link optimizer developed to speed up large applications
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献

View File

@ -1,28 +1,31 @@
%bcond_without sys_llvm
%bcond_with check
%bcond_without toolchain_clang
%global maj_ver 17
%global min_ver 0
%global patch_ver 6
%if %{with toolchain_clang}
%global toolchain clang
%endif
%global maj_ver 18
%global min_ver 1
%global patch_ver 8
%global bolt_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global bolt_srcdir llvm-project-%{bolt_version}.src
%if %{with sys_llvm}
%global pkg_name llvm-bolt
%global install_prefix %{_prefix}
%else
%global pkg_name llvm-bolt%{maj_ver}
%global install_prefix %{_libdir}/llvm%{maj_ver}
%endif
%global _scl_prefix /opt/openEuler
%{?scl:%scl_package %scl}
%{!?scl:%global scl_prefix llvm-toolset-%{maj_ver}-}
%{!?scl:%global pkg_name %{name}}
%global install_prefix %{!?scl:%{_scl_prefix}/llvm-toolset-%{maj_ver}/root}%{_prefix}
%global install_datadir %{!?scl:%{_scl_prefix}/llvm-toolset-%{maj_ver}/root}%{_datadir}
%global install_bindir %{install_prefix}/bin
%global install_libdir %{install_prefix}/lib
%global install_docdir %{install_prefix}/share/doc
%global max_link_jobs 2
Name: %{pkg_name}
Name: %{?scl_prefix}llvm-bolt
Version: %{bolt_version}
Release: 1
Release: 2
Summary: BOLT is a post-link optimizer developed to speed up large applications
License: Apache 2.0
URL: https://github.com/llvm/llvm-project/tree/main/bolt
@ -43,6 +46,11 @@ BuildRequires: zlib-devel
BuildRequires: python3-lit
BuildRequires: python3-psutil
BuildRequires: doxygen
%if %{with toolchain_clang}
BuildRequires: clang
%endif
%{?scl:Requires: %scl_runtime}
%description
BOLT is a post-link optimizer developed to speed up large applications.
@ -52,7 +60,7 @@ on execution profile gathered by sampling profiler, such as Linux perf tool.
%package doc
Summary: Documentation for BOLT
BuildArch: noarch
Requires: %{name} = %{version}-%{release}
Requires: %{pkg_name} = %{version}-%{release}
%description doc
Documentation for the BOLT optimizer
@ -77,6 +85,10 @@ Documentation for the BOLT optimizer
-DLLVM_EXTERNAL_LIT=%{_bindir}/lit \
-DLLVM_ENABLE_PROJECTS="bolt" \
-DLLVM_PARALLEL_LINK_JOBS=%{max_link_jobs} \
%if "%{toolchain}" == "clang"
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
%endif
%ifarch %ix86 x86_64
-DLLVM_TARGETS_TO_BUILD="X86"
%endif
@ -135,19 +147,30 @@ rm -f %{buildroot}/%{_builddir}/%{bolt_srcdir}/%{_vpath_builddir}/%{_lib}/lib*.a
%{install_bindir}/merge-fdata
%{install_bindir}/perf2bolt
%{install_bindir}/llvm-bolt-heatmap
%ifarch x86_64
%ifnarch riscv64
%{install_libdir}/libbolt_rt_hugify.a
%{install_libdir}/libbolt_rt_instr.a
%endif
%exclude %{_builddir}/%{bolt_srcdir}/lib/*
%files doc
%doc %{install_docdir}
%changelog
* Mon Dec 23 2024 laokz <zhangkai@iscas.ac.cn> - 18.1.8-2
- riscv64: not package non-exist .a files
* Fri Dec 6 2024 liyunfei <liyunfei33@huawei.com> - 18.1.8-1
- init for Multi-Version LLVM-18.1.8
* Tue Nov 12 2024 Funda Wang <fundawang@yeah.net> - 17.0.6-3
- adopt to new cmake macro
- build with gcc now, as llvm/clang will produce linking error
against libLLVMTableGen.a now
* Fri Jul 5 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-2
- Add toolchain_clang build support
* Mon Dec 4 2023 zhoujing <zhoujing106@huawei.com> 17.0.6-1
- Update to 17.0.6

4
llvm-bolt.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: github
src_repo: llvm/llvm-project
tag_prefix: ^llvmorg-
separator: .

Binary file not shown.

Binary file not shown.