This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Re: more plugin testsuite issues
- From: Dave Korn <dave dot korn dot cygwin at gmail dot com>
- To: "binutils at sourceware dot org" <binutils at sourceware dot org>
- Date: Thu, 04 Nov 2010 20:11:32 +0000
- Subject: [PATCH] Re: more plugin testsuite issues
- References: <20101026045431.GB5348@bubble.grove.modra.org> <4CC70CDB.9060202@gmail.com> <20101028081642.GK31277@bubble.grove.modra.org> <4CD2E0C1.2060304@gmail.com>
On 04/11/2010 16:35, Dave Korn wrote:
> Ah, hang on, I just discovered ld_simple_link_defsyms. If I use that, is it
> meant to guarantee I have enough symbols defined to link an object file
> without needing any crt startup objects or libraries? Maybe all I need do is
> add "__main" to the list there, and not use any (particularly $HOSTING) libs
> or crt0 at all in this test. Does that sound right?
This looks better to me. Tested natively on i686-pc-cygwin and
i686-pc-linux-gnu, and cross from i686-pc-cygwin to i686-pc-mingw32.
ld/testsuite/ChangeLog:
* ld-plugin/plugin.exp (testobjfiles): Dont use HOSTING_CRT0.
(testobjfiles_notext): Likewise.
(libs): Don't use HOSTING_LIBS; fill with default symbol defs instead.
* lib/ld-lib.exp (ld_simple_link_defsyms): Add cygming clause.
What do you think? OK for head?
cheers,
DaveK
Index: ld/testsuite/ld-plugin/plugin.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-plugin/plugin.exp,v
retrieving revision 1.4
diff -p -u -r1.4 plugin.exp
--- ld/testsuite/ld-plugin/plugin.exp 28 Oct 2010 08:16:34 -0000 1.4
+++ ld/testsuite/ld-plugin/plugin.exp 4 Nov 2010 19:42:18 -0000
@@ -53,10 +53,6 @@ set lt_objdir [regsub "objdir=" "$lt_obj
set plugin_path "$base_dir/$lt_objdir/$plugin_name"
verbose "Full plugin path $plugin_path" 2
-set testobjfiles "$HOSTING_CRT0 tmpdir/main.o tmpdir/func.o tmpdir/text.o"
-set testobjfiles_notext "$HOSTING_CRT0 tmpdir/main.o tmpdir/func.o"
-set libs "$HOSTING_LIBS"
-
set regclm "-plugin-opt registerclaimfile"
set regas "-plugin-opt registerallsymbolsread"
set regcln "-plugin-opt registercleanup"
@@ -87,6 +83,12 @@ if { $can_compile && !$failed_compile }
}
}
+set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o"
+set testobjfiles_notext "tmpdir/main.o tmpdir/func.o"
+# Rather than having libs we just define dummy values for anything
+# we may need to link a target exe; we aren't going to run it anyway.
+set libs "[ld_simple_link_defsyms] --defsym ${_}printf=0 --defsym ${_}puts=0"
+
set plugin_tests [list \
[list "load plugin" "-plugin $plugin_path \
$testobjfiles $libs" "" "" {{ld plugin-1.d}} "main.x" ] \
Index: ld/testsuite/lib/ld-lib.exp
===================================================================
RCS file: /cvs/src/src/ld/testsuite/lib/ld-lib.exp,v
retrieving revision 1.75
diff -p -u -r1.75 ld-lib.exp
--- ld/testsuite/lib/ld-lib.exp 14 Oct 2010 01:31:33 -0000 1.75
+++ ld/testsuite/lib/ld-lib.exp 4 Nov 2010 19:42:19 -0000
@@ -369,6 +369,11 @@ proc ld_simple_link_defsyms {} {
append flags " --defsym __gccmain=0"
}
+ # Windows targets need __main, prefixed with underscore.
+ if {[istarget *-*-cygwin* ] || [istarget *-*-mingw*]} {
+ append flags " --defsym ___main=0"
+ }
+
# PowerPC EABI code calls __eabi.
if {[istarget powerpc*-*-eabi*] || [istarget powerpc*-*-rtems*]} {
append flags " --defsym __eabi=0"