luajit2 icon indicating copy to clipboard operation
luajit2 copied to clipboard

Segfault on powerpc

Open Cynerd opened this issue 5 years ago • 0 comments

I am trying to run latest v2.1-agentzh on powerpc e500v2 (with soft-float). In short my compiler command is make HOST_CC="gcc -m32" CROSS="powerpc-unknown-linux-gnu-" TARGET_SYS=Linux TARGET_CFLAGS="-mcpu=8540 -msoft-float". Then running compiled luajit executable results in Segfault.

I tried to run it in gdb. What is weird is that it segfaults with following backtrace:

#0  0x3ffd422c in _dl_load_cache_lookup (name=name@entry=0x10002461 "libm.so.6") at dl-cache.c:279
#1  0x3ffc7d90 in _dl_map_object (loader=0x3ffff1e0, name=0x10002461 "libm.so.6", type=1, trace_mode=0, mode=0, nsid=0) at dl-load.c:2096
#2  0x3ffcb814 in openaux (a=a@entry=0x407ff820) at dl-deps.c:64
#3  0x3ffd776c in _dl_catch_exception (exception=0x407ff838, exception@entry=0x407ff8b8, operate=operate@entry=0x3ffcb7d4 <openaux>, args=args@entry=0x407ff820) at dl-error-skeleton.c:196
#4  0x3ffcbdcc in _dl_map_object_deps (map=map@entry=0x3ffff1e0, preloads=<optimized out>, npreloads=npreloads@entry=0, trace_mode=trace_mode@entry=0, open_mode=open_mode@entry=0) at dl-deps.c:248
#5  0x3ffc2e04 in dl_main (phdr=<optimized out>, phdr@entry=0x10000034, phnum=<optimized out>, phnum@entry=9, user_entry=user_entry@entry=0x407ffa98, auxv=<optimized out>) at rtld.c:1731
#6  0x3ffd6568 in _dl_sysdep_start (start_argptr=start_argptr@entry=0x407ffe10, dl_main=0x3ffc1780 <dl_main>) at ../elf/dl-sysdep.c:253
#7  0x3ffc0d9c in _dl_start_final (arg=arg@entry=0x407ffe10, info=info@entry=0x407ffb48) at rtld.c:415
#8  0x3ffc1360 in _dl_start (arg=0x407ffe10) at rtld.c:524
#9  0x3ffd8488 in _start () at ../sysdeps/powerpc/powerpc32/dl-start.S:41

Clearly it won't even get to main. From investigating the exact location in code the ld.so tries to access LD cache structure and it seems it is somehow corrupted. Clearly it tries to load libm.so but I do not think that is the cause. Theoretically it might be caused by libc. This is run with glibc 2.29 but I also tested it with musl with same result (segfault). I really suspect that it is cause by something LuaJIT2 does. I haven't experienced any such issue with any other program I am using this toolchain setup with. Do you have any idea what could cause this kind of issue?

Cynerd avatar Jan 08 '21 12:01 Cynerd