diff options
author | David Daney <ddaney@avtrex.com> | 2011-12-16 06:18:55 +0000 |
---|---|---|
committer | David Daney <ddaney@avtrex.com> | 2011-12-16 06:18:55 +0000 |
commit | fb35d3d8fae4422243d6803c41b5cb4d2f5e5e2a (patch) | |
tree | 4c7e97bbf53909703c8c15712b562cae69abdabc /ld/testsuite/lib | |
parent | 083a5534142f4615f9fc4f01a5e9b7be4ef1bee9 (diff) | |
download | binutils-gdb-fb35d3d8fae4422243d6803c41b5cb4d2f5e5e2a.tar.gz |
2011-12-15 David Daney <david.daney@cavium.com>
Nick Clifton <nickc@redhat.com>
* ld-elfvers/vers.exp (picflag): Set to -fpic for mips*-*-* when
using GCC-4.3 or later.
(pic): Set to "yes" for mips*-*-linux*.
* ld-elfvsb/elfvsb.exp: Don't test non-PIC shared libraried on
mips*-*-linux*.
(picflag): Set to -fpic for mips*-*-* when using GCC-4.3 or later.
* ld-elfweak/elfweak.exp (picflag): Set to -fpic for mips*-*-*
when using GCC-4.3 or later.
* ld-shared/shared.exp (picflag): Same.
* lib/ld-lib.exp (at_least_gcc_version): New proc.
Diffstat (limited to 'ld/testsuite/lib')
-rw-r--r-- | ld/testsuite/lib/ld-lib.exp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 30098c1ae20..25999e9220b 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -27,6 +27,31 @@ proc load_common_lib { name } { load_common_lib binutils-common.exp +# Returns 1 if the gcc for the target is at least version MAJOR.MINOR +# Returns 0 otherwise. +# +proc at_least_gcc_version { major minor } { + + if {![info exists CC]} { + set CC [find_gcc] + } + if { $CC == "" } { + return 0 + } + set state [remote_exec host $CC --version] + set tmp "[lindex $state 1]\n" + # Look for (eg) 4.6.1 in the version output. + regexp " .* (\[1-9\])\\.(\[0-9\])\\.\[0-9\]* .*" "$tmp" fred maj min + verbose "gcc version: $tmp" + verbose "major gcc version is $maj, want at least $major" + if { $maj == $major } then { + verbose "minor gcc version is $min, want at least $minor" + return [expr $min >= $minor ] + } else { + return [expr $maj > $major ] + } +} + # Extract and print the version number of ld. # proc default_ld_version { ld } { |