Skip to content

Commit 0a9cce9

Browse files
rebase
Created using spr 1.3.7
2 parents f6191da + 70d379f commit 0a9cce9

File tree

1,668 files changed

+42749
-26267
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,668 files changed

+42749
-26267
lines changed

.ci/premerge_advisor_explain.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
import sys
99
import json
1010

11+
# TODO(boomanaiden154): Remove the optional call once we can require Python
12+
# 3.10.
13+
from typing import Optional
14+
1115
import requests
1216
import github
1317
import github.PullRequest
@@ -20,7 +24,7 @@
2024
COMMENT_TAG = "<!--PREMERGE ADVISOR COMMENT: {platform}-->"
2125

2226

23-
def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> int | None:
27+
def get_comment_id(platform: str, pr: github.PullRequest.PullRequest) -> Optional[int]:
2428
platform_comment_tag = COMMENT_TAG.format(platform=platform)
2529
for comment in pr.as_issue().get_comments():
2630
if platform_comment_tag in comment.body:
@@ -39,6 +43,7 @@ def get_comment(
3943
comment_id = get_comment_id(platform.system(), pr)
4044
if comment_id:
4145
comment["id"] = comment_id
46+
return comment
4247

4348

4449
def main(
@@ -76,10 +81,12 @@ def main(
7681
if return_code == 0:
7782
with open("comment", "w") as comment_file_handle:
7883
comment = get_comment(
84+
github_token,
85+
pr_number,
7986
":white_check_mark: With the latest revision this PR passed "
80-
"the premerge checks."
87+
"the premerge checks.",
8188
)
82-
if comment["id"]:
89+
if "id" in comment:
8390
json.dump([comment], comment_file_handle)
8491
junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
8592
build_log_files

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
HeaderFilterRegex: ''
12
Checks: >
23
-*,
34
clang-diagnostic-*,

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ jobs:
3232
fail-fast: false
3333
matrix:
3434
include:
35-
- container-name: code-format
35+
- container-name: format
3636
test-command: 'cd $HOME && clang-format --version | grep version && git-clang-format -h | grep usage && black --version | grep black'
37-
- container-name: code-lint
37+
- container-name: lint
3838
test-command: 'cd $HOME && clang-tidy --version | grep version && clang-tidy-diff.py -h | grep usage'
39+
- container-name: abi-tests
40+
test-command: 'cd $HOME && abi-compliance-checker --help'
41+
target: abi-tests
3942
steps:
4043
- name: Checkout LLVM
4144
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -52,7 +55,7 @@ jobs:
5255
with:
5356
container-name: ci-ubuntu-24.04-${{ matrix.container-name }}
5457
dockerfile: .github/workflows/containers/github-action-ci-tooling/Dockerfile
55-
target: ci-container-${{ matrix.container-name }}
58+
target: ci-container-${{ matrix.target || format('code-{0}', matrix.container-name) }}
5659
test-command: ${{ matrix.test-command }}
5760

5861
push-ci-container:

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

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
- build-ci-container-windows
5757
permissions:
5858
packages: write
59-
runs-on: windows-2022
59+
runs-on: ubuntu-24.04
6060
env:
6161
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6262
steps:
@@ -66,8 +66,12 @@ jobs:
6666
name: container
6767
- name: Push Container
6868
run: |
69-
docker load -i ${{ needs.build-ci-container-windows.outputs.container-filename }}
70-
docker tag ${{ needs.build-ci-container-windows.outputs.container-name-tag }} ${{ needs.build-ci-container-windows.outputs.container-name }}:latest
71-
docker login -u ${{ github.actor }} -p $env:GITHUB_TOKEN ghcr.io
72-
docker push ${{ needs.build-ci-container-windows.outputs.container-name-tag }}
73-
docker push ${{ needs.build-ci-container-windows.outputs.container-name }}:latest
69+
sudo apt-get update
70+
sudo apt-get install -y skopeo
71+
skopeo login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
72+
skopeo copy docker-archive:${{ needs.build-ci-container-windows.outputs.container-filename }} \
73+
--dest-compress-format zstd \
74+
docker://${{ needs.build-ci-container-windows.outputs.container-name-tag }}
75+
skopeo copy docker-archive:${{ needs.build-ci-container-windows.outputs.container-filename }} \
76+
--dest-compress-format zstd \
77+
docker://${{ needs.build-ci-container-windows.outputs.container-name }}:latest

.github/workflows/containers/github-action-ci-tooling/Dockerfile

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,28 @@ RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
4747
# as root in 'ci-container-code-format' and 'ci-container-code-lint' containers
4848

4949

50+
FROM base AS ci-container-build-tools
51+
ARG LLVM_VERSION
52+
ARG LLVM_VERSION_MAJOR
53+
54+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
55+
${LLVM_SYSROOT}/bin/
56+
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
57+
${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION_MAJOR}/include
58+
RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION_MAJOR} ${LLVM_SYSROOT}/bin/clang && \
59+
ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
60+
61+
RUN apt-get update && \
62+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
63+
cmake \
64+
ninja-build && \
65+
apt-get clean && \
66+
rm -rf /var/lib/apt/lists/*
67+
68+
ENV CC=${LLVM_SYSROOT}/bin/clang
69+
ENV CXX=${LLVM_SYSROOT}/bin/clang++
70+
71+
5072
FROM base AS ci-container-code-format
5173
ARG LLVM_VERSION
5274

@@ -63,31 +85,37 @@ USER gha
6385
WORKDIR /home/gha
6486

6587

66-
FROM base AS ci-container-code-lint
88+
FROM ci-container-build-tools AS ci-container-code-lint
6789
ARG LLVM_VERSION
6890
ARG LLVM_VERSION_MAJOR
6991

7092
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-tidy \
71-
/llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/bin/clang-${LLVM_VERSION_MAJOR} \
7293
${LLVM_SYSROOT}/bin/
73-
COPY --from=llvm-downloader /llvm-extract/LLVM-${LLVM_VERSION}-Linux-X64/lib/clang/${LLVM_VERSION_MAJOR}/include \
74-
${LLVM_SYSROOT}/lib/clang/${LLVM_VERSION_MAJOR}/include
7594
COPY clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py ${LLVM_SYSROOT}/bin/clang-tidy-diff.py
7695

77-
RUN ln -s ${LLVM_SYSROOT}/bin/clang-${LLVM_VERSION_MAJOR} ${LLVM_SYSROOT}/bin/clang && \
78-
ln -s ${LLVM_SYSROOT}/bin/clang ${LLVM_SYSROOT}/bin/clang++
96+
# Install dependencies for 'pr-code-lint.yml' job
97+
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
98+
RUN pip install -r requirements_linting.txt --break-system-packages && \
99+
rm requirements_linting.txt
100+
USER gha
101+
WORKDIR /home/gha
102+
79103

104+
FROM ci-container-build-tools as ci-container-abi-tests
80105

81106
RUN apt-get update && \
82107
DEBIAN_FRONTEND=noninteractive apt-get install -y \
83-
cmake \
84-
ninja-build && \
108+
abi-compliance-checker \
109+
abi-dumper \
110+
autoconf \
111+
pkg-config && \
85112
apt-get clean && \
86113
rm -rf /var/lib/apt/lists/*
87114

88-
# Install dependencies for 'pr-code-lint.yml' job
89-
COPY llvm/utils/git/requirements_linting.txt requirements_linting.txt
90-
RUN pip install -r requirements_linting.txt --break-system-packages && \
91-
rm requirements_linting.txt
92-
USER gha
93-
WORKDIR /home/gha
115+
RUN git clone https://github.com/universal-ctags/ctags.git && \
116+
cd ctags && \
117+
./autogen.sh && \
118+
./configure && \
119+
sudo make install && \
120+
rm -Rf ../ctags
121+

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ jobs:
222222
python3 -m venv .venv
223223
source .venv/bin/activate
224224
python -m pip install psutil
225-
bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}
225+
xcrun bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}
226226
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
227227
if: always() # Upload artifacts even if the build or test suite fails
228228
with:

.github/workflows/llvm-abi-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ on:
1010
- 'release/**'
1111
paths:
1212
- 'llvm/**'
13-
- '.github/workflows/llvm-tests.yml'
13+
- '.github/workflows/llvm-abi-tests.yml'
1414
pull_request:
1515
branches:
1616
- 'release/**'
1717
paths:
1818
- 'llvm/**'
19-
- '.github/workflows/llvm-tests.yml'
19+
- '.github/workflows/llvm-abi-tests.yml'
2020

2121
concurrency:
2222
# Skip intermediate builds: always.

.github/workflows/premerge.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,8 @@ jobs:
204204
with:
205205
max-size: "2000M"
206206
- name: Install Ninja
207-
uses: llvm/actions/install-ninja@42d80571b13f4599bbefbc7189728b64723c7f78 # main
207+
run: |
208+
brew install ninja
208209
- name: Build and Test
209210
run: |
210211
source <(git diff --name-only HEAD~1...HEAD | python3 .ci/compute_projects.py)

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,6 @@ class BinaryContext {
354354
/// Newly created segments.
355355
std::vector<SegmentInfo> NewSegments;
356356

357-
/// Symbols that are expected to be undefined in MCContext during emission.
358-
std::unordered_set<MCSymbol *> UndefinedSymbols;
359-
360357
/// [name] -> [BinaryData*] map used for global symbol resolution.
361358
using SymbolMapType = StringMap<BinaryData *>;
362359
SymbolMapType GlobalSymbols;
@@ -500,7 +497,7 @@ class BinaryContext {
500497
///
501498
/// As we fold identical functions, multiple symbols can point
502499
/// to the same BinaryFunction.
503-
std::unordered_map<const MCSymbol *, BinaryFunction *> SymbolToFunctionMap;
500+
DenseMap<const MCSymbol *, BinaryFunction *> SymbolToFunctionMap;
504501

505502
/// A mutex that is used to control parallel accesses to SymbolToFunctionMap
506503
mutable llvm::sys::RWMutex SymbolToFunctionMapMutex;

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,14 @@ class BinaryFunction {
281281
/// goto labels.
282282
std::set<uint64_t> ExternallyReferencedOffsets;
283283

284+
/// Relocations from data sections targeting internals of this function, i.e.
285+
/// some code not at an entry point. These include, but are not limited to,
286+
/// jump table relocations and computed goto tables.
287+
///
288+
/// Since relocations can be removed/deallocated, we store relocation offsets
289+
/// instead of pointers.
290+
DenseSet<uint64_t> InternalRefDataRelocations;
291+
284292
/// Offsets of indirect branches with unknown destinations.
285293
std::set<uint64_t> UnknownIndirectBranchOffsets;
286294

@@ -640,6 +648,20 @@ class BinaryFunction {
640648
Islands->CodeOffsets.emplace(Offset);
641649
}
642650

651+
/// Register a relocation from data section referencing code at a non-zero
652+
/// offset in this function.
653+
void registerInternalRefDataRelocation(uint64_t FuncOffset,
654+
uint64_t RelOffset) {
655+
assert(FuncOffset != 0 && "Relocation should reference function internals");
656+
registerReferencedOffset(FuncOffset);
657+
InternalRefDataRelocations.insert(RelOffset);
658+
const MCSymbol *ReferencedSymbol =
659+
getOrCreateLocalLabel(getAddress() + FuncOffset);
660+
661+
// Track the symbol mapping since it's used in relocation handling.
662+
BC.setSymbolToFunctionMap(ReferencedSymbol, this);
663+
}
664+
643665
/// Register an internal offset in a function referenced from outside.
644666
void registerReferencedOffset(uint64_t Offset) {
645667
ExternallyReferencedOffsets.emplace(Offset);
@@ -1299,6 +1321,12 @@ class BinaryFunction {
12991321
void addRelocation(uint64_t Address, MCSymbol *Symbol, uint32_t RelType,
13001322
uint64_t Addend, uint64_t Value);
13011323

1324+
/// Return locations (offsets) of data section relocations targeting internals
1325+
/// of this functions.
1326+
const DenseSet<uint64_t> &getInternalRefDataRelocations() const {
1327+
return InternalRefDataRelocations;
1328+
}
1329+
13021330
/// Return the name of the section this function originated from.
13031331
std::optional<StringRef> getOriginSectionName() const {
13041332
if (!OriginSection)

0 commit comments

Comments
 (0)