# BASENAME is a basename to use for temporary files.
# TYPE is the type of compilation to perform (see target_compile).
# CONTENTS gives the contents of the input file.
-proc get_compiler_messages {basename type contents} {
+# The rest is optional:
+# OPTIONS: additional compiler options to use.
+proc get_compiler_messages {basename type contents args} {
global tool
+ if { [llength $args] > 0 } {
+ set options "additional_flags=[lindex $args 0]"
+ } else {
+ set options ""
+ }
+
set src ${basename}[pid].c
switch $type {
assembly { set output ${basename}[pid].s }
set f [open $src "w"]
puts $f $contents
close $f
- set lines [${tool}_target_compile $src $output $type ""]
+ set lines [${tool}_target_compile $src $output $type "$options"]
file delete $src
remote_file build delete $output
|| [istarget cris-*-*]
|| [istarget h8300-*-*]
|| [istarget mips*-*-elf]
+ || [istarget xtensa-*-elf]
|| [istarget *-*-windiss] } {
set profiling_available_saved 0
} else {
return $profiling_available_saved
}
+# Return 1 if -fpic and -fPIC are supported, as in no warnings or errors
+# emitted, 0 otherwise. Whether a shared library can actually be built is
+# out of scope for this test.
+#
+# When the target name changes, replace the cached result.
+
+proc check_effective_target_fpic { } {
+ global et_fpic_saved
+ global et_fpic_target_name
+
+ if { ![info exists et_fpic_target_name] } {
+ set et_fpic_target_name ""
+ }
+
+ # If the target has changed since we set the cached value, clear it.
+ set current_target [current_target_name]
+ if { $current_target != $et_fpic_target_name } {
+ verbose "check_effective_target_fpic: `$et_fpic_target_name'" 2
+ set et_fpic_target_name $current_target
+ if [info exists et_fpic_saved] {
+ verbose "check_effective_target_fpic: removing cached result" 2
+ unset et_fpic_saved
+ }
+ }
+
+ if [info exists et_fpic_saved] {
+ verbose "check_effective_target_fpic: using cached result" 2
+ } else {
+ verbose "check_effective_target_fpic: compiling source" 2
+
+ # Note that M68K has a multilib that supports -fpic but not
+ # -fPIC, so we need to check both. We test with a program that
+ # requires GOT references.
+ set et_fpic_saved [string match "" [get_compiler_messages fpic object {
+ extern int foo (void); extern int bar;
+ int baz (void) { return foo () + bar; }
+ } "-fpic"]]
+
+ if { $et_fpic_saved != 0 } {
+ set et_fpic_saved [string match "" [get_compiler_messages fpic object {
+ extern int foo (void); extern int bar;
+ int baz (void) { return foo () + bar; }
+ } "-fPIC"]]
+ }
+ }
+ verbose "check_effective_target_fpic: returning $et_fpic_saved" 2
+ return $et_fpic_saved
+}
+
# Return true if iconv is supported on the target. In particular IBM1047.
proc check_iconv_available { test_what } {
return $et_vect_no_align_saved
}
+# Return 1 if the target supports vector conditional operations, 0 otherwise.
+
+proc check_effective_target_vect_condition { } {
+ global et_vect_cond_saved
+
+ if [info exists et_vect_int_cond] {
+ verbose "check_effective_target_vect_cond: using cached result" 2
+ } else {
+ set et_vect_cond_saved 0
+ if { [istarget powerpc*-*-*]
+ || [istarget ia64-*-*]
+ || [istarget i?86-*-*]
+ || [istarget x86_64-*-*] } {
+ set et_vect_cond_saved 1
+ }
+ }
+
+ verbose "check_effective_target_vect_cond: returning $et_vect_cond_saved" 2
+ return $et_vect_cond_saved
+}
+
+# Return 1 if the target supports vector int multiplication, 0 otherwise.
+
+proc check_effective_target_vect_int_mult { } {
+ global et_vect_int_mult_saved
+
+ if [info exists et_vect_int_mult_saved] {
+ verbose "check_effective_target_vect_int_mult: using cached result" 2
+ } else {
+ set et_vect_int_mult_saved 0
+ if { [istarget powerpc*-*-*] } {
+ set et_vect_int_mult_saved 1
+ }
+ }
+
+ verbose "check_effective_target_vect_int_mult: returning $et_vect_int_mult_saved" 2
+ return $et_vect_int_mult_saved
+}
+
+# Return 1 if the target supports atomic operations on "int" and "long".
+
+proc check_effective_target_sync_int_long { } {
+ global et_sync_int_long_saved
+
+ if [info exists et_sync_int_long_saved] {
+ verbose "check_effective_target_sync_int_long: using cached result" 2
+ } else {
+ set et_sync_int_long_saved 0
+# This is intentionally powerpc but not rs6000, rs6000 doesn't have the
+# load-reserved/store-conditional instructions.
+ if { [istarget ia64-*-*]
+ || [istarget i?86-*-*]
+ || [istarget x86_64-*-*]
+ || [istarget alpha*-*-*]
+ || [istarget powerpc*-*-*] } {
+ set et_sync_int_long_saved 1
+ }
+ }
+
+ verbose "check_effective_target_sync_int_long: returning $et_sync_int_long_saved" 2
+ return $et_sync_int_long_saved
+}
+
# Return 1 if the target matches the effective target 'arg', 0 otherwise.
# This can be used with any check_* proc that takes no argument and
# returns only 1 or 0. It could be used with check_* procs that take