#1069927 binutils: ld 2.42-4 is much slower than 2.41-7 when linking large a ppc64le kernel

Package:
binutils
Source:
binutils
Description:
GNU assembler, linker and binary utilities
Submitter:
Stephen Rothwell
Date:
2024-04-27 08:33:04 UTC
Severity:
normal
#1069927#5
Date:
2024-04-27 08:22:00 UTC
From:
To:
Dear Maintainer,

   * What led up to the situation?

Upgrading bintuils in Testing from 2.41-7 to 2.42-4

   * What was the outcome of this action?

My linux kernel powerpc allyesconfig builds went from about 30 minutes
to about 3 hours.  Most if this time is just a single ld process.

   * What outcome did you expect instead?

The old timing.

This is on a ppc64le machine doing native builds.  All the objects were
created with the upgraded compiler, the only change between the runs of
ld was to downgrade binutils and the compiler.

New version:

$ gcc --version
gcc (Debian 13.2.0-23) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ld --version
GNU ld (GNU Binutils for Debian) 2.42
Copyright (C) 2024 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

$ /usr/bin/time ld -EB -m elf64ppc -z noexecstack --no-warn-rwx-segments -r -o vmlinux.o  --whole-archive vmlinux.a --no-whole-archive --start-group  --end-group
9004.40user 8.97system 2:30:34elapsed 99%CPU (0avgtext+0avgdata 7057664maxresident)k
0inputs+0outputs (0major+107200minor)pagefaults 0swaps

$ ls -latr vm*
-rw-r--r-- 1 sfr users    5845322 Apr 27 11:48 vmlinux.a
-rw-r--r-- 1 sfr users 1382054744 Apr 27 14:31 vmlinux.o

After downgrade:

$ gcc --version
gcc (Debian 13.2.0-7) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ ld --version
GNU ld (GNU Binutils for Debian) 2.41
Copyright (C) 2023 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License version 3 or (at your option) a later version.
This program has absolutely no warranty.

$ /usr/bin/time ld -EB -m elf64ppc -z noexecstack --no-warn-rwx-segments -r -o vmlinux.o  --whole-archive vmlinux.a --no-whole-archive --start-group  --end-group
27.78user 8.60system 0:36.42elapsed 99%CPU (0avgtext+0avgdata 6317504maxresident)k
0inputs+0outputs (0major+95508minor)pagefaults 0swaps

$ ls -latr vm*
-rw-r--r-- 1 sfr users    5845322 Apr 27 11:48 vmlinux.a
-rw-r--r-- 1 sfr users 1328724736 Apr 27 16:17 vmlinux.o

The vmlinux.a file is a thin archive.  I have uploaded a tar file, to
https://ozlabs.org/~sfr/objects.tar.xz, containing it and all the
objects it refers to (its is 154M compressed).