diff mbox

PR lto/47188 (-flto-partition=none disabling efect of -fuse-linker-plugin)

Message ID 20110106192218.GA32433@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Jan. 6, 2011, 7:22 p.m. UTC
Hi,
the testcase demonstrates that -fuse-linker-plugin effect is nullified by
-flto-partition=none.  This is because of my thinko in collect2.c.  Logic
in collect2.c is supposed to set LTO_MODE_NONE when plugin is active, but
-flto-partition=none sets it to LTO_MODE_LTO.
As a effect LTO is performe dtwice, once from plugin and once from collect2
and only the second result is used.

Bootstrapped/regtested x86_64-linux, comitted as obvoius.

The patch unfortunately triggers few extra failures with the patch enabling
linker plugin by default:

./gcc/testsuite/gcc5/gcc.sum:FAIL: gcc.c-torture/execute/builtins/memcpy-chk.c execution,  -O2 -flto -flto-partition=none 
./gcc/testsuite/gcc5/gcc.sum:FAIL: gcc.c-torture/execute/builtins/memmove-chk.c execution,  -O2 -flto -flto-partition=none 
./gcc/testsuite/gcc5/gcc.sum:FAIL: gcc.c-torture/execute/builtins/mempcpy-chk.c execution,  -O2 -flto -flto-partition=none 
./gcc/testsuite/gcc5/gcc.sum:FAIL: gcc.c-torture/execute/builtins/memset-chk.c execution,  -O2 -flto -flto-partition=none 

This seems like another problem with aliases where whopr gets luckily around.
I will analyze them.

Honza

	PR lto/47188
	* collect2.c (main): Do not enable LTOmode when plugin is active.
	* testsuite/gcc.dg/lto/pr47188_0.c: New testcase.
	* testsuite/gcc.dg/lto/pr47188_1.c: New testcase.
diff mbox

Patch

Index: testsuite/gcc.dg/lto/pr47188_0.c
===================================================================
--- testsuite/gcc.dg/lto/pr47188_0.c	(revision 0)
+++ testsuite/gcc.dg/lto/pr47188_0.c	(revision 0)
@@ -0,0 +1,7 @@ 
+/* { dg-lto-do assemble } */
+/* { dg-require-linker-plugin "" } */
+/* { dg-extra-ld-options "-fuse-linker-plugin -fwhole-program" } */
+int foo(void)
+{
+  return 0;
+}
Index: testsuite/gcc.dg/lto/pr47188_1.c
===================================================================
--- testsuite/gcc.dg/lto/pr47188_1.c	(revision 0)
+++ testsuite/gcc.dg/lto/pr47188_1.c	(revision 0)
@@ -0,0 +1,8 @@ 
+/* { dg-options "-fno-lto" } */
+
+extern int foo(void);
+
+int main(void)
+{
+  return foo();
+}
Index: collect2.c
===================================================================
--- collect2.c	(revision 168539)
+++ collect2.c	(working copy)
@@ -1236,7 +1236,7 @@ 
 #endif
       }
     vflag = debug;
-    if (no_partition)
+    if (no_partition && lto_mode == LTO_MODE_WHOPR)
       lto_mode = LTO_MODE_LTO;
   }