Bug 9655 - Slow linking times, even after gcc -fno-merge-constants used.
Summary: Slow linking times, even after gcc -fno-merge-constants used.
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 3.2
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-11 07:06 UTC by kslavin
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kslavin 2003-02-11 07:06:01 UTC
Having already compiled with -fno-merge-constants, I have taken the link time (using GNU ld version 2.13.90.0.2 20020802) from 17 minutes down to over 2 minutes. The same code used to link in under 2 seconds using GNU ld version 2.10.90 (with BFD 2.10.0.18).

Firstly, it seems that -fno-merge-constants should be changed to -fmerge-constants - I have seen elsewhere people reporting a factor of 1000 slowdown due to not using this flag. However, this is not the only factor slowing linking. I am still 100x slower than the old ld. I have no idea why. The link only uses 47MBytes of RAM, and the CPU load averages over 90%.


time gcc -static cache_xxx.o xxx_interface.o xxx_main.o cpu_interface_xxx.o my_getopt.o read_ppm_header.o resizer.o resizer_interface.o /home/kslavin/atools/libraries/asim/wrapper_lib.o /home/kslavin/atools/libraries/asim/asim_lib.o ../../o_intermediates/age_machine.o ../../o_intermediates/asim_models.o ../../o_intermediates/cache_update.o ../../o_intermediates/xxx_cache.o ../../o_intermediates/dram.model.o ../../o_intermediates/get_transfer_mask.o ../../o_intermediates/mask_table.o ../../o_intermediates/system_RAM_xxx.o ../../o_intermediates/top_level.model.o ../../o_intermediates/transfer_machine.o -o xxx2_sim -lm -lpthread -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
/usr/lib/gcc-lib/i386-redhat-linux/3.2/collect2 -m elf_i386 -static -o xxx2_sim /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crt1.o /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crti.o /usr/lib/gcc-lib/i386-redhat-linux/3.2/crtbeginT.o -L/usr/lib/gcc-lib/i386-redhat-linux/3.2 -L/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../.. cache_xxx.o xxx_interface.o xxx_main.o cpu_interface_xxx.o my_getopt.o read_ppm_header.o resizer.o resizer_interface.o /home/kslavin/atools/libraries/asim/wrapper_lib.o /home/kslavin/atools/libraries/asim/asim_lib.o ../../o_intermediates/age_machine.o ../../o_intermediates/asim_models.o ../../o_intermediates/cache_update.o ../../o_intermediates/xxx_cache.o ../../o_intermediates/dram.model.o ../../o_intermediates/get_transfer_mask.o ../../o_intermediates/mask_table.o ../../o_intermediates/system_RAM_xxx.o ../../o_intermediates/top_level.model.o ../../o_intermediates/transfer_machine.o -lm -lpthread -lgcc -lgcc_eh -lc
-lgcc -lgcc_eh /usr/lib/gcc-lib/i386-redhat-linux/3.2/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crtn.o

real    2m26.990s
user    2m17.178s     <--- note: -fno-merge-constants used
sys     0m0.514s


If I temporarily replace ld using the old GNU ld version 2.10.90 (also with the -static flag), I get the following:

time gcc -static cache_xxx.o xxx_interface.o xxx_main.o cpu_interface_xxx.o my_getopt.o read_ppm_header.o resizer.o resizer_interface.o /home/kslavin/atools/libraries/asim/wrapper_lib.o /home/kslavin/atools/libraries/asim/asim_lib.o ../../o_intermediates/age_machine.o ../../o_intermediates/asim_models.o ../../o_intermediates/cache_update.o ../../o_intermediates/xxx_cache.o ../../o_intermediates/dram.model.o ../../o_intermediates/get_transfer_mask.o ../../o_intermediates/mask_table.o ../../o_intermediates/system_RAM_xxx.o ../../o_intermediates/top_level.model.o ../../o_intermediates/transfer_machine.o -o xxx2_sim -lm -lpthread -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)
/usr/lib/gcc-lib/i386-redhat-linux/3.2/collect2 -m elf_i386 -static -o xxx2_sim /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crt1.o /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crti.o /usr/lib/gcc-lib/i386-redhat-linux/3.2/crtbeginT.o -L/usr/lib/gcc-lib/i386-redhat-linux/3.2 -L/usr/lib/gcc-lib/i386-redhat-linux/3.2/../../.. cache_xxx.o xxx_interface.o xxx_main.o cpu_interface_xxx.o my_getopt.o read_ppm_header.o resizer.o resizer_interface.o /home/kslavin/atools/libraries/asim/wrapper_lib.o /home/kslavin/atools/libraries/asim/asim_lib.o ../../o_intermediates/age_machine.o ../../o_intermediates/asim_models.o ../../o_intermediates/cache_update.o ../../o_intermediates/xxx_cache.o ../../o_intermediates/dram.model.o ../../o_intermediates/get_transfer_mask.o ../../o_intermediates/mask_table.o ../../o_intermediates/system_RAM_xxx.o ../../o_intermediates/top_level.model.o ../../o_intermediates/transfer_machine.o -lm -lpthread -lgcc -lgcc_eh -lc
-lgcc -lgcc_eh /usr/lib/gcc-lib/i386-redhat-linux/3.2/crtend.o /usr/lib/gcc-lib/i386-redhat-linux/3.2/../../../crtn.o

real    0m1.868s
user    0m0.949s         <--------------- NOTE!!!!!!!
sys     0m0.527s

Release:
gcc version 3.2,  GNU ld version 2.13.90.0.2

Environment:
Red Hat 8.0, AMD 1GHz Athalon, 1GByte RAM.
gcc configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --host=i386-redhat-linux --with-system-zlib --enable-__cxa_atexit
Thread model: posix
gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7)

How-To-Repeat:
I have simple programs with huge statically initialized tables (generated from other code), and very little executable code. There is too much stuff (30 MBytes or so) to include here. See above for the linking command line.
Comment 1 Dara Hazeghi 2003-05-26 22:29:56 UTC
Hello,

would it be possible for you to attach a testcase that demonstrates this problem? Can you check 
whether this problem still occurs under gcc 3.3? Thanks,

Dara
Comment 2 Andrew Pinski 2003-05-26 22:34:11 UTC
See Dara's question
Comment 3 Andrew Pinski 2003-06-09 01:59:19 UTC
Actually I think this bug is still in 3.3 but I think this was just fixed on the mainline within 
the last month, can you try the mainline (aka cvs version) of gcc.
Comment 4 Andrew Pinski 2003-08-23 20:25:00 UTC
No feedback in 3 months (T-3 days).