Skip to content

Commit adf4d4d

Browse files
authored
Merge branch 'main' into alignment-attr-op-interface
2 parents 3f081df + 7c666e2 commit adf4d4d

File tree

1,941 files changed

+88436
-45566
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,941 files changed

+88436
-45566
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
BasedOnStyle: LLVM
2+
LineEnding: LF

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ jobs:
215215
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
216216
with:
217217
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
218-
xcode-version: '16.3'
218+
xcode-version: '26.0'
219219
- uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # v6
220220
- name: Build and test
221221
run: |
@@ -281,6 +281,10 @@ jobs:
281281
- name: Set up the MSVC dev environment
282282
if: ${{ matrix.mingw != true }}
283283
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
284+
- name: Add the installed Clang at the start of the path
285+
if: ${{ matrix.mingw != true }}
286+
run: |
287+
echo "c:\Program Files\LLVM\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append
284288
- name: Build and test
285289
run: |
286290
bash libcxx/utils/ci/run-buildbot ${{ matrix.config }}

bolt/include/bolt/Core/BinaryContext.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,9 @@ class BinaryContext {
190190
/// Unique build ID if available for the binary.
191191
std::optional<std::string> FileBuildID;
192192

193+
/// GNU property note indicating AArch64 BTI.
194+
bool UsesBTI{false};
195+
193196
/// Set of all sections.
194197
struct CompareSections {
195198
bool operator()(const BinarySection *A, const BinarySection *B) const {
@@ -384,6 +387,9 @@ class BinaryContext {
384387
}
385388
void setFileBuildID(StringRef ID) { FileBuildID = std::string(ID); }
386389

390+
bool usesBTI() const { return UsesBTI; }
391+
void setUsesBTI(bool Value) { UsesBTI = Value; }
392+
387393
bool hasSymbolsWithFileName() const { return HasSymbolsWithFileName; }
388394
void setHasSymbolsWithFileName(bool Value) { HasSymbolsWithFileName = Value; }
389395

bolt/include/bolt/Passes/SplitFunctions.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,6 @@
1818
namespace llvm {
1919
namespace bolt {
2020

21-
/// Strategy used to partition blocks into fragments.
22-
enum SplitFunctionsStrategy : char {
23-
/// Split each function into a hot and cold fragment using profiling
24-
/// information.
25-
Profile2 = 0,
26-
/// Split each function into a hot, warm, and cold fragment using
27-
/// profiling information.
28-
CDSplit,
29-
/// Split each function into a hot and cold fragment at a randomly chosen
30-
/// split point (ignoring any available profiling information).
31-
Random2,
32-
/// Split each function into N fragments at a randomly chosen split points
33-
/// (ignoring any available profiling information).
34-
RandomN,
35-
/// Split all basic blocks of each function into fragments such that each
36-
/// fragment contains exactly a single basic block.
37-
All
38-
};
39-
4021
class SplitStrategy {
4122
public:
4223
using BlockIt = BinaryFunction::BasicBlockOrderType::iterator;

bolt/include/bolt/Rewrite/MetadataRewriters.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ std::unique_ptr<MetadataRewriter> createPseudoProbeRewriter(BinaryContext &);
2727

2828
std::unique_ptr<MetadataRewriter> createSDTRewriter(BinaryContext &);
2929

30+
std::unique_ptr<MetadataRewriter> createGNUPropertyRewriter(BinaryContext &);
31+
3032
} // namespace bolt
3133
} // namespace llvm
3234

bolt/include/bolt/Rewrite/RewriteInstance.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,12 +249,11 @@ class RewriteInstance {
249249
/// Analyze relocation \p Rel.
250250
/// Return true if the relocation was successfully processed, false otherwise.
251251
/// The \p SymbolName, \p SymbolAddress, \p Addend and \p ExtractedValue
252-
/// parameters will be set on success. The \p Skip argument indicates
253-
/// that the relocation was analyzed, but it must not be processed.
252+
/// parameters will be set on success.
254253
bool analyzeRelocation(const object::RelocationRef &Rel, uint32_t &RType,
255254
std::string &SymbolName, bool &IsSectionRelocation,
256255
uint64_t &SymbolAddress, int64_t &Addend,
257-
uint64_t &ExtractedValue, bool &Skip) const;
256+
uint64_t &ExtractedValue) const;
258257

259258
/// Rewrite non-allocatable sections with modifications.
260259
void rewriteNoteSections();

bolt/include/bolt/Utils/CommandLineOpts.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@ enum HeatmapModeKind {
2929
HM_Optional // perf2bolt --heatmap
3030
};
3131

32+
/// Strategy used to partition blocks into fragments.
33+
enum SplitFunctionsStrategy : char {
34+
/// Split each function into a hot and cold fragment using profiling
35+
/// information.
36+
Profile2 = 0,
37+
/// Split each function into a hot, warm, and cold fragment using
38+
/// profiling information.
39+
CDSplit,
40+
/// Split each function into a hot and cold fragment at a randomly chosen
41+
/// split point (ignoring any available profiling information).
42+
Random2,
43+
/// Split each function into N fragments at a randomly chosen split points
44+
/// (ignoring any available profiling information).
45+
RandomN,
46+
/// Split all basic blocks of each function into fragments such that each
47+
/// fragment contains exactly a single basic block.
48+
All
49+
};
50+
3251
using HeatmapBlockSizes = std::vector<unsigned>;
3352
struct HeatmapBlockSpecParser : public llvm::cl::parser<HeatmapBlockSizes> {
3453
explicit HeatmapBlockSpecParser(llvm::cl::Option &O)
@@ -78,6 +97,7 @@ extern llvm::cl::opt<std::string> OutputFilename;
7897
extern llvm::cl::opt<std::string> PerfData;
7998
extern llvm::cl::opt<bool> PrintCacheMetrics;
8099
extern llvm::cl::opt<bool> PrintSections;
100+
extern llvm::cl::opt<SplitFunctionsStrategy> SplitStrategy;
81101

82102
// The format to use with -o in aggregation mode (perf2bolt)
83103
enum ProfileFormatKind { PF_Fdata, PF_YAML };

bolt/lib/Core/BinaryContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1662,7 +1662,7 @@ void BinaryContext::preprocessDWODebugInfo() {
16621662
"files.\n";
16631663
}
16641664
// Prevent failures when DWOName is already an absolute path.
1665-
sys::fs::make_absolute(DWOCompDir, AbsolutePath);
1665+
sys::path::make_absolute(DWOCompDir, AbsolutePath);
16661666
DWARFUnit *DWOCU =
16671667
DwarfUnit->getNonSkeletonUnitDIE(false, AbsolutePath).getDwarfUnit();
16681668
if (!DWOCU->isDWOUnit()) {

bolt/lib/Core/Relocation.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ static bool isSupportedAArch64(uint32_t Type) {
8181
case ELF::R_AARCH64_LD64_GOT_LO12_NC:
8282
case ELF::R_AARCH64_TLSDESC_LD64_LO12:
8383
case ELF::R_AARCH64_TLSDESC_ADD_LO12:
84-
case ELF::R_AARCH64_TLSDESC_CALL:
8584
case ELF::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
8685
case ELF::R_AARCH64_PREL16:
8786
case ELF::R_AARCH64_PREL32:
@@ -193,7 +192,6 @@ static size_t getSizeForTypeAArch64(uint32_t Type) {
193192
case ELF::R_AARCH64_LD64_GOT_LO12_NC:
194193
case ELF::R_AARCH64_TLSDESC_LD64_LO12:
195194
case ELF::R_AARCH64_TLSDESC_ADD_LO12:
196-
case ELF::R_AARCH64_TLSDESC_CALL:
197195
case ELF::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
198196
case ELF::R_AARCH64_PREL32:
199197
case ELF::R_AARCH64_MOVW_UABS_G0:
@@ -248,7 +246,14 @@ static bool skipRelocationTypeX86(uint32_t Type) {
248246
}
249247

250248
static bool skipRelocationTypeAArch64(uint32_t Type) {
251-
return Type == ELF::R_AARCH64_NONE || Type == ELF::R_AARCH64_LD_PREL_LO19;
249+
switch (Type) {
250+
default:
251+
return false;
252+
case ELF::R_AARCH64_NONE:
253+
case ELF::R_AARCH64_LD_PREL_LO19:
254+
case ELF::R_AARCH64_TLSDESC_CALL:
255+
return true;
256+
}
252257
}
253258

254259
static bool skipRelocationTypeRISCV(uint32_t Type) {
@@ -362,7 +367,6 @@ static uint64_t extractValueAArch64(uint32_t Type, uint64_t Contents,
362367
return static_cast<int64_t>(PC) + SignExtend64<32>(Contents & 0xffffffff);
363368
case ELF::R_AARCH64_PREL64:
364369
return static_cast<int64_t>(PC) + Contents;
365-
case ELF::R_AARCH64_TLSDESC_CALL:
366370
case ELF::R_AARCH64_JUMP26:
367371
case ELF::R_AARCH64_CALL26:
368372
// Immediate goes in bits 25:0 of B and BL.
@@ -552,7 +556,6 @@ static bool isGOTAArch64(uint32_t Type) {
552556
case ELF::R_AARCH64_TLSDESC_ADR_PAGE21:
553557
case ELF::R_AARCH64_TLSDESC_LD64_LO12:
554558
case ELF::R_AARCH64_TLSDESC_ADD_LO12:
555-
case ELF::R_AARCH64_TLSDESC_CALL:
556559
return true;
557560
}
558561
}
@@ -591,7 +594,6 @@ static bool isTLSAArch64(uint32_t Type) {
591594
case ELF::R_AARCH64_TLSLE_MOVW_TPREL_G0_NC:
592595
case ELF::R_AARCH64_TLSDESC_LD64_LO12:
593596
case ELF::R_AARCH64_TLSDESC_ADD_LO12:
594-
case ELF::R_AARCH64_TLSDESC_CALL:
595597
case ELF::R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21:
596598
return true;
597599
}
@@ -667,7 +669,6 @@ static bool isPCRelativeAArch64(uint32_t Type) {
667669
case ELF::R_AARCH64_MOVW_UABS_G2_NC:
668670
case ELF::R_AARCH64_MOVW_UABS_G3:
669671
return false;
670-
case ELF::R_AARCH64_TLSDESC_CALL:
671672
case ELF::R_AARCH64_CALL26:
672673
case ELF::R_AARCH64_JUMP26:
673674
case ELF::R_AARCH64_TSTBR14:

bolt/lib/Passes/LongJmp.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,10 @@ void LongJmpPass::relaxLocalBranches(BinaryFunction &BF) {
895895

896896
Error LongJmpPass::runOnFunctions(BinaryContext &BC) {
897897

898+
assert((opts::CompactCodeModel ||
899+
opts::SplitStrategy != opts::SplitFunctionsStrategy::CDSplit) &&
900+
"LongJmp cannot work with functions split in more than two fragments");
901+
898902
if (opts::CompactCodeModel) {
899903
BC.outs()
900904
<< "BOLT-INFO: relaxing branches for compact code model (<128MB)\n";

0 commit comments

Comments
 (0)