This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Tweak to testsuite/gcc.dg/special/ecos.exp


Jeffrey A Law wrote:
> 
>   In message <37569E6C.646EBDAD@cygnus.co.uk>you write:
>   >         * gcc.dg/special/ecos.exp: Use -Wl,-static when testing
>   > --gc-sections
> -Wl,-static is not portable.
> 
> gcc -static would be better, but is still not 100% portable because it's
> handled
> by the target specific specs, not by any generic code.
> 
> One possibility would be to use gcc -static for native systems only since
> the vast majority of the ones we care about these days have shared
> libraries and support the -static option to force static linking.
> 
> Even that isn't 100% safe.  Consider systems where static linking doesn't
> actually work because the static libs reference functions/data which are
> never defined anywhere (HP & Sun have been notorious for this).  But I can
> live with this problem :-)

If you are prepared to live with that then here's the replacement patch.
IMHO it would be a genuine failure - if it's not possible to link
statically, then gc-sections isn't going to work. When we know exactly what
these targets are, this test should be an XFAIL on those.

Ta,

Jifl

1999-06-04  Jonathan Larmour  <jlarmour@cygnus.co.uk>

        * gcc.dg/special/ecos.exp: Use -static when testing --gc-sections
	on native targets

-- 
Cygnus Solutions, 35 Cambridge Place, Cambridge, UK.  Tel: +44 (1223) 728762
"I used to have an open mind but || Get yer free open source RTOS's here...
 my brains kept falling out."    || http://sourceware.cygnus.com/ecos
Help fight spam! http://spam.abuse.net/  These opinions are all my own fault
Index: gcc/testsuite/gcc.dg/special/ecos.exp
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/testsuite/gcc.dg/special/ecos.exp,v
retrieving revision 1.1
diff -u -5 -p -r1.1 ecos.exp
--- gcc/testsuite/gcc.dg/special/ecos.exp	1999/02/10 16:00:06	1.1
+++ gcc/testsuite/gcc.dg/special/ecos.exp	1999/06/04 16:21:03
@@ -200,14 +200,21 @@ if { [ check_weak_available ] == 1 } {
 # gcsec-1.c
 ###########
 
 set ld_output [ exec [ find_ld ] --help ]
 
+global host_triplet
+global target_triplet
+
 if { [ string first "--gc-sections" $ld_output ] >= 0 } {
 
     dg-init
-    dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections" ""
+    if { $host_triplet == $target_triplet } {
+      dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections -static" ""
+    } else {
+      dg-runtest "$srcdir/$subdir/gcsec-1.c" "-ffunction-sections -fdata-sections -Wl,--gc-sections" ""
+    }
     dg-finish
 } else {
     unsupported "gcsec-1.c"
 }
 

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]