Skip to content

Commit 2aa0310

Browse files
kettenismordak
authored andcommitted
Enable BTI PLT entries by default.
ok jsg@
1 parent cb04aee commit 2aa0310

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lld/ELF/Arch/AArch64.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,11 @@ class AArch64BtiPac final : public AArch64 {
836836
} // namespace
837837

838838
AArch64BtiPac::AArch64BtiPac() {
839+
#ifdef __OpenBSD__
840+
btiHeader = true;
841+
#else
839842
btiHeader = (config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI);
843+
#endif
840844
// A BTI (Branch Target Indicator) Plt Entry is only required if the
841845
// address of the PLT entry can be taken by the program, which permits an
842846
// indirect jump to the PLT entry. This can happen when the address
@@ -936,13 +940,18 @@ void AArch64BtiPac::writePlt(uint8_t *buf, const Symbol &sym,
936940
}
937941

938942
static TargetInfo *getTargetInfo() {
943+
#ifdef __OpenBSD__
944+
static AArch64BtiPac t;
945+
return &t;
946+
#else
939947
if ((config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) ||
940948
config->zPacPlt) {
941949
static AArch64BtiPac t;
942950
return &t;
943951
}
944952
static AArch64 t;
945953
return &t;
954+
#endif
946955
}
947956

948957
TargetInfo *elf::getAArch64TargetInfo() { return getTargetInfo(); }

0 commit comments

Comments
 (0)