Re: compile and run 32bit programs on aarch64eb
Valery Ushakov <[email protected]> Wed, 26 Nov 2025 16:26:30 +0300
| Newsgroups | gmane.os.netbsd.ports.arm |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Nov 26, 2025 at 16:10:32 +0300, Valery Ushakov wrote: > The second use case is compiling code on sparc64 with -m32. We do > that as part of the _64-bit_ build and ship it as the base32 set. > [...] > $ readelf -d hello | grep NEED > 0x00000001 (NEEDED) Shared library: [libc.so.12] > $ ldd hello > hello: > -lc.12 => /usr/lib/i386/libc.so.12 [...] > The library search is special cased by libexec/ld.elf_so/rtld.c > where _rtld_init does: > > _rtld_add_paths(execname, &_rtld_default_paths, > RTLD_DEFAULT_LIBRARY_PATH); > > #ifdef RTLD_ARCH_SUBDIR > _rtld_add_paths(execname, &_rtld_default_paths, > RTLD_DEFAULT_LIBRARY_PATH "/" RTLD_ARCH_SUBDIR); > #endif To reiterate, the /usr/lib/i386/libc.so.12 was compiled as part of an amd64 build with -m32 and was shipped as part of amd64 sets. There may be differences with the native 32-bit version. E.g. on sparc a sligtly different set of atomic primitives is provided by the compat libc (this might or might not be a bug, I couldn't get an answer from people in the know). Also, we only build base libs as part of compat sets, we don't build X11 libraries - you will need to grab those yourself from the native 32-bit sets (I have to deal with this a lot, b/c when I play with 32-bit only Inferno or Self on a 64-bit host, the X11 libraries in a different location is a constant source of minor annoyance). -uwe