aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/lib/ld-lib.exp
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2007-09-04 14:49:43 +0000
committerMike Frysinger <vapier@gentoo.org>2007-09-04 14:49:43 +0000
commit58ffc3bd2c8bd012a0e1251e8a611c58defc2caf (patch)
tree7abb8f871e7ba0c2c0f5c1e06cf04a6fd525e89b /ld/testsuite/lib/ld-lib.exp
parent8aa20f8269a9fd45e4c50ff91a3948d8d9cf94f0 (diff)
downloadgdb-58ffc3bd2c8bd012a0e1251e8a611c58defc2caf.zip
gdb-58ffc3bd2c8bd012a0e1251e8a611c58defc2caf.tar.gz
gdb-58ffc3bd2c8bd012a0e1251e8a611c58defc2caf.tar.bz2
* lib/ld-lib.exp (default_ld_compile): Pull in global CXXFLAGS and
add it to $flags when $ccexe matches *++*. (run_ld_link_exec_tests): Pull in global CXXFLAGS and execute CXX with CXXFLAGS when $lang matches c++. (run_cc_link_tests): Likewise.
Diffstat (limited to 'ld/testsuite/lib/ld-lib.exp')
-rw-r--r--ld/testsuite/lib/ld-lib.exp23
1 files changed, 20 insertions, 3 deletions
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 5518a72..456e9fd 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -207,6 +207,7 @@ proc default_ld_simple_link { ld target objects } {
#
proc default_ld_compile { cc source object } {
global CFLAGS
+ global CXXFLAGS
global srcdir
global subdir
global host_triplet
@@ -224,7 +225,7 @@ proc default_ld_compile { cc source object } {
remote_file build delete "$object"
remote_file host delete "$object"
- set flags "-I$srcdir/$subdir $CFLAGS"
+ set flags "-I$srcdir/$subdir"
# If we are compiling with gcc, we want to add gcc_gas_flag to
# flags. Rather than determine this in some complex way, we guess
@@ -242,6 +243,12 @@ proc default_ld_compile { cc source object } {
set flags "$gcc_gas_flag $flags"
}
+ if {[string match "*++*" $ccexe]} {
+ set flags "$flags $CXXFLAGS"
+ } else {
+ set flags "$flags $CFLAGS"
+ }
+
if [board_info [target_info name] exists multilib_flags] {
append flags " [board_info [target_info name] multilib_flags]"
}
@@ -1285,6 +1292,7 @@ proc run_ld_link_exec_tests { targets_to_xfail ldtests } {
global CC
global CXX
global CFLAGS
+ global CXXFLAGS
global errcnt
global exec_output
@@ -1319,7 +1327,11 @@ proc run_ld_link_exec_tests { targets_to_xfail ldtests } {
# We ignore warnings since some compilers may generate
# incorrect section attributes and the assembler will warn
# them.
- ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile
+ if { [ string match "c++" $lang ] } {
+ ld_compile "$CXX -c $CXXFLAGS $cflags" $srcdir/$subdir/$src_file $objfile
+ } else {
+ ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile
+ }
# We have to use $CC to build PIE and shared library.
if { [ string match "c" $lang ] } {
@@ -1411,6 +1423,7 @@ proc run_cc_link_tests { ldtests } {
global CC
global CXX
global CFLAGS
+ global CXXFLAGS
foreach testitem $ldtests {
set testname [lindex $testitem 0]
@@ -1432,7 +1445,11 @@ proc run_cc_link_tests { ldtests } {
# We ignore warnings since some compilers may generate
# incorrect section attributes and the assembler will warn
# them.
- ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile
+ if { [ string match "c++" $lang ] } {
+ ld_compile "$CXX -c $CXXFLAGS $cflags" $srcdir/$subdir/$src_file $objfile
+ } else {
+ ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/$src_file $objfile
+ }
}
# Clear error and warning counts.