if ![info exists LDFLAGS] then {
set LDFLAGS {}
}
+
+# Set PLT_CFLAGS to "-fplt" if target compiler supports it.
+
+if { ![info exists PLT_CFLAGS] } then {
+ if { [which $CC] != 0 } {
+ # Check if gcc supports -fplt
+ set flags ""
+ if [board_info [target_info name] exists cflags] {
+ append flags " [board_info [target_info name] cflags]"
+ }
+ if [board_info [target_info name] exists ldflags] {
+ append flags " [board_info [target_info name] ldflags]"
+ }
+
+ set basename "tmpdir/plt[pid]"
+ set src ${basename}.c
+ set output ${basename}.o
+ set f [open $src "w"]
+ puts $f ""
+ close $f
+ remote_download host $src
+ set plt_available [run_host_cmd_yesno "$CC" "$flags -c -fplt $src -o $output"]
+ remote_file host delete $src
+ remote_file host delete $output
+ file delete $src
+
+ if { $plt_available == 1 } then {
+ set PLT_CFLAGS "-fplt"
+ } else {
+ set PLT_CFLAGS ""
+ }
+ } else {
+ set PLT_CFLAGS ""
+ }
+}