Skip to content

don't use unaligned access on ARM #216

New issue

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

By clicking “No 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? No Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Conversation

p1otr
Copy link

@p1otr p1otr commented Oct 25, 2017

Hi,

I've got a patch from Ubuntu guys that fixes build on armhf. Please consider applying it.

https://bugs.debian.org/872408

Copy link
Member

@elprans elprans left a comment

Choose a reason for hiding this comment

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

This doesn't seem like a complete fix. Why only fix unpack_int32? If unaligned access is an issue, then all 16- and 32-bit reads and writes should be fixed.

I think the proper way would be to use -mno-unaligned-access for all architectures that do not support unaligned access.

elprans added a commit that referenced this pull request Oct 27, 2017
Per report in #216 and https://bugs.debian.org/872408, the current
implementation may raise SIGBUS on ARM platforms that do not support
unaligned memory access.

Fix this by using a stack variable and memcpy, which gives the compiler
more opportunity to generate correct code.  While at it, implement
hton* and ntoh* in terms of byteswap intrinsics with an open-coded
fallback.  This drops the dependency on the platform's implementation,
which might not necessarily be consistently fast.

Smoke-tested locally on cross-compiled armv5tel-softfloat-linux-gnueabi
and armv6j-hardfloat-linux-gnueabi with QEMU TCG.

Fixes: #216.
elprans added a commit that referenced this pull request Oct 27, 2017
Per report in #216 and https://bugs.debian.org/872408, the current
implementation may raise SIGBUS on ARM platforms that do not support
unaligned memory access.

Fix this by using a stack variable and memcpy, which gives the compiler
more opportunity to generate correct code.  While at it, implement
hton* and ntoh* in terms of byteswap intrinsics with an open-coded
fallback.  This drops the dependency on the platform's implementation,
which might not necessarily be consistently fast.

Smoke-tested locally on cross-compiled armv5tel-softfloat-linux-gnueabi
and armv6j-hardfloat-linux-gnueabi with QEMU TCG.

Fixes: #216.
elprans added a commit that referenced this pull request Oct 30, 2017
Per report in #216 and https://bugs.debian.org/872408, the current
implementation may raise SIGBUS on ARM platforms that do not support
unaligned memory access.

Fix this by using a stack variable and memcpy, which gives the compiler
more opportunity to generate correct code.  While at it, implement
hton* and ntoh* in terms of byteswap intrinsics with an open-coded
fallback.  This drops the dependency on the platform's implementation,
which might not necessarily be consistently fast.

Smoke-tested locally on cross-compiled armv5tel-softfloat-linux-gnueabi
and armv6j-hardfloat-linux-gnueabi with QEMU TCG.

Fixes: #216.
@elprans elprans closed this in #218 Oct 31, 2017
elprans added a commit that referenced this pull request Oct 31, 2017
Per report in #216 and https://bugs.debian.org/872408, the current
implementation may raise SIGBUS on ARM platforms that do not support
unaligned memory access.

Fix this by using a stack variable and memcpy, which gives the compiler
more opportunity to generate correct code.  While at it, implement
hton* and ntoh* in terms of byteswap intrinsics with an open-coded
fallback.  This drops the dependency on the platform's implementation,
which might not necessarily be consistently fast.

Smoke-tested locally on cross-compiled armv5tel-softfloat-linux-gnueabi
and armv6j-hardfloat-linux-gnueabi with QEMU TCG.

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

Successfully merging this pull request may close these issues.

3 participants