[Buildroot] [PATCH 2/9] package/binutils: add upstream backported patches to support -mcmodel=large gcc option

Romain Naour romain.naour at gmail.com
Wed Jun 9 06:26:44 UTC 2021


Hi Giulio,

Le 09/06/2021 à 00:16, Giulio Benetti a écrit :
> Hi Romain,
> 
> On 6/8/21 11:29 PM, Romain Naour wrote:
>> Hi Giulio, All,
>>
>> Le 03/05/2021 à 13:13, Giulio Benetti a écrit :
>>> Add upstream backported patches that allows using -mcmodel=large gcc option
>>> that in order allows fixing build failure due to binutils bug 21464:
>>> https://sourceware.org/bugzilla/show_bug.cgi?id=21464
>>>
>>> Signed-off-by: Giulio Benetti <giulio.benetti at benettiengineering.com>
>>> ---
>>>   ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
>>>   ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
>>>   ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
>>>   ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
>>>   ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
>>>   ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
>>>   ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
>>>   ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
>>>   ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
>>>   ...elocation-R_OR1K_GOT_AHI16-for-gotha.patch | 256 +++++++++
>>>   ...K_GOT16-overflow-failures-in-presenc.patch |  61 +++
>>>   ...ge-plt_relocs-when-generating-plt-en.patch | 500 ++++++++++++++++++
>>>   12 files changed, 3268 insertions(+)
>>>   create mode 100644
>>> package/binutils/2.32/0011-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.32/0012-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.32/0013-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.34/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.34/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.34/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.35.2/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.35.2/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.35.2/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.36.1/0004-or1k-Implement-relocation-R_OR1K_GOT_AHI16-for-gotha.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.36.1/0005-or1k-Avoid-R_OR1K_GOT16-overflow-failures-in-presenc.patch
>>>
>>>   create mode 100644
>>> package/binutils/2.36.1/0006-or1k-Support-large-plt_relocs-when-generating-plt-en.patch
>>>
>>>
>>
>>> +   unsigned nodelay = elf_elfheader (output_bfd)->e_flags & EF_OR1K_NODELAY;
>>> +-  unsigned insn4;
>>> ++  unsigned output_insns[PLT_MAX_INSN_COUNT];
>>> ++
>>> ++  /* Copy instructions into the output buffer.  */
>>> ++  for (size_t i = 0; i < insn_count; i++)
>>> ++    output_insns[i] = insns[i];
>>> +
>>
>> This syntax break with good old compilers :)
>>
>> elf32-or1k.c:2251:3: error: 'for' loop initial declarations are only allowed in
>> C99 or C11 mode
>>     for (size_t i = 0; i < insn_count; i++)
>>     ^
>>
>> See:
>> https://gitlab.com/bootlin/toolchains-builder/-/jobs/1325646298
> 
> Thanks for pointing, I didn't think about old host compiler. I'm going to fix it
> soon by patching actual patches initializing variable at the
> begin of functions.

Toolchain-builder use Debian 8 jessie to build the toolchain while Debian 9
stretch is used to run the Buildroot testsuite.

See, there is no problem to build the qemu_or1k_defconfig in gitlab using stretch:
https://gitlab.com/buildroot.org/buildroot/-/jobs/1307293494

The host gcc used by stretch is gcc 6 while it's gcc 4.9 for jessie, the default
mode for C is -std=gnu11 since gcc 5:
https://gcc.gnu.org/gcc-5/changes.html

Thanks!

Best regards,
Romain


> 
> Best regards




More information about the buildroot mailing list