plugin: Pass -flto-partition=none to GCC

Message ID 20200306205657.14118-1-hjl.tools@gmail.com
State New
Headers show
Series
  • plugin: Pass -flto-partition=none to GCC
Related show

Commit Message

H.J. Lu March 6, 2020, 8:56 p.m.
Without -flto-partition=none, GCC may generate more than one real object
from a single LTO IR object while plugin expects only one object with
real symbols.

	PR binutils/25640
	* plugin.c (setup_lto_wrapper_env): Pass -flto-partition=none to
	GCC.
---
 bfd/plugin.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.24.1

Comments

Peter Bergner via Binutils March 13, 2020, 12:54 p.m. | #1
Hi H.J.

> 	PR binutils/25640

> 	* plugin.c (setup_lto_wrapper_env): Pass -flto-partition=none to

> 	GCC.


Approved - please apply.

Cheers
  Nick
Peter Bergner via Binutils March 13, 2020, 1:02 p.m. | #2
On Fri, Mar 13, 2020 at 5:54 AM Nick Clifton <nickc@redhat.com> wrote:
>

> Hi H.J.

>

> >       PR binutils/25640

> >       * plugin.c (setup_lto_wrapper_env): Pass -flto-partition=none to

> >       GCC.

>

> Approved - please apply.


This patch doesn't work since LTO wrapper ignores -flto-partition=none:

https://sourceware.org/bugzilla/show_bug.cgi?id=25640#c7

There is a proposal to extend plugin API to add symbol type:

https://gcc.gnu.org/pipermail/gcc-patches/2020-March/541930.html



-- 
H.J.

Patch

diff --git a/bfd/plugin.c b/bfd/plugin.c
index a0f172d363..b9b2c3794d 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -317,7 +317,7 @@  static int
 setup_lto_wrapper_env (struct plugin_list_entry *plugin)
 {
   return (putenv (plugin->gcc_env)
-	  || putenv ("COLLECT_GCC_OPTIONS="));
+	  || putenv ("COLLECT_GCC_OPTIONS=-flto-partition=none"));
 }
 
 static struct plugin_list_entry *plugin_list = NULL;