[PATCH] ld: work around pr17618 testcase failure

H.J. Lu hjl.tools@gmail.com
Wed Feb 22 16:34:00 GMT 2017


On Wed, Feb 22, 2017 at 12:07 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>> On 22.02.17 at 05:08, <amodra@gmail.com> wrote:
>> On Tue, Feb 21, 2017 at 11:41:17AM +0100, Andreas Schwab wrote:
>>> On Feb 21 2017, "Jan Beulich" <JBeulich@suse.com> wrote:
>>>
>>> > Some change from 2.26.1 to 2.27 causes the ld-x86-64/pr17618 test to
>>> > exhaust memory on a 32-bit host.
>>>
>>> Isn't that a bug that should be fixed?
>>
>> The testcase is stupidly large
>>
>> $ size tmpdir/pr17618.o
>>    text          data     bss     dec     hex filename
>> 2145386275          0       0 2145386275      7fdfff23        tmpdir/pr17618.o
>>
>> So we will have an almost 2G input buffer for this object file,
>> and another 2G of output buffer.  No hope to link that on a 32 bit
>> system..
>>
>> Hmm, this code in elf64-x86-64.c:
>>
>>   /* Get the section contents.  */
>>   if (elf_section_data (sec)->this_hdr.contents != NULL)
>>     contents = elf_section_data (sec)->this_hdr.contents;
>>   else if (!bfd_malloc_and_get_section (abfd, sec, &contents))
>>     {
>>       sec->check_relocs_failed = 1;
>>       return FALSE;
>>     }
>>
>> ought to instead read section contents only when they are needed.
>> That would help cut down memory usage early in the linking process,
>> and speed up the linker a little.
>
> H.J.,
>
> you did contribute that test (and then excluded it for x32 targets,
> although oddly enough only Linux ones) - any thoughts here?
>
> Thanks, Jan
>

Are you cross compiling binutils to x86-64 from ia32?  I never tried
it myself and I don't see how it can work in general, given that the
address is limited to 32-bit.


-- 
H.J.



More information about the Binutils mailing list