This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: [PATCH] PR ld/18028: 32-bit ld runs out of memory when linking 32-bit clang with debug info


On Fri, Feb 27, 2015 at 3:30 PM, Alan Modra <amodra@gmail.com> wrote:
> On Fri, Feb 27, 2015 at 11:42:39AM -0800, H.J. Lu wrote:
>> When link_info.keep_memory is TRUE, linker caches the relocation
>> information and symbol tables of input files in memory.  On 32-bit
>> hosts, linker runs out of 32-bit virtual memory on input files with many
>> relocations.  This patch defaults link_info.keep_memory to TRUE only if
>> pointer size > 4 and adds a --keep-memory linker option. FIXME: linker
>> may run out of physical memory on 64-bit hosts with 4GB ram.
>>
>> Any comments?
>
> This is not a good idea.  You are slowing down 32-bit host linkers for
> the sake of the very few projects that need --no-keep-memory.  Better
> to modify project makefiles as needed.

I compared the time of linking cc1plus in GCC 5 on Linux/x86-64
with 24 GB RAM:

[hjl@gnu-mic-2 gcc]$ /bin/time ld `cat args`
4.11user 0.32system 0:04.44elapsed 99%CPU (0avgtext+0avgdata 398092maxresident)k
0inputs+182456outputs (0major+206944minor)pagefaults 0swaps
[hjl@gnu-mic-2 gcc]$ /bin/time ld `cat args` --no-keep-memory
4.10user 0.35system 0:04.46elapsed 99%CPU (0avgtext+0avgdata 255856maxresident)k
0inputs+182456outputs (0major+145652minor)pagefaults 0swaps
[hjl@gnu-mic-2 gcc]$

I don't see the big speedup.  What numbers do you get?

> Also, --no-keep-memory will exercise code paths that aren't generally
> used.  I'd be pleasantly surprised if this doesn't expose bugs in some
> target dependent code.
>
> --
> Alan Modra
> Australia Development Lab, IBM



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]