This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] Fix ld-cdtest if CFLAGS contains -fexceptions (take 2)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 16 Aug 2005 14:25:46 +0200
- Subject: [PATCH] Fix ld-cdtest if CFLAGS contains -fexceptions (take 2)
- References: <20050721084250.GB15708@sunsite.mff.cuni.cz> <42EA41E0.8020400@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Jul 29, 2005 at 03:49:04PM +0100, Nick Clifton wrote:
> >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.
>
> Surely this is the wrong solution. Surely ld_compile ought to prepend
> $CFLAGS rather than append it, so that the individual linker tests can
> override command line switches like -fexceptions.
>
> ie if the cdtest.exp wants to use -fno-exceptions then it should be
> allowed to and we should not be trying to work around this by restoring
> the exception handling library to the linker command line.
Is the following better?
Alternatively, we could add a separate argument to ld_compile (guess
in between cc and source) that would contain the flags, so callers could
decide which options they want to prepend to $CFLAGS and which to append.
2005-08-16 Jakub Jelinek <jakub@redhat.com>
* lib/ld-lib.exp (default_ld_compile): Append $cc arguments after
$CFLAGS instead of prepending them.
--- ld/testsuite/lib/ld-lib.exp.jj 2005-08-16 11:21:50.000000000 +0200
+++ ld/testsuite/lib/ld-lib.exp 2005-08-16 14:18:11.000000000 +0200
@@ -226,8 +226,11 @@ proc default_ld_compile { cc source obje
# based on the name of the compiler.
set ccexe $cc
set ccparm [string first " " $cc]
+ set ccflags ""
if { $ccparm > 0 } then {
+ set ccflags [string range $cc $ccparm end]
set ccexe [string range $cc 0 $ccparm]
+ set cc $ccexe
}
set ccexe [string replace $ccexe 0 [string last "/" $ccexe] ""]
if {[string match "*gcc*" $ccexe] || [string match "*++*" $ccexe]} then {
@@ -238,9 +241,9 @@ proc default_ld_compile { cc source obje
append flags " [board_info [target_info name] multilib_flags]"
}
- verbose -log "$cc $flags -c $source -o $object"
+ verbose -log "$cc $flags $ccflags -c $source -o $object"
- catch "exec $cc $flags -c $source -o $object" exec_output
+ catch "exec $cc $flags $ccflags -c $source -o $object" exec_output
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
if {![file exists $object]} then {
Jakub