[Buildroot] [PATCH v2 07/17] uclibc: disable DOPIC on ARM FLAT

Ezequiel Garcia ezequiel at vanguardiasur.com.ar
Sat Mar 19 19:27:19 UTC 2016


+Waldemar

On 18 March 2016 at 18:08, Thomas Petazzoni
<thomas.petazzoni at free-electrons.com> wrote:
> As explained by Waldemar, enabling DOPIC in uClibc will lead to the
> creation of a Position Independent library. In turn, this will cause
> elf2flt to generate a "Has-PIC-GOT" flat binary, which doesn't work on
> ARM. In fact, elf2flt on ARM really expect to have non-PIC code as
> input, so we must disable DOPIC in the uClibc configuration.
>

While testing on LPC4350, I found that Lua is built with the Has-PIC-GOT flag:

$ output/host/usr/bin/arm-buildroot-uclinux-uclibcgnueabi-flthdr
output/target/usr/bin/lua
output/target/usr/bin/lua
    Magic:        bFLT
    Rev:          4
    Build Date:   Sat Mar 19 16:14:03 2016
    Entry:        0x45
    Data Start:   0x1f08c
    Data End:     0x23ed8
    BSS End:      0x260c0
    Stack Size:   0x1000
    Reloc Start:  0x23ed8
    Reloc Count:  0x214
    Flags:        0x2 ( Has-PIC-GOT )

The Lua interpreter is not loaded by the binfmt_flat loader, and the
kernel says:

  BINFMT_FLAT: reloc outside program 0x7fffd3e4 (0 - 0x26080/0x1f04c),
killing lua!

When DEBUG is defined in fs/binfmt_flat.c, the kernel says:

  BINFMT_FLAT: reference 0xffd3e4 to shared library 127, killing lua!

On the other side, atftp throws the same error:

  BINFMT_FLAT: reference 0xa0100 to shared library 161, killing atftp!

Any ideas?
-- 
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar



More information about the buildroot mailing list