This is the mail archive of the
mailing list for the binutils project.
Re: RFC: [PATCH] PR ld/18028: 32-bit ld runs out of memory when linking 32-bit clang with debug info
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Binutils <binutils at sourceware dot org>
- Date: Fri, 27 Feb 2015 16:10:54 -0800
- Subject: Re: RFC: [PATCH] PR ld/18028: 32-bit ld runs out of memory when linking 32-bit clang with debug info
- Authentication-results: sourceware.org; auth=none
- References: <20150227194239 dot GA9961 at intel dot com> <20150227233028 dot GQ16384 at bubble dot grove dot modra dot org>
On Fri, Feb 27, 2015 at 3:30 PM, Alan Modra <email@example.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
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