Skip to content

Commit 2202f35

Browse files
author
z1_cciauto
authored
merge main into amd-staging (llvm#3764)
2 parents a41b546 + b93c179 commit 2202f35

File tree

296 files changed

+8235
-3766
lines changed

Some content is hidden

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

296 files changed

+8235
-3766
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ RUN apt-get update && \
7373
# caching), so we manually install it here.
7474
# TODO(boomanaiden154): We should return to installing this from the apt
7575
# repository once a version containing the necessary bug fixes is available.
76-
RUN curl -L 'https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-x86_64-unknown-linux-musl.tar.gz' > /tmp/sccache.tar.gz && \
77-
echo "1fbb35e135660d04a2d5e42b59c7874d39b3deb17de56330b25b713ec59f849b /tmp/sccache.tar.gz" | sha256sum -c && \
76+
RUN curl -L "https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-$(arch)-unknown-linux-musl.tar.gz" > /tmp/sccache.tar.gz && \
77+
echo $( [ $(arch) = 'x86_64' ] && echo "1fbb35e135660d04a2d5e42b59c7874d39b3deb17de56330b25b713ec59f849b" || echo "d6a1ce4acd02b937cd61bc675a8be029a60f7bc167594c33d75732bbc0a07400") /tmp/sccache.tar.gz | sha256sum -c && \
7878
tar xzf /tmp/sccache.tar.gz -O --wildcards '*/sccache' > '/usr/local/bin/sccache' && \
7979
rm /tmp/sccache.tar.gz && \
8080
chmod +x /usr/local/bin/sccache

.github/workflows/premerge.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ jobs:
6565
# several test suites in a row and discard statistics that we want
6666
# to save in the end.
6767
export SCCACHE_IDLE_TIMEOUT=0
68-
sccache --start-server
68+
mkdir artifacts
69+
SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server
6970
7071
./.ci/monolithic-linux.sh "${projects_to_build}" "${project_check_targets}" "${runtimes_to_build}" "${runtimes_check_targets}" "${runtimes_check_targets_needs_reconfig}" "${enable_cir}"
7172
- name: Upload Artifacts
@@ -117,7 +118,7 @@ jobs:
117118
call C:\\BuildTools\\Common7\\Tools\\VsDevCmd.bat -arch=amd64 -host_arch=amd64
118119
# See the comments above in the Linux job for why we define each of
119120
# these environment variables.
120-
bash -c "export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET; export SCCACHE_GCS_RW_MODE=READ_WRITE; export SCCACHE_IDLE_TIMEOUT=0; sccache --start-server; .ci/monolithic-windows.sh \"${{ steps.vars.outputs.windows-projects }}\" \"${{ steps.vars.outputs.windows-check-targets }}\""
121+
bash -c "export SCCACHE_GCS_BUCKET=$CACHE_GCS_BUCKET; export SCCACHE_GCS_RW_MODE=READ_WRITE; export SCCACHE_IDLE_TIMEOUT=0; mkdir artifacts; SCCACHE_LOG=info SCCACHE_ERROR_LOG=$(pwd)/artifacts/sccache.log sccache --start-server; .ci/monolithic-windows.sh \"${{ steps.vars.outputs.windows-projects }}\" \"${{ steps.vars.outputs.windows-check-targets }}\""
121122
- name: Upload Artifacts
122123
# In some cases, Github will fail to upload the artifact. We want to
123124
# continue anyways as a failed artifact upload is an infra failure, not

bolt/lib/Core/BinaryFunction.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3773,6 +3773,8 @@ MCSymbol *BinaryFunction::addEntryPointAtOffset(uint64_t Offset) {
37733773
assert(Offset && "cannot add primary entry point");
37743774

37753775
const uint64_t EntryPointAddress = getAddress() + Offset;
3776+
assert(!isInConstantIsland(EntryPointAddress) &&
3777+
"cannot add entry point that points to constant data");
37763778
MCSymbol *LocalSymbol = getOrCreateLocalLabel(EntryPointAddress);
37773779

37783780
MCSymbol *EntrySymbol = getSecondaryEntryPointSymbol(LocalSymbol);

bolt/lib/Rewrite/RewriteInstance.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2935,7 +2935,8 @@ void RewriteInstance::handleRelocation(const SectionRef &RelocatedSection,
29352935
ReferencedSymbol = nullptr;
29362936
ExtractedValue = Address;
29372937
} else if (RefFunctionOffset) {
2938-
if (ContainingBF && ContainingBF != ReferencedBF) {
2938+
if (ContainingBF && ContainingBF != ReferencedBF &&
2939+
!ReferencedBF->isInConstantIsland(Address)) {
29392940
ReferencedSymbol =
29402941
ReferencedBF->addEntryPointAtOffset(RefFunctionOffset);
29412942
} else {

bolt/test/AArch64/validate-secondary-entry-point.s

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
# This test is to verify that BOLT won't take a label pointing to constant
2-
# island as a secondary entry point (function `_start` doesn't have ELF size
3-
# set originally) and the function won't otherwise be mistaken as non-simple.
2+
# island as a secondary entry point. This could happen when function doesn't
3+
# have ELF size set if it is from assembly code, or a constant island is
4+
# referenced by another function discovered during relocation processing.
45

5-
# RUN: %clang %cflags -pie %s -o %t.so -Wl,-q -Wl,--init=_foo -Wl,--fini=_foo
6+
# RUN: split-file %s %t
7+
8+
# RUN: %clang %cflags -pie %t/tt.asm -o %t.so \
9+
# RUN: -Wl,-q -Wl,--init=_foo -Wl,--fini=_foo
610
# RUN: llvm-bolt %t.so -o %t.bolt.so --print-cfg 2>&1 | FileCheck %s
711
# CHECK-NOT: BOLT-WARNING: reference in the middle of instruction detected \
812
# CHECK-NOT: function _start at offset 0x{{[0-9a-f]+}}
913
# CHECK: Binary Function "_start" after building cfg
1014

15+
# RUN: %clang %cflags -ffunction-sections -shared %t/tt.c %t/ss.c -o %tt.so \
16+
# RUN: -Wl,-q -Wl,--init=_start -Wl,--fini=_start \
17+
# RUN: -Wl,--version-script=%t/linker_script
18+
# RUN: llvm-bolt %tt.so -o %tt.bolted.so
19+
20+
;--- tt.asm
1121
.text
1222

1323
.global _foo
@@ -32,3 +42,31 @@ _bar:
3242

3343
# Dummy relocation to force relocation mode
3444
.reloc 0, R_AARCH64_NONE
45+
46+
;--- tt.c
47+
void _start() {}
48+
49+
__attribute__((naked)) void foo() {
50+
asm("ldr x16, .L_fnptr\n"
51+
"blr x16\n"
52+
"ret\n"
53+
54+
"_rodatx:"
55+
".global _rodatx;"
56+
".quad 0;"
57+
".L_fnptr:"
58+
".quad 0;");
59+
}
60+
61+
;--- ss.c
62+
__attribute__((visibility("hidden"))) extern void* _rodatx;
63+
void* bar() { return &_rodatx; }
64+
65+
;--- linker_script
66+
{
67+
global:
68+
_start;
69+
foo;
70+
bar;
71+
local: *;
72+
};

clang-tools-extra/clang-tidy/bugprone/EasilySwappableParametersCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ approximateStandardConversionSequence(const TheCheck &Check, QualType From,
997997
WorkType = QualType{ToBuiltin, FastQualifiersToApply};
998998
}
999999

1000-
const auto *FromEnum = WorkType->getAs<EnumType>();
1000+
const auto *FromEnum = WorkType->getAsCanonical<EnumType>();
10011001
const auto *ToEnum = To->getAs<EnumType>();
10021002
if (FromEnum && ToNumeric && FromEnum->isUnscopedEnumerationType()) {
10031003
// Unscoped enumerations (or enumerations in C) convert to numerics.

clang-tools-extra/clang-tidy/cppcoreguidelines/MissingStdForwardCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ AST_MATCHER(ParmVarDecl, isTemplateTypeParameter) {
4545

4646
QualType ParamType =
4747
Node.getType().getNonPackExpansionType()->getPointeeType();
48-
const auto *TemplateType = ParamType->getAs<TemplateTypeParmType>();
48+
const auto *TemplateType = ParamType->getAsCanonical<TemplateTypeParmType>();
4949
if (!TemplateType)
5050
return false;
5151

clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ struct InitializerInsertion {
189189

190190
// Convenience utility to get a RecordDecl from a QualType.
191191
const RecordDecl *getCanonicalRecordDecl(const QualType &Type) {
192-
if (const auto *RT = Type.getCanonicalType()->getAs<RecordType>())
192+
if (const auto *RT = Type->getAsCanonical<RecordType>())
193193
return RT->getOriginalDecl();
194194
return nullptr;
195195
}

clang-tools-extra/clang-tidy/misc/UnusedUsingDeclsCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ void UnusedUsingDeclsCheck::check(const MatchFinder::MatchResult &Result) {
131131
return;
132132
}
133133
if (const auto *ECD = dyn_cast<EnumConstantDecl>(Used)) {
134-
if (const auto *ET = ECD->getType()->getAs<EnumType>())
134+
if (const auto *ET = ECD->getType()->getAsCanonical<EnumType>())
135135
removeFromFoundDecls(ET->getOriginalDecl());
136136
}
137137
};

clang-tools-extra/clang-tidy/modernize/UseScopedLockCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static bool isLockGuardDecl(const NamedDecl *Decl) {
2828
}
2929

3030
static bool isLockGuard(const QualType &Type) {
31-
if (const auto *Record = Type->getAs<RecordType>())
31+
if (const auto *Record = Type->getAsCanonical<RecordType>())
3232
if (const RecordDecl *Decl = Record->getOriginalDecl())
3333
return isLockGuardDecl(Decl);
3434

0 commit comments

Comments
 (0)