On 11/22/2021 7:29 PM, H.J. Lu wrote:
On Mon, Nov 22, 2021 at 4:29 PM Jeff Law <jeffreya...@gmail.com> wrote:


On 11/13/2021 9:33 AM, H.J. Lu via Gcc-patches wrote:
Sync with binutils for building binutils with LTO:

  From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.to...@gmail.com>
Date: Sat, 9 Jan 2021 06:43:11 -0800
Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB

Detect GCC LTO plugin.  Pass --plugin to AR and RANLIB to support LTO
build.

       * Makefile.tpl (AR): Add @AR_PLUGIN_OPTION@
       (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
       * configure.ac: Include config/gcc-plugin.m4.
       AC_SUBST AR_PLUGIN_OPTION and RANLIB_PLUGIN_OPTION.
       * libtool.m4 (_LT_CMD_OLD_ARCHIVE): Pass --plugin to AR and
       RANLIB if possible.
       * Makefile.in: Regenerated.
       * configure: Likewise.

config/

       * gcc-plugin.m4 (GCC_PLUGIN_OPTION): New.

libiberty/

       * Makefile.in (AR): Add @AR_PLUGIN_OPTION@
       (RANLIB): Add @RANLIB_PLUGIN_OPTION@.
       (configure_deps): Depend on ../config/gcc-plugin.m4.
       * configure.ac: AC_SUBST AR_PLUGIN_OPTION and
       RANLIB_PLUGIN_OPTION.
       * aclocal.m4: Regenerated.
       * configure: Likewise.

zlib/

       * configure: Regenerated.
I thought the plugins were automatically loaded if they're in the right
place in the filesystem.  Wouldn't that make this patch unnecessary?  Am
I missing something?

It only works for system GCC and binutils.  It doesn't work for non-system
GCC nor binutils since either GCC plugin isn't installed in the binutils plugin
search patch.
Ah.  So this is primarily useful if GCC was installed into a path different than the system binutils expects to find the plugin? Does it work properly in cross environments or at least do no harm in those kinds of builds?

Jeff

Reply via email to