public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][RFH] Add dg-requires-linker-plugin support
@ 2010-07-15 13:38 Richard Guenther
  2010-07-21 18:49 ` Richard Guenther
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2010-07-15 13:38 UTC (permalink / raw)
  To: GCC Patches, Janis Johnson, Diego Novillo

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

This adds a check for working linker-plugin support to the testsuite.
It's includes a hack
to add a -B to find the lto plugin in a built tree (Janis, is there
some variable available
that specifies the root of the build tree?  For installed testing not
specifying the -B should
be ok).  Should/can the dg-require-linker-plugin automatically add to
ld-additional-options
(still allowing that to append others?).

Thus, not "ok?", but - any help here?

It works in a built tree with linker plugin support and it properly
makes the test
unsupported if I mess up the -B argument (thus it should also work in a tree
w/o linker plugin support).

Thanks,
Richard.

2010-07-15  Richard Guenther  <rguenther@suse.de>

        * lib/lto.exp (lto-link-and-maybe-run): Append path to find
        the linker plugin.
        * lib/target-supports-dg.exp (dg-require-linker-plugin): New proc.
        * lib/target-supports.exp (check_linker_plugin_available): Likewise.

        * gcc.dg/lto/20100715-1_0.c: New testcase.
        * gcc.dg/lto/20100715-1_1.c: Likewise.

[-- Attachment #2: lto-linker-plugin-testsuite --]
[-- Type: application/octet-stream, Size: 3240 bytes --]

2010-07-15  Richard Guenther  <rguenther@suse.de>

	* lib/lto.exp (lto-link-and-maybe-run): Append path to find
	the linker plugin.
	* lib/target-supports-dg.exp (dg-require-linker-plugin): New proc.
	* lib/target-supports.exp (check_linker_plugin_available): Likewise.

	* gcc.dg/lto/20100715-1_0.c: New testcase.
	* gcc.dg/lto/20100715-1_1.c: Likewise.

Index: gcc/testsuite/lib/lto.exp
===================================================================
*** gcc/testsuite/lib/lto.exp	(revision 162215)
--- gcc/testsuite/lib/lto.exp	(working copy)
*************** proc lto-link-and-maybe-run { testname o
*** 175,180 ****
--- 175,181 ----
  
      # Set up the options for linking this test.
      set options ""
+     lappend optall "-B../../../lto-plugin/.libs"
      lappend options "additional_flags=$optall $optfile"
  
      # Link the objects into an executable.
Index: gcc/testsuite/lib/target-supports-dg.exp
===================================================================
*** gcc/testsuite/lib/target-supports-dg.exp	(revision 162215)
--- gcc/testsuite/lib/target-supports-dg.exp	(working copy)
*************** proc dg-require-host-local { args } {
*** 207,212 ****
--- 207,220 ----
      }
  }
  
+ proc dg-require-linker-plugin { args } {
+     set linker_plugin_available [ check_linker_plugin_available ]
+     if { $linker_plugin_available == 0 } {
+ 	upvar dg-do-what dg-do-what
+ 	set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+     }
+ }
+ 
  # Add any target-specific flags needed for accessing the given list
  # of features.  This must come after all dg-options.
  
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
*** gcc/testsuite/lib/target-supports.exp	(revision 162215)
--- gcc/testsuite/lib/target-supports.exp	(working copy)
*************** proc check_effective_target_static_libgf
*** 886,891 ****
--- 886,897 ----
      } "-static"]
  }
  
+ proc check_linker_plugin_available { } {
+   return [check_no_compiler_messages_nocache linker_plugin executable {
+      int main() { return 0; }
+   } "-flto -fuse-linker-plugin -B../../../lto-plugin/.libs"]
+ }
+ 
  # Return 1 if the target supports executing 750CL paired-single instructions, 0
  # otherwise.  Cache the result.
  
Index: gcc/testsuite/gcc.dg/lto/20100715-1_0.c
===================================================================
*** gcc/testsuite/gcc.dg/lto/20100715-1_0.c	(revision 0)
--- gcc/testsuite/gcc.dg/lto/20100715-1_0.c	(revision 0)
***************
*** 0 ****
--- 1,15 ----
+ /* { dg-lto-do run } */
+ /* { dg-require-linker-plugin "" } */
+ /* { dg-extra-ld-options "-fuse-linker-plugin" } */
+ 
+ __attribute__ ((visibility("hidden"))) int a;
+ void abort (void);
+ extern int b(void);
+ main()
+ {
+   b();
+   if (a!=3)
+     abort ();
+   return 0;
+ }
+ 
Index: gcc/testsuite/gcc.dg/lto/20100715-1_1.c
===================================================================
*** gcc/testsuite/gcc.dg/lto/20100715-1_1.c	(revision 0)
--- gcc/testsuite/gcc.dg/lto/20100715-1_1.c	(revision 0)
***************
*** 0 ****
--- 1,7 ----
+ /* { dg-options "-fno-lto -fno-whopr" } */
+ 
+ __attribute__ ((visibility("hidden"))) int a;
+ int b(void)
+ {
+   a=3;
+ }

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-22 12:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-15 13:38 [PATCH][RFH] Add dg-requires-linker-plugin support Richard Guenther
2010-07-21 18:49 ` Richard Guenther
2010-07-21 19:32   ` Ralf Wildenhues
2010-07-22 11:37     ` Richard Guenther
2010-07-22 12:04       ` Diego Novillo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).