[PATCH] D74537: [LLD][ELF][AArch64] Fix plt generation for PAC/BTI.

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 06:17:36 PST 2020


peter.smith accepted this revision.
peter.smith added a comment.
This revision is now accepted and ready to land.

One query aside, this looks good to me. The original idea for glibc was to automatically have the dynamic loader sign the .plt.got entries on the presence of AARCH64_PAC_PLT, it turns out that those patches haven't been accepted in glibc yet. Android does not use lazy binding and marks the .plt.got as RELRO so PAC isn't much use there. I've marked as approved, but please wait a day or so to see if there are any comments from other timezones.



================
Comment at: lld/ELF/Arch/AArch64.cpp:597
+  btiHeader = (config->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_BTI) ||
+              config->forceBTI;
   // A BTI (Branch Target Indicator) Plt Entry is only required if the
----------------
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.

```
// Driver.cpp
if (config->forceBTI && !(features & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) {
      warn(toString(f) + ": -z force-bti: file does not have "
                         "GNU_PROPERTY_AARCH64_FEATURE_1_BTI property");
      features |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI;
    }
```


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