* [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
* Re: [PATCH][RFH] Add dg-requires-linker-plugin support
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
0 siblings, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2010-07-21 18:49 UTC (permalink / raw)
To: GCC Patches, Janis Johnson, Diego Novillo, Ralf Wildenhues
On Thu, Jul 15, 2010 at 3:38 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> 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).
Another way would be to copy lto-plugin.so to gcc/, similar to how we
do for libgcc_s.so. But I am quite lost on how to do that with the current
lto-plugin makefiles (not to mention the dependency issue if we want to
make use of this during LTO bootstrap as well).
Ralf - do you have an idea where to hook the copying with automake?
Thanks,
Richard.
> 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.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RFH] Add dg-requires-linker-plugin support
2010-07-21 18:49 ` Richard Guenther
@ 2010-07-21 19:32 ` Ralf Wildenhues
2010-07-22 11:37 ` Richard Guenther
0 siblings, 1 reply; 5+ messages in thread
From: Ralf Wildenhues @ 2010-07-21 19:32 UTC (permalink / raw)
To: Richard Guenther; +Cc: GCC Patches, Janis Johnson, Diego Novillo
Hello,
* Richard Guenther wrote on Wed, Jul 21, 2010 at 08:48:52PM CEST:
> > 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).
>
> Another way would be to copy lto-plugin.so to gcc/, similar to how we
> do for libgcc_s.so. But I am quite lost on how to do that with the current
> lto-plugin makefiles (not to mention the dependency issue if we want to
> make use of this during LTO bootstrap as well).
>
> Ralf - do you have an idea where to hook the copying with automake?
I don't yet understand from the above description, what depends on what,
and at what time do you need what to be done? In an LTO bootstrap, when
is lto-plugin needed, and by who?
I can give some general hints, but I guess that won't help you too much:
if you need to have some action be done before the usual targets built
by "make all", then list them in BUILT_SOURCES; to add generic targets
to be built sometime during "make all", just make them prerequisites of
the "all-local" target.
The early copyback of libgcc is done within libgcc/Makefile (search for
"Early copyback"). The part missing in lto-plugin is the extension of
the shared object and $(LT_OBJDIR). I assume GCC already has a variable
for the former? Otherwise, you can set module=yes and eval $shrext_cmds
after AC_PROG_LIBTOOL; that won't give you the right name on all systems
yet but I think on all which LTO currently supports.
The other thing that probably needs adjusting is toplevel Makefile.defs
dependencies line so that *all-lto-plugin is run before anything that
needs it.
I haven't been looking at GCC for a little while now, sorry.
Cheers,
Ralf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RFH] Add dg-requires-linker-plugin support
2010-07-21 19:32 ` Ralf Wildenhues
@ 2010-07-22 11:37 ` Richard Guenther
2010-07-22 12:04 ` Diego Novillo
0 siblings, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2010-07-22 11:37 UTC (permalink / raw)
To: Ralf Wildenhues, Richard Guenther, GCC Patches, Janis Johnson,
Diego Novillo
[-- Attachment #1: Type: text/plain, Size: 2923 bytes --]
On Wed, Jul 21, 2010 at 9:32 PM, Ralf Wildenhues <Ralf.Wildenhues@gmx.de> wrote:
> Hello,
>
> * Richard Guenther wrote on Wed, Jul 21, 2010 at 08:48:52PM CEST:
>> > 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).
>>
>> Another way would be to copy lto-plugin.so to gcc/, similar to how we
>> do for libgcc_s.so. But I am quite lost on how to do that with the current
>> lto-plugin makefiles (not to mention the dependency issue if we want to
>> make use of this during LTO bootstrap as well).
>>
>> Ralf - do you have an idea where to hook the copying with automake?
>
> I don't yet understand from the above description, what depends on what,
> and at what time do you need what to be done? In an LTO bootstrap, when
> is lto-plugin needed, and by who?
>
> I can give some general hints, but I guess that won't help you too much:
> if you need to have some action be done before the usual targets built
> by "make all", then list them in BUILT_SOURCES; to add generic targets
> to be built sometime during "make all", just make them prerequisites of
> the "all-local" target.
>
> The early copyback of libgcc is done within libgcc/Makefile (search for
> "Early copyback"). The part missing in lto-plugin is the extension of
> the shared object and $(LT_OBJDIR). I assume GCC already has a variable
> for the former? Otherwise, you can set module=yes and eval $shrext_cmds
> after AC_PROG_LIBTOOL; that won't give you the right name on all systems
> yet but I think on all which LTO currently supports.
>
> The other thing that probably needs adjusting is toplevel Makefile.defs
> dependencies line so that *all-lto-plugin is run before anything that
> needs it.
>
> I haven't been looking at GCC for a little while now, sorry.
Ok, I think I have found my way through it and came up with the
following simple solution that works for me (the testsuite changes
work and for LTO bootstrap adding -B /../prev-lto-plugin/.libs to
BOOT_CFLAGS is no longer necessary.
Thus - ok for mainline?
Thanks,
Richard.
2010-07-22 Richard Guenther <rguenther@suse.de>
lto-plugin/
* Makefile.am: New copy_lto_plugin rule to install the plugin
into ../gcc.
* Makefile.in: Regenerated.
[-- Attachment #2: p3 --]
[-- Type: application/octet-stream, Size: 1441 bytes --]
2010-07-22 Richard Guenther <rguenther@suse.de>
lto-plugin/
* Makefile.am: New copy_lto_plugin rule to install the plugin
into ../gcc.
* Makefile.in: Regenerated.
Index: lto-plugin/Makefile.am
===================================================================
*** lto-plugin/Makefile.am (revision 162404)
--- lto-plugin/Makefile.am (working copy)
*************** libexecsub_LTLIBRARIES = liblto_plugin.l
*** 18,20 ****
--- 18,26 ----
liblto_plugin_la_SOURCES = lto-plugin.c
liblto_plugin_la_LIBADD = $(LIBELFLIBS) ../libiberty/pic/libiberty.a
+
+ all: copy_lto_plugin
+
+ copy_lto_plugin: all-am
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $(libexecsub_LTLIBRARIES) `pwd`/../gcc/
+
Index: lto-plugin/Makefile.in
===================================================================
*** lto-plugin/Makefile.in (revision 162404)
--- lto-plugin/Makefile.in (working copy)
*************** uninstall-am: uninstall-libexecsubLTLIBR
*** 495,500 ****
--- 495,505 ----
tags uninstall uninstall-am uninstall-libexecsubLTLIBRARIES
+ all: copy_lto_plugin
+
+ copy_lto_plugin: all-am
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $(libexecsub_LTLIBRARIES) `pwd`/../gcc/
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH][RFH] Add dg-requires-linker-plugin support
2010-07-22 11:37 ` Richard Guenther
@ 2010-07-22 12:04 ` Diego Novillo
0 siblings, 0 replies; 5+ messages in thread
From: Diego Novillo @ 2010-07-22 12:04 UTC (permalink / raw)
To: Richard Guenther; +Cc: Ralf Wildenhues, GCC Patches, Janis Johnson
On Thu, Jul 22, 2010 at 07:37, Richard Guenther
<richard.guenther@gmail.com> wrote:
> 2010-07-22 Richard Guenther <rguenther@suse.de>
>
> lto-plugin/
> * Makefile.am: New copy_lto_plugin rule to install the plugin
> into ../gcc.
> * Makefile.in: Regenerated.
OK.
Diego.
^ 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).