@@ -704,6 +704,7 @@ handleAArch64BAAndGnuProperties(const ELFT &tPointer, Ctx &ctx, bool isBE,
704704 };
705705
706706 if (hasBA && hasGP) {
707+ // Check for data mismatch
707708 if (!gpInfo.aarch64PauthAbiCoreInfo .empty ()) {
708709 auto baPauth = serializeUnsigned (baInfo.pauth .tagPlatform ,
709710 baInfo.pauth .tagSchema , isBE);
@@ -723,6 +724,9 @@ handleAArch64BAAndGnuProperties(const ELFT &tPointer, Ctx &ctx, bool isBE,
723724 }
724725
725726 if (hasBA && !hasGP) {
727+ // Write missing data
728+ // We can only know when Pauth is missing.
729+ // Unlike AArch64 Build Attributes, GNU properties does not give a way to distinguish between no-value given to value of '0' given.
726730 if (baInfo.pauth .tagPlatform || baInfo.pauth .tagSchema ) {
727731 tPointer->aarch64PauthAbiCoreInfoStorage = serializeUnsigned (
728732 baInfo.pauth .tagPlatform , baInfo.pauth .tagSchema , isBE);
@@ -763,7 +767,7 @@ template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) {
763767 // Collect GNU properties data.
764768 // GNU properties might be processed in this loop, or only later on (e.g. in
765769 // initializeSections) Therefore there is no guarantee that the GNU
766- // properties data will be read after this loop end, so it is being
770+ // properties data will be ready after this loop end, so it has to be
767771 // collected here.
768772 if (check (obj.getSectionName (sec, shstrtab)) == " .note.gnu.property" ) {
769773 if (0 == this ->andFeatures && this ->aarch64PauthAbiCoreInfo .empty ()) {
@@ -873,7 +877,6 @@ template <class ELFT> void ObjFile<ELFT>::parse(bool ignoreComdats) {
873877 // dynamic loader. In the future, when relocatable linking (`-r` flag) is
874878 // performed, a single merged AArch64 Build Attributes section will be
875879 // emitted.
876-
877880 if (sec.sh_type == SHT_AARCH64_ATTRIBUTES) {
878881 ArrayRef<uint8_t > contents = check (obj.getSectionContents (sec));
879882 AArch64AttributeParser attributes;
0 commit comments