Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8051

Advanced users • Re: Running 32bit ELF executables on 64bit Pi OS

$
0
0
I was able to install arm-linux-gnueabihf-gcc-12 on aarch64 Bookworm, but the armhf shared libraries are missing. Since you were able to run sudoku, I know you must have them properly installed.
I already had the cross compiler installed on my bookworm64 system, and I do not remember how or why. But I think the libraries you need are libc6:armhf libgcc-s1:armhf.

Are you sure you are not already using a 32bit compiler? I still cannot see how you would avoid the warnings or have the JIT work, unless your target environment has int the same width as pointer.

strace -i gives us just enough information to debug the crash:

Code:

[b5923158] --- SIGBUS {si_signo=SIGBUS, si_code=BUS_ADRALN, si_addr=0xb652517f} ---
The instruction at 0x158 bytes into the binary is the ldr here:

Code:

      9c:       e305c17f        movw    ip, #20863      @ 0x517f      a0:       e34bc652        movt    ip, #46674      @ 0xb652      a4:       e59cf000        ldr     pc, [ip]
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:

  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al  [10] .got              PROGBITS        b6525173 001173 000018 04  WA  0   0  4
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.

Statistics: Posted by jojopi — Fri Apr 25, 2025 6:07 pm



Viewing all articles
Browse latest Browse all 8051

Trending Articles