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

Daniel Kiss via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 13 08:24:40 PST 2020


danielkiss marked an inline comment as done.
danielkiss added inline comments.
Herald added a subscriber: tatyana-krasnukha.


================
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
----------------
peter.smith wrote:
> 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;
>     }
> ```
lld/test/ELF/aarch64-feature-btipac.s:156 will fail without it because in that test the AArch64BtiPac::AArch64BtiPac() runs before the  getAndFeatures(). 
I guess the PLT generation for the passed so runs before the flags are processed in the driver.


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