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

Build AArch32 base variants with strict alignment #605

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vhscampos
Copy link
Member

This patch adds -mno-unaligned-access to the compile flags of the AArch32 base variants.

Base variants are the set of libraries that provide the most compatible functionality. As a consequence, they are built with strict alignment in order to work nicely with client code that is compiled with or without strict alignment.

The libraries for Armv7-a soft already had a variant with and without strict alignment. Hence now just one remains, the one with strict alignment.

This patch adds `-mno-unaligned-access` to the compile flags of the
AArch32 base variants.

Base variants are the set of libraries that provide the most compatible
functionality. As a consequence, they are built with strict alignment in
order to work nicely with client code that is compiled with or without
strict alignment.

The libraries for Armv7-a soft already had a variant with and without
strict alignment. Hence now just one remains, the one with strict
alignment.
Copy link
Collaborator

@pratlucas pratlucas left a comment

Choose a reason for hiding this comment

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

LGTM.

@nolange
Copy link

nolange commented Dec 19, 2024

As a consequence, they are built with strict alignment in order to work nicely with client code that is compiled with or without strict alignment.

I doubt that's the case, the code should work nicely without strict alignment, unless you explicitly disable unaligned load/store via some special register (Can't think of many reasons why you would).

The only observable effect would be some slower routines.

can you describe some usecases where strict alignment is necessary (on cores that don't use it by default)?
AFAIU Code should be compatible anyway, whatever your client code does unless you disable some bits in CP15.

in the cases where you absolutely need it, you could replace the few problematic functions or link the libraries from a "lower" arch like ARMv6.
That would be better than hurting everything by default.

@vhscampos
Copy link
Member Author

We have some internal customers that rely on strict alignment.

Bear in mind this is not the final picture. As this is an incremental work, in the near future we will add library variants with more optimised code generation, including unaligned access.

These base variants are a fallback option when no better option is available.

@nolange
Copy link

nolange commented Dec 20, 2024

These base variants are a fallback option when no better option is available.

Maybe i misunderstand something, this patch builds every armv7 target with strict alignment?

My expectation when using multilib is that code is explicitly optimized for each arch.

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.

3 participants