Does that mean that the unaligned access is intentional? Why is there an option 
to disable it?

Ah no, that's not quite what I meant.

Apparently, there are other architectures that had alignment issues in the 
past, so they added code to xdelta3 that works without unaligned access. There 
are guard #ifdefs around the unaligned code. Example: [1]

Then, there is this autoconf macro[2] they use to detect if the target requires 
aligned access.
This script does not actually trigger bus errors, but it's meant to detect if 
the lower address bits are ignored on non-byte-aligned memory access.
However, my assumption is that it will also work if the test program crashes 
with a bus error.

If that's not the case, a different solution needs to be found, such as 
hardcoding ax_cv_have_aligned_access_required=yes when the CPU architecture is 
sparc or sparc64.

The rest of xdelta3 can be compiled with -O3/-Os just fine, as long as the 
macro is set.

And the testsuite passes as well?
Yes, at least the autopkgtest that is run when building the package.
Same for pristine-tar, with the xdelta3 that is built this way.

[1] https://salsa.debian.org/debian/xdelta3/-/blob/master/xdelta3.c#L3881
[2] 
https://salsa.debian.org/debian/xdelta3/-/blob/master/m4/ax_check_aligned_access_required.m4

Reply via email to