bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance problems with ld


From: Alan Modra
Subject: Re: Performance problems with ld
Date: Sun, 6 Apr 2003 21:50:56 +0930
User-agent: Mutt/1.4i

On Sat, Apr 05, 2003 at 07:21:14AM -0600, Fritz Boehm wrote:
in http://sources.redhat.com/ml/bug-binutils/2003-q2/msg00032.html
> I'm seeing a noticeable slow down with ld going from redhat 7.1 to redhat
> 8.0 when linking code compiled with debug as opposed to without debug.
[snip]
> % time g++ -o main main.o definitions*.o
> 5.880u 0.270s 0:48.13 12.7%     0+0k 0+0io 509pf+0w
[snip]
> % time g++ -o main main.o definitions*.o 
> 1875.166u 8.652s 41:57.00 74.8% 0+0k 0+0io 490pf+0w

This slowdown is almost certainly due to ld trying to merge strings
in .debug_str.  While ld could be probably be improved, I think
there ought to be a way to turn off this feature for pathological
cases.  We could do that in ld, but gcc has a -fno-merge-constants
option which almost does what you want.  With the following patch
-fno-merge-constants will turn off string merging in the debug
section as well as in other sections.

        * dwarf2out.c (DEBUG_STR_SECTION_FLAGS): Heed flag_merge_constants.

OK to install mainline, 3.3, and 3.2?

Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.414
diff -u -p -r1.414 dwarf2out.c
--- gcc/dwarf2out.c     28 Mar 2003 07:47:52 -0000      1.414
+++ gcc/dwarf2out.c     6 Apr 2003 07:58:33 -0000
@@ -3905,7 +3905,9 @@ static int maybe_emit_file              
 /* Section flags for .debug_str section.  */
 #ifdef HAVE_GAS_SHF_MERGE
 #define DEBUG_STR_SECTION_FLAGS \
-  (SECTION_DEBUG | SECTION_MERGE | SECTION_STRINGS | 1)
+  (flag_merge_constants                                                \
+   ? SECTION_DEBUG | SECTION_MERGE | SECTION_STRINGS | 1       \
+   : SECTION_DEBUG)
 #else
 #define DEBUG_STR_SECTION_FLAGS        SECTION_DEBUG
 #endif

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]