@@ -212,7 +212,12 @@ static void updateSupportedARMFeatures(Ctx &ctx,
212
212
ctx.arg .armHasThumb2ISA |= thumb && *thumb >= ARMBuildAttrs::AllowThumb32;
213
213
}
214
214
215
- // Sanitize pauth values
215
+ // Sanitize pauth values.
216
+ // Ensure that pauthSubSection is either std::nullopt or contains exactly two build attributes: ID and Scheme.
217
+ // - Content[0]: ID, Content[1]: Scheme.
218
+ // - Remove build attributes with unknown tags.
219
+ // - Set pauthSubSection to std::nullopt if any required attributes are missing.
220
+ // - Sort the content vector so that ID is at Content[0] and Scheme at Content[1].
216
221
static void sanitizePauthSubSection (
217
222
Ctx &ctx, std::optional<llvm::BuildAttributeSubSection> &pauthSubSection,
218
223
InputSection isec) {
@@ -259,7 +264,12 @@ static void sanitizePauthSubSection(
259
264
assert (2 == pauthSubSection->Content [1 ].Tag && " first tag should be 2" );
260
265
}
261
266
262
- // Sanitize features bits
267
+ // Sanitize feature bits.
268
+ // Ensure that fAndBSubSection always contains exactly three build attributes: BTI, PAC, and GCS.
269
+ // - Content[0]: BTI, Content[1]: PAC, Content[2]: GCS.
270
+ // - Remove build attributes with unknown tags.
271
+ // - If any attribute is missing, add it with its value set to `0`.
272
+ // - Sort the content vector so that Content[0] is BTI, Content[1] is PAC, and Content[2] is GCS.
263
273
static void sanitizeFAndBSubSection (
264
274
std::optional<llvm::BuildAttributeSubSection> &fAndBSubSection ) {
265
275
/*
0 commit comments