Hi Greg, Greg Ungerer wrote, > Hi Waldemar, > > On 06/05/16 05:06, Waldemar Brodkorb wrote: > >Hi Greg, > >Waldemar Brodkorb wrote, > > > >>Hi Greg, > >>Greg Ungerer wrote, > >> > >>>Attached is a kernel patch that modifies binfmt_flat to print > >>>out the reloc number along with the reloc error. That way we can > >>>map that back to the reloc entry number printed out in the verbose > >>>output from elf2flt at compile time. > >> > >>The stm32 is now working, here is the output with patched > >>kernel: > >>~ # /hello > >>[ 162.460000] BINFMT_FLAT: Loading file: /hello > >>[ 162.460000] Mapping is 90520000, Entry point is 45, data_start is 8984 > >>[ 162.460000] Load /hello: TEXT=90520040-90528984 DATA=905289a0-9052e1b0 > >>BSS=9052e1b0-9053240c > >>[ 162.460000] BINFMT_FLAT: reference 0x870000 to shared library 237, > >>killing hello! > >>SEGV > >> > >> /hello > >>[ 11.230000] BINFMT_FLAT: reference 0x870000 to shared library 237, > >>killing hello! > >>SEGV > >> > >>Hmm, on the stm32 with latest buildroot, I now get this errors. > >> > >>But I just use UCLIBC_FORMAT_FLAT. The kernel defconfig used has > >>CONFIG_BINFMT_SHARED_FLAT enabled. > > > >I disabled CONFIG_BINFMT_SHARED_FLAT in the kernel. > >And now I get: > >~ # /hello > >[ 90.830000] BINFMT_FLAT: reloc[405] outside program 0xed870000 (0 > >- 0x123b0/0x8944), killing hello! > >SEGV > > > >Compiling with > >./output/host/usr/bin/arm-buildroot-uclinux-uclibcgnueabi-gcc > >-Wl,-elf2flt=-v -o hello hello.c -lpthread : > >.. > >reloc[403] = 0xe140 > > RELOC[404]: offset=0x5724 symbol=frame_dummy+0x0 section=.text > >size=0 fixup=0xac (reloc=0xe144) > >reloc[404] = 0xe144 > > RELOC[405]: offset=0x5728 symbol=pthread_initialize+0x0 > >section=.text size=0 fixup=0x87ec (reloc=0xe148) > >reloc[405] = 0xe148 > > RELOC[406]: offset=0x572c symbol=__do_global_dtors_aux+0x0 > >section=.text size=0 fixup=0x80 (reloc=0xe14c) > >reloc[406] = 0xe14c > >.. > > > >So pthread_initialize() is the problem? > > I have an idea what is broken here now. > > I am able to run this same test on qemu/versatile and get the > same result as you above with "hello" pthread test. > > I think elf2flt is not properly handling R_ARM_TARGET1 relocation > types. And this causes a bad relocation calculation at runtime. > > Can you try the attached patch? > > This fixes it for me, and I can run "hello" and get expected result.
Thanks. This works for me, too. Great that we have a solution for it! Please push it :=) best regards 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