I test i686-linux-gnu in a presumably unusual setting: it's an
x86_64-linux-gnu system, and I've configured the GCC build to use as
builddev tools wrapper scripts for as, ld, gnatmake and gcc that add
flags that make them default to 32-bit.

This worked fine for regression testing, but I've recently realized
(with the PR49888/53671 mishap) that I'm getting tons of LTO testsuite
failures (before and after, so no regression), because the 32-bit LTO
plugin built in this setting can't possibly be used by the 64-bit linker
installed on the system.  Obviously, passing -melf_i386 to the linker
through the wrapper is not enough for it to be able to dlopen a 32-bit
plugin ;-)

I'm considering installing alternate 32-bit tools on my system for
better testing, but I figured I'd betetr fix the test harness before
tackling this: if we find that the LTO plugin doesn't work, we'd better
not use -flto without -fno-use-linker-plugin, to avoid such spurious
failures as GCC attempts by its own initiative to use the linker plugin.

At first I wished there was a simpler, off-band way to tell it not to
use the LTO plugin, that didn't pollute the command line or the test
results, but before I even looked around for some such way, I figured it
would be useful to have information that the linker plugin was not used
in a particular test run, so I went for this patch instead.

Ok to install?

for  gcc/testsuite/ChangeLog
from  Alexandre Oliva  <aol...@redhat.com>

	* lib/c-torture.exp (LTO_TORTURE_OPTIONS): Add -fno-use-linker-plugin
	if plugin detection does not succeed.
	* lib/gcc-dg.exp (LTO_TORTURE_OPTIONS): Likewise.
	* lib/lto.exp (LTO_OPTIONS): Likewise.

Index: gcc/testsuite/lib/c-torture.exp
===================================================================
--- gcc/testsuite/lib/c-torture.exp.orig	2012-06-25 19:15:07.490911571 -0300
+++ gcc/testsuite/lib/c-torture.exp	2012-06-25 19:15:32.927836277 -0300
@@ -61,8 +61,8 @@ if [check_effective_target_lto] {
       ]
     } else {
       set LTO_TORTURE_OPTIONS [list \
-	  { -O2 -flto -flto-partition=none } \
-	  { -O2 -flto }
+	  { -O2 -flto -fno-use-linker-plugin -flto-partition=none } \
+	  { -O2 -flto -fno-use-linker-plugin }
       ]
     }
 }
Index: gcc/testsuite/lib/gcc-dg.exp
===================================================================
--- gcc/testsuite/lib/gcc-dg.exp.orig	2012-06-25 19:15:09.617738045 -0300
+++ gcc/testsuite/lib/gcc-dg.exp	2012-06-25 19:15:33.161817189 -0300
@@ -92,8 +92,8 @@ if [check_effective_target_lto] {
       set gcc_force_conventional_output "-ffat-lto-objects"
     } else {
       set LTO_TORTURE_OPTIONS [list \
-	  { -O2 -flto -flto-partition=none } \
-	  { -O2 -flto }
+	  { -O2 -flto -fno-use-linker-plugin -flto-partition=none } \
+	  { -O2 -flto -fno-use-linker-plugin }
       ]
     }
 }
Index: gcc/testsuite/lib/lto.exp
===================================================================
--- gcc/testsuite/lib/lto.exp.orig	2012-06-25 19:15:14.617330140 -0300
+++ gcc/testsuite/lib/lto.exp	2012-06-25 19:15:34.966669945 -0300
@@ -77,12 +77,12 @@ proc lto_init { args } {
 	  ]
  	} else {
 	  set LTO_OPTIONS [list	\
-	      {-O0 -flto -flto-partition=none } \
-	      {-O2 -flto -flto-partition=none } \
-	      {-O0 -flto -flto-partition=1to1 } \
-	      {-O2 -flto -flto-partition=1to1 } \
-	      {-O0 -flto }	\
-	      {-O2 -flto}		\
+	      {-O0 -flto -fno-use-linker-plugin -flto-partition=none } \
+	      {-O2 -flto -fno-use-linker-plugin -flto-partition=none } \
+	      {-O0 -flto -fno-use-linker-plugin -flto-partition=1to1 } \
+	      {-O2 -flto -fno-use-linker-plugin -flto-partition=1to1 } \
+	      {-O0 -flto -fno-use-linker-plugin }			\
+	      {-O2 -flto -fno-use-linker-plugin }			\
 	  ]
 	}
     }
-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

Reply via email to