@@ -214,11 +214,7 @@ struct AArch64BuildAttrSubsections {
214214 uint64_t tagPlatform = 0 ;
215215 uint64_t tagSchema = 0 ;
216216 } pauth;
217- struct FAndBSubSection {
218- unsigned tagBTI = 0 ;
219- unsigned tagPAC = 0 ;
220- unsigned tagGCS = 0 ;
221- } fAndB ;
217+ uint32_t andFeatures = 0 ;
222218};
223219
224220static AArch64BuildAttrSubsections
@@ -235,21 +231,23 @@ extractBuildAttributesSubsections(const AArch64AttributeParser &attributes) {
235231 .getAttributeValue (" aeabi_pauthabi" ,
236232 llvm::AArch64BuildAttributes::TAG_PAUTH_SCHEMA)
237233 .value_or (0 );
238- subSections.fAndB . tagBTI =
234+ subSections.andFeatures | =
239235 attributes
240236 .getAttributeValue (" aeabi_feature_and_bits" ,
241237 llvm::AArch64BuildAttributes::TAG_FEATURE_BTI)
242238 .value_or (0 );
243- subSections.fAndB .tagPAC =
244- attributes
245- .getAttributeValue (" aeabi_feature_and_bits" ,
246- llvm::AArch64BuildAttributes::TAG_FEATURE_PAC)
247- .value_or (0 );
248- subSections.fAndB .tagGCS =
249- attributes
250- .getAttributeValue (" aeabi_feature_and_bits" ,
251- llvm::AArch64BuildAttributes::TAG_FEATURE_GCS)
252- .value_or (0 );
239+ subSections.andFeatures |=
240+ (attributes
241+ .getAttributeValue (" aeabi_feature_and_bits" ,
242+ llvm::AArch64BuildAttributes::TAG_FEATURE_PAC)
243+ .value_or (0 ))
244+ << 1 ;
245+ subSections.andFeatures |=
246+ (attributes
247+ .getAttributeValue (" aeabi_feature_and_bits" ,
248+ llvm::AArch64BuildAttributes::TAG_FEATURE_GCS)
249+ .value_or (0 ))
250+ << 2 ;
253251
254252 return subSections;
255253}
@@ -714,9 +712,7 @@ handleAArch64BAAndGnuProperties(const ELFT &tPointer, Ctx &ctx, bool isBE,
714712 << " Pauth Data mismatch: file contains both GNU properties and "
715713 " AArch64 build attributes sections with different Pauth data" ;
716714 }
717- if (baInfo.fAndB .tagBTI != (gpInfo.andFeatures & 0x01 ) ||
718- baInfo.fAndB .tagPAC != ((gpInfo.andFeatures >> 1 ) & 0x01 ) ||
719- baInfo.fAndB .tagGCS != ((gpInfo.andFeatures >> 2 ) & 0x01 ))
715+ if (baInfo.andFeatures != gpInfo.andFeatures )
720716 ErrAlways (ctx) << tPointer
721717 << " Features Data mismatch: file contains both GNU "
722718 " properties and AArch64 build attributes sections with "
@@ -734,10 +730,7 @@ handleAArch64BAAndGnuProperties(const ELFT &tPointer, Ctx &ctx, bool isBE,
734730 tPointer->aarch64PauthAbiCoreInfo =
735731 tPointer->aarch64PauthAbiCoreInfoStorage ;
736732 }
737- tPointer->andFeatures = 0 ;
738- tPointer->andFeatures |= (baInfo.fAndB .tagBTI ) << 0 ;
739- tPointer->andFeatures |= (baInfo.fAndB .tagPAC ) << 1 ;
740- tPointer->andFeatures |= (baInfo.fAndB .tagGCS ) << 2 ;
733+ tPointer->andFeatures = baInfo.andFeatures ;
741734 }
742735}
743736
0 commit comments