[lld] [llvm] [lld][AArch64][Build Attributes] Add support for AArch64 Build Attributes (PR #147970)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 15 06:46:47 PDT 2025
================
@@ -537,6 +538,44 @@ uint32_t ObjFile<ELFT>::getSectionIndex(const Elf_Sym &sym) const {
this);
}
+template <class ELFT>
+static void
+handleAArch64BAAndGnuProperties(ObjFile<ELFT> *file, Ctx &ctx,
+ const AArch64BuildAttrSubsections &baInfo) {
+ if (file->aarch64PauthAbiCoreInfo) {
+ // Check for data mismatch
+ if (file->aarch64PauthAbiCoreInfo) {
+ if (baInfo.Pauth.TagPlatform != file->aarch64PauthAbiCoreInfo->platform ||
+ baInfo.Pauth.TagSchema != file->aarch64PauthAbiCoreInfo->version)
+ Err(ctx) << file
+ << " GNU properties and build attributes have conflicting "
+ "AArch64 PAuth data";
+ }
+ if (baInfo.AndFeatures != file->andFeatures)
+ Err(ctx) << file
+ << " GNU properties and build attributes have conflicting "
+ "AArch64 PAuth data";
+ } else {
+ // When BuildAttributes are missing, PauthABI value defaults to (TagPlatform
+ // = 0, TagSchema = 0). GNU properties do not write PAuthAbiCoreInfo if GNU
+ // property is not present. To match this behaviour, we only write
+ // PAuthAbiCoreInfo when there is at least one non-zero value. The
+ // specification reserves TagPlatform = 0, TagSchema = 1 values to match the
+ // 'Invalid' GNU property section with platform = 0, version = 0.
+ if (baInfo.Pauth.TagPlatform || baInfo.Pauth.TagSchema) {
+ if (baInfo.Pauth.TagPlatform == 0 && baInfo.Pauth.TagSchema == 1)
+ file->aarch64PauthAbiCoreInfo = {0, 0};
+ else
+ file->aarch64PauthAbiCoreInfo = {baInfo.Pauth.TagPlatform,
+ baInfo.Pauth.TagSchema};
+ }
+ file->andFeatures = baInfo.AndFeatures;
+ }
+}
+
+template <typename ELFT>
----------------
smithp35 wrote:
This forward declaration isn't needed anymore.
https://github.com/llvm/llvm-project/pull/147970
More information about the llvm-commits
mailing list