[PATCH] D74537: [LLD][ELF][AArch64] Fix plt generation for PAC/BTI.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 13 21:00:25 PST 2020
MaskRay added a comment.
> Unless I missed something, the || config->forceBTI shouldn't be necessary due to forceBTI always adding GNU_PROPERTY_AARCH64_FEATURE_1_BTI to all objects if it isn't there already.
Adding `config->pacPlt` to `getTargetInfo()` is problematic. `getTargetInfo()` is called twice.
readConfig(); // config->pacPlt is set. config->andFeatures is 0
target = getTarget();
config->andFeatures = getAndFeatures<ELFT>();
target = getTarget();
I think the following change should be made.
--- i/lld/ELF/Arch/AArch64.cpp
+++ w/lld/ELF/Arch/AArch64.cpp
@@ -595,4 +595,3 @@ private:
AArch64BtiPac::AArch64BtiPac() {
- btiHeader = (config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) ||
- config->forceBTI;
+ btiHeader = config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI;
// A BTI (Branch Target Indicator) Plt Entry is only required if the
@@ -693,3 +692,3 @@ static TargetInfo *getTargetInfo() {
if ((config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) ||
- config->pacPlt) {
+ (config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_PAC)) {
static AArch64BtiPac t;
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D74537/new/
https://reviews.llvm.org/D74537
More information about the llvm-commits
mailing list