18 |
# Please email any bugs, comments, and/or additions to this file to: |
# Please email any bugs, comments, and/or additions to this file to: |
19 |
# bug-dejagnu@prep.ai.mit.edu |
# bug-dejagnu@prep.ai.mit.edu |
20 |
|
|
21 |
# This file was written by Rob Savoye. (rob@cygnus.com) |
# This file was written by Rob Savoye. (rob@cygnus.com) (now rob@welcomehome.org) |
22 |
|
|
23 |
# this contains a list of gcc options and their respective directories. |
# this contains a list of gcc options and their respective directories. |
24 |
|
|
424 |
break; |
break; |
425 |
} |
} |
426 |
} |
} |
427 |
set mopts "" |
|
428 |
if { [llength $args] > 0 } { |
regexp "/.* " $compiler compiler |
429 |
set mopts [lindex $args 0]; |
set compiler [string trimright $compiler " "] |
430 |
|
verbose "compiler is $compiler" |
431 |
|
|
432 |
|
if { [which $compiler] == 0 } { |
433 |
|
return ""; |
434 |
|
} |
435 |
|
|
436 |
|
if { [board_info $target_board exists multilib_flags] } { |
437 |
|
set mopts [board_info $target_board multilib_flags]; |
438 |
} else { |
} else { |
439 |
if { [board_info $target_board exists multilib_flags] } { |
set mopts "" |
440 |
set mopts [board_info $target_board multilib_flags]; |
} |
441 |
} else { |
|
442 |
set mopts "" |
set default_multilib [exec $compiler --print-multi-lib] |
443 |
|
set default_multilib [lindex $default_multilib 0]; |
444 |
|
set extra [string trimleft $default_multilib ".;@@"] |
445 |
|
|
446 |
|
# extract the options and their directory names as know by gcc |
447 |
|
foreach i "[exec $compiler --print-multi-lib]" { |
448 |
|
if {$extra != ""} { |
449 |
|
# string trimright would do the wrong thing if we included |
450 |
|
# the leading @@ in $extra |
451 |
|
set i [string trimright $i $extra] |
452 |
|
set i [string trimright $i "@@"] |
453 |
|
} |
454 |
|
set opts "" |
455 |
|
set dir "" |
456 |
|
regexp -- "\[a-z0-9=/\.-\]*;" $i dir |
457 |
|
set dir [string trimright $dir "\;@"] |
458 |
|
regexp -- "\;@*\[\@a-zA-Z0-9=/\.-\]*" $i opts |
459 |
|
set opts [split [string trimleft $opts "\;@@"] "@@"] |
460 |
|
lappend multilibs "$dir {$opts }" |
461 |
|
|
462 |
|
# If args contains arguments don't use the first one as |
463 |
|
# multilib option unless it qualifies as a multilib option. |
464 |
|
if { [llength $args] > 0 } { |
465 |
|
set override_opt [lindex $args 0] |
466 |
|
foreach j $opts { |
467 |
|
if {$j == $override_opt} { |
468 |
|
set mopts $override_opt |
469 |
|
} |
470 |
|
} |
471 |
} |
} |
472 |
} |
} |
473 |
|
|
480 |
} |
} |
481 |
} |
} |
482 |
|
|
|
regexp "/.* " $compiler compiler |
|
|
set compiler [string trimright $compiler " "] |
|
|
verbose "compiler is $compiler" |
|
|
|
|
|
if { [which $compiler] == 0 } { |
|
|
return ""; |
|
|
} |
|
|
|
|
483 |
if ![info exists comp_base_dir] { |
if ![info exists comp_base_dir] { |
484 |
set comp_base_dir [file dirname [file dirname [file dirname [file dirname [file dirname [exec $compiler --print-prog-name=cc1]]]]]]; |
set comp_base_dir [file dirname [file dirname [file dirname [file dirname [file dirname [exec $compiler --print-prog-name=cc1]]]]]]; |
485 |
} |
} |
508 |
return "$multitop/$gccpath"; |
return "$multitop/$gccpath"; |
509 |
} |
} |
510 |
|
|
|
# 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 }" |
|
|
} |
|
|
|
|
511 |
# extract the MULTILIB_MATCHES from dumpspecs |
# extract the MULTILIB_MATCHES from dumpspecs |
512 |
set multimatches "" |
set multimatches "" |
513 |
set lines [split [exec $compiler -dumpspecs] "\n"] |
set lines [split [exec $compiler -dumpspecs] "\n"] |
821 |
|
|
822 |
proc build_wrapper { gluefile } { |
proc build_wrapper { gluefile } { |
823 |
global libdir |
global libdir |
824 |
|
global tool |
825 |
|
|
826 |
if [target_info exists wrap_m68k_aout] { |
if [target_info exists wrap_m68k_aout] { |
827 |
set flags "additional_flags=-DWRAP_M68K_AOUT"; |
set flags "additional_flags=-DWRAP_M68K_AOUT"; |
833 |
set flags ""; |
set flags ""; |
834 |
if [target_info exists is_vxworks] { |
if [target_info exists is_vxworks] { |
835 |
set flags "additional_flags=-DVXWORKS"; |
set flags "additional_flags=-DVXWORKS"; |
836 |
|
set result "-Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort"; |
837 |
|
} else { |
838 |
|
set result "-Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort"; |
839 |
} |
} |
|
set result "-Wl,-wrap,exit -Wl,-wrap,main -Wl,-wrap,abort"; |
|
840 |
} |
} |
841 |
if [target_info exists wrap_compile_flags] { |
if [target_info exists wrap_compile_flags] { |
842 |
lappend flags "additional_flags=[target_info wrap_compile_flags]"; |
lappend flags "additional_flags=[target_info wrap_compile_flags]"; |
843 |
} |
} |
844 |
if { [target_compile ${libdir}/testglue.c ${gluefile} object $flags] == "" } { |
if { [target_compile ${libdir}/testglue.c ${gluefile} object $flags] == "" } { |
845 |
set gluefile [remote_download host ${gluefile} testglue.o]; |
set gluefile [remote_download host ${gluefile} ${tool}_tg.o]; |
846 |
return [list $gluefile $result]; |
return [list $gluefile $result]; |
847 |
} else { |
} else { |
848 |
return "" |
return "" |