Skip to content

Commit 20ed224

Browse files
committed
Merge branch 'main' into ptrauth-constants-in-data
2 parents 9633e04 + c0b65a2 commit 20ed224

File tree

777 files changed

+26619
-12129
lines changed

Some content is hidden

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

777 files changed

+26619
-12129
lines changed

.ci/generate-buildkite-pipeline-premerge

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ function exclude-linux() {
153153
for project in ${projects}; do
154154
case ${project} in
155155
cross-project-tests) ;; # tests failing
156-
lldb) ;; # tests failing
157156
openmp) ;; # https://github.com/google/llvm-premerge-checks/issues/410
158157
*)
159158
echo "${project}"
@@ -170,7 +169,7 @@ function exclude-windows() {
170169
compiler-rt) ;; # tests taking too long
171170
openmp) ;; # TODO: having trouble with the Perl installation
172171
libc) ;; # no Windows support
173-
lldb) ;; # tests failing
172+
lldb) ;; # custom environment requirements (https://github.com/llvm/llvm-project/pull/94208#issuecomment-2146256857)
174173
bolt) ;; # tests are not supported yet
175174
*)
176175
echo "${project}"
@@ -213,7 +212,7 @@ function check-targets() {
213212
echo "check-unwind"
214213
;;
215214
lldb)
216-
echo "check-all" # TODO: check-lldb may not include all the LLDB tests?
215+
echo "check-lldb"
217216
;;
218217
pstl)
219218
echo "check-all"

.ci/monolithic-linux.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ targets="${2}"
3939

4040
echo "--- cmake"
4141
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
42+
pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
4243
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
4344
-D LLVM_ENABLE_PROJECTS="${projects}" \
4445
-G Ninja \
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import json
2+
import multiprocessing
3+
import os
4+
import re
5+
import subprocess
6+
import sys
7+
8+
9+
def run_analyzer(data):
10+
os.chdir(data["directory"])
11+
command = (
12+
data["command"]
13+
+ f" --analyze --analyzer-output html -o analyzer-results -Xclang -analyzer-config -Xclang max-nodes=75000"
14+
)
15+
print(command)
16+
subprocess.run(command, shell=True, check=True)
17+
18+
19+
def pool_error(e):
20+
print("Error analyzing file:", e)
21+
22+
23+
def main():
24+
db_path = sys.argv[1]
25+
database = json.load(open(db_path))
26+
27+
with multiprocessing.Pool() as pool:
28+
pool.map_async(run_analyzer, [k for k in database], error_callback=pool_error)
29+
pool.close()
30+
pool.join()
31+
32+
33+
if __name__ == "__main__":
34+
main()
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Post-Commit Static Analyzer
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
branches:
9+
- 'release/**'
10+
paths:
11+
- 'clang/**'
12+
- 'llvm/**'
13+
- '.github/workflows/ci-post-commit-analyzer.yml'
14+
pull_request:
15+
types:
16+
- opened
17+
- synchronize
18+
- reopened
19+
- closed
20+
paths:
21+
- '.github/workflows/ci-post-commit-analyzer.yml'
22+
- '.github/workflows/ci-post-commit-analyzer-run.py'
23+
schedule:
24+
- cron: '30 0 * * *'
25+
26+
concurrency:
27+
group: >-
28+
llvm-project-${{ github.workflow }}-${{ github.event_name == 'pull_request' &&
29+
( github.event.pull_request.number || github.ref) }}
30+
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
31+
32+
jobs:
33+
post-commit-analyzer:
34+
if: >-
35+
github.repository_owner == 'llvm' &&
36+
github.event.action != 'closed'
37+
runs-on: ubuntu-22.04
38+
container:
39+
image: 'ghcr.io/llvm/ci-ubuntu-22.04:latest'
40+
env:
41+
LLVM_VERSION: 18
42+
steps:
43+
- name: Checkout Source
44+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
45+
46+
- name: Setup ccache
47+
uses: hendrikmuhs/ccache-action@v1
48+
with:
49+
# A full build of llvm, clang, lld, and lldb takes about 250MB
50+
# of ccache space. There's not much reason to have more than this,
51+
# because we usually won't need to save cache entries from older
52+
# builds. Also, there is an overall 10GB cache limit, and each
53+
# run creates a new cache entry so we want to ensure that we have
54+
# enough cache space for all the tests to run at once and still
55+
# fit under the 10 GB limit.
56+
# Default to 2G to workaround: https://github.com/hendrikmuhs/ccache-action/issues/174
57+
max-size: 2G
58+
key: post-commit-analyzer
59+
variant: sccache
60+
61+
- name: Configure
62+
run: |
63+
cmake -B build -S llvm -G Ninja \
64+
-DLLVM_ENABLE_ASSERTIONS=ON \
65+
-DLLVM_ENABLE_PROJECTS=clang \
66+
-DLLVM_BUILD_LLVM_DYLIB=ON \
67+
-DLLVM_LINK_LLVM_DYLIB=ON \
68+
-DCMAKE_CXX_COMPILER=clang++ \
69+
-DCMAKE_C_COMPILER=clang \
70+
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
71+
-DCMAKE_C_COMPILER_LAUNCHER=sccache \
72+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
73+
-DLLVM_INCLUDE_TESTS=OFF \
74+
-DCLANG_INCLUDE_TESTS=OFF \
75+
-DCMAKE_BUILD_TYPE=Release
76+
77+
- name: Build
78+
run: |
79+
# FIXME: We need to build all the generated header files in order to be able to run
80+
# the analyzer on every file. Building libLLVM and libclang is probably overkill for
81+
# this, but it's better than building every target.
82+
ninja -v -C build libLLVM.so libclang.so
83+
84+
# Run the analyzer.
85+
python3 .github/workflows/ci-post-commit-analyzer-run.py build/compile_commands.json
86+
87+
scan-build --generate-index-only build/analyzer-results
88+
89+
- name: Upload Results
90+
uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
91+
if: always()
92+
with:
93+
name: analyzer-results
94+
path: 'build/analyzer-results/*'
95+

.github/workflows/release-binaries.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ jobs:
216216
217217
- id: package-info
218218
run: |
219-
filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.gz"
219+
filename="LLVM-${{ needs.prepare.outputs.release-version }}-Linux.tar.xz"
220220
echo "filename=$filename" >> $GITHUB_OUTPUT
221221
echo "path=/mnt/build/tools/clang/stage2-bins/$filename" >> $GITHUB_OUTPUT
222222

bolt/include/bolt/Core/MCPlusBuilder.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,12 +1706,9 @@ class MCPlusBuilder {
17061706
}
17071707

17081708
/// Reverses the branch condition in Inst and update its taken target to TBB.
1709-
///
1710-
/// Returns true on success.
1711-
virtual bool reverseBranchCondition(MCInst &Inst, const MCSymbol *TBB,
1709+
virtual void reverseBranchCondition(MCInst &Inst, const MCSymbol *TBB,
17121710
MCContext *Ctx) const {
17131711
llvm_unreachable("not implemented");
1714-
return false;
17151712
}
17161713

17171714
virtual bool replaceBranchCondition(MCInst &Inst, const MCSymbol *TBB,
@@ -1751,12 +1748,9 @@ class MCPlusBuilder {
17511748
}
17521749

17531750
/// Sets the taken target of the branch instruction to Target.
1754-
///
1755-
/// Returns true on success.
1756-
virtual bool replaceBranchTarget(MCInst &Inst, const MCSymbol *TBB,
1751+
virtual void replaceBranchTarget(MCInst &Inst, const MCSymbol *TBB,
17571752
MCContext *Ctx) const {
17581753
llvm_unreachable("not implemented");
1759-
return false;
17601754
}
17611755

17621756
/// Extract a symbol and an addend out of the fixup value expression.

bolt/lib/Core/BinaryEmitter.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ class BinaryEmitter {
194194

195195
void BinaryEmitter::emitAll(StringRef OrgSecPrefix) {
196196
Streamer.initSections(false, *BC.STI);
197+
Streamer.setUseAssemblerInfoForParsing(false);
197198

198199
if (opts::UpdateDebugSections && BC.isELF()) {
199200
// Force the emission of debug line info into allocatable section to ensure
@@ -226,6 +227,7 @@ void BinaryEmitter::emitAll(StringRef OrgSecPrefix) {
226227
// TODO Enable for Mach-O once BinaryContext::getDataSection supports it.
227228
if (BC.isELF())
228229
AddressMap::emit(Streamer, BC);
230+
Streamer.setUseAssemblerInfoForParsing(true);
229231
}
230232

231233
void BinaryEmitter::emitFunctions() {

bolt/lib/Passes/VeneerElimination.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,8 @@ Error VeneerElimination::runOnFunctions(BinaryContext &BC) {
7777
continue;
7878

7979
VeneerCallers++;
80-
if (!BC.MIB->replaceBranchTarget(
81-
Instr, VeneerDestinations[TargetSymbol], BC.Ctx.get())) {
82-
return createFatalBOLTError(
83-
"BOLT-ERROR: updating veneer call destination failed\n");
84-
}
80+
BC.MIB->replaceBranchTarget(Instr, VeneerDestinations[TargetSymbol],
81+
BC.Ctx.get());
8582
}
8683
}
8784
}

bolt/lib/Profile/BoltAddressTranslation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ std::error_code BoltAddressTranslation::parse(raw_ostream &OS, StringRef Buf) {
304304

305305
StringRef Name = Buf.slice(Offset, Offset + NameSz);
306306
Offset = alignTo(Offset + NameSz, 4);
307-
if (Name.substr(0, 4) != "BOLT")
307+
if (!Name.starts_with("BOLT"))
308308
return make_error_code(llvm::errc::io_error);
309309

310310
Error Err(Error::success());

bolt/lib/Target/AArch64/AArch64MCPlusBuilder.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
616616
return getTargetAddend(Op.getExpr());
617617
}
618618

619-
bool replaceBranchTarget(MCInst &Inst, const MCSymbol *TBB,
619+
void replaceBranchTarget(MCInst &Inst, const MCSymbol *TBB,
620620
MCContext *Ctx) const override {
621621
assert((isCall(Inst) || isBranch(Inst)) && !isIndirectBranch(Inst) &&
622622
"Invalid instruction");
@@ -638,7 +638,6 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
638638

639639
*OI = MCOperand::createExpr(
640640
MCSymbolRefExpr::create(TBB, MCSymbolRefExpr::VK_None, *Ctx));
641-
return true;
642641
}
643642

644643
/// Matches indirect branch patterns in AArch64 related to a jump table (JT),
@@ -969,7 +968,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
969968
}
970969
}
971970

972-
bool reverseBranchCondition(MCInst &Inst, const MCSymbol *TBB,
971+
void reverseBranchCondition(MCInst &Inst, const MCSymbol *TBB,
973972
MCContext *Ctx) const override {
974973
if (isTB(Inst) || isCB(Inst)) {
975974
Inst.setOpcode(getInvertedBranchOpcode(Inst.getOpcode()));
@@ -984,7 +983,7 @@ class AArch64MCPlusBuilder : public MCPlusBuilder {
984983
LLVM_DEBUG(Inst.dump());
985984
llvm_unreachable("Unrecognized branch instruction");
986985
}
987-
return replaceBranchTarget(Inst, TBB, Ctx);
986+
replaceBranchTarget(Inst, TBB, Ctx);
988987
}
989988

990989
int getPCRelEncodingSize(const MCInst &Inst) const override {

0 commit comments

Comments
 (0)