It's a follow up of PR25355: https://sourceware.org/bugzilla/show_bug.cgi?id=25355#c63
Created attachment 12310 [details] Please try this
I can confirm the patch works.
(In reply to Martin Liška from comment #2) > I can confirm the patch works. Are you 100% sure?
Yes, I used the updated binutils to build a LTO project.
The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ecda90163e2b0a6f0be96e3fc262c28820a27211 commit ecda90163e2b0a6f0be96e3fc262c28820a27211 Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Feb 25 03:30:33 2020 -0800 Don't call lto-wrapper for ar and ranlib Since ar and ranlib don't need to know symbol types to work properly, we should avoid calling lto-wrapper for them to speed them up. bfd/ PR binutils/25584 * plugin.c (need_lto_wrapper_p): New. (bfd_plugin_set_program_name): Add an int argument to set need_lto_wrapper_p. (get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't set. * plugin.h (bfd_plugin_set_program_name): Add an int argument. binutils/ PR binutils/25584 * ar.c (main): Pass 0 to bfd_plugin_set_program_name. * nm.c (main): Pass 1 to bfd_plugin_set_program_name.
The binutils-2_34-branch branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=42b2380cdced1f828ede6fa1c7c7d1fdf0e331ca commit 42b2380cdced1f828ede6fa1c7c7d1fdf0e331ca Author: H.J. Lu <hjl.tools@gmail.com> Date: Tue Feb 25 03:30:33 2020 -0800 Don't call lto-wrapper for ar and ranlib Since ar and ranlib don't need to know symbol types to work properly, we should avoid calling lto-wrapper for them to speed them up. bfd/ PR binutils/25584 * plugin.c (need_lto_wrapper_p): New. (bfd_plugin_set_program_name): Add an int argument to set need_lto_wrapper_p. (get_lto_wrapper): Return FALSE if need_lto_wrapper_p isn't set. * plugin.h (bfd_plugin_set_program_name): Add an int argument. binutils/ PR binutils/25584 * ar.c (main): Pass 0 to bfd_plugin_set_program_name. * nm.c (main): Pass 1 to bfd_plugin_set_program_name. (cherry picked from commit ecda90163e2b0a6f0be96e3fc262c28820a27211)
Fixed for 2.35 and 2.34 branch.