As a follow up, your info above allowed me to fix the alignment issue in about 30 minutes of work. I pushed the alignment fix a few days ago. Thanks again.strace -i gives us just enough information to debug the crash:The instruction at 0x158 bytes into the binary is the ldr here:Code:
[b5923158] --- SIGBUS {si_signo=SIGBUS, si_code=BUS_ADRALN, si_addr=0xb652517f} ---
I am used to SIGBUS meaning that we went outside the extent of an mmapped file (usually because the disk is full), but this is a straightforward alignment issue. readelf confirms that the .got in the binary is misaligned:Code:
9c: e305c17f movw ip, #20863 @ 0x517f a0: e34bc652 movt ip, #46674 @ 0xb652 a4: e59cf000 ldr pc, [ip]
How does this work in a 32bit distro? I think it might actually depend on the CPU model. I can only reproduce a bus error when attempting a misaligned read directly to PC. Reading to a different register first and then moving appears to hide the problem.Code:
[Nr] Name Type Addr Off Size ES Flg Lk Inf Al [10] .got PROGBITS b6525173 001173 000018 04 WA 0 0 4
I will try your Bookworm64 "shared library install" fix on the Pi 500 to enable 32 bit ELF executables to run on the PI 500 shortly, after I further "clean up" my ELF file creation code. I will also update my Makefile at that point to run on any machine with the proper 32 bit eabi-hf environment installed.
Frankly, I'm surprised the package installation process for the 32 bit compile/execution environment on the 64 bit OS is not described somewhere within the raspberrypi.com Documentation tab. I'm betting it will be as simple as three "sudo apt install" commands, back-to-back.
Statistics: Posted by HPCguy — Wed Apr 30, 2025 1:32 am