open("./libtest.so", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0(\0\1\0\0\0\360E\2\0004\0\0\0"..., 512) = 512
lseek(3, 497736, SEEK_SET) = 497736
read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1040) = 1040
lseek(3, 493664, SEEK_SET) = 493664
read(3, "A\35\0\0\0aeabi\0\1\23\0\0\0\6\6\10\1\t\1\30\1\31\1\"\0D\1", 30) = 30
close(3) = 0
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=11919, ...}) = 0
mmap2(NULL, 11919, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb6fab000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
Zig Version
0.9.1
Steps to Reproduce
Compile the program in this gist: https://gist.github.com/saierd/3ee0a898ae7fa5b469e53536851cb39c
lib.cpp:main.cpp:Build:
Expected Behavior
Program should run on an ARM device.
Actual Behavior
Without the dynamic library
If I remove the dynamic library from the test program (just a hello world) everything works fine. The program runs in QEMU as well as on the actual device, even though there are some strange things happening on the device:
ldd a.outoutputsnot a dynamic executable./lib/ld-linux-armhf.so.3 --verify a.outreturns 1.With the dynamic library
lddandld --verifyare the same as above for botha.outandlibtest.so.I tried to debug what happens with
LD_DEBUGandstraceand this is what I found out:libtest.soand tries to open it.straceshows that some parts of the file get read:/etc/ld.so.nohwcapexists, this removes some of the paths that were searched previously and theaccessno longer fails:I know that this is probably difficult to debug without actual hardware. Do you have any idea for how I could investigate this further?