Need help: a dynamically linked program crashes at address 0x0, IMHO the first executable instruction of the code. The program is cross-compiled using gcc:
arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/opt/cross/libexec/gcc/arm-linux-gnueabi/7.2.0/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../configure --prefix=/opt/cross --enable-bootstrap=no --build=x86_64-suse-linux --target=arm-linux-gnueabi --enable-languages=c,c++ --with-float=soft --disable-libmudflap --disable-multilib --with-cpu=arm7tdmi --with-float=soft
Thread model: posix
gcc version 7.2.0 (GCC)
Executing the program under gdb results in an immediate segmentation fault:
Program received signal SIGSEGV, Segmentation fault.
0x00000000 in ?? ()
(gdb) info registers
r0 0x0 0
r1 0xbefff767 3204446055
r2 0x0 0
r3 0x2a017000 704737280
r4 0x0 0
r5 0x0 0
r6 0x0 0
r7 0x0 0
r8 0x0 0
r9 0x0 0
r10 0x0 0
r11 0x0 0
r12 0x0 0
sp 0xbefff640 0xbefff640
lr 0x0 0
pc 0x0 0x0
cpsr 0x60000010 1610612752
The executable file: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, not stripped
The libraries reside in the common path (/lib/).
The target system uname -a: Linux nanoPi 3.4.39-h3 #12 SMP PREEMPT Thu Mar 23 15:51:07 CST 2017 armv7l armv7l armv7l GNU/Linux
compile options: arm-linux-gnueabi-gcc -std=c99 -D_GNU_SOURCE=1 -D_POSIX_SOURCE=1 (... some source files ...) -O0 -g3 -pedantic -pedantic-errors -Wall -Wextra -Wconversion -c -fmessage-length=0 -MMD -MP -MF"src/options.d" -MT"src/options.o" -o "src/options.o" "../src/options.c"
Linking statically, the program works as intended.
I'm stuck on this issue for some hours now, running out of ideas what to try or where to look further. Google search mostly returns references to dereferencing Null Pointers, but I think that this is a different case.
Any hint appreciated.
User contributions licensed under CC BY-SA 3.0