bug-binutils
[Top][All Lists]
Advanced

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

[Bug binutils/32238] Performance issues found from binutils version '2.3


From: kumar.naveen099 at gmail dot com
Subject: [Bug binutils/32238] Performance issues found from binutils version '2.36' version with function 'lang_output_section_statement_lookup'
Date: Sat, 05 Oct 2024 08:36:56 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=32238

--- Comment #7 from Naveen Kumar <kumar.naveen099 at gmail dot com> ---
Host & Target: x86_64

I've been able to repro a ~10x slowdown between 2.29 and 2.36 using open-source
LLVM.

1) Download LLVM 19.1.0 sources from
https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.0/llvm-project-19.1.0.src.tar.xz

2) Unarchive and configure with:

   cmake -DCMAKE_BUILD_TYPE=Debug -G Ninja -DLLVM_TARGETS_TO_BUILD=X86
-DCMAKE_INSTALL_PREFIX=/path/to/install/dir
-DCMAKE_C_FLAGS="-ffunction-sections -fdata-sections"
-DCMAKE_CXX_FLAGS="-ffunction-sections -fdata-sections"
<local_path>/llvm-project-19.1.0.src/llvm

    <local_path> => This is the folder path where we do unarchive of
'llvm-project-19.1.0.src.tar.xz' file.

3) Build with command: ninja install

4) copy attached main.cpp & Makefile at <local_path>/llvm-project-19.1.0.src
folder 

5) Modify the Makefile:

     => 'LLVM_CONFIG' variable to point to your installed 'llvm-config'
utility.   
     => 'LD' variable to point to 2.34 ld version.

6) run the command 'make' and record the build time 

    => if you notice any compiler issues, Please add '-std=c++17' to 'CFLAGS'
and rerun 'make' command. 

7) Rerun with another ld version (anything b/w 2.36 to 2.42) to observe build
time difference (delete main.o first).

At 6th step, You can find the linker command in the log where you can see all
the flags we are using. 

Note:- The main.cpp source is taken from an LLVM example, modifying to include
some extra stuff, meaning extra required LLVM symbols. 

Build time metrics:

ld 2.34.1-64:

  real    1m25.619s
  user    1m20.950s
  sys     0m4.287s

ld 2.36.1-64:

  real    13m23.851s
  user    13m19.463s
  sys     0m4.268s

perf metrics while running culprit linker (2.36) process:-

Samples: 3M of event 'cycles', Event count (approx.): 4629795486714
  Children      Self  Command  Shared Object      Symbol
+   89.25%    89.17%  ld       ld                 [.]
lang_output_section_statement_lookup


I hope above repro testcase is sufficient for your use case.

BTW, In our original build system we deal with huge set of obj files and
linker/ld (> 2.36 version) takes around 65mins to complete. Where as same
linker command with ld (< 2.36) will take less than 2mins.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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