On Tue, 2025-10-14 at 20:59 +0200, Gregor Riepl wrote:
> > 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]

OK, after looking at the code, I understand the situation now. Thanks for the 
clarification.

> 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.

That's not really important. What is important is figuring out how to patch the 
m4 script that
it works properly. In fact, this particular script is also part of texlive-bin 
[1] and the test
there works correctly [2]:

checking size of int... 4
checking size of long... (cached) 8
checking whether byte ordering is bigendian... yes
checking if pointers to integers require aligned access... yes
checking for strcasecmp... yes
checking for strnlen... yes
checking for strndup... yes

> 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.

Look at the version of the script from [1], it has a hard-coded list for 
cross-compiling:

AC_DEFUN([AX_CHECK_ALIGNED_ACCESS_REQUIRED],
[AC_CACHE_CHECK([if pointers to integers require aligned access],
  [ax_cv_have_aligned_access_required],
[if test "$cross_compiling" = "yes"; then
  case "$host_cpu" in alpha*|arm*|bfin*|hp*|mips*|sh*|sparc*|ia64|nv1)
    ax_cv_have_aligned_access_required="yes"
  ;; esac

I suggest you try the version of the script from there and report back.

Adrian
> > 

> [1] 
> https://sources.debian.org/src/texlive-bin/2025.20250727.75242+ds-4/libs/zziplib/zziplib-src/m4/ax_check_aligned_access_required.m4
> [2] 
> https://buildd.debian.org/status/fetch.php?pkg=texlive-bin&arch=sparc64&ver=2025.20250727.75242%2Bds-4&stamp=1755229726&raw=0

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

Reply via email to