aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/lib
diff options
context:
space:
mode:
authorYiran Wang <yiran@google.com>2015-06-23 15:33:17 -0700
committerYiran Wang <yiran@google.com>2015-06-29 10:56:28 -0700
commit1d9fec7937f45dde5e04cac966a2d9a12f2fc15a (patch)
tree3fbcd18a379a05fd6d43491a107e1f36bc61b185 /gcc-4.9/gcc/testsuite/lib
parentf378ebf14df0952eae870c9865bab8326aa8f137 (diff)
downloadtoolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.gz
toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.tar.bz2
toolchain_gcc-1d9fec7937f45dde5e04cac966a2d9a12f2fc15a.zip
Synchronize with google/gcc-4_9 to r224707 (from r214835)
Change-Id: I3d6f06fc613c8f8b6a82143dc44b7338483aac5d
Diffstat (limited to 'gcc-4.9/gcc/testsuite/lib')
-rw-r--r--gcc-4.9/gcc/testsuite/lib/asan-dg.exp23
-rw-r--r--gcc-4.9/gcc/testsuite/lib/profopt.exp2
-rw-r--r--gcc-4.9/gcc/testsuite/lib/target-supports.exp64
3 files changed, 86 insertions, 3 deletions
diff --git a/gcc-4.9/gcc/testsuite/lib/asan-dg.exp b/gcc-4.9/gcc/testsuite/lib/asan-dg.exp
index f4ec44577..04bf3bf23 100644
--- a/gcc-4.9/gcc/testsuite/lib/asan-dg.exp
+++ b/gcc-4.9/gcc/testsuite/lib/asan-dg.exp
@@ -23,6 +23,21 @@ proc check_effective_target_faddress_sanitizer {} {
} "-fsanitize=address"]
}
+proc asan_include_flags {} {
+ global srcdir
+ global TESTING_IN_BUILD_TREE
+
+ set flags ""
+
+ if { [is_remote host] || ! [info exists TESTING_IN_BUILD_TREE] } {
+ return "${flags}"
+ }
+
+ set flags "-I$srcdir/../../libsanitizer/include"
+
+ return "$flags"
+}
+
#
# asan_link_flags -- compute library path and flags to find libasan.
# (originally from g++.exp)
@@ -80,17 +95,19 @@ proc asan_init { args } {
}
}
+ set include_flags "[asan_include_flags]"
+
if [info exists TEST_ALWAYS_FLAGS] {
set asan_saved_TEST_ALWAYS_FLAGS $TEST_ALWAYS_FLAGS
}
if [info exists ALWAYS_CXXFLAGS] {
set ALWAYS_CXXFLAGS [concat "{ldflags=$link_flags}" $ALWAYS_CXXFLAGS]
- set ALWAYS_CXXFLAGS [concat "{additional_flags=-fsanitize=address -static-libasan -g}" $ALWAYS_CXXFLAGS]
+ set ALWAYS_CXXFLAGS [concat "{additional_flags=-fsanitize=address -static-libasan -g $include_flags}" $ALWAYS_CXXFLAGS]
} else {
if [info exists TEST_ALWAYS_FLAGS] {
- set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -static-libasan -g $TEST_ALWAYS_FLAGS"
+ set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -static-libasan -g $include_flags $TEST_ALWAYS_FLAGS"
} else {
- set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -static-libasan -g"
+ set TEST_ALWAYS_FLAGS "$link_flags -fsanitize=address -static-libasan -g $include_flags"
}
}
if { $link_flags != "" } {
diff --git a/gcc-4.9/gcc/testsuite/lib/profopt.exp b/gcc-4.9/gcc/testsuite/lib/profopt.exp
index a6e4d8903..6210aedc6 100644
--- a/gcc-4.9/gcc/testsuite/lib/profopt.exp
+++ b/gcc-4.9/gcc/testsuite/lib/profopt.exp
@@ -169,6 +169,8 @@ proc profopt-final-code { which final_code name } {
# SRC is the full pathname of the testcase.
#
proc profopt-get-options { src } {
+ global srcdir
+
# dg-options sets a variable called dg-extra-tool-flags.
set dg-extra-tool-flags ""
diff --git a/gcc-4.9/gcc/testsuite/lib/target-supports.exp b/gcc-4.9/gcc/testsuite/lib/target-supports.exp
index 36a0b6c1b..8995fb0b3 100644
--- a/gcc-4.9/gcc/testsuite/lib/target-supports.exp
+++ b/gcc-4.9/gcc/testsuite/lib/target-supports.exp
@@ -869,6 +869,19 @@ proc check_effective_target_fpic { } {
return 0
}
+# Return 1 if -shared is supported, as in no warnings or errors
+# emitted, 0 otherwise.
+
+proc check_effective_target_shared { } {
+ # 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.
+ return [check_no_compiler_messages shared executable {
+ extern int foo (void); extern int bar;
+ int baz (void) { return foo () + bar; }
+ } "-shared -fpic"]
+}
+
# Return 1 if -pie, -fpie and -fPIE are supported, 0 otherwise.
proc check_effective_target_pie { } {
@@ -5993,3 +6006,54 @@ proc force_conventional_output_for { test } {
}
}
+# Return 1 if the x86-64 target supports PIE with copy reloc, 0
+# otherwise. Cache the result.
+
+proc check_effective_target_pie_copyreloc { } {
+ global pie_copyreloc_available_saved
+ global tool
+ global GCC_UNDER_TEST
+
+ if { !([istarget x86_64-*-*] || [istarget i?86-*-*]) } {
+ return 0
+ }
+
+ # Need auto-host.h to check linker support.
+ if { ![file exists ../../auto-host.h ] } {
+ return 0
+ }
+
+ if [info exists pie_copyreloc_available_saved] {
+ verbose "check_effective_target_pie_copyreloc returning saved $pie_copyreloc_available_saved" 2
+ } else {
+ # Set up and compile to see if linker supports PIE with copy
+ # reloc. Include the current process ID in the file names to
+ # prevent conflicts with invocations for multiple testsuites.
+
+ set src pie[pid].c
+ set obj pie[pid].o
+
+ set f [open $src "w"]
+ puts $f "#include \"../../auto-host.h\""
+ puts $f "#if HAVE_LD_PIE_COPYRELOC == 0"
+ puts $f "# error Linker does not support PIE with copy reloc."
+ puts $f "#endif"
+ close $f
+
+ verbose "check_effective_target_pie_copyreloc compiling testfile $src" 2
+ set lines [${tool}_target_compile $src $obj object ""]
+
+ file delete $src
+ file delete $obj
+
+ if [string match "" $lines] then {
+ verbose "check_effective_target_pie_copyreloc testfile compilation passed" 2
+ set pie_copyreloc_available_saved 1
+ } else {
+ verbose "check_effective_target_pie_copyreloc testfile compilation failed" 2
+ set pie_copyreloc_available_saved 0
+ }
+ }
+
+ return $pie_copyreloc_available_saved
+}