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

Ezequiel Garcia ezequiel at vanguardiasur.com.ar
Sun Mar 20 01:59:30 UTC 2016


On 19 March 2016 at 17:50, Thomas Petazzoni
<thomas.petazzoni at free-electrons.com> wrote:
> Hello,
>
> On Sat, 19 Mar 2016 16:27:19 -0300, Ezequiel Garcia wrote:
>
>> 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?
>
> Thanks for this testing. Is lua using threads by any chance? I for sure
> know that the thread support is causing errors similar to the one that
> you are reporting.
>

No, Lua doesn't uses threads.

> The ARM noMMU support is preliminary, for now I've only tested Busybox
> and a few other small programs. Once this preliminary support is
> merged, we can start looking at additional problems.

Sure, I'm not at all objecting this patchset. I've tested some
programs and all of them seem to work fine, with the sole exception of
lua and atftp.

Interestingly, the atftp binary does not have the Has-PIC-GOT flag
set... so I don't know if it's the real reason for the issue.
-- 
Ezequiel García, VanguardiaSur
www.vanguardiasur.com.ar


More information about the buildroot mailing list