Skip to content

[lld][AArch64][Build Attributes] Add support for AArch64 Build Attributes #142637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sivan-shani
Copy link
Contributor

This patch enables lld to read AArch64 Build Attributes and convert them into GNU Properties.

Changes:

  • Parses AArch64 Build Attributes from input object files.
  • Converts known attributes into corresponding GNU Properties.
  • Merges attributes when linking multiple objects.

Previously, the AArch64 PAuth ABI core values were stored as an ArrayRef<uint8_t>, introducing unnecessary indirection.
This patch replaces the ArrayRef with two explicit uint64_t fields: aarch64PauthAbiPlatform and aarch64PauthAbiVersion. This simplifies the representation and improves readability.
No functional change intended, aside from improved error messages.
Copy link
Collaborator

@smithp35 smithp35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one quick comment on the functional side (mapping PAuth BuildAttributes 0, 1 to an explicit GNU properties of 0, 0).

Will keep looking to see if I can spot anything else.

"properties and AArch64 build attributes sections with "
"different And Features data";
} else {
// Write missing data
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bit in the BuildAttributes spec to handle this case. Starting at https://github.com/ARM-software/abi-aa/pull/230/files#diff-9563b0c9eccaf2fd9c6dd704c6ef00fbe7b531657e220c0324523391da355d1cR1030 and also https://github.com/ARM-software/abi-aa/pull/230/files#diff-9563b0c9eccaf2fd9c6dd704c6ef00fbe7b531657e220c0324523391da355d1cR1053

Essentially a build attributes of TagPlatform 0, TagSchema 1 maps to an explicit GNU Properties section of 0, 0.

I think the simplest way of handling this would be to change TagPlatform 0, TagSchema 1 (which would pass the if test) to an aarch64PauthAbiCoreInfo of (0, 0).

Would likely need the comment updating. Something like:

Build Attributes default to a value of 0 when not present. A (TagPlatform, TagSchema) of (0, 0) maps to no PAuth property present. A (TagPlatform, TagSchema) of (0, 1) maps to an explicit PAuth property of platform = 0, version = 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handled

…utes

This patch enables lld to read AArch64 Build Attributes and convert them into GNU Properties.

Changes:
- Parses AArch64 Build Attributes from input object files.
- Converts known attributes into corresponding GNU Properties.
- Merges attributes when linking multiple objects.
According to the Arm BuildAttributes specification, a (TagPlatform, TagSchema)
of (0, 1) corresponds to an explicit property with platform = 0 and version = 0 ('Invalid').

Update LLD to handle this case by mapping it to aarch64PauthAbiCoreInfo = {0, 0}.
Update comment to clarify default behavior and mapping.

Spec reference:
https://github.com/ARM-software/abi-aa/pull/230/files#r1030
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants