[lld] [llvm] [lld][AArch64][Build Attributes] Add support for AArch64 Build Attributes (PR #144082)
Peter Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 2 09:21:58 PDT 2025
================
@@ -537,6 +538,52 @@ uint32_t ObjFile<ELFT>::getSectionIndex(const Elf_Sym &sym) const {
this);
}
+template <class ELFT>
+static void
+handleAArch64BAAndGnuProperties(ObjFile<ELFT> *file, Ctx &ctx, bool hasGP,
+ const AArch64BuildAttrSubsections &baInfo,
+ const GnuPropertiesInfo &gpInfo) {
+ if (hasGP) {
+ // Check for data mismatch
+ if (gpInfo.pauthAbiCoreInfo) {
+ if (baInfo.Pauth.TagPlatform != gpInfo.pauthAbiCoreInfo->platform ||
+ baInfo.Pauth.TagSchema != gpInfo.pauthAbiCoreInfo->version)
+ Err(ctx)
+ << file
+ << " Pauth Data mismatch: file contains both GNU properties and "
+ "AArch64 build attributes sections with different Pauth data";
+ }
+ if (baInfo.AndFeatures != gpInfo.andFeatures)
+ Err(ctx) << file
+ << " Features Data mismatch: file contains both GNU "
+ "properties and AArch64 build attributes sections with "
+ "different And Features data";
+ } else {
+ // Write missing data
+ // We can only know when Pauth is missing.
+ // Unlike AArch64 Build Attributes, GNU properties does not give a way to
----------------
smithp35 wrote:
I would combine the comment here with the one below the if statement.
BuildAttributes that are not present have an implicit default of 0, 0. To match the existing behavior of GNU properties, which do not write to aarch64PAuthAbiCoreInfo if there is no GNU property we only write 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.
https://github.com/llvm/llvm-project/pull/144082
More information about the llvm-commits
mailing list