diff options
author | Rob Savoye <rob@welcomehome.org> | 2002-11-14 18:20:59 +0000 |
---|---|---|
committer | Rob Savoye <rob@welcomehome.org> | 2002-11-14 18:20:59 +0000 |
commit | b32796502b467485e1732e036dc8efd464c2e8bb (patch) | |
tree | b4aa722bdd453cb9dbe1d197bd835da44ba0da47 /lib/libgloss.exp | |
parent | 7323108c4cccc11e8bdb552edab79e6e16e29257 (diff) | |
download | dejagnu-b32796502b467485e1732e036dc8efd464c2e8bb.zip dejagnu-b32796502b467485e1732e036dc8efd464c2e8bb.tar.gz dejagnu-b32796502b467485e1732e036dc8efd464c2e8bb.tar.bz2 |
2002-10-21 Adam Nemet <anemet@lnxw.com>
* libgloss.exp (get_multilibs): Don't use the first argument
passed to this function as the multilib option unless it is in
fact a multilib option.
Diffstat (limited to 'lib/libgloss.exp')
-rw-r--r-- | lib/libgloss.exp | 89 |
1 files changed, 49 insertions, 40 deletions
diff --git a/lib/libgloss.exp b/lib/libgloss.exp index ce6f681..c2957c2 100644 --- a/lib/libgloss.exp +++ b/lib/libgloss.exp @@ -18,7 +18,7 @@ # Please email any bugs, comments, and/or additions to this file to: # bug-dejagnu@prep.ai.mit.edu -# This file was written by Rob Savoye. (rob@cygnus.com) +# This file was written by Rob Savoye. (rob@cygnus.com) (now rob@welcomehome.org) # this contains a list of gcc options and their respective directories. @@ -424,14 +424,50 @@ proc get_multilibs { args } { break; } } - set mopts "" - if { [llength $args] > 0 } { - set mopts [lindex $args 0]; + + regexp "/.* " $compiler compiler + set compiler [string trimright $compiler " "] + verbose "compiler is $compiler" + + if { [which $compiler] == 0 } { + return ""; + } + + if { [board_info $target_board exists multilib_flags] } { + set mopts [board_info $target_board multilib_flags]; } else { - if { [board_info $target_board exists multilib_flags] } { - set mopts [board_info $target_board multilib_flags]; - } else { - set mopts "" + set mopts "" + } + + set default_multilib [exec $compiler --print-multi-lib] + set default_multilib [lindex $default_multilib 0]; + set extra [string trimleft $default_multilib ".;@@"] + + # extract the options and their directory names as know by gcc + foreach i "[exec $compiler --print-multi-lib]" { + if {$extra != ""} { + # string trimright would do the wrong thing if we included + # the leading @@ in $extra + set i [string trimright $i $extra] + set i [string trimright $i "@@"] + } + set opts "" + set dir "" + regexp -- "\[a-z0-9=/\.-\]*;" $i dir + set dir [string trimright $dir "\;@"] + regexp -- "\;@*\[\@a-zA-Z0-9=/\.-\]*" $i opts + set opts [split [string trimleft $opts "\;@@"] "@@"] + lappend multilibs "$dir {$opts }" + + # If args contains arguments don't use the first one as + # multilib option unless it qualifies as a multilib option. + if { [llength $args] > 0 } { + set override_opt [lindex $args 0] + foreach j $opts { + if {$j == $override_opt} { + set mopts $override_opt + } + } } } @@ -444,14 +480,6 @@ proc get_multilibs { args } { } } - regexp "/.* " $compiler compiler - set compiler [string trimright $compiler " "] - verbose "compiler is $compiler" - - if { [which $compiler] == 0 } { - return ""; - } - if ![info exists comp_base_dir] { set comp_base_dir [file dirname [file dirname [file dirname [file dirname [file dirname [exec $compiler --print-prog-name=cc1]]]]]]; } @@ -480,28 +508,6 @@ proc get_multilibs { args } { return "$multitop/$gccpath"; } - # set output [exec $objdump_name --file-headers objfmtst.o ] - set default_multilib [exec $compiler --print-multi-lib] - set default_multilib [lindex $default_multilib 0]; - set extra [string trimleft $default_multilib ".;@@"] - - # extract the options and their directory names as know by gcc - foreach i "[exec $compiler --print-multi-lib]" { - if {$extra != ""} { - # string trimright would do the wrong thing if we included - # the leading @@ in $extra - set i [string trimright $i $extra"] - set i [string trimright $i "@@"] - } - set opts "" - set dir "" - regexp -- "\[a-z0-9=/\.-\]*;" $i dir - set dir [string trimright $dir "\;@"] - regexp -- "\;@*\[\@a-zA-Z0-9=/\.-\]*" $i opts - set opts [split [string trimleft $opts "\;@@"] "@@"] - lappend multilibs "$dir {$opts }" - } - # extract the MULTILIB_MATCHES from dumpspecs set multimatches "" set lines [split [exec $compiler -dumpspecs] "\n"] @@ -815,6 +821,7 @@ proc find_ld { } { proc build_wrapper { gluefile } { global libdir + global tool if [target_info exists wrap_m68k_aout] { set flags "additional_flags=-DWRAP_M68K_AOUT"; @@ -826,14 +833,16 @@ proc build_wrapper { gluefile } { set flags ""; if [target_info exists is_vxworks] { set flags "additional_flags=-DVXWORKS"; + set result "-Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort"; + } else { + set result "-Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort"; } - set result "-Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort"; } if [target_info exists wrap_compile_flags] { lappend flags "additional_flags=[target_info wrap_compile_flags]"; } if { [target_compile ${libdir}/testglue.c ${gluefile} object $flags] == "" } { - set gluefile [remote_download host ${gluefile} testglue.o]; + set gluefile [remote_download host ${gluefile} ${tool}_tg.o]; return [list $gluefile $result]; } else { return "" |