Hi uClinux/elf2flt devs,

How can I debug an issue with the following error while
executing:
~ # ./hello 
BINFMT_FLAT: reloc outside program 0xb5890000 (0 - 0x125a4/0x8b0c),
killing hello!
SEGV

The target is an ARM Cortex-M4 device. The error is only happening
when libpthread from uClibc-ng is used in the binary. Non-threading
applications are working fine. (Linuxthreads.old used)
The problem was reported by Thomas Petazzoni from Buildroot project.

On the build system I used this example code:
http://timmurphy.org/2010/05/04/pthreads-in-c-a-minimal-working-example/

$ /usr/bin/arm-openadk-uclinux-uclibceabi-gcc -o hello hello.c -lpthread        
                                           
$ /usr/bin/arm-openadk-uclinux-uclibceabi-flthdr -k hello
$ /usr/bin/arm-openadk-uclinux-uclibceabi-flthdr -p hello                       
                                           
hello
    Magic:        bFLT
    Rev:          4
    Build Date:   Tue Apr  5 12:28:25 2016
    Entry:        0x45
    Data Start:   0x8b4c
    Data End:     0xe384
    BSS End:      0x125e0
    Stack Size:   0x1000
    Reloc Start:  0xe384
    Reloc Count:  0x197
    Flags:        0x11 ( Load-to-Ram Kernel-Traced-Load )

On the target system:
~ # ./hello 
BINFMT_FLAT: Loading file: ./hello
Mapping is 70020000, Entry point is 45, data_start is 8b4c
Load ./hello: TEXT=70020040-70028b4c DATA=70028b50-7002e388
BSS=7002e388-700325e4
BINFMT_FLAT: reloc outside program 0xb5890000 (0 - 0x125a4/0x8b0c),
killing hello!
SEGV

You can find readelf, objdump -x, objdump -D and the source of
hello.c here:
http://debug.openadk.org/arm-pthreads/

Stracing the process does not work:
~ # ./strace ./hello
BINFMT_FLAT: Loading file: ./hello
./strace: Can't attach to 45: No such process
~ # Mapping is 70560000, Entry point is 45, data_start is 8b4c
Load ./hello: TEXT=70560040-70568b4c DATA=70568b50-7056e388
BSS=7056e388-705725e4
BINFMT_FLAT: reloc outside program 0xb5890000 (0 - 0x125a4/0x8b0c),
killing hello!

gdbserver (gdb 7.11) does not compile for me as it uses fork(): 
       build-gnulib-gdbserver/import/libgnu.a
build-libiberty-gdbserver/libiberty.a -lthread_db
linux-low.o: In function `linux_create_inferior':
linux-low.c:(.text+0x25d2): undefined reference to `fork'
linux-ptrace.o: In function `linux_child_function':
linux-ptrace.c:(.text+0x24): undefined reference to `fork'
linux-ptrace.o: In function `linux_check_ptrace_features':
linux-ptrace.c:(.text+0x10a): undefined reference to `fork'
thread-db.o: In function `thread_db_init':
thread-db.c:(.text+0x520): undefined reference to `td_thr_tlsbase'
collect2: error: ld returned 1 exit status

I searched the internet and found that it might be stack size
related. But even compiling example code and C library with
-Wl,-elf2flt=-s16384 didn't help.

Any help is appreciated,
 thanks
  Waldemar
_______________________________________________
uClinux-dev mailing list
uClinux-dev@uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev@uclinux.org
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to