}
}
+# Return flags as defined within board_info
+#
+proc get_board_flags {} {
+ global board_cflags
+ global board_ldflags
+
+ if [board_info [target_info name] exists cflags] {
+ set board_cflags " [board_info [target_info name] cflags]"
+ } else {
+ set board_cflags ""
+ }
+
+ if [board_info [target_info name] exists ldflags] {
+ set board_ldflags " [board_info [target_info name] ldflags]"
+ } else {
+ set board_ldflags ""
+ }
+
+ return "$board_cflags $board_ldflags"
+}
+
+
# Link a program using ld
#
proc default_ld_link { ld target objects } {
global CXX_FOR_TARGET
global errcnt
global exec_output
- global board_cflags
- global board_ldflags
global STATIC_LDFLAGS
# When using GCC as the linker driver, we need to specify board cflags when
# linking because cflags may contain linker options. For example when
# linker options are included in GCC spec files then we need the -specs
# option.
- if [board_info [target_info name] exists cflags] {
- set board_cflags " [board_info [target_info name] cflags]"
- } else {
- set board_cflags ""
- }
-
- if [board_info [target_info name] exists ldflags] {
- set board_ldflags " [board_info [target_info name] ldflags]"
- } else {
- set board_ldflags ""
- }
+ set board_flags [get_board_flags]
foreach testitem $ldtests {
set testname [lindex $testitem 0]
continue;
} else {
if { [string match "" $STATIC_LDFLAGS] \
- && [regexp -- ".* \[-\]+static .*" " $board_cflags $board_ldflags $ld_options $objfiles $ld_after "] } {
+ && [regexp -- ".* \[-\]+static .*" " $board_flags $ld_options $objfiles $ld_after "] } {
untested $testname
continue
}
- if ![$link_proc $link_cmd $binfile "$board_cflags $board_ldflags -L$srcdir/$subdir $ld_options $objfiles $ld_after"] {
+ if ![$link_proc $link_cmd $binfile "$board_flags -L$srcdir/$subdir $ld_options $objfiles $ld_after"] {
set failed 1
}
}
global CXX_FOR_TARGET
global ar
global exec_output
- global board_cflags
- global board_ldflags
global STATIC_LDFLAGS
- if [board_info [target_info name] exists cflags] {
- set board_cflags " [board_info [target_info name] cflags]"
- } else {
- set board_cflags ""
- }
-
- if [board_info [target_info name] exists ldflags] {
- set board_ldflags " [board_info [target_info name] ldflags]"
- } else {
- set board_ldflags ""
- }
+ set board_flags [get_board_flags]
foreach testitem $ldtests {
set testname [lindex $testitem 0]
}
} else {
if { [string match "" $STATIC_LDFLAGS] \
- && [regexp -- ".* \[-\]+static .*" " $board_cflags $board_ldflags $ldflags $objfiles "] } {
+ && [regexp -- ".* \[-\]+static .*" " $board_flags $ldflags $objfiles "] } {
untested $testname
continue
}
- ld_link $cc_cmd $binfile "$board_cflags $board_ldflags -L$srcdir/$subdir $ldflags $objfiles"
+ ld_link $cc_cmd $binfile "$board_flags -L$srcdir/$subdir $ldflags $objfiles"
set ld_output "$exec_output"
if { $check_ld(source) == "regexp" } then {
# elf2flt uses -q (--emit-relocs), which is incompatible with
# --gc-sections.
- if { [board_info target exists ldflags]
- && [regexp " -elf2flt\[ =\]" " [board_info target ldflags] "] } {
+ set board_flags [get_board_flags]
+ if { [regexp " (-Wl,)*-elf2flt\[ =\]" " $board_flags "] } {
set gc_sections_available_saved 0
return 0
}
return 0
}
- 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 flags [get_board_flags]
set basename "tmpdir/compiler[pid]"
set src ${basename}.c
set output ${basename}.out
return 1
}
# Check if gcc supports -flto -fuse-linker-plugin
- 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 flags [get_board_flags]
set basename "tmpdir/lto[pid]"
set src ${basename}.c
set output ${basename}.out
return 1
}
# Check if gcc supports -flto -fuse-linker-plugin
- 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 flags [get_board_flags]
set basename "tmpdir/lto[pid]"
set src ${basename}.c
set output ${basename}.out
return 1
}
# Check if gcc supports -flto -fuse-linker-plugin -shared
- 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 flags [get_board_flags]
set basename "tmpdir/lto_shared[pid]"
set src ${basename}.c
set output ${basename}.so
return 0
}
# Check if gcc supports -flto -fuse-linker-plugin
- 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 flags [get_board_flags]
set basename "tmpdir/ifunc[pid]"
set src ${basename}.c
set output ${basename}.out
return 0
}
# Check if gcc supports -flto -fuse-linker-plugin
- 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 flags [get_board_flags]
set basename "tmpdir/ifunc[pid]"
set src ${basename}.c
set output ${basename}.out
return 0
}
# Check if GNU2 TLS works.
- set flags "$GNU2_CFLAGS"
- 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 flags "$GNU2_CFLAGS [get_board_flags]"
set basename "tmpdir/gnu2_tls[pid]"
set src1 ${basename}1.c
set output1 ${basename}.so
global CC_FOR_TARGET
global CFLAGS_FOR_TARGET
- 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 flags [get_board_flags]
if [is_remote host] {
set src [remote_download host $src]