Skip to content

Commit 88e9b63

Browse files
authored
Merge branch 'main' into implement-countlsfx
2 parents 780fd3a + d11b9b7 commit 88e9b63

File tree

3,336 files changed

+153794
-53980
lines changed

Some content is hidden

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

3,336 files changed

+153794
-53980
lines changed

.github/new-prs-labeler.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,9 @@ llvm:regalloc:
730730
lldb:
731731
- lldb/**
732732

733+
lldb-dap:
734+
- lldb/tools/lldb-dap/**
735+
733736
backend:AMDGPU:
734737
- '**/*amdgpu*'
735738
- '**/*AMDGPU*'

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

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,31 @@ on:
2020
jobs:
2121
build-ci-container:
2222
if: github.repository_owner == 'llvm'
23-
runs-on: depot-ubuntu-22.04-16
24-
outputs:
25-
container-name: ${{ steps.vars.outputs.container-name }}
26-
container-name-agent: ${{ steps.vars.outputs.container-name-agent }}
27-
container-name-tag: ${{ steps.vars.outputs.container-name-tag }}
28-
container-name-agent-tag: ${{ steps.vars.outputs.container-name-agent-tag }}
29-
container-filename: ${{ steps.vars.outputs.container-filename }}
30-
container-agent-filename: ${{ steps.vars.outputs.container-agent-filename }}
23+
runs-on: ${{ matrix.runs-on }}
24+
strategy:
25+
matrix:
26+
include:
27+
# The arch names should match the names used on dockerhub.
28+
# See https://github.com/docker-library/official-images#architectures-other-than-amd64
29+
- arch: amd64
30+
runs-on: depot-ubuntu-22.04-16
31+
- arch: arm64v8
32+
runs-on: depot-ubuntu-22.04-arm-16
3133
steps:
3234
- name: Checkout LLVM
3335
uses: actions/checkout@v4
3436
with:
3537
sparse-checkout: .github/workflows/containers/github-action-ci/
38+
# podman is not installed by default on the ARM64 images.
39+
- name: Install Podman
40+
if: runner.arch == 'ARM64'
41+
run: |
42+
sudo apt-get install podman
3643
- name: Write Variables
3744
id: vars
3845
run: |
39-
tag=`date +%s`
40-
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/ci-ubuntu-22.04"
46+
tag=$(git rev-parse --short=12 HEAD)
47+
container_name="ghcr.io/$GITHUB_REPOSITORY_OWNER/${{ matrix.arch }}/ci-ubuntu-22.04"
4148
echo "container-name=$container_name" >> $GITHUB_OUTPUT
4249
echo "container-name-agent=$container_name-agent" >> $GITHUB_OUTPUT
4350
echo "container-name-tag=$container_name:$tag" >> $GITHUB_OUTPUT
@@ -61,7 +68,7 @@ jobs:
6168
- name: Upload container image
6269
uses: actions/upload-artifact@v4
6370
with:
64-
name: container
71+
name: container-${{ matrix.arch }}
6572
path: "*.tar"
6673
retention-days: 14
6774

@@ -84,18 +91,29 @@ jobs:
8491
steps:
8592
- name: Download container
8693
uses: actions/download-artifact@v4
87-
with:
88-
name: container
8994

9095
- name: Push Container
9196
run: |
92-
podman load -i ${{ needs.build-ci-container.outputs.container-filename }}
93-
podman tag ${{ needs.build-ci-container.outputs.container-name-tag }} ${{ needs.build-ci-container.outputs.container-name }}:latest
97+
function push_container {
98+
image_name=$1
99+
latest_name=$(echo $image_name | sed 's/:[a-f0-9]\+$/:latest/g')
100+
podman tag $image_name $latest_name
101+
echo "Pushing $image_name ..."
102+
podman push $image_name
103+
echo "Pushing $latest_name ..."
104+
podman push $latest_name
105+
}
106+
94107
podman login -u ${{ github.actor }} -p $GITHUB_TOKEN ghcr.io
95-
podman push ${{ needs.build-ci-container.outputs.container-name-tag }}
96-
podman push ${{ needs.build-ci-container.outputs.container-name }}:latest
108+
for f in $(find . -iname *.tar); do
109+
image_name=$(podman load -q -i $f | sed 's/Loaded image: //g')
110+
push_container $image_name
97111
98-
podman load -i ${{ needs.build-ci-container.outputs.container-agent-filename }}
99-
podman tag ${{ needs.build-ci-container.outputs.container-name-agent-tag }} ${{ needs.build-ci-container.outputs.container-name-agent }}:latest
100-
podman push ${{ needs.build-ci-container.outputs.container-name-agent-tag }}
101-
podman push ${{ needs.build-ci-container.outputs.container-name-agent }}:latest
112+
if echo $image_name | grep '/amd64/'; then
113+
# For amd64, create an alias with the arch component removed.
114+
# This matches the convention used on dockerhub.
115+
default_image_name=$(echo $(dirname $(dirname $image_name))/$(basename $image_name))
116+
podman tag $image_name $default_image_name
117+
push_container $default_image_name
118+
fi
119+
done

.github/workflows/libc-fullbuild-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18+
build_type: [Debug, Release, MinSizeRel]
1819
include:
1920
- os: ubuntu-24.04
2021
ccache-variant: sccache
@@ -68,7 +69,7 @@ jobs:
6869
cmake -B ${{ steps.strings.outputs.build-output-dir }}
6970
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
7071
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
71-
-DCMAKE_BUILD_TYPE=MinSizeRel
72+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
7273
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
7374
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
7475
-DCMAKE_INSTALL_PREFIX=${{ steps.strings.outputs.build-install-dir }}

.github/workflows/libc-overlay-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations.
1717
fail-fast: false
1818
matrix:
19+
build_type: [Debug, Release, MinSizeRel]
1920
include:
2021
# TODO: add linux gcc when it is fixed
2122
- os: ubuntu-24.04
@@ -95,7 +96,7 @@ jobs:
9596
cmake -B ${{ steps.strings.outputs.build-output-dir }}
9697
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.cpp_compiler }}
9798
-DCMAKE_C_COMPILER=${{ matrix.compiler.c_compiler }}
98-
-DCMAKE_BUILD_TYPE=MinSizeRel
99+
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
99100
-DCMAKE_C_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
100101
-DCMAKE_CXX_COMPILER_LAUNCHER=${{ matrix.ccache-variant }}
101102
-DCMAKE_POLICY_DEFAULT_CMP0141=NEW

.github/workflows/libcxx-build-containers.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ name: Build Docker images for libc++ CI
99

1010
permissions:
1111
contents: read
12-
packages: write
1312

1413
on:
1514
push:

.github/workflows/premerge.yaml

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,32 @@ permissions:
55

66
on:
77
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
# When a PR is closed, we still start this workflow, but then skip
13+
# all the jobs, which makes it effectively a no-op. The reason to
14+
# do this is that it allows us to take advantage of concurrency groups
15+
# to cancel in progress CI jobs whenever the PR is closed.
16+
- closed
817
paths:
918
- .github/workflows/premerge.yaml
1019
push:
1120
branches:
1221
- 'main'
1322
- 'release/**'
1423

24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
26+
cancel-in-progress: true
27+
1528
jobs:
1629
premerge-checks-linux:
17-
if: github.repository_owner == 'llvm'
30+
if: >-
31+
github.repository_owner == 'llvm' &&
32+
(github.event_name != 'pull_request' || github.event.action != 'closed')
1833
runs-on: llvm-premerge-linux-runners
19-
concurrency:
20-
group: ${{ github.workflow }}-linux-${{ github.event.pull_request.number || github.sha }}
21-
cancel-in-progress: true
2234
steps:
2335
- name: Checkout LLVM
2436
uses: actions/checkout@v4
@@ -73,11 +85,10 @@ jobs:
7385
./.ci/monolithic-linux.sh "$(echo ${linux_projects} | tr ' ' ';')" "$(echo ${linux_check_targets})" "$(echo ${linux_runtimes} | tr ' ' ';')" "$(echo ${linux_runtime_check_targets})"
7486
7587
premerge-checks-windows:
76-
if: github.repository_owner == 'llvm'
88+
if: >-
89+
github.repository_owner == 'llvm' &&
90+
(github.event_name != 'pull_request' || github.event.action != 'closed')
7791
runs-on: llvm-premerge-windows-runners
78-
concurrency:
79-
group: ${{ github.workflow }}-windows-${{ github.event.pull_request.number || github.sha }}
80-
cancel-in-progress: true
8192
defaults:
8293
run:
8394
shell: bash
@@ -135,12 +146,11 @@ jobs:
135146
136147
permerge-check-macos:
137148
runs-on: macos-14
138-
concurrency:
139-
group: ${{ github.workflow }}-macos-${{ github.event.pull_request.number || github.sha }}
140-
cancel-in-progress: true
141149
if: >-
150+
github.repository_owner == 'llvm' &&
142151
(startswith(github.ref_name, 'release/') ||
143-
startswith(github.base_ref, 'refs/heads/release/'))
152+
startswith(github.base_ref, 'release/')) &&
153+
(github.event_name != 'pull_request' || github.event.action != 'closed')
144154
steps:
145155
- name: Checkout LLVM
146156
uses: actions/checkout@v4

.github/workflows/release-binaries.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
target-cmake-flags: ${{ steps.vars.outputs.target-cmake-flags }}
5959
ccache: ${{ steps.vars.outputs.ccache }}
6060
build-flang: ${{ steps.vars.outputs.build-flang }}
61-
enable-pgo: ${{ steps.vars.outputs.enable-pgo }}
6261
release-binary-basename: ${{ steps.vars.outputs.release-binary-basename }}
6362
release-binary-filename: ${{ steps.vars.outputs.release-binary-filename }}
6463
build-runs-on: ${{ steps.vars.outputs.build-runs-on }}
@@ -130,9 +129,6 @@ jobs:
130129
echo ccache=sccache >> $GITHUB_OUTPUT
131130
fi
132131
133-
# Detect necessary CMake flags
134-
echo "enable-pgo=false" >> $GITHUB_OUTPUT
135-
target_cmake_flags="-DLLVM_RELEASE_ENABLE_PGO=OFF"
136132
# The macOS builds try to cross compile some libraries so we need to
137133
# add extra CMake args to disable them.
138134
# See https://github.com/llvm/llvm-project/issues/99767
@@ -238,13 +234,14 @@ jobs:
238234
${{ needs.prepare.outputs.target-cmake-flags }} \
239235
-C clang/cmake/caches/Release.cmake \
240236
-DBOOTSTRAP_LLVM_PARALLEL_LINK_JOBS=1 \
241-
-DBOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}"
237+
-DBOOTSTRAP_BOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}"
242238
243239
- name: Build
244240
shell: bash
245241
run: |
246242
ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
247-
mv ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/${{ needs.prepare.outputs.release-binary-filename }} .
243+
release_dir=`find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname 'stage2-bins'`
244+
mv $release_dir/${{ needs.prepare.outputs.release-binary-filename }} .
248245
249246
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
250247
with:
@@ -259,7 +256,7 @@ jobs:
259256
shell: bash
260257
run: |
261258
find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname ${{ needs.prepare.outputs.release-binary-filename }} -delete
262-
rm -Rf ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/_CPack_Packages
259+
find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname _CPack_Packages -prune -exec rm -r {} +
263260
264261
- name: Save Stage
265262
uses: ./workflows-main/.github/workflows/release-binaries-save-stage

.github/workflows/release-tasks.yml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,20 +89,10 @@ jobs:
8989
needs:
9090
- validate-tag
9191
- release-create
92-
strategy:
93-
fail-fast: false
94-
matrix:
95-
runs-on:
96-
- ubuntu-22.04
97-
- windows-2022
98-
- macos-13
99-
- macos-14
100-
101-
uses: ./.github/workflows/release-binaries.yml
92+
uses: ./.github/workflows/release-binaries-all.yml
10293
with:
10394
release-version: ${{ needs.validate-tag.outputs.release-version }}
10495
upload: true
105-
runs-on: ${{ matrix.runs-on }}
10696
# Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use.
10797
secrets:
10898
RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }}

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,6 +1435,17 @@ class BinaryContext {
14351435
bool PrintRelocations = false,
14361436
StringRef Endl = "\n") const;
14371437

1438+
/// Print data when embedded in the instruction stream keeping the format
1439+
/// similar to printInstruction().
1440+
void printData(raw_ostream &OS, ArrayRef<uint8_t> Data,
1441+
uint64_t Offset) const;
1442+
1443+
/// Extract data from the binary corresponding to [Address, Address + Size)
1444+
/// range. Return an empty ArrayRef if the address range does not belong to
1445+
/// any section in the binary, crosses a section boundary, or falls into a
1446+
/// virtual section.
1447+
ArrayRef<uint8_t> extractData(uint64_t Address, uint64_t Size) const;
1448+
14381449
/// Print a range of instructions.
14391450
template <typename Itr>
14401451
uint64_t

bolt/include/bolt/Core/BinaryFunction.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,6 +2060,11 @@ class BinaryFunction {
20602060
return Islands ? Islands->getAlignment() : 1;
20612061
}
20622062

2063+
/// If there is a constant island in the range [StartOffset, EndOffset),
2064+
/// return its address.
2065+
std::optional<uint64_t> getIslandInRange(uint64_t StartOffset,
2066+
uint64_t EndOffset) const;
2067+
20632068
uint64_t
20642069
estimateConstantIslandSize(const BinaryFunction *OnBehalfOf = nullptr) const {
20652070
if (!Islands)

bolt/lib/Core/BinaryContext.cpp

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1759,7 +1759,11 @@ void BinaryContext::preprocessDebugInfo() {
17591759
dwarf::toString(CU->getUnitDIE().find(dwarf::DW_AT_name), nullptr);
17601760
if (std::optional<uint64_t> DWOID = CU->getDWOId()) {
17611761
auto Iter = DWOCUs.find(*DWOID);
1762-
assert(Iter != DWOCUs.end() && "DWO CU was not found.");
1762+
if (Iter == DWOCUs.end()) {
1763+
this->errs() << "BOLT-ERROR: DWO CU was not found for " << Name
1764+
<< '\n';
1765+
exit(1);
1766+
}
17631767
Name = dwarf::toString(
17641768
Iter->second->getUnitDIE().find(dwarf::DW_AT_name), nullptr);
17651769
}
@@ -1942,6 +1946,43 @@ static void printDebugInfo(raw_ostream &OS, const MCInst &Instruction,
19421946
OS << " discriminator:" << Row.Discriminator;
19431947
}
19441948

1949+
ArrayRef<uint8_t> BinaryContext::extractData(uint64_t Address,
1950+
uint64_t Size) const {
1951+
ArrayRef<uint8_t> Res;
1952+
1953+
const ErrorOr<const BinarySection &> Section = getSectionForAddress(Address);
1954+
if (!Section || Section->isVirtual())
1955+
return Res;
1956+
1957+
if (!Section->containsRange(Address, Size))
1958+
return Res;
1959+
1960+
auto *Bytes =
1961+
reinterpret_cast<const uint8_t *>(Section->getContents().data());
1962+
return ArrayRef<uint8_t>(Bytes + Address - Section->getAddress(), Size);
1963+
}
1964+
1965+
void BinaryContext::printData(raw_ostream &OS, ArrayRef<uint8_t> Data,
1966+
uint64_t Offset) const {
1967+
DataExtractor DE(Data, AsmInfo->isLittleEndian(),
1968+
AsmInfo->getCodePointerSize());
1969+
uint64_t DataOffset = 0;
1970+
while (DataOffset + 4 <= Data.size()) {
1971+
OS << format(" %08" PRIx64 ": \t.word\t0x", Offset + DataOffset);
1972+
const auto Word = DE.getUnsigned(&DataOffset, 4);
1973+
OS << Twine::utohexstr(Word) << '\n';
1974+
}
1975+
if (DataOffset + 2 <= Data.size()) {
1976+
OS << format(" %08" PRIx64 ": \t.short\t0x", Offset + DataOffset);
1977+
const auto Short = DE.getUnsigned(&DataOffset, 2);
1978+
OS << Twine::utohexstr(Short) << '\n';
1979+
}
1980+
if (DataOffset + 1 == Data.size()) {
1981+
OS << format(" %08" PRIx64 ": \t.byte\t0x%x\n", Offset + DataOffset,
1982+
Data[DataOffset]);
1983+
}
1984+
}
1985+
19451986
void BinaryContext::printInstruction(raw_ostream &OS, const MCInst &Instruction,
19461987
uint64_t Offset,
19471988
const BinaryFunction *Function,

0 commit comments

Comments
 (0)