Skip to content

Commit df9fba6

Browse files
committed
LLVM and SPIRV-LLVM-Translator pulldown (WW02 2025)
LLVM: llvm/llvm-project@c1ea05e SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@f2d913cb1a22cb3
2 parents 2cfe8e6 + 2bae401 commit df9fba6

File tree

1,447 files changed

+56335
-23331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,447 files changed

+56335
-23331
lines changed

.github/workflows/build-ci-container.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ jobs:
5959

6060
- name: Test Container
6161
run: |
62-
for image in ${{ steps.vars.outputs.container-name-tag }} ${{ steps.vars.outputs.container-name }}; do
63-
podman run --rm -it $image /usr/bin/bash -x -c 'cd $HOME && printf '\''#include <iostream>\nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello'
62+
for image in ${{ steps.vars.outputs.container-name-tag }}; do
63+
# Use --pull=never to ensure we are testing the just built image.
64+
podman run --pull=never --rm -it $image /usr/bin/bash -x -c 'cd $HOME && printf '\''#include <iostream>\nint main(int argc, char **argv) { std::cout << "Hello\\n"; }'\'' | clang++ -x c++ - && ./a.out | grep Hello'
6465
done
6566
6667
push-ci-container:

.github/workflows/new-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
steps:
1616
- uses: llvm/actions/issue-labeler@main
1717
with:
18-
repo-token: ${{ secrets.GITHUB_TOKEN }}
18+
repo-token: ${{ secrets.ISSUE_SUBSCRIBER_TOKEN }}
1919
configuration-path: .github/new-issues-labeler.yml
2020
include-title: 1
2121
include-body: 0

.github/workflows/release-binaries.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}
8484
shell: bash
8585
run: |
86-
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user ${{ github.actor }} --user-token "$USER_TOKEN" check-permissions
86+
./llvm/utils/release/./github-upload-release.py --token "$GITHUB_TOKEN" --user "$GITHUB_ACTOR" --user-token "$USER_TOKEN" check-permissions
8787
8888
- name: Collect Variables
8989
id: vars
@@ -102,8 +102,8 @@ jobs:
102102
release_version="$trimmed"
103103
ref="llvmorg-$release_version"
104104
else
105-
release_version="${{ (github.event_name == 'pull_request' && format('PR{0}', github.event.pull_request.number)) || 'CI'}}-${{ github.sha }}"
106-
ref=${{ github.sha }}
105+
release_version="${{ (github.event_name == 'pull_request' && format('PR{0}', github.event.pull_request.number)) || 'CI'}}-$GITHUB_SHA"
106+
ref="$GITHUB_SHA"
107107
fi
108108
if [ -n "${{ inputs.upload }}" ]; then
109109
upload="${{ inputs.upload }}"
@@ -114,20 +114,20 @@ jobs:
114114
echo "ref=$ref" >> $GITHUB_OUTPUT
115115
echo "upload=$upload" >> $GITHUB_OUTPUT
116116
117-
release_binary_basename="LLVM-$release_version-${{ runner.os }}-${{ runner.arch }}"
117+
release_binary_basename="LLVM-$release_version-$RUNNER_OS-$RUNNER_ARCH"
118118
echo "release-binary-basename=$release_binary_basename" >> $GITHUB_OUTPUT
119119
echo "release-binary-filename=$release_binary_basename.tar.xz" >> $GITHUB_OUTPUT
120120
121121
# Detect necessary CMake flags
122-
target="${{ runner.os }}-${{ runner.arch }}"
122+
target="$RUNNER_OS-$RUNNER_ARCH"
123123
echo "enable-pgo=false" >> $GITHUB_OUTPUT
124124
target_cmake_flags="-DLLVM_RELEASE_ENABLE_PGO=OFF"
125125
# The macOS builds try to cross compile some libraries so we need to
126126
# add extra CMake args to disable them.
127127
# See https://github.com/llvm/llvm-project/issues/99767
128-
if [ "${{ runner.os }}" = "macOS" ]; then
128+
if [ "$RUNNER_OS" = "macOS" ]; then
129129
target_cmake_flags="$target_cmake_flags -DBOOTSTRAP_COMPILER_RT_ENABLE_IOS=OFF"
130-
if [ "${{ runner.arch }}" = "ARM64" ]; then
130+
if [ "$RUNNER_ARCH" = "ARM64" ]; then
131131
arches=arm64
132132
else
133133
arches=x86_64
@@ -137,7 +137,7 @@ jobs:
137137
138138
build_flang="true"
139139
140-
if [ "${{ runner.os }}" = "Windows" ]; then
140+
if [ "$RUNNER_OS" = "Windows" ]; then
141141
# The build times out on Windows, so we need to disable LTO.
142142
target_cmake_flags="$target_cmake_flags -DLLVM_RELEASE_ENABLE_LTO=OFF"
143143
fi

bolt/docs/CommandLineArgumentReference.md

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -931,15 +931,6 @@
931931

932932
Remove redundant Address-Size override prefix
933933

934-
### BOLT options in relocation mode:
935-
936-
- `--align-macro-fusion=<value>`
937-
938-
Fix instruction alignment for macro-fusion (x86 relocation mode)
939-
- `none`: do not insert alignment no-ops for macro-fusion
940-
- `hot`: only insert alignment no-ops on hot execution paths (default)
941-
- `all`: always align instructions to allow macro-fusion
942-
943934
### BOLT instrumentation options:
944935

945936
`llvm-bolt <executable> -instrument [-o outputfile] <instrumented-executable>`

bolt/include/bolt/Core/BinaryData.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ class BinaryData {
169169
return Parent && (Parent == BD || Parent->isAncestorOf(BD));
170170
}
171171

172+
void updateSize(uint64_t N) {
173+
if (N > Size)
174+
Size = N;
175+
}
176+
172177
void setIsMoveable(bool Flag) { IsMoveable = Flag; }
173178
void setSection(BinarySection &NewSection);
174179
void setOutputSection(BinarySection &NewSection) {

bolt/lib/Core/BinaryContext.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,7 @@ MCSymbol *BinaryContext::registerNameAtAddress(StringRef Name, uint64_t Address,
10761076
BD = GAI->second;
10771077
if (!BD->hasName(Name)) {
10781078
GlobalSymbols[Name] = BD;
1079+
BD->updateSize(Size);
10791080
BD->Symbols.push_back(Symbol);
10801081
}
10811082
}

bolt/lib/Rewrite/LinuxKernelRewriter.cpp

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include "llvm/Support/CommandLine.h"
2222
#include "llvm/Support/Debug.h"
2323
#include "llvm/Support/Errc.h"
24+
#include "llvm/Support/ErrorOr.h"
25+
#include <regex>
2426

2527
#define DEBUG_TYPE "bolt-linux"
2628

@@ -89,6 +91,34 @@ static cl::opt<bool>
8991

9092
} // namespace opts
9193

94+
/// Linux kernel version
95+
struct LKVersion {
96+
LKVersion() {}
97+
LKVersion(unsigned Major, unsigned Minor, unsigned Rev)
98+
: Major(Major), Minor(Minor), Rev(Rev) {}
99+
100+
bool operator<(const LKVersion &Other) const {
101+
return std::make_tuple(Major, Minor, Rev) <
102+
std::make_tuple(Other.Major, Other.Minor, Other.Rev);
103+
}
104+
105+
bool operator>(const LKVersion &Other) const { return Other < *this; }
106+
107+
bool operator<=(const LKVersion &Other) const { return !(*this > Other); }
108+
109+
bool operator>=(const LKVersion &Other) const { return !(*this < Other); }
110+
111+
bool operator==(const LKVersion &Other) const {
112+
return Major == Other.Major && Minor == Other.Minor && Rev == Other.Rev;
113+
}
114+
115+
bool operator!=(const LKVersion &Other) const { return !(*this == Other); }
116+
117+
unsigned Major{0};
118+
unsigned Minor{0};
119+
unsigned Rev{0};
120+
};
121+
92122
/// Linux Kernel supports stack unwinding using ORC (oops rewind capability).
93123
/// ORC state at every IP can be described by the following data structure.
94124
struct ORCState {
@@ -148,6 +178,8 @@ class AddressExtractor : public DataExtractor {
148178
};
149179

150180
class LinuxKernelRewriter final : public MetadataRewriter {
181+
LKVersion LinuxKernelVersion;
182+
151183
/// Information required for updating metadata referencing an instruction.
152184
struct InstructionFixup {
153185
BinarySection &Section; // Section referencing the instruction.
@@ -249,6 +281,8 @@ class LinuxKernelRewriter final : public MetadataRewriter {
249281
ErrorOr<BinarySection &> PCIFixupSection = std::errc::bad_address;
250282
static constexpr size_t PCI_FIXUP_ENTRY_SIZE = 16;
251283

284+
Error detectLinuxKernelVersion();
285+
252286
/// Process linux kernel special sections and their relocations.
253287
void processLKSections();
254288

@@ -314,6 +348,9 @@ class LinuxKernelRewriter final : public MetadataRewriter {
314348
: MetadataRewriter("linux-kernel-rewriter", BC) {}
315349

316350
Error preCFGInitializer() override {
351+
if (Error E = detectLinuxKernelVersion())
352+
return E;
353+
317354
processLKSections();
318355

319356
if (Error E = processSMPLocks())
@@ -394,6 +431,28 @@ class LinuxKernelRewriter final : public MetadataRewriter {
394431
}
395432
};
396433

434+
Error LinuxKernelRewriter::detectLinuxKernelVersion() {
435+
if (BinaryData *BD = BC.getBinaryDataByName("linux_banner")) {
436+
const BinarySection &Section = BD->getSection();
437+
const std::string S =
438+
Section.getContents().substr(BD->getOffset(), BD->getSize()).str();
439+
440+
const std::regex Re(R"---(Linux version ((\d+)\.(\d+)(\.(\d+))?))---");
441+
std::smatch Match;
442+
if (std::regex_search(S, Match, Re)) {
443+
const unsigned Major = std::stoi(Match[2].str());
444+
const unsigned Minor = std::stoi(Match[3].str());
445+
const unsigned Rev = Match[5].matched ? std::stoi(Match[5].str()) : 0;
446+
LinuxKernelVersion = LKVersion(Major, Minor, Rev);
447+
BC.outs() << "BOLT-INFO: Linux kernel version is " << Match[1].str()
448+
<< "\n";
449+
return Error::success();
450+
}
451+
}
452+
return createStringError(errc::executable_format_error,
453+
"Linux kernel version is unknown");
454+
}
455+
397456
void LinuxKernelRewriter::processLKSections() {
398457
processLKKSymtab();
399458
processLKKSymtab(true);

bolt/test/X86/linux-alt-instruction.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,15 @@ _start:
142142
.section .orc_unwind_ip
143143
.long .L0 + 2 - .
144144

145+
## Linux kernel version
146+
.rodata
147+
.align 16
148+
.globl linux_banner
149+
.type linux_banner, @object
150+
linux_banner:
151+
.string "Linux version 6.6.61\n"
152+
.size linux_banner, . - linux_banner
153+
145154
## Fake Linux Kernel sections.
146155
.section __ksymtab,"a",@progbits
147156
.section __ksymtab_gpl,"a",@progbits

bolt/test/X86/linux-bug-table.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@ _start:
5656
.long .L1 - . # instruction
5757
.org 2b + 12
5858

59+
## Linux kernel version
60+
.rodata
61+
.align 16
62+
.globl linux_banner
63+
.type linux_banner, @object
64+
linux_banner:
65+
.string "Linux version 6.6.61\n"
66+
.size linux_banner, . - linux_banner
67+
5968
## Fake Linux Kernel sections.
6069
.section __ksymtab,"a",@progbits
6170
.section __ksymtab_gpl,"a",@progbits

bolt/test/X86/linux-exceptions.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ foo:
5959
.long .LF0 - . # fixup
6060
.long 0 # data
6161

62+
## Linux kernel version
63+
.rodata
64+
.align 16
65+
.globl linux_banner
66+
.type linux_banner, @object
67+
linux_banner:
68+
.string "Linux version 6.6.61\n"
69+
.size linux_banner, . - linux_banner
70+
6271
## Fake Linux Kernel sections.
6372
.section __ksymtab,"a",@progbits
6473
.section __ksymtab_gpl,"a",@progbits

bolt/test/X86/linux-orc.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,15 @@ bar:
157157
.section .orc_unwind_ip
158158
.long .L4 - .
159159

160+
## Linux kernel version
161+
.rodata
162+
.align 16
163+
.globl linux_banner
164+
.type linux_banner, @object
165+
linux_banner:
166+
.string "Linux version 6.6.61\n"
167+
.size linux_banner, . - linux_banner
168+
160169
## Fake Linux Kernel sections.
161170
.section __ksymtab,"a",@progbits
162171
.section __ksymtab_gpl,"a",@progbits

bolt/test/X86/linux-parainstructions.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ _start:
4949
.byte 1 # type
5050
.byte 7 # length
5151

52+
## Linux kernel version
53+
.rodata
54+
.align 16
55+
.globl linux_banner
56+
.type linux_banner, @object
57+
linux_banner:
58+
.string "Linux version 6.6.61\n"
59+
.size linux_banner, . - linux_banner
60+
5261
## Fake Linux Kernel sections.
5362
.section __ksymtab,"a",@progbits
5463
.section __ksymtab_gpl,"a",@progbits

bolt/test/X86/linux-pci-fixup.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ _start:
3636
.long 0x0 # class shift
3737
.long .L0 - . # fixup
3838

39+
## Linux kernel version
40+
.rodata
41+
.align 16
42+
.globl linux_banner
43+
.type linux_banner, @object
44+
linux_banner:
45+
.string "Linux version 6.6.61\n"
46+
.size linux_banner, . - linux_banner
47+
3948
## Fake Linux Kernel sections.
4049
.section __ksymtab,"a",@progbits
4150
.section __ksymtab_gpl,"a",@progbits

bolt/test/X86/linux-smp-locks.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ _start:
3535
.long .L0 - .
3636
.long .L1 - .
3737

38+
## Linux kernel version
39+
.rodata
40+
.align 16
41+
.globl linux_banner
42+
.type linux_banner, @object
43+
linux_banner:
44+
.string "Linux version 6.6.61\n"
45+
.size linux_banner, . - linux_banner
46+
3847
## Fake Linux Kernel sections.
3948
.section __ksymtab,"a",@progbits
4049
.section __ksymtab_gpl,"a",@progbits

bolt/test/X86/linux-static-calls.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,15 @@ __start_static_call_sites:
5454
.type __stop_static_call_sites, %object
5555
__stop_static_call_sites:
5656

57+
## Linux kernel version
58+
.rodata
59+
.align 16
60+
.globl linux_banner
61+
.type linux_banner, @object
62+
linux_banner:
63+
.string "Linux version 6.6.61\n"
64+
.size linux_banner, . - linux_banner
65+
5766
## Fake Linux Kernel sections.
5867
.section __ksymtab,"a",@progbits
5968
.section __ksymtab_gpl,"a",@progbits

bolt/test/X86/linux-static-keys.s

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ __stop___jump_table:
8585
fake_static_key:
8686
.quad 0
8787

88+
## Linux kernel version
89+
.rodata
90+
.align 16
91+
.globl linux_banner
92+
.type linux_banner, @object
93+
linux_banner:
94+
.string "Linux version 6.6.61\n"
95+
.size linux_banner, . - linux_banner
96+
8897
## Fake Linux Kernel sections.
8998
.section __ksymtab,"a",@progbits
9099
.section __ksymtab_gpl,"a",@progbits

0 commit comments

Comments
 (0)