Skip to content
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

Improve arm64 ABI handling across the board #387

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

Cvelth
Copy link
Member

@Cvelth Cvelth commented May 10, 2024

@Cvelth
Copy link
Member Author

Cvelth commented May 10, 2024

This resolves #367

Comment on lines +289 to +290
Specifies whether functions accepting a return value location should
return it back.
Copy link
Contributor

Choose a reason for hiding this comment

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

Specifies whether functions whose return value is saved in a memory area pointed by an argument passed by the caller (SPTAR) should also return such pointer on ReturnValueLocationRegister/ReturnValueLocationOnStack.

@@ -145,6 +145,13 @@ type: struct
ARM ABI), the value of `StackAlignment` should be equal to 4.
type: uint64_t

- name: MinimumStackWordSize
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd avoid the "word" nomenclature, it's quite overloaded.

- name: MinimumStackWordSize
doc: |
States the minimum possible stack argument size in bytes.
When the factual type of an argument is below this value, it should be
Copy link
Contributor

Choose a reason for hiding this comment

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

factual?

Copy link
Member Author

Choose a reason for hiding this comment

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

Was supposed to be actual, but I suppose I was thinking about some kind of facts at the time 😆

Comment on lines +107 to +109
This allows a non-position-based ABI to take advantage of one of the main
traits of position-based ABI: ability to use pointers to copy to pass
big aggregates.
Copy link
Contributor

Choose a reason for hiding this comment

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

These descriptions are very difficult to understand.

Can you make an example of the difference between an ABI using true and one using false?

@@ -79,7 +79,7 @@ class model::Segment : public model::generated::Segment {

public:
bool contains(MetaAddress Address) const {
auto EndAddress = StartAddress() + VirtualSize();
auto EndAddress = StartAddress().toGeneric() + VirtualSize();
Copy link
Contributor

Choose a reason for hiding this comment

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

Wait segments should already be Generic

Copy link
Member Author

Choose a reason for hiding this comment

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

I saw AArch64 segments failing because of alignment. Hence these changes. I guess PDB importer did something weird? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Do we want to have an assert about segments being generic instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

It should be in verify

Comment on lines +290 to 298
inline constexpr model::ABI::Values
getDefaultForMachO(model::Architecture::Values V) {
switch (V) {
case model::Architecture::aarch64:
return model::ABI::Apple_AAPCS64;
default:
return getDefaultFallback(V);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

getDefaultFallback handles x86-64 ABIs, correct?

Copy link
Member Author

@Cvelth Cvelth May 15, 2024

Choose a reason for hiding this comment

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

getDefaultFallback is the "current default" in a way. This lets you only specify "overrides" for the architectures that needs something special. This limits logic duplication somewhat.

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess we could be even stricter with it and explicitly disallow some combinations (for example MIPS in a Mach-O binary), but for now I opted to preserve the current behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants