Make LTO tests that require recent binutils UNSUPPORTED with older ones (PR lto/86004)

Message ID 20181211073122.GL12380@tucnak
State New
Headers show
Series
  • Make LTO tests that require recent binutils UNSUPPORTED with older ones (PR lto/86004)
Related show

Commit Message

Jakub Jelinek Dec. 11, 2018, 7:31 a.m.
Hi!

As mentioned in the PR, older binutils (like 2.25) complain on these tests
when using -r that:
plugin needed to handle lto object
The following patch introduces an effective target and guards those tests on
a linker with this issue fixed.

Regtested on x86_64-linux and i686-linux, plus regtested on x86_64-linux
with 2.25 binutils, where the patch converts all those FAILs into
UNSUPPORTEDs.

Ok for trunk?

2018-12-11  Jakub Jelinek  <jakub@redhat.com>

	PR lto/86004
	* lib/target-supports.exp (check_effective_target_lto_incremental):
	New.
	* g++.dg/lto/pr69137_0.C: Require lto_incremental effective target.
	* g++.dg/lto/pr65316_0.C: Likewise.
	* g++.dg/lto/pr85176_0.C: Likewise.
	* g++.dg/lto/pr79000_0.C: Likewise.
	* g++.dg/lto/pr66180_0.C: Likewise.
	* g++.dg/lto/pr65193_0.C: Likewise.
	* g++.dg/lto/pr69077_0.C: Likewise.
	* g++.dg/lto/pr68057_0.C: Likewise.
	* g++.dg/lto/pr66705_0.C: Likewise.
	* g++.dg/lto/pr65302_0.C: Likewise.
	* g++.dg/lto/20091002-1_0.C: Likewise.
	* g++.dg/lto/pr81940_0.C: Likewise.
	* g++.dg/lto/pr64043_0.C: Likewise.
	* g++.dg/lto/pr65549_0.C: Likewise.
	* g++.dg/lto/pr69133_0.C: Likewise.
	* gfortran.dg/lto/pr79108_0.f90: Likewise.


	Jakub

Comments

Rainer Orth Dec. 11, 2018, 7:52 a.m. | #1
Hi Jakub,

> As mentioned in the PR, older binutils (like 2.25) complain on these tests

> when using -r that:

> plugin needed to handle lto object

> The following patch introduces an effective target and guards those tests on

> a linker with this issue fixed.

>

> Regtested on x86_64-linux and i686-linux, plus regtested on x86_64-linux

> with 2.25 binutils, where the patch converts all those FAILs into

> UNSUPPORTEDs.

>

> Ok for trunk?


please document the new effective-target keyword in sourcebuild.texi.

Thanks.
        Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
Richard Biener Dec. 11, 2018, 8:30 a.m. | #2
On Tue, 11 Dec 2018, Jakub Jelinek wrote:

> Hi!

> 

> As mentioned in the PR, older binutils (like 2.25) complain on these tests

> when using -r that:

> plugin needed to handle lto object

> The following patch introduces an effective target and guards those tests on

> a linker with this issue fixed.

> 

> Regtested on x86_64-linux and i686-linux, plus regtested on x86_64-linux

> with 2.25 binutils, where the patch converts all those FAILs into

> UNSUPPORTEDs.

> 

> Ok for trunk?


OK.

> 2018-12-11  Jakub Jelinek  <jakub@redhat.com>

> 

> 	PR lto/86004

> 	* lib/target-supports.exp (check_effective_target_lto_incremental):

> 	New.

> 	* g++.dg/lto/pr69137_0.C: Require lto_incremental effective target.

> 	* g++.dg/lto/pr65316_0.C: Likewise.

> 	* g++.dg/lto/pr85176_0.C: Likewise.

> 	* g++.dg/lto/pr79000_0.C: Likewise.

> 	* g++.dg/lto/pr66180_0.C: Likewise.

> 	* g++.dg/lto/pr65193_0.C: Likewise.

> 	* g++.dg/lto/pr69077_0.C: Likewise.

> 	* g++.dg/lto/pr68057_0.C: Likewise.

> 	* g++.dg/lto/pr66705_0.C: Likewise.

> 	* g++.dg/lto/pr65302_0.C: Likewise.

> 	* g++.dg/lto/20091002-1_0.C: Likewise.

> 	* g++.dg/lto/pr81940_0.C: Likewise.

> 	* g++.dg/lto/pr64043_0.C: Likewise.

> 	* g++.dg/lto/pr65549_0.C: Likewise.

> 	* g++.dg/lto/pr69133_0.C: Likewise.

> 	* gfortran.dg/lto/pr79108_0.f90: Likewise.

> 

> --- gcc/testsuite/lib/target-supports.exp.jj	2018-12-04 20:40:01.491379395 +0100

> +++ gcc/testsuite/lib/target-supports.exp	2018-12-10 15:39:37.714763670 +0100

> @@ -8014,6 +8014,18 @@ proc check_effective_target_lto { } {

>      } "-flto"]

>  }

>  

> +# Return 1 if the compiler and linker support incremental link-time

> +# optimization.

> +

> +proc check_effective_target_lto_incremental { } {

> +    if ![check_effective_target_lto] {

> +	return 0

> +    }

> +    return [check_no_compiler_messages lto_incremental executable {

> +	int main () { return 0; }

> +    } "-flto -r -nostdlib"]

> +}

> +

>  # Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.

>  

>  proc check_effective_target_maybe_x32 { } {

> --- gcc/testsuite/g++.dg/lto/pr69137_0.C.jj	2016-01-15 20:37:28.533589631 +0100

> +++ gcc/testsuite/g++.dg/lto/pr69137_0.C	2018-12-10 15:42:38.355806095 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -std=c++11 -g -flto } } }

>  // { dg-extra-ld-options "-r -nostdlib" }

>  

> --- gcc/testsuite/g++.dg/lto/pr65316_0.C.jj	2017-11-06 17:24:08.773286226 +0100

> +++ gcc/testsuite/g++.dg/lto/pr65316_0.C	2018-12-10 15:41:01.092398551 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -flto -std=c++11 -g2 -fno-lto-odr-type-merging -O2 -Wno-return-type } } }

>  // { dg-extra-ld-options "-r -nostdlib -O2 -fno-lto-odr-type-merging" }

>  

> --- gcc/testsuite/g++.dg/lto/pr85176_0.C.jj	2018-04-04 16:13:42.972551086 +0200

> +++ gcc/testsuite/g++.dg/lto/pr85176_0.C	2018-12-10 15:43:20.838110547 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -flto -g1 } } }

>  // { dg-extra-ld-options "-r -nostdlib" }

>  namespace a {

> --- gcc/testsuite/g++.dg/lto/pr79000_0.C.jj	2017-01-09 11:35:04.310821717 +0100

> +++ gcc/testsuite/g++.dg/lto/pr79000_0.C	2018-12-10 15:42:54.657539190 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { "-flto -g" } }

>  // { dg-extra-ld-options "-r -nostdlib" }

>  

> --- gcc/testsuite/g++.dg/lto/pr66180_0.C.jj	2015-05-29 15:04:33.064803028 +0200

> +++ gcc/testsuite/g++.dg/lto/pr66180_0.C	2018-12-10 15:41:39.730765940 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -flto -std=c++14 -r -nostdlib } } }

>  #include <memory>

>  namespace {

> --- gcc/testsuite/g++.dg/lto/pr65193_0.C.jj	2017-11-06 17:24:08.774286214 +0100

> +++ gcc/testsuite/g++.dg/lto/pr65193_0.C	2018-12-10 15:40:23.564012993 +0100

> @@ -1,5 +1,6 @@

>  /* { dg-lto-do link } */

>  /* { dg-require-effective-target fpic } */

> +/* { dg-require-effective-target lto_incremental } */

>  /* { dg-lto-options {{-fPIC -r -nostdlib -flto -O2 -g -Wno-return-type}} } */

>  

>  void frexp (int, int *);

> --- gcc/testsuite/g++.dg/lto/pr69077_0.C.jj	2017-11-06 17:24:08.770286263 +0100

> +++ gcc/testsuite/g++.dg/lto/pr69077_0.C	2018-12-10 15:42:19.886108489 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -O3 -g -flto } } }

>  // { dg-extra-ld-options "-r -nostdlib" }

>  

> --- gcc/testsuite/g++.dg/lto/pr68057_0.C.jj	2015-11-09 13:39:21.418394784 +0100

> +++ gcc/testsuite/g++.dg/lto/pr68057_0.C	2018-12-10 15:42:08.058302145 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  /* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */

>  struct SPxPricer;

>  struct SoPlex {

> --- gcc/testsuite/g++.dg/lto/pr66705_0.C.jj	2015-09-03 17:18:33.224711564 +0200

> +++ gcc/testsuite/g++.dg/lto/pr66705_0.C	2018-12-10 15:41:53.763536188 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -O2 -flto -flto-partition=max -fipa-pta } } }

>  // { dg-extra-ld-options "-r -nostdlib" }

>  

> --- gcc/testsuite/g++.dg/lto/pr65302_0.C.jj	2017-11-06 17:24:08.770286263 +0100

> +++ gcc/testsuite/g++.dg/lto/pr65302_0.C	2018-12-10 15:40:53.705519502 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -flto -O2 -Wno-return-type } } }

>  // { dg-extra-ld-options "-r -nostdlib -O0" }

>  

> --- gcc/testsuite/g++.dg/lto/20091002-1_0.C.jj	2017-11-06 17:24:08.768286288 +0100

> +++ gcc/testsuite/g++.dg/lto/20091002-1_0.C	2018-12-10 15:40:03.968333822 +0100

> @@ -1,5 +1,6 @@

>  // { dg-lto-do link }

>  // { dg-require-effective-target fpic }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options {{-fPIC -flto -Wno-return-type}} }

>  // { dg-extra-ld-options "-fPIC -r -nostdlib" }

>  

> --- gcc/testsuite/g++.dg/lto/pr81940_0.C.jj	2017-09-01 09:26:20.822938902 +0200

> +++ gcc/testsuite/g++.dg/lto/pr81940_0.C	2018-12-10 15:43:07.350331378 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -O -flto } } }

>  // { dg-extra-ld-options "-r -nostdlib -g" }

>  

> --- gcc/testsuite/g++.dg/lto/pr64043_0.C.jj	2014-12-15 10:36:23.853604377 +0100

> +++ gcc/testsuite/g++.dg/lto/pr64043_0.C	2018-12-10 15:26:51.800299063 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -flto -std=c++11 } } }

>  // { dg-extra-ld-options "-r -nostdlib -O2" }

>  class Validator

> --- gcc/testsuite/g++.dg/lto/pr65549_0.C.jj	2017-11-06 17:24:08.773286226 +0100

> +++ gcc/testsuite/g++.dg/lto/pr65549_0.C	2018-12-10 15:41:26.456983265 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -std=gnu++14 -flto -g -Wno-return-type } { -std=gnu++14 -flto -g -O2 -fno-inline -flto-partition=max -Wno-return-type } } }

>  // { dg-extra-ld-options "-r -nostdlib" }

>  

> --- gcc/testsuite/g++.dg/lto/pr69133_0.C.jj	2016-01-19 13:31:07.638760602 +0100

> +++ gcc/testsuite/g++.dg/lto/pr69133_0.C	2018-12-10 15:42:30.451935499 +0100

> @@ -1,4 +1,5 @@

>  // { dg-lto-do link }

> +// { dg-require-effective-target lto_incremental }

>  // { dg-lto-options { { -flto -O2 } } }

>  // { dg-extra-ld-options "-r -nostdlib -flto -flto-partition=none -O2" }

>  namespace xercesc_3_1 {

> --- gcc/testsuite/gfortran.dg/lto/pr79108_0.f90.jj	2018-09-21 19:07:12.649985507 +0200

> +++ gcc/testsuite/gfortran.dg/lto/pr79108_0.f90	2018-12-10 15:43:49.724637597 +0100

> @@ -1,4 +1,5 @@

>  ! { dg-lto-do link }

> +! { dg-require-effective-target lto_incremental }

>  ! { dg-lto-options {{ -Ofast -flto --param ggc-min-expand=0 --param ggc-min-heapsize=0 }} }

>  ! { dg-extra-ld-options "-r" }

>  

> 

> 	Jakub

> 

> 


-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)
Jakub Jelinek Dec. 11, 2018, 9:11 a.m. | #3
On Tue, Dec 11, 2018 at 08:52:12AM +0100, Rainer Orth wrote:
> Hi Jakub,

> 

> > As mentioned in the PR, older binutils (like 2.25) complain on these tests

> > when using -r that:

> > plugin needed to handle lto object

> > The following patch introduces an effective target and guards those tests on

> > a linker with this issue fixed.

> >

> > Regtested on x86_64-linux and i686-linux, plus regtested on x86_64-linux

> > with 2.25 binutils, where the patch converts all those FAILs into

> > UNSUPPORTEDs.

> >

> > Ok for trunk?

> 

> please document the new effective-target keyword in sourcebuild.texi.


So like this?

2018-12-11  Jakub Jelinek  <jakub@redhat.com>

	PR lto/86004
	* doc/sourcebuild.texi (lto_incremental): Document new effective
	target.

	* lib/target-supports.exp (check_effective_target_lto_incremental):
	New.
	* g++.dg/lto/pr69137_0.C: Require lto_incremental effective target.
	* g++.dg/lto/pr65316_0.C: Likewise.
	* g++.dg/lto/pr85176_0.C: Likewise.
	* g++.dg/lto/pr79000_0.C: Likewise.
	* g++.dg/lto/pr66180_0.C: Likewise.
	* g++.dg/lto/pr65193_0.C: Likewise.
	* g++.dg/lto/pr69077_0.C: Likewise.
	* g++.dg/lto/pr68057_0.C: Likewise.
	* g++.dg/lto/pr66705_0.C: Likewise.
	* g++.dg/lto/pr65302_0.C: Likewise.
	* g++.dg/lto/20091002-1_0.C: Likewise.
	* g++.dg/lto/pr81940_0.C: Likewise.
	* g++.dg/lto/pr64043_0.C: Likewise.
	* g++.dg/lto/pr65549_0.C: Likewise.
	* g++.dg/lto/pr69133_0.C: Likewise.
	* gfortran.dg/lto/pr79108_0.f90: Likewise.

--- gcc/doc/sourcebuild.texi.jj	2018-11-27 09:48:58.095110442 +0100
+++ gcc/doc/sourcebuild.texi	2018-12-11 10:06:03.766267580 +0100
@@ -2265,6 +2265,10 @@ Target keeps null pointer checks, either
 @item lto
 Compiler has been configured to support link-time optimization (LTO).
 
+@item lto_incremental
+Compiler and linker support link-time optimization relocatable linking
+with @option{-r} and @option{-flto} options.
+
 @item naked_functions
 Target supports the @code{naked} function attribute.
 
--- gcc/testsuite/lib/target-supports.exp.jj	2018-12-04 20:40:01.491379395 +0100
+++ gcc/testsuite/lib/target-supports.exp	2018-12-10 15:39:37.714763670 +0100
@@ -8014,6 +8014,18 @@ proc check_effective_target_lto { } {
     } "-flto"]
 }
 
+# Return 1 if the compiler and linker support incremental link-time
+# optimization.
+
+proc check_effective_target_lto_incremental { } {
+    if ![check_effective_target_lto] {
+	return 0
+    }
+    return [check_no_compiler_messages lto_incremental executable {
+	int main () { return 0; }
+    } "-flto -r -nostdlib"]
+}
+
 # Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
 
 proc check_effective_target_maybe_x32 { } {
--- gcc/testsuite/g++.dg/lto/pr69137_0.C.jj	2016-01-15 20:37:28.533589631 +0100
+++ gcc/testsuite/g++.dg/lto/pr69137_0.C	2018-12-10 15:42:38.355806095 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -std=c++11 -g -flto } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr65316_0.C.jj	2017-11-06 17:24:08.773286226 +0100
+++ gcc/testsuite/g++.dg/lto/pr65316_0.C	2018-12-10 15:41:01.092398551 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -std=c++11 -g2 -fno-lto-odr-type-merging -O2 -Wno-return-type } } }
 // { dg-extra-ld-options "-r -nostdlib -O2 -fno-lto-odr-type-merging" }
 
--- gcc/testsuite/g++.dg/lto/pr85176_0.C.jj	2018-04-04 16:13:42.972551086 +0200
+++ gcc/testsuite/g++.dg/lto/pr85176_0.C	2018-12-10 15:43:20.838110547 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -g1 } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 namespace a {
--- gcc/testsuite/g++.dg/lto/pr79000_0.C.jj	2017-01-09 11:35:04.310821717 +0100
+++ gcc/testsuite/g++.dg/lto/pr79000_0.C	2018-12-10 15:42:54.657539190 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { "-flto -g" } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr66180_0.C.jj	2015-05-29 15:04:33.064803028 +0200
+++ gcc/testsuite/g++.dg/lto/pr66180_0.C	2018-12-10 15:41:39.730765940 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -std=c++14 -r -nostdlib } } }
 #include <memory>
 namespace {
--- gcc/testsuite/g++.dg/lto/pr65193_0.C.jj	2017-11-06 17:24:08.774286214 +0100
+++ gcc/testsuite/g++.dg/lto/pr65193_0.C	2018-12-10 15:40:23.564012993 +0100
@@ -1,5 +1,6 @@
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
+/* { dg-require-effective-target lto_incremental } */
 /* { dg-lto-options {{-fPIC -r -nostdlib -flto -O2 -g -Wno-return-type}} } */
 
 void frexp (int, int *);
--- gcc/testsuite/g++.dg/lto/pr69077_0.C.jj	2017-11-06 17:24:08.770286263 +0100
+++ gcc/testsuite/g++.dg/lto/pr69077_0.C	2018-12-10 15:42:19.886108489 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -O3 -g -flto } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr68057_0.C.jj	2015-11-09 13:39:21.418394784 +0100
+++ gcc/testsuite/g++.dg/lto/pr68057_0.C	2018-12-10 15:42:08.058302145 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 /* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */
 struct SPxPricer;
 struct SoPlex {
--- gcc/testsuite/g++.dg/lto/pr66705_0.C.jj	2015-09-03 17:18:33.224711564 +0200
+++ gcc/testsuite/g++.dg/lto/pr66705_0.C	2018-12-10 15:41:53.763536188 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -O2 -flto -flto-partition=max -fipa-pta } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr65302_0.C.jj	2017-11-06 17:24:08.770286263 +0100
+++ gcc/testsuite/g++.dg/lto/pr65302_0.C	2018-12-10 15:40:53.705519502 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -O2 -Wno-return-type } } }
 // { dg-extra-ld-options "-r -nostdlib -O0" }
 
--- gcc/testsuite/g++.dg/lto/20091002-1_0.C.jj	2017-11-06 17:24:08.768286288 +0100
+++ gcc/testsuite/g++.dg/lto/20091002-1_0.C	2018-12-10 15:40:03.968333822 +0100
@@ -1,5 +1,6 @@
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options {{-fPIC -flto -Wno-return-type}} }
 // { dg-extra-ld-options "-fPIC -r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr81940_0.C.jj	2017-09-01 09:26:20.822938902 +0200
+++ gcc/testsuite/g++.dg/lto/pr81940_0.C	2018-12-10 15:43:07.350331378 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -O -flto } } }
 // { dg-extra-ld-options "-r -nostdlib -g" }
 
--- gcc/testsuite/g++.dg/lto/pr64043_0.C.jj	2014-12-15 10:36:23.853604377 +0100
+++ gcc/testsuite/g++.dg/lto/pr64043_0.C	2018-12-10 15:26:51.800299063 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -std=c++11 } } }
 // { dg-extra-ld-options "-r -nostdlib -O2" }
 class Validator
--- gcc/testsuite/g++.dg/lto/pr65549_0.C.jj	2017-11-06 17:24:08.773286226 +0100
+++ gcc/testsuite/g++.dg/lto/pr65549_0.C	2018-12-10 15:41:26.456983265 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -std=gnu++14 -flto -g -Wno-return-type } { -std=gnu++14 -flto -g -O2 -fno-inline -flto-partition=max -Wno-return-type } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr69133_0.C.jj	2016-01-19 13:31:07.638760602 +0100
+++ gcc/testsuite/g++.dg/lto/pr69133_0.C	2018-12-10 15:42:30.451935499 +0100
@@ -1,4 +1,5 @@
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -O2 } } }
 // { dg-extra-ld-options "-r -nostdlib -flto -flto-partition=none -O2" }
 namespace xercesc_3_1 {
--- gcc/testsuite/gfortran.dg/lto/pr79108_0.f90.jj	2018-09-21 19:07:12.649985507 +0200
+++ gcc/testsuite/gfortran.dg/lto/pr79108_0.f90	2018-12-10 15:43:49.724637597 +0100
@@ -1,4 +1,5 @@
 ! { dg-lto-do link }
+! { dg-require-effective-target lto_incremental }
 ! { dg-lto-options {{ -Ofast -flto --param ggc-min-expand=0 --param ggc-min-heapsize=0 }} }
 ! { dg-extra-ld-options "-r" }
 


	Jakub
Rainer Orth Dec. 11, 2018, 9:41 a.m. | #4
Hi Jakub,

> On Tue, Dec 11, 2018 at 08:52:12AM +0100, Rainer Orth wrote:

>> Hi Jakub,

>> 

>> > As mentioned in the PR, older binutils (like 2.25) complain on these tests

>> > when using -r that:

>> > plugin needed to handle lto object

>> > The following patch introduces an effective target and guards those tests on

>> > a linker with this issue fixed.

>> >

>> > Regtested on x86_64-linux and i686-linux, plus regtested on x86_64-linux

>> > with 2.25 binutils, where the patch converts all those FAILs into

>> > UNSUPPORTEDs.

>> >

>> > Ok for trunk?

>> 

>> please document the new effective-target keyword in sourcebuild.texi.

>

> So like this?


ok, thanks.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Patch

--- gcc/testsuite/lib/target-supports.exp.jj	2018-12-04 20:40:01.491379395 +0100
+++ gcc/testsuite/lib/target-supports.exp	2018-12-10 15:39:37.714763670 +0100
@@ -8014,6 +8014,18 @@  proc check_effective_target_lto { } {
     } "-flto"]
 }
 
+# Return 1 if the compiler and linker support incremental link-time
+# optimization.
+
+proc check_effective_target_lto_incremental { } {
+    if ![check_effective_target_lto] {
+	return 0
+    }
+    return [check_no_compiler_messages lto_incremental executable {
+	int main () { return 0; }
+    } "-flto -r -nostdlib"]
+}
+
 # Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
 
 proc check_effective_target_maybe_x32 { } {
--- gcc/testsuite/g++.dg/lto/pr69137_0.C.jj	2016-01-15 20:37:28.533589631 +0100
+++ gcc/testsuite/g++.dg/lto/pr69137_0.C	2018-12-10 15:42:38.355806095 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -std=c++11 -g -flto } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr65316_0.C.jj	2017-11-06 17:24:08.773286226 +0100
+++ gcc/testsuite/g++.dg/lto/pr65316_0.C	2018-12-10 15:41:01.092398551 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -std=c++11 -g2 -fno-lto-odr-type-merging -O2 -Wno-return-type } } }
 // { dg-extra-ld-options "-r -nostdlib -O2 -fno-lto-odr-type-merging" }
 
--- gcc/testsuite/g++.dg/lto/pr85176_0.C.jj	2018-04-04 16:13:42.972551086 +0200
+++ gcc/testsuite/g++.dg/lto/pr85176_0.C	2018-12-10 15:43:20.838110547 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -g1 } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 namespace a {
--- gcc/testsuite/g++.dg/lto/pr79000_0.C.jj	2017-01-09 11:35:04.310821717 +0100
+++ gcc/testsuite/g++.dg/lto/pr79000_0.C	2018-12-10 15:42:54.657539190 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { "-flto -g" } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr66180_0.C.jj	2015-05-29 15:04:33.064803028 +0200
+++ gcc/testsuite/g++.dg/lto/pr66180_0.C	2018-12-10 15:41:39.730765940 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -std=c++14 -r -nostdlib } } }
 #include <memory>
 namespace {
--- gcc/testsuite/g++.dg/lto/pr65193_0.C.jj	2017-11-06 17:24:08.774286214 +0100
+++ gcc/testsuite/g++.dg/lto/pr65193_0.C	2018-12-10 15:40:23.564012993 +0100
@@ -1,5 +1,6 @@ 
 /* { dg-lto-do link } */
 /* { dg-require-effective-target fpic } */
+/* { dg-require-effective-target lto_incremental } */
 /* { dg-lto-options {{-fPIC -r -nostdlib -flto -O2 -g -Wno-return-type}} } */
 
 void frexp (int, int *);
--- gcc/testsuite/g++.dg/lto/pr69077_0.C.jj	2017-11-06 17:24:08.770286263 +0100
+++ gcc/testsuite/g++.dg/lto/pr69077_0.C	2018-12-10 15:42:19.886108489 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -O3 -g -flto } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr68057_0.C.jj	2015-11-09 13:39:21.418394784 +0100
+++ gcc/testsuite/g++.dg/lto/pr68057_0.C	2018-12-10 15:42:08.058302145 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 /* { dg-extra-ld-options { -O2 -Wno-odr -r -nostdlib } } */
 struct SPxPricer;
 struct SoPlex {
--- gcc/testsuite/g++.dg/lto/pr66705_0.C.jj	2015-09-03 17:18:33.224711564 +0200
+++ gcc/testsuite/g++.dg/lto/pr66705_0.C	2018-12-10 15:41:53.763536188 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -O2 -flto -flto-partition=max -fipa-pta } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr65302_0.C.jj	2017-11-06 17:24:08.770286263 +0100
+++ gcc/testsuite/g++.dg/lto/pr65302_0.C	2018-12-10 15:40:53.705519502 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -O2 -Wno-return-type } } }
 // { dg-extra-ld-options "-r -nostdlib -O0" }
 
--- gcc/testsuite/g++.dg/lto/20091002-1_0.C.jj	2017-11-06 17:24:08.768286288 +0100
+++ gcc/testsuite/g++.dg/lto/20091002-1_0.C	2018-12-10 15:40:03.968333822 +0100
@@ -1,5 +1,6 @@ 
 // { dg-lto-do link }
 // { dg-require-effective-target fpic }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options {{-fPIC -flto -Wno-return-type}} }
 // { dg-extra-ld-options "-fPIC -r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr81940_0.C.jj	2017-09-01 09:26:20.822938902 +0200
+++ gcc/testsuite/g++.dg/lto/pr81940_0.C	2018-12-10 15:43:07.350331378 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -O -flto } } }
 // { dg-extra-ld-options "-r -nostdlib -g" }
 
--- gcc/testsuite/g++.dg/lto/pr64043_0.C.jj	2014-12-15 10:36:23.853604377 +0100
+++ gcc/testsuite/g++.dg/lto/pr64043_0.C	2018-12-10 15:26:51.800299063 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -std=c++11 } } }
 // { dg-extra-ld-options "-r -nostdlib -O2" }
 class Validator
--- gcc/testsuite/g++.dg/lto/pr65549_0.C.jj	2017-11-06 17:24:08.773286226 +0100
+++ gcc/testsuite/g++.dg/lto/pr65549_0.C	2018-12-10 15:41:26.456983265 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -std=gnu++14 -flto -g -Wno-return-type } { -std=gnu++14 -flto -g -O2 -fno-inline -flto-partition=max -Wno-return-type } } }
 // { dg-extra-ld-options "-r -nostdlib" }
 
--- gcc/testsuite/g++.dg/lto/pr69133_0.C.jj	2016-01-19 13:31:07.638760602 +0100
+++ gcc/testsuite/g++.dg/lto/pr69133_0.C	2018-12-10 15:42:30.451935499 +0100
@@ -1,4 +1,5 @@ 
 // { dg-lto-do link }
+// { dg-require-effective-target lto_incremental }
 // { dg-lto-options { { -flto -O2 } } }
 // { dg-extra-ld-options "-r -nostdlib -flto -flto-partition=none -O2" }
 namespace xercesc_3_1 {
--- gcc/testsuite/gfortran.dg/lto/pr79108_0.f90.jj	2018-09-21 19:07:12.649985507 +0200
+++ gcc/testsuite/gfortran.dg/lto/pr79108_0.f90	2018-12-10 15:43:49.724637597 +0100
@@ -1,4 +1,5 @@ 
 ! { dg-lto-do link }
+! { dg-require-effective-target lto_incremental }
 ! { dg-lto-options {{ -Ofast -flto --param ggc-min-expand=0 --param ggc-min-heapsize=0 }} }
 ! { dg-extra-ld-options "-r" }