Skip to content

Commit 415e71e

Browse files
committed
Merge remote-tracking branch 'origin/main' into android-mblen-wctrans
2 parents 137d877 + 94d100f commit 415e71e

File tree

3,335 files changed

+136351
-86613
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,335 files changed

+136351
-86613
lines changed

.ci/generate_test_report.py

Lines changed: 423 additions & 0 deletions
Large diffs are not rendered by default.

.ci/monolithic-linux.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
2828
ccache --clear
2929
fi
3030

31-
function show-stats {
31+
function at-exit {
3232
mkdir -p artifacts
3333
ccache --print-stats > artifacts/ccache_stats.txt
34+
35+
# If building fails there will be no results files.
36+
shopt -s nullglob
37+
python3 "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":linux: Linux x64 Test Results" \
38+
"linux-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
3439
}
35-
trap show-stats EXIT
40+
trap at-exit EXIT
3641

3742
projects="${1}"
3843
targets="${2}"
@@ -42,6 +47,7 @@ lit_args="-v --xunit-xml-output ${BUILD_DIR}/test-results.xml --use-unique-outpu
4247
echo "--- cmake"
4348
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
4449
pip install -q -r "${MONOREPO_ROOT}"/lldb/test/requirements.txt
50+
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
4551
cmake -S "${MONOREPO_ROOT}"/llvm -B "${BUILD_DIR}" \
4652
-D LLVM_ENABLE_PROJECTS="${projects}" \
4753
-G Ninja \

.ci/monolithic-windows.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,23 @@ if [[ -n "${CLEAR_CACHE:-}" ]]; then
2727
fi
2828

2929
sccache --zero-stats
30-
function show-stats {
30+
function at-exit {
3131
mkdir -p artifacts
3232
sccache --show-stats >> artifacts/sccache_stats.txt
33+
34+
# If building fails there will be no results files.
35+
shopt -s nullglob
36+
python "${MONOREPO_ROOT}"/.ci/generate_test_report.py ":windows: Windows x64 Test Results" \
37+
"windows-x64-test-results" "${BUILD_DIR}"/test-results.*.xml
3338
}
34-
trap show-stats EXIT
39+
trap at-exit EXIT
3540

3641
projects="${1}"
3742
targets="${2}"
3843

3944
echo "--- cmake"
4045
pip install -q -r "${MONOREPO_ROOT}"/mlir/python/requirements.txt
46+
pip install -q -r "${MONOREPO_ROOT}"/.ci/requirements.txt
4147

4248
# The CMAKE_*_LINKER_FLAGS to disable the manifest come from research
4349
# on fixing a build reliability issue on the build server, please

.ci/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
junitparser==3.2.0

.github/new-prs-labeler.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,12 @@ llvm:ir:
587587
- llvm/docs/LangRef.rst
588588
- llvm/unittests/IR/**
589589

590+
llvm:SandboxIR:
591+
- llvm/lib/SandboxIR/**
592+
- llvm/include/llvm/SandboxIR/**
593+
- llvm/docs/SandboxIR.md
594+
- llvm/unittests/SandboxIR/**
595+
590596
llvm:analysis:
591597
- llvm/lib/Analysis/**
592598
- llvm/include/llvm/Analysis/**

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

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ env:
4545
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-19"
4646
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
4747

48-
4948
jobs:
5049
stage1:
5150
if: github.repository_owner == 'llvm'
52-
runs-on: libcxx-runners-set
53-
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
51+
runs-on: libcxx-self-hosted-linux
52+
container: ghcr.io/llvm/libcxx-linux-builder:0fd6f684b9c84c32d6cbfd9742402e788b2879f1
5453
continue-on-error: false
5554
strategy:
5655
fail-fast: false
@@ -86,8 +85,8 @@ jobs:
8685
**/crash_diagnostics/*
8786
stage2:
8887
if: github.repository_owner == 'llvm'
89-
runs-on: libcxx-runners-set
90-
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
88+
runs-on: libcxx-self-hosted-linux
89+
container: ghcr.io/llvm/libcxx-linux-builder:0fd6f684b9c84c32d6cbfd9742402e788b2879f1
9190
needs: [ stage1 ]
9291
continue-on-error: false
9392
strategy:
@@ -161,21 +160,21 @@ jobs:
161160
'generic-static',
162161
'bootstrapping-build'
163162
]
164-
machine: [ 'libcxx-runners-set' ]
163+
machine: [ 'libcxx-self-hosted-linux' ]
165164
include:
166165
- config: 'generic-cxx26'
167-
machine: libcxx-runners-set
166+
machine: libcxx-self-hosted-linux
168167
- config: 'generic-asan'
169-
machine: libcxx-runners-set
168+
machine: libcxx-self-hosted-linux
170169
- config: 'generic-tsan'
171-
machine: libcxx-runners-set
170+
machine: libcxx-self-hosted-linux
172171
- config: 'generic-ubsan'
173-
machine: libcxx-runners-set
172+
machine: libcxx-self-hosted-linux
174173
# Use a larger machine for MSAN to avoid timeout and memory allocation issues.
175174
- config: 'generic-msan'
176-
machine: libcxx-runners-set
175+
machine: libcxx-self-hosted-linux
177176
runs-on: ${{ matrix.machine }}
178-
container: ghcr.io/libcxx/actions-builder:testing-2024-09-21
177+
container: ghcr.io/llvm/libcxx-linux-builder:0fd6f684b9c84c32d6cbfd9742402e788b2879f1
179178
steps:
180179
- uses: actions/checkout@v4
181180
- name: ${{ matrix.config }}
@@ -202,13 +201,13 @@ jobs:
202201
matrix:
203202
include:
204203
- config: generic-cxx03
205-
os: macos-latest
204+
os: macos-15
206205
- config: generic-cxx23
207-
os: macos-latest
206+
os: macos-15
208207
- config: generic-modules
209-
os: macos-latest
208+
os: macos-15
210209
- config: apple-configuration
211-
os: macos-latest
210+
os: macos-15
212211
- config: apple-system
213212
os: macos-13
214213
- config: apple-system-hardened
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This file defines an action that builds the various Docker images used to run
2+
# libc++ CI whenever modifications to those Docker files are pushed to `main`.
3+
#
4+
# The images are pushed to the LLVM package registry at https://github.com/orgs/llvm/packages
5+
# and tagged appropriately. The selection of which Docker image version is used by the libc++
6+
# CI nodes at any given point is controlled from the workflow files themselves.
7+
8+
name: Build Docker images for libc++ CI
9+
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
on:
15+
push:
16+
branches:
17+
- main
18+
paths:
19+
- 'libcxx/utils/ci/**'
20+
- '.github/workflows/libcxx-build-containers.yml'
21+
pull_request:
22+
branches:
23+
- main
24+
paths:
25+
- 'libcxx/utils/ci/**'
26+
- '.github/workflows/libcxx-build-containers.yml'
27+
28+
jobs:
29+
build-and-push:
30+
runs-on: ubuntu-latest
31+
if: github.repository_owner == 'llvm'
32+
permissions:
33+
packages: write
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Build the Linux builder image
39+
working-directory: libcxx/utils/ci
40+
run: docker compose build actions-builder
41+
env:
42+
TAG: ${{ github.sha }}
43+
44+
# - name: Build the Android builder image
45+
# working-directory: libcxx/utils/ci
46+
# run: docker compose build android-buildkite-builder
47+
# env:
48+
# TAG: ${{ github.sha }}
49+
50+
- name: Log in to GitHub Container Registry
51+
uses: docker/login-action@v3
52+
with:
53+
registry: ghcr.io
54+
username: ${{ github.actor }}
55+
password: ${{ secrets.GITHUB_TOKEN }}
56+
57+
- name: Push the Linux builder image
58+
if: github.event_name == 'push'
59+
working-directory: libcxx/utils/ci
60+
run: |
61+
docker compose push actions-builder
62+
env:
63+
TAG: ${{ github.sha }}
64+
65+
# - name: Push the Android builder image
66+
# if: github.event_name == 'push'
67+
# working-directory: libcxx/utils/ci
68+
# run: |
69+
# docker compose push android-buildkite-builder
70+
# env:
71+
# TAG: ${{ github.sha }}

bolt/include/bolt/Core/Exceptions.h

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,14 @@ class CFIReaderWriter {
4343

4444
/// Generate .eh_frame_hdr from old and new .eh_frame sections.
4545
///
46-
/// Take FDEs from the \p NewEHFrame unless their initial_pc is listed
47-
/// in \p FailedAddresses. All other entries are taken from the
46+
/// Take FDEs from the \p NewEHFrame. All other entries are taken from the
4847
/// \p OldEHFrame.
4948
///
5049
/// \p EHFrameHeaderAddress specifies location of .eh_frame_hdr,
5150
/// and is required for relative addressing used in the section.
52-
std::vector<char>
53-
generateEHFrameHeader(const DWARFDebugFrame &OldEHFrame,
54-
const DWARFDebugFrame &NewEHFrame,
55-
uint64_t EHFrameHeaderAddress,
56-
std::vector<uint64_t> &FailedAddresses) const;
51+
std::vector<char> generateEHFrameHeader(const DWARFDebugFrame &OldEHFrame,
52+
const DWARFDebugFrame &NewEHFrame,
53+
uint64_t EHFrameHeaderAddress) const;
5754

5855
using FDEsMap = std::map<uint64_t, const dwarf::FDE *>;
5956

bolt/include/bolt/Rewrite/RewriteInstance.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -556,14 +556,6 @@ class RewriteInstance {
556556
return ErrOrSection ? &ErrOrSection.get() : nullptr;
557557
}
558558

559-
/// Keep track of functions we fail to write in the binary. We need to avoid
560-
/// rewriting CFI info for these functions.
561-
std::vector<uint64_t> FailedAddresses;
562-
563-
/// Keep track of which functions didn't fit in their original space in the
564-
/// last emission, so that we may either decide to split or not optimize them.
565-
std::set<uint64_t> LargeFunctions;
566-
567559
/// Section header string table.
568560
StringTableBuilder SHStrTab;
569561

bolt/lib/Core/BinaryEmitter.cpp

Lines changed: 19 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -906,17 +906,6 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
906906
if (Sites.empty())
907907
return;
908908

909-
// Calculate callsite table size. Size of each callsite entry is:
910-
//
911-
// sizeof(start) + sizeof(length) + sizeof(LP) + sizeof(uleb128(action))
912-
//
913-
// or
914-
//
915-
// sizeof(dwarf::DW_EH_PE_data4) * 3 + sizeof(uleb128(action))
916-
uint64_t CallSiteTableLength = llvm::size(Sites) * 4 * 3;
917-
for (const auto &FragmentCallSite : Sites)
918-
CallSiteTableLength += getULEB128Size(FragmentCallSite.second.Action);
919-
920909
Streamer.switchSection(BC.MOFI->getLSDASection());
921910

922911
const unsigned TTypeEncoding = BF.getLSDATypeEncoding();
@@ -975,36 +964,24 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
975964

976965
Streamer.emitIntValue(TTypeEncoding, 1); // TType format
977966

978-
// See the comment in EHStreamer::emitExceptionTable() on to use
979-
// uleb128 encoding (which can use variable number of bytes to encode the same
980-
// value) to ensure type info table is properly aligned at 4 bytes without
981-
// iteratively fixing sizes of the tables.
982-
unsigned CallSiteTableLengthSize = getULEB128Size(CallSiteTableLength);
983-
unsigned TTypeBaseOffset =
984-
sizeof(int8_t) + // Call site format
985-
CallSiteTableLengthSize + // Call site table length size
986-
CallSiteTableLength + // Call site table length
987-
BF.getLSDAActionTable().size() + // Actions table size
988-
BF.getLSDATypeTable().size() * TTypeEncodingSize; // Types table size
989-
unsigned TTypeBaseOffsetSize = getULEB128Size(TTypeBaseOffset);
990-
unsigned TotalSize = sizeof(int8_t) + // LPStart format
991-
sizeof(int8_t) + // TType format
992-
TTypeBaseOffsetSize + // TType base offset size
993-
TTypeBaseOffset; // TType base offset
994-
unsigned SizeAlign = (4 - TotalSize) & 3;
995-
996-
if (TTypeEncoding != dwarf::DW_EH_PE_omit)
997-
// Account for any extra padding that will be added to the call site table
998-
// length.
999-
Streamer.emitULEB128IntValue(TTypeBaseOffset,
1000-
/*PadTo=*/TTypeBaseOffsetSize + SizeAlign);
967+
MCSymbol *TTBaseLabel = nullptr;
968+
if (TTypeEncoding != dwarf::DW_EH_PE_omit) {
969+
TTBaseLabel = BC.Ctx->createTempSymbol("TTBase");
970+
MCSymbol *TTBaseRefLabel = BC.Ctx->createTempSymbol("TTBaseRef");
971+
Streamer.emitAbsoluteSymbolDiffAsULEB128(TTBaseLabel, TTBaseRefLabel);
972+
Streamer.emitLabel(TTBaseRefLabel);
973+
}
1001974

1002975
// Emit the landing pad call site table. We use signed data4 since we can emit
1003976
// a landing pad in a different part of the split function that could appear
1004977
// earlier in the address space than LPStart.
1005978
Streamer.emitIntValue(dwarf::DW_EH_PE_sdata4, 1);
1006-
Streamer.emitULEB128IntValue(CallSiteTableLength);
1007979

980+
MCSymbol *CSTStartLabel = BC.Ctx->createTempSymbol("CSTStart");
981+
MCSymbol *CSTEndLabel = BC.Ctx->createTempSymbol("CSTEnd");
982+
Streamer.emitAbsoluteSymbolDiffAsULEB128(CSTEndLabel, CSTStartLabel);
983+
984+
Streamer.emitLabel(CSTStartLabel);
1008985
for (const auto &FragmentCallSite : Sites) {
1009986
const BinaryFunction::CallSite &CallSite = FragmentCallSite.second;
1010987
const MCSymbol *BeginLabel = CallSite.Start;
@@ -1020,6 +997,7 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
1020997
emitLandingPad(CallSite.LP);
1021998
Streamer.emitULEB128IntValue(CallSite.Action);
1022999
}
1000+
Streamer.emitLabel(CSTEndLabel);
10231001

10241002
// Write out action, type, and type index tables at the end.
10251003
//
@@ -1038,6 +1016,8 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
10381016
assert(TypeTable.size() == BF.getLSDATypeTable().size() &&
10391017
"indirect type table size mismatch");
10401018

1019+
Streamer.emitValueToAlignment(Align(TTypeAlignment));
1020+
10411021
for (int Index = TypeTable.size() - 1; Index >= 0; --Index) {
10421022
const uint64_t TypeAddress = TypeTable[Index];
10431023
switch (TTypeEncoding & 0x70) {
@@ -1063,6 +1043,10 @@ void BinaryEmitter::emitLSDA(BinaryFunction &BF, const FunctionFragment &FF) {
10631043
}
10641044
}
10651045
}
1046+
1047+
if (TTypeEncoding != dwarf::DW_EH_PE_omit)
1048+
Streamer.emitLabel(TTBaseLabel);
1049+
10661050
for (uint8_t const &Byte : BF.getLSDATypeIndexTable())
10671051
Streamer.emitIntValue(Byte, 1);
10681052
}

bolt/lib/Core/Exceptions.cpp

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -665,16 +665,13 @@ bool CFIReaderWriter::fillCFIInfoFor(BinaryFunction &Function) const {
665665
return true;
666666
}
667667

668-
std::vector<char> CFIReaderWriter::generateEHFrameHeader(
669-
const DWARFDebugFrame &OldEHFrame, const DWARFDebugFrame &NewEHFrame,
670-
uint64_t EHFrameHeaderAddress,
671-
std::vector<uint64_t> &FailedAddresses) const {
668+
std::vector<char>
669+
CFIReaderWriter::generateEHFrameHeader(const DWARFDebugFrame &OldEHFrame,
670+
const DWARFDebugFrame &NewEHFrame,
671+
uint64_t EHFrameHeaderAddress) const {
672672
// Common PC -> FDE map to be written into .eh_frame_hdr.
673673
std::map<uint64_t, uint64_t> PCToFDE;
674674

675-
// Presort array for binary search.
676-
llvm::sort(FailedAddresses);
677-
678675
// Initialize PCToFDE using NewEHFrame.
679676
for (dwarf::FrameEntry &Entry : NewEHFrame.entries()) {
680677
const dwarf::FDE *FDE = dyn_cast<dwarf::FDE>(&Entry);
@@ -689,13 +686,7 @@ std::vector<char> CFIReaderWriter::generateEHFrameHeader(
689686
continue;
690687

691688
// Add the address to the map unless we failed to write it.
692-
if (!std::binary_search(FailedAddresses.begin(), FailedAddresses.end(),
693-
FuncAddress)) {
694-
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: FDE for function at 0x"
695-
<< Twine::utohexstr(FuncAddress) << " is at 0x"
696-
<< Twine::utohexstr(FDEAddress) << '\n');
697-
PCToFDE[FuncAddress] = FDEAddress;
698-
}
689+
PCToFDE[FuncAddress] = FDEAddress;
699690
};
700691

701692
LLVM_DEBUG(dbgs() << "BOLT-DEBUG: new .eh_frame contains "

0 commit comments

Comments
 (0)