This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix ld-cdtest if CFLAGS contains -fexceptions


Hi!

We compile most of the packages with -fexceptions these days,
but this breaks ld-cdtest.  Although it adds -fno-exceptions to cc
in ld_compile, ld_compile then appends $CFLAGS and therefore -fexceptions
comes after -fno-exceptions and wins.
The following patch fixes that by adding full path of libsupc++.a to the
command line if it exists.
Is this something acceptable for CVS?

2005-07-21  Jakub Jelinek  <jakub@redhat.com>

	* ld-cdtest/cdtest.exp (libsupcxx): Set to the full path of libsupc++.a
	if needed.  Use it in ld_link lines.

--- ld/testsuite/ld-cdtest/cdtest.exp.jj	2005-05-13 23:44:38.000000000 +0200
+++ ld/testsuite/ld-cdtest/cdtest.exp	2005-07-21 10:06:07.000000000 +0200
@@ -1,5 +1,5 @@
 # Expect script for LD cdtest Tests
-#   Copyright 1993, 1994, 1995, 1997, 2001, 2004
+#   Copyright 1993, 1994, 1995, 1997, 2001, 2004, 2005
 #   Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
@@ -36,6 +36,12 @@ if { [which $CXX] == 0 } {
     return
 }
 
+set libsupcxx_ret [catch "exec $CXX $CXXFLAGS -print-file-name=libsupc++.a" libsupcxx]
+if {   $libsupcxx_ret != 0
+    || [string match "libsupc\+\+.a" $libsupcxx] } {
+    set libsupcxx ""
+}
+
 if {   ![ld_compile "$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-foo.cc tmpdir/cdtest-foo.o]
     || ![ld_compile "$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-bar.cc tmpdir/cdtest-bar.o]
     || ![ld_compile "$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/cdtest-main.cc tmpdir/cdtest-main.o] } {
@@ -46,7 +52,7 @@ if {   ![ld_compile "$CXX $CXXFLAGS -fno
 
 set expected_output "$srcdir/$subdir/cdtest.dat"
 
-if ![ld_link $ld tmpdir/cdtest {tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] {
+if ![ld_link $ld tmpdir/cdtest "tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o $libsupcxx"] {
     fail $test1
 } else {
     send_log   "tmpdir/cdtest >tmpdir/cdtest.out\n"
@@ -93,7 +99,7 @@ if ![ld_link $ld tmpdir/cdtest {tmpdir/c
 if ![ld_relocate $ld tmpdir/cdtest.o {-Ur tmpdir/cdtest-foo.o tmpdir/cdtest-bar.o tmpdir/cdtest-main.o}] {
     fail $test2
 } else {
-    if ![ld_link $ld tmpdir/cdtest tmpdir/cdtest.o] {
+    if ![ld_link $ld tmpdir/cdtest "tmpdir/cdtest.o $libsupcxx"] {
 	fail $test2
     } else {
 	send_log   "tmpdir/cdtest >tmpdir/cdtest.out\n"

	Jakub


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