Skip to content

Commit 56fbf64

Browse files
committed
Merge remote-tracking branch 'origin/main' into pr/gisel-rotate
2 parents b2911f9 + b970a78 commit 56fbf64

File tree

2,292 files changed

+68182
-36602
lines changed

Some content is hidden

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

2,292 files changed

+68182
-36602
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ jobs:
159159
'generic-no-rtti',
160160
'generic-optimized-speed',
161161
'generic-static',
162-
# TODO Find a better place for the benchmark and bootstrapping builds to live. They're either very expensive
163-
# or don't provide much value since the benchmark run results are too noise on the bots.
164-
'benchmarks',
165162
'bootstrapping-build'
166163
]
167164
machine: [ 'libcxx-runners-set' ]

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,9 +789,44 @@ void RewriteInstance::discoverFileObjects() {
789789
BinarySection Section(*BC, *cantFail(Sym.getSection()));
790790
return Section.isAllocatable();
791791
};
792+
auto checkSymbolInSection = [this](const SymbolInfo &S) {
793+
// Sometimes, we encounter symbols with addresses outside their section. If
794+
// such symbols happen to fall into another section, they can interfere with
795+
// disassembly. Notably, this occurs with AArch64 marker symbols ($d and $t)
796+
// that belong to .eh_frame, but end up pointing into .text.
797+
// As a workaround, we ignore all symbols that lie outside their sections.
798+
auto Section = cantFail(S.Symbol.getSection());
799+
800+
// Accept all absolute symbols.
801+
if (Section == InputFile->section_end())
802+
return true;
803+
804+
uint64_t SecStart = Section->getAddress();
805+
uint64_t SecEnd = SecStart + Section->getSize();
806+
uint64_t SymEnd = S.Address + ELFSymbolRef(S.Symbol).getSize();
807+
if (S.Address >= SecStart && SymEnd <= SecEnd)
808+
return true;
809+
810+
auto SymType = cantFail(S.Symbol.getType());
811+
// Skip warnings for common benign cases.
812+
if (opts::Verbosity < 1 && SymType == SymbolRef::ST_Other)
813+
return false; // E.g. ELF::STT_TLS.
814+
815+
auto SymName = S.Symbol.getName();
816+
auto SecName = cantFail(S.Symbol.getSection())->getName();
817+
BC->errs() << "BOLT-WARNING: ignoring symbol "
818+
<< (SymName ? *SymName : "[unnamed]") << " at 0x"
819+
<< Twine::utohexstr(S.Address) << ", which lies outside "
820+
<< (SecName ? *SecName : "[unnamed]") << "\n";
821+
822+
return false;
823+
};
792824
for (const SymbolRef &Symbol : InputFile->symbols())
793-
if (isSymbolInMemory(Symbol))
794-
SortedSymbols.push_back({cantFail(Symbol.getAddress()), Symbol});
825+
if (isSymbolInMemory(Symbol)) {
826+
SymbolInfo SymInfo{cantFail(Symbol.getAddress()), Symbol};
827+
if (checkSymbolInSection(SymInfo))
828+
SortedSymbols.push_back(SymInfo);
829+
}
795830

796831
auto CompareSymbols = [this](const SymbolInfo &A, const SymbolInfo &B) {
797832
if (A.Address != B.Address)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
--- !ELF
2+
FileHeader:
3+
Class: ELFCLASS64
4+
Data: ELFDATA2LSB
5+
Type: ET_EXEC
6+
Machine: EM_AARCH64
7+
Entry: 0x2a0000
8+
ProgramHeaders:
9+
- Type: PT_PHDR
10+
Flags: [ PF_R ]
11+
VAddr: 0x40
12+
Align: 0x8
13+
FileSize: 0xa8
14+
MemSize: 0xa8
15+
Offset: 0x40
16+
- Type: PT_LOAD
17+
Flags: [ PF_R ]
18+
VAddr: 0x0
19+
Align: 0x10000
20+
FileSize: 0xf8
21+
MemSize: 0xf8
22+
Offset: 0x0
23+
- Type: PT_LOAD
24+
Flags: [ PF_X, PF_R ]
25+
VAddr: 0x2a0000
26+
Align: 0x10000
27+
FirstSec: .text
28+
LastSec: .ignored
29+
Sections:
30+
- Name: .text
31+
Type: SHT_PROGBITS
32+
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
33+
Address: 0x2a0000
34+
AddressAlign: 0x4
35+
Content: 400580d2c0035fd6
36+
- Name: .ignored
37+
Type: SHT_PROGBITS
38+
Flags: [ SHF_ALLOC ]
39+
Address: 0x2a0008
40+
AddressAlign: 0x8
41+
Size: 0x8
42+
- Name: .eh_frame
43+
Type: SHT_PROGBITS
44+
Flags: [ SHF_ALLOC ]
45+
Address: 0x2a0010
46+
AddressAlign: 0x8
47+
Content: 1000000000000000017a520004781e010b0c1f00140000001800000000002a0008000000000e01410e010000
48+
Symbols:
49+
- Name: func
50+
Section: .text
51+
Value: 0x2a0000
52+
Size: 0x8
53+
- Name: '$d.42'
54+
Section: .ignored
55+
Value: 0x2a0004
56+
...
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Check that marker symbols ($d, $x) denoting data embedded in code are ignored
2+
// if they fall outside their respective sections.
3+
4+
// RUN: yaml2obj %S/Inputs/spurious-marker-symbol.yaml -o %t.exe
5+
// RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s
6+
// CHECK: 1 out of 1 functions were overwritten
7+
// RUN: llvm-objdump -j .text -d %t.bolt | FileCheck %s -check-prefix=CHECK-DISASM
8+
// CHECK-DISASM: func
9+
// CHECK-DISASM: 2a0000: d2800540 mov
10+
// CHECK-DISASM: 2a0004: d65f03c0 ret
11+
12+
// The YAML encodes the following assembly and debug information:
13+
14+
.text
15+
.globl func
16+
.type func, %function
17+
func:
18+
mov x0, #42
19+
// $d.42: (symbol in .ignored, with an address in .text)
20+
ret
21+
22+
// .eh_frame contains minimal DWARF with a CFA operation on the `ret`. BOLT
23+
// should ignore the spurious `$d.42`. If it doesn't, then it will stop
24+
// disassembling after the `mov` and will fail to process the second
25+
// DW_CFA_def_cfa_offset.
26+
//
27+
// CIE
28+
// length: 00000010
29+
// CIE_id: 00000000
30+
// version: 01
31+
// augmentation:
32+
// "zR" 7a 52 00
33+
// - read augmentation data
34+
// - read FDE pointer encoding
35+
// code_alignment_factor: 04
36+
// data_alignment_factor: 78 (-8)
37+
// return_address_register: 1e (r30 / lr)
38+
//
39+
// augmentation data:
40+
// length: 01
41+
// FDE pointers are absptr+sdata4 0b
42+
//
43+
// initial_instructions:
44+
// DW_CFA_def_cfa (31, 0): 0c 1f 00
45+
//
46+
// Encoding: 10000000'00000000'01'7a5200'04'78'1e'10'0b'0c1f00
47+
//
48+
// FDE
49+
// length: 00000014
50+
// CIE_pointer: 00000018 (backwards offset from here to CIE)
51+
// initial_location: 002a0000 (`func` as absptr+sdata4)
52+
// address_range: 00000008
53+
// augmentation data:
54+
// length: 00
55+
// instructions:
56+
// DW_CFA_def_cfa_offset (1) 0e 01
57+
// DW_CFA_advance_loc (1) 41 (`ret` at 0x2a0004)
58+
// DW_CFA_def_cfa_offset (1) 0e 01 Fails unless $d.42 is ignored.
59+
// DW_CFA_nop 00 00
60+
//
61+
// Encoding: 14000000'18000000'00002a00'08000000'000e0141'0e010000

clang-tools-extra/clang-include-fixer/InMemorySymbolIndex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ InMemorySymbolIndex::InMemorySymbolIndex(
2121

2222
std::vector<SymbolAndSignals>
2323
InMemorySymbolIndex::search(llvm::StringRef Identifier) {
24-
auto I = LookupTable.find(std::string(Identifier));
24+
auto I = LookupTable.find(Identifier);
2525
if (I != LookupTable.end())
2626
return I->second;
2727
return {};

clang-tools-extra/clang-include-fixer/InMemorySymbolIndex.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class InMemorySymbolIndex : public SymbolIndex {
2727
search(llvm::StringRef Identifier) override;
2828

2929
private:
30-
std::map<std::string, std::vector<find_all_symbols::SymbolAndSignals>>
30+
std::map<std::string, std::vector<find_all_symbols::SymbolAndSignals>,
31+
std::less<>>
3132
LookupTable;
3233
};
3334

clang-tools-extra/clang-tidy/abseil/DurationRewriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ std::optional<DurationScale> getScaleForDurationInverse(llvm::StringRef Name) {
244244
{"ToDoubleNanoseconds", DurationScale::Nanoseconds},
245245
{"ToInt64Nanoseconds", DurationScale::Nanoseconds}});
246246

247-
auto ScaleIter = ScaleMap.find(std::string(Name));
247+
auto ScaleIter = ScaleMap.find(Name);
248248
if (ScaleIter == ScaleMap.end())
249249
return std::nullopt;
250250

@@ -260,7 +260,7 @@ std::optional<DurationScale> getScaleForTimeInverse(llvm::StringRef Name) {
260260
{"ToUnixMicros", DurationScale::Microseconds},
261261
{"ToUnixNanos", DurationScale::Nanoseconds}});
262262

263-
auto ScaleIter = ScaleMap.find(std::string(Name));
263+
auto ScaleIter = ScaleMap.find(Name);
264264
if (ScaleIter == ScaleMap.end())
265265
return std::nullopt;
266266

clang/docs/OpenMPSupport.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ implementation.
284284
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
285285
| memory management | alignment for allocate directive and clause | :good:`done` | D115683 |
286286
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
287+
| memory management | 'allocator' modifier for allocate clause | :good:`done` | https://github.com/llvm/llvm-project/pull/114883 |
288+
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
287289
| memory management | new memory management routines | :none:`unclaimed` | |
288290
+------------------------------+--------------------------------------------------------------+--------------------------+-----------------------------------------------------------------------+
289291
| memory management | changes to omp_alloctrait_key enum | :none:`unclaimed` | |

clang/docs/ReleaseNotes.rst

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ C++ Specific Potentially Breaking Changes
140140
unsigned operator""_udl_name(unsigned long long);
141141

142142
- Clang will now produce an error diagnostic when [[clang::lifetimebound]] is
143-
applied on a parameter of a function that returns void. This was previously
144-
ignored and had no effect. (#GH107556)
143+
applied on a parameter or an implicit object parameter of a function that
144+
returns void. This was previously ignored and had no effect. (#GH107556)
145145

146146
.. code-block:: c++
147147

@@ -274,6 +274,30 @@ C Language Changes
274274
C2y Feature Support
275275
^^^^^^^^^^^^^^^^^^^
276276

277+
- Updated conformance for `N3298 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3298.htm>`_
278+
which adds the ``i`` and ``j`` suffixes for the creation of a ``_Complex``
279+
constant value. Clang has always supported these suffixes as a GNU extension,
280+
so ``-Wgnu-imaginary-constant`` no longer has effect in C modes, as this is
281+
not a C2y extension in C. ``-Wgnu-imaginary-constant`` still applies in C++
282+
modes.
283+
284+
- Clang updated conformance for `N3370 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3370.htm>`_
285+
case range expressions. This feature was previously supported by Clang as a
286+
GNU extension, so ``-Wgnu-case-range`` no longer has effect in C modes, as
287+
this is now a C2y extension in C. ``-Wgnu-case-range`` still applies in C++
288+
modes.
289+
290+
- Clang implemented support for `N3344 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3344.pdf>`_
291+
which disallows a ``void`` parameter from having a qualifier or storage class
292+
specifier. Note that ``register void`` was previously accepted in all C
293+
language modes but is now rejected (all of the other qualifiers and storage
294+
class specifiers were previously rejected).
295+
296+
- Updated conformance for `N3364 <https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3364.pdf>`_
297+
on floating-point translation-time initialization with signaling NaN. This
298+
paper adopts Clang's existing practice, so there were no changes to compiler
299+
behavior.
300+
277301
C23 Feature Support
278302
^^^^^^^^^^^^^^^^^^^
279303

@@ -569,9 +593,6 @@ Bug Fixes to C++ Support
569593
in certain friend declarations. (#GH93099)
570594
- Clang now instantiates the correct lambda call operator when a lambda's class type is
571595
merged across modules. (#GH110401)
572-
- Clang now uses the correct set of template argument lists when comparing the constraints of
573-
out-of-line definitions and member templates explicitly specialized for a given implicit instantiation of
574-
a class template. (#GH102320)
575596
- Fix a crash when parsing a pseudo destructor involving an invalid type. (#GH111460)
576597
- Fixed an assertion failure when invoking recovery call expressions with explicit attributes
577598
and undeclared templates. (#GH107047), (#GH49093)
@@ -591,6 +612,9 @@ Bug Fixes to C++ Support
591612
- Clang now correctly ignores previous partial specializations of member templates explicitly specialized for
592613
an implicitly instantiated class template specialization. (#GH51051)
593614
- Fixed an assertion failure caused by invalid enum forward declarations. (#GH112208)
615+
- Name independent data members were not correctly initialized from default member initializers. (#GH114069)
616+
- Fixed an assertion failure caused by invalid default argument substitutions in non-defining
617+
friend declarations. (#GH113324).
594618

595619
Bug Fixes to AST Handling
596620
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/docs/analyzer/checkers.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3560,6 +3560,12 @@ We also define a set of safe transformations which if passed a safe value as an
35603560
- casts
35613561
- unary operators like ``&`` or ``*``
35623562
3563+
alpha.webkit.UncheckedCallArgsChecker
3564+
"""""""""""""""""""""""""""""""""""""
3565+
The goal of this rule is to make sure that lifetime of any dynamically allocated CheckedPtr capable object passed as a call argument keeps its memory region past the end of the call. This applies to call to any function, method, lambda, function pointer or functor. CheckedPtr capable objects aren't supposed to be allocated on stack so we check arguments for parameters of raw pointers and references to unchecked types.
3566+
3567+
The rules of when to use and not to use CheckedPtr / CheckedRef are same as alpha.webkit.UncountedCallArgsChecker for ref-counted objects.
3568+
35633569
alpha.webkit.UncountedLocalVarsChecker
35643570
""""""""""""""""""""""""""""""""""""""
35653571
The goal of this rule is to make sure that any uncounted local variable is backed by a ref-counted object with lifetime that is strictly larger than the scope of the uncounted local variable. To be on the safe side we require the scope of an uncounted variable to be embedded in the scope of ref-counted object that backs it.

0 commit comments

Comments
 (0)