From: Alan Modra Date: Thu, 10 Feb 2011 03:41:11 +0000 (+0000) Subject: apply mainline testsuite fixes and tweaks X-Git-Tag: binutils-2_21_1~204 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7a506d075c7f3f8db9dbc9bd2759104a306270fd;p=thirdparty%2Fbinutils-gdb.git apply mainline testsuite fixes and tweaks --- diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index a2960c663fa..678f82aef04 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,24 @@ +2011-02-10 Alan Modra + + Apply from mainline + 2010-11-20 Richard Sandiford + * lib/binutils-common.exp (regexp_diff): New procedure. + * lib/utils-lib.exp (regexp_diff): Delete. + + 2010-11-20 Richard Sandiford + * lib/binutils-common.exp: New file. + * lib/utils-lib.exp (load_common_lib): New function. Load + binutils-common.exp. + (is_elf_format): Delete. + + 2010-11-08 Thomas Schwinge + * lib/utils-lib.exp (is_elf_format): Consider for *-*-gnu*, too. + * binutils-all/elfedit-2.d (target): Likewise. + * binutils-all/elfedit-3.d (target): Likewise. + * binutils-all/i386/i386.exp: Likewise. + * binutils-all/objcopy.exp: Likewise. + * binutils-all/strip-3.d (target): Likewise. + 2011-02-01 Alan Modra Backport from mainline diff --git a/binutils/testsuite/binutils-all/elfedit-2.d b/binutils/testsuite/binutils-all/elfedit-2.d index af07c1db297..56468b51fc0 100644 --- a/binutils/testsuite/binutils-all/elfedit-2.d +++ b/binutils/testsuite/binutils-all/elfedit-2.d @@ -3,7 +3,7 @@ #source: empty.s #readelf: -h #name: Update ELF header 2 -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... ELF Header: diff --git a/binutils/testsuite/binutils-all/elfedit-3.d b/binutils/testsuite/binutils-all/elfedit-3.d index c877f46ef29..219cac5919b 100644 --- a/binutils/testsuite/binutils-all/elfedit-3.d +++ b/binutils/testsuite/binutils-all/elfedit-3.d @@ -3,7 +3,7 @@ #source: empty.s #readelf: -h #name: Update ELF header 3 -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... ELF Header: diff --git a/binutils/testsuite/binutils-all/i386/i386.exp b/binutils/testsuite/binutils-all/i386/i386.exp index 2ca4bd535f0..5b33e67f2c6 100644 --- a/binutils/testsuite/binutils-all/i386/i386.exp +++ b/binutils/testsuite/binutils-all/i386/i386.exp @@ -15,7 +15,11 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. -if {!([istarget "i*86-*-linux*"] || [istarget "x86_64-*-linux*"]) || ![is_elf_format] || [is_remote host]} then { +if {!([istarget "i*86-*-linux*"] + || [istarget "i*86-*-gnu*"] + || [istarget "x86_64-*-linux*"]) + || ![is_elf_format] + || [is_remote host]} then { return } diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index c93372c2f48..0e2345e5cd1 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -538,7 +538,8 @@ proc copy_setup { } { set add_libs "" } - if { [istarget *-*-linux*] } { + if { [istarget *-*-linux*] + || [istarget *-*-gnu*] } { foreach i $gcc_gas_flag { set flags "additional_flags=$i $flags" } diff --git a/binutils/testsuite/binutils-all/strip-3.d b/binutils/testsuite/binutils-all/strip-3.d index d6566977001..acfec85d7a8 100644 --- a/binutils/testsuite/binutils-all/strip-3.d +++ b/binutils/testsuite/binutils-all/strip-3.d @@ -3,7 +3,7 @@ #strip: -R .text -R .data -R .bss -R .ARM.attributes -R .reginfo -R .pdr -R .xtensa.info #readelf: -S --wide #name: strip empty file -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... \[[ 0]+\][ \t]+NULL[ \t]+.* diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index 8e2c36f504a..2f8b4265282 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -167,9 +167,7 @@ proc is_elf64 { binary_file } { # REGEXP # Skip all lines in FILE_1 until the first that matches REGEXP. # -# Other # lines are comments. Regexp lines starting with the `!' character -# specify inverse matching (use `\!' for literal matching against a leading -# `!'). Skip empty lines in both files. +# Other # lines are comments. Skip empty lines in both files. # # The first optional argument is a list of regexp substitutions of the form: # @@ -237,15 +235,12 @@ proc regexp_diff { file_1 file_2 args } { set diff_pass 1 break } - set negated [expr { [string index $line_b 0] == "!" }] - set line_bx [string range $line_b $negated end] - set n [expr { $negated ? "! " : "" }] # Substitute on the reference. foreach {name value} $ref_subst { - regsub -- $name $line_bx $value line_bx + regsub -- $name $line_b $value line_b } - verbose "looking for $n\"^$line_bx$\"" 3 - while { [expr [regexp "^$line_bx$" "$line_a"] == $negated] } { + verbose "looking for \"^$line_b$\"" 3 + while { ![regexp "^$line_b$" "$line_a"] } { verbose "skipping \"$line_a\"" 3 if { [gets $file_a line_a] == $eof } { set end_1 1 @@ -275,18 +270,14 @@ proc regexp_diff { file_1 file_2 args } { set differences 1 break } else { - set negated [expr { [string index $line_b 0] == "!" }] - set line_bx [string range $line_b $negated end] - set n [expr { $negated ? "! " : "" }] - set s [expr { $negated ? " " : "" }] # Substitute on the reference. foreach {name value} $ref_subst { - regsub -- $name $line_bx $value line_bx + regsub -- $name $line_b $value line_b } - verbose "regexp $n\"^$line_bx$\"\nline \"$line_a\"" 3 - if { [expr [regexp "^$line_bx$" "$line_a"] == $negated] } { + verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3 + if { ![regexp "^$line_b$" "$line_a"] } { send_log "regexp_diff match failure\n" - send_log "regexp $n\"^$line_bx$\"\nline $s\"$line_a\"\n" + send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n" verbose "regexp_diff match failure\n" 3 set differences 1 } diff --git a/binutils/testsuite/lib/utils-lib.exp b/binutils/testsuite/lib/utils-lib.exp index db170d387a5..72e368cbb39 100644 --- a/binutils/testsuite/lib/utils-lib.exp +++ b/binutils/testsuite/lib/utils-lib.exp @@ -1,5 +1,5 @@ # Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2004, 2006, 2007, -# 2009 Free Software Foundation, Inc. +# 2009, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,6 +21,12 @@ # This file was written by Rob Savoye # and extended by Ian Lance Taylor +proc load_common_lib { name } { + load_lib $name +} + +load_common_lib binutils-common.exp + proc binutil_version { prog } { if ![is_remote host] { set path [which $prog] @@ -118,62 +124,6 @@ proc default_binutils_assemble_flags { source object asflags } { } } -# True if the object format is known to be ELF. -# -proc is_elf_format {} { - if { ![istarget *-*-sysv4*] - && ![istarget *-*-unixware*] - && ![istarget *-*-elf*] - && ![istarget *-*-eabi*] - && ![istarget *-*-rtems*] - && ![istarget hppa*64*-*-hpux*] - && ![istarget ia64-*-hpux*] - && ![istarget *-*-linux*] - && ![istarget frv-*-uclinux*] - && ![istarget bfin-*-uclinux] - && ![istarget sh*-*-uclinux*] - && ![istarget *-*-irix5*] - && ![istarget *-*-irix6*] - && ![istarget *-*-netbsd*] - && ![istarget *-*-openbsd*] - && ![istarget *-*-solaris2*] } { - return 0 - } - - if { [istarget *-*-linux*aout*] - || [istarget *-*-linux*oldld*] - || [istarget h8500-*-rtems*] - || [istarget i960-*-rtems*] - || [istarget *-*-rtemscoff*] } { - return 0 - } - - if { ![istarget *-*-netbsdelf*] - && ([istarget *-*-netbsd*aout*] - || [istarget *-*-netbsdpe*] - || [istarget arm*-*-netbsd*] - || [istarget sparc-*-netbsd*] - || [istarget i*86-*-netbsd*] - || [istarget m68*-*-netbsd*] - || [istarget vax-*-netbsd*] - || [istarget ns32k-*-netbsd*]) } { - return 0 - } - - if { [istarget arm-*-openbsd*] - || [istarget i386-*-openbsd\[0-2\].*] - || [istarget i386-*-openbsd3.\[0-2\]] - || [istarget m68*-*-openbsd*] - || [istarget ns32k-*-openbsd*] - || [istarget sparc-*-openbsd\[0-2\].*] - || [istarget sparc-*-openbsd3.\[0-1\]] - || [istarget vax-*-openbsd*] } { - return 0 - } - - return 1 -} - # # exe_ext # Returns target executable extension, if any. @@ -292,8 +242,8 @@ proc exe_ext {} { # # After the option lines come regexp lines. `run_dump_test' calls # `regexp_diff' to compare the output of the dumping tool against the -# regexps in FILE.d. `regexp_diff' is defined later in this file; see -# further comments there. +# regexps in FILE.d. `regexp_diff' is defined in binutils-common.exp; +# see further comments there. proc run_dump_test { name {extra_options {}} } { global subdir srcdir @@ -588,110 +538,6 @@ proc slurp_options { file } { return $opt_array } -# regexp_diff, based on simple_diff taken from ld test suite -# compares two files line-by-line -# file1 contains strings, file2 contains regexps and #-comments -# blank lines are ignored in either file -# returns non-zero if differences exist -# -proc regexp_diff { file_1 file_2 } { - - set eof -1 - set end_1 0 - set end_2 0 - set differences 0 - set diff_pass 0 - - if [file exists $file_1] then { - set file_a [open $file_1 r] - } else { - perror "$file_1 doesn't exist" - return 1 - } - - if [file exists $file_2] then { - set file_b [open $file_2 r] - } else { - perror "$file_2 doesn't exist" - close $file_a - return 1 - } - - verbose " Regexp-diff'ing: $file_1 $file_2" 2 - - while { 1 } { - set line_a "" - set line_b "" - while { [string length $line_a] == 0 } { - if { [gets $file_a line_a] == $eof } { - set end_1 1 - break - } - } - while { [string length $line_b] == 0 || [string match "#*" $line_b] } { - if [ string match "#pass" $line_b ] { - set end_2 1 - set diff_pass 1 - break - } elseif [ string match "#..." $line_b ] { - if { [gets $file_b line_b] == $eof } { - set end_2 1 - set diff_pass 1 - break - } - verbose "looking for \"^$line_b$\"" 3 - while { ![regexp "^$line_b$" "$line_a"] } { - verbose "skipping \"$line_a\"" 3 - if { [gets $file_a line_a] == $eof } { - set end_1 1 - break - } - } - break - } - if { [gets $file_b line_b] == $eof } { - set end_2 1 - break - } - } - - if { $diff_pass } { - break - } elseif { $end_1 && $end_2 } { - break - } elseif { $end_1 } { - send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n" - verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3 - set differences 1 - break - } elseif { $end_2 } { - send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" - verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3 - set differences 1 - break - } else { - verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3 - if ![regexp "^$line_b$" "$line_a"] { - send_log "regexp_diff match failure\n" - send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n" - verbose "regexp_diff match failure\n" 3 - set differences 1 - } - } - } - - if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } { - send_log "$file_1 and $file_2 are different lengths\n" - verbose "$file_1 and $file_2 are different lengths" 3 - set differences 1 - } - - close $file_a - close $file_b - - return $differences -} - proc file_contents { filename } { set file [open $filename r] set contents [read $file] diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 06df39f64dd..f66ce9d567b 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,28 @@ +2011-02-10 Alan Modra + + Apply from mainline + 2010-11-20 Richard Sandiford + * lib/gas-defs.exp (regexp_diff): Delete. + (run_dump_test): Remove final "" argument in call to regexp_diff. + (run_list_test): Likewise. + (run_list_test_stdin): Likewise. + * gas/all/gas.exp (test_cond): Likewise. + * gas/elf/elf.exp (run_elf_list_test): Likewise. + * gas/m68k/all.exp: Likewise. + * gas/mep/complex-relocs.exp (regexp_test): Likewise. + * gas/mt/relocs.exp (regexp_test): Likewise. + * gas/symver/symver.exp (run_error_test): Likewise. + + 2010-11-20 Richard Sandiford + * lib/gas-defs.exp (load_common_lib): New function. Load + binutils-common.exp. + (is_elf_format, is_aout_format, is_pecoff_format): Delete. + + 2010-11-08 Thomas Schwinge + * lib/gas-defs.exp (is_elf_format): Consider for *-*-gnu*, too. + * gas/elf/elf.exp: Likewise. + * gas/symver/symver.exp: Likewise. + 2011-02-07 Vincent Riviere PR gas/3041 diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp index 1dd7cbb025b..c41db983c12 100644 --- a/gas/testsuite/gas/all/gas.exp +++ b/gas/testsuite/gas/all/gas.exp @@ -308,7 +308,7 @@ proc test_cond {} { send_log "$comp_output\n" fail $testname } else { - if { [regexp_diff dump.out $srcdir/$subdir/cond.l ""] } { + if { [regexp_diff dump.out $srcdir/$subdir/cond.l] } { fail $testname } else { pass $testname diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index 5ce538a3170..3babe0b1cb4 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -9,7 +9,7 @@ proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } { set file $srcdir/$subdir/$name gas_run ${name}.s "$opts -o dump.o" ">&dump.out" if { ![string match "" $opts] - && [regexp_diff "dump.out" "${file}.l" ""] } then { + && [regexp_diff "dump.out" "${file}.l"] } then { fail $testname verbose "output is [file_contents "dump.out"]" 2 return @@ -28,7 +28,7 @@ proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } { return } verbose_eval {[file_contents "dump.out"]} 3 - if { [regexp_diff "dump.out" "${file}.e${suffix}" ""] } then { + if { [regexp_diff "dump.out" "${file}.e${suffix}"] } then { fail $testname verbose "output is [file_contents "dump.out"]" 2 return @@ -39,6 +39,7 @@ proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } { # We're testing bits in obj-elf -- don't run on anything else. if { ([istarget "*-*-*elf*"] || [istarget "*-*-linux*"] + || [istarget "*-*-gnu*"] || [istarget "m6811-*"] || [istarget "m6812-*"] || [istarget "sparc*-*-solaris*"] diff --git a/gas/testsuite/gas/m68k/all.exp b/gas/testsuite/gas/m68k/all.exp index 8b9ecdb606f..b3db085a678 100644 --- a/gas/testsuite/gas/m68k/all.exp +++ b/gas/testsuite/gas/m68k/all.exp @@ -84,7 +84,7 @@ if { [istarget m68*-*-*] || [istarget fido*-*-*] } then { verbose "$comp_output" 3 fail $testname } else { - if [regexp_diff "err.out" "$srcdir/$subdir/op68000.d" ""] then { + if [regexp_diff "err.out" "$srcdir/$subdir/op68000.d"] then { fail $testname } else { pass $testname diff --git a/gas/testsuite/gas/mep/complex-relocs.exp b/gas/testsuite/gas/mep/complex-relocs.exp index a5a3127fb1f..83d89bb6375 100644 --- a/gas/testsuite/gas/mep/complex-relocs.exp +++ b/gas/testsuite/gas/mep/complex-relocs.exp @@ -18,7 +18,7 @@ proc objdump_test { exec flags dest test } { } proc regexp_test { file1 file2 test } { - if [regexp_diff $file1 $file2 ""] then { fail $test } else { pass $test } + if [regexp_diff $file1 $file2] then { fail $test } else { pass $test } } diff --git a/gas/testsuite/gas/mt/relocs.exp b/gas/testsuite/gas/mt/relocs.exp index d47742ebf32..076f428bc73 100644 --- a/gas/testsuite/gas/mt/relocs.exp +++ b/gas/testsuite/gas/mt/relocs.exp @@ -15,7 +15,7 @@ proc objdump_test { exec flags dest test } { } proc regexp_test { file1 file2 test } { - if [regexp_diff $file1 $file2 ""] then { fail $test } else { pass $test } + if [regexp_diff $file1 $file2] then { fail $test } else { pass $test } } diff --git a/gas/testsuite/gas/symver/symver.exp b/gas/testsuite/gas/symver/symver.exp index 737bc85e40a..6fcae0edab2 100644 --- a/gas/testsuite/gas/symver/symver.exp +++ b/gas/testsuite/gas/symver/symver.exp @@ -6,7 +6,7 @@ proc run_error_test { name opts } { set testname "symver $name" set file $srcdir/$subdir/$name gas_run ${name}.s $opts ">&dump.out" - if { [regexp_diff "dump.out" "${file}.l" ""] } then { + if { [regexp_diff "dump.out" "${file}.l"] } then { fail $testname verbose "output is [file_contents "dump.out"]" 2 return @@ -18,7 +18,8 @@ proc run_error_test { name opts } { if { ([istarget "*-*-elf*"] || [istarget "m6811-*"] || [istarget "m6812-*"] - || [istarget "*-*-linux*"]) + || [istarget "*-*-linux*"] + || [istarget "*-*-gnu*"]) && ![istarget *-*-linux*aout*] && ![istarget *-*-linux*oldld*] } then { diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp index 8e14101ac70..f10d72adce7 100644 --- a/gas/testsuite/lib/gas-defs.exp +++ b/gas/testsuite/lib/gas-defs.exp @@ -1,5 +1,5 @@ # Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -# 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc. +# 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,6 +21,13 @@ # This file was written by Ken Raeburn (raeburn@cygnus.com). +proc load_common_lib { name } { + global srcdir + load_file $srcdir/../../binutils/testsuite/lib/$name +} + +load_common_lib binutils-common.exp + proc gas_version {} { global AS if [is_remote host] then { @@ -277,112 +284,6 @@ proc gas_init { args } { return } -# True if the object format is known to be ELF. -# -proc is_elf_format {} { - if { ![istarget *-*-sysv4*] - && ![istarget *-*-unixware*] - && ![istarget *-*-elf*] - && ![istarget *-*-eabi*] - && ![istarget *-*-rtems*] - && ![istarget hppa*64*-*-hpux*] - && ![istarget ia64-*-hpux*] - && ![istarget *-*-linux*] - && ![istarget frv-*-uclinux*] - && ![istarget bfin-*-uclinux] - && ![istarget sh*-*-uclinux*] - && ![istarget *-*-irix5*] - && ![istarget *-*-irix6*] - && ![istarget *-*-netbsd*] - && ![istarget *-*-openbsd*] - && ![istarget *-*-solaris2*] } { - return 0 - } - - if { [istarget *-*-linux*aout*] - || [istarget *-*-linux*oldld*] - || [istarget h8500-*-rtems*] - || [istarget i960-*-rtems*] - || [istarget *-*-rtemscoff*] } { - return 0 - } - - if { ![istarget *-*-netbsdelf*] - && ([istarget *-*-netbsd*aout*] - || [istarget *-*-netbsdpe*] - || [istarget arm*-*-netbsd*] - || [istarget sparc-*-netbsd*] - || [istarget i*86-*-netbsd*] - || [istarget m68*-*-netbsd*] - || [istarget vax-*-netbsd*] - || [istarget ns32k-*-netbsd*]) } { - return 0 - } - - if { [istarget arm-*-openbsd*] - || [istarget i386-*-openbsd\[0-2\].*] - || [istarget i386-*-openbsd3.\[0-2\]] - || [istarget m68*-*-openbsd*] - || [istarget ns32k-*-openbsd*] - || [istarget sparc-*-openbsd\[0-2\].*] - || [istarget sparc-*-openbsd3.\[0-1\]] - || [istarget vax-*-openbsd*] } { - return 0 - } - - return 1 -} - -# True if the object format is known to be a.out. -# -proc is_aout_format {} { - if { [istarget *-*-netbsdelf] - || [istarget sparc64-*-netbsd*] - || [istarget sparc64-*-openbsd*] } { - return 0 - } - if { [istarget *-*-*\[ab\]out*] - || [istarget *-*-linux*oldld*] - || [istarget *-*-bsd*] - || [istarget *-*-msdos*] - || [istarget arm-*-netbsd*] - || [istarget arm-*-openbsd*] - || [istarget arm-*-riscix*] - || [istarget i?86-*-freebsd\[12\]*] - || [istarget i?86-*-netbsd*] - || [istarget i?86-*-openbsd\[0-2\]*] - || [istarget i?86-*-openbsd3.\[0-2\]*] - || [istarget i?86-*-vsta] - || [istarget i?86-*-mach*] - || [istarget m68*-*-netbsd*] - || [istarget m68*-*-openbsd*] - || [istarget ns32k-*-*] - || [istarget pdp11-*-*] - || [istarget sparc*-*-sunos4*] - || [istarget sparc*-*-netbsd*] - || [istarget sparc*-*-openbsd\[0-2\]*] - || [istarget sparc*-*-openbsd3.\[0-1\]*] - || [istarget sparc*-fujitsu-none] - || [istarget vax-dec-ultrix*] - || [istarget vax-*-netbsd] } { - return 1 - } - return 0 -} - -# True if the object format is known to be PE COFF. -# -proc is_pecoff_format {} { - if { ![istarget *-*-mingw*] - && ![istarget *-*-cygwin*] - && ![istarget *-*-cegcc*] - && ![istarget *-*-pe*] } { - return 0 - } - - return 1 -} - # Internal procedure: return the names of the standard sections # proc get_standard_section_names {} { @@ -526,8 +427,8 @@ proc run_dump_tests { testcases {extra_options {}} } { # # After the option lines come regexp lines. `run_dump_test' calls # `regexp_diff' to compare the output of the dumping tool against the -# regexps in FILE.d. `regexp_diff' is defined later in this file; see -# further comments there. +# regexps in FILE.d. `regexp_diff' is defined in binutils-common.exp; +# see further comments there. proc run_dump_test { name {extra_options {}} } { global subdir srcdir @@ -778,7 +679,7 @@ proc run_dump_test { name {extra_options {}} } { } set stderrfile $srcdir/$subdir/$opts(stderr) verbose "wrote pruned stderr to dump.stderr" 3 - if { [regexp_diff "dump.stderr" "$stderrfile" ""] } then { + if { [regexp_diff "dump.stderr" "$stderrfile"] } then { if { $opts(error) != "" } { verbose -log "$exitstat with: <$comp_output>, expected: <$opts(error)>" if [regexp $opts(error) $comp_output] { @@ -938,120 +839,6 @@ expect_after -i { eof { perror "eof" } } -# regexp_diff, based on simple_diff taken from ld test suite. -# Compares two files line-by-line. -# FILE_1 contains strings, FILE_2 contains regexps and #-comments -# Blank lines are ignored in either file. -# Subsitutions in REF_SUBST are applied on FILE_2 lines. -# Returns non-zero if differences exist. -# -proc regexp_diff { file_1 file_2 ref_subst} { - - set eof -1 - set end_1 0 - set end_2 0 - set differences 0 - set diff_pass 0 - - if [file exists $file_1] then { - set file_a [open $file_1 r] - } else { - perror "$file_1 doesn't exist" - return 1 - } - - if [file exists $file_2] then { - set file_b [open $file_2 r] - } else { - perror "$file_2 doesn't exist" - close $file_a - return 1 - } - - verbose " Regexp-diff'ing: $file_1 $file_2" 2 - - while { 1 } { - set line_a "" - set line_b "" - while { [string length $line_a] == 0 } { - # Ignore blank line in FILE_1. - if { [gets $file_a line_a] == $eof } { - set end_1 1 - break - } - } - while { [string length $line_b] == 0 || [string match "#*" $line_b] } { - if [ string match "#pass" $line_b ] { - set end_2 1 - set diff_pass 1 - break - } elseif [ string match "#..." $line_b ] { - if { [gets $file_b line_b] == $eof } { - set end_2 1 - set diff_pass 1 - break - } - # Substitute on the reference. - foreach {name value} $ref_subst { - regsub -- $name $line_b $value line_b - } - verbose "looking for \"^$line_b$\"" 3 - while { ![regexp "^$line_b$" "$line_a"] } { - verbose "skipping \"$line_a\"" 3 - if { [gets $file_a line_a] == $eof } { - set end_1 1 - break - } - } - break - } - if { [gets $file_b line_b] == $eof } { - set end_2 1 - break - } - } - - if { $diff_pass } { - break - } elseif { $end_1 && $end_2 } { - break - } elseif { $end_1 } { - send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n" - verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3 - set differences 1 - break - } elseif { $end_2 } { - send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" - verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3 - set differences 1 - break - } else { - # Substitute on the reference. - foreach {name value} $ref_subst { - regsub -- $name $line_b $value line_b - } - verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3 - if ![regexp "^$line_b$" "$line_a"] { - send_log "regexp_diff match failure\n" - send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n" - verbose "regexp_diff match failure\n" 3 - set differences 1 - } - } - } - - if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } { - send_log "$file_1 and $file_2 are different lengths\n" - verbose "$file_1 and $file_2 are different lengths" 3 - set differences 1 - } - - close $file_a - close $file_b - - return $differences -} - proc file_contents { filename } { set file [open $filename r] set contents [read $file] @@ -1107,7 +894,7 @@ proc run_list_test { name {opts {}} {testname {}} } { } set file $srcdir/$subdir/$name gas_run ${name}.s $opts ">&dump.out" - if { [regexp_diff "dump.out" "${file}.l" ""] } then { + if { [regexp_diff "dump.out" "${file}.l"] } then { fail $testname verbose "output is [file_contents "dump.out"]" 2 return @@ -1126,7 +913,7 @@ proc run_list_test_stdin { name {opts {}} {testname {}} } { } set file $srcdir/$subdir/$name gas_run_stdin ${name}.s $opts ">&dump.out" - if { [regexp_diff "dump.out" "${file}.l" ""] } then { + if { [regexp_diff "dump.out" "${file}.l"] } then { fail $testname verbose "output is [file_contents "dump.out"]" 2 return diff --git a/ld/ChangeLog b/ld/ChangeLog index e0f686291f6..a547b7b5764 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2011-02-10 Alan Modra + + Apply from mainline + 2010-11-08 Thomas Schwinge + * configure.host: Add stanza for *-*-gnu*. + 2011-02-01 Alan Modra Backport from mainline diff --git a/ld/configure.host b/ld/configure.host index 3e88c27d2e9..f2dffe67bc5 100644 --- a/ld/configure.host +++ b/ld/configure.host @@ -37,6 +37,15 @@ case "${host}" in HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`' ;; +*-*-gnu*) + # When creating static executables, we ought to use crt0.o instead of crt1.o, + # , + # but the testing infrastructure is not prepared for that. This is not + # relevant for most tests, and the few remaining ones have been XFAILed. + HOSTING_CRT0='-dynamic-linker `${CC} --help --verbose 2>&1 | egrep "ld[^ ]*\.so" | sed -e "s,.*-dynamic-linker[ ][ ]*\(.*/ld[^ ]*\.so[^ ]*\).*,\1,"` `${CC} --print-file-name=crt1.o` `${CC} --print-file-name=crti.o` `if [ -f ../gcc/crtbegin.o ]; then echo ../gcc/crtbegin.o; else ${CC} --print-file-name=crtbegin.o; fi`' + HOSTING_LIBS='-L`dirname \`${CC} --print-file-name=libc.so\`` '"$HOSTING_LIBS"' `if [ -f ../gcc/crtend.o ]; then echo ../gcc/crtend.o; else ${CC} --print-file-name=crtend.o; fi` `${CC} --print-file-name=crtn.o`' + ;; + *-*-netbsd*) # Different versions of NetBSD with the ELF object format use different # sets of start/end files. @@ -194,7 +203,7 @@ sparc64-*-solaris2* | sparcv9-*-solaris2*) *-*-freebsd* | *-*-kfreebsd*-gnu | *-*-dragonfly*) ;; -*-*-linux*) +*-*-linux* | *-*-gnu*) ;; *-*-netbsd*) diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index baa874db2d0..13472908397 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,143 @@ +2011-02-10 Alan Modra + + Apply from mainline + 2011-01-08 Nick Clifton + PR ld/13258 + PR ld/13259 + * ld-elf/textaddr2.d: Fix regexp to work with hppa64 targets. + * ld-elf/textaddr6.d: Fix regexp to work with hppa64 targets. + + 2010-12-31 John David Anglin + PR ld/12360 + * ld-elfcomm/elfcomm.exp (test1w1): Use same check as MIPS on + hppa*64*-*-*. + + 2010-12-20 Alan Modra + * ld-bootstrap/bootstrap.exp: Fix misplaced comment. + + 2010-12-04 H.J. Lu + * ld-selective/selective.exp: Don't pass -fvtable-gc to GCC + 3.4.0 or above. + + 2010-12-04 H.J. Lu + * ld-elfvers/vers.exp: Replace -export-dynamic with + -Wl,-export-dynamic. + + 2010-12-11 Alan Modra + * ld-elfvers/vers25a.dsym: Really include _? in match. + + 2010-12-10 Mike Frysinger + * ld-elfvers/vers.h: New file. + * ld-elfvers/vers1.c: Include vers.h. Change asm(.symver) to SYMVER(). + * ld-elfvers/vers4.c, ld-elfvers/vers5.c, ld-elfvers/vers6.c, + ld-elfvers/vers7a.c, ld-elfvers/vers9.c, ld-elfvers/vers15.c, + ld-elfvers/vers18.c, ld-elfvers/vers21.c, ld-elfvers/vers22a.c, + ld-elfvers/vers23a.c, ld-elfvers/vers24a.c, ld-elfvers/vers24c.c, + ld-elfvers/vers27d1.c: Likewise. + * ld-elf/pr9676.rd: Include _? in symbol match + * ld-elf/pr9676.rd, ld-elf/pr9679.rd, ld-elfvers/vers1.dsym, + ld-elfvers/vers1.sym, ld-elfvers/vers15.dsym, ld-elfvers/vers15.sym, + ld-elfvers/vers16.dsym, ld-elfvers/vers16a.dsym, ld-elfvers/vers17.dsym, + ld-elfvers/vers18.dsym, ld-elfvers/vers18.sym, ld-elfvers/vers19.dsym, + ld-elfvers/vers2.dsym, ld-elfvers/vers20.dsym, ld-elfvers/vers21.dsym, + ld-elfvers/vers21.sym, ld-elfvers/vers22.dsym, ld-elfvers/vers22a.dsym, + ld-elfvers/vers22a.sym, ld-elfvers/vers22b.dsym, ld-elfvers/vers23.dsym, + ld-elfvers/vers23a.dsym, ld-elfvers/vers23a.sym, + ld-elfvers/vers23b.dsym, ld-elfvers/vers23d.dsym, + ld-elfvers/vers24.rd, ld-elfvers/vers25a.dsym, + ld-elfvers/vers26a.dsym, ld-elfvers/vers27a.dsym, + ld-elfvers/vers27d.dsym, ld-elfvers/vers27d.sym, + ld-elfvers/vers27d4.dsym, ld-elfvers/vers28b.dsym, + ld-elfvers/vers28c.dsym, ld-elfvers/vers29.dsym, ld-elfvers/vers3.dsym, + ld-elfvers/vers30.dsym, ld-elfvers/vers31.dsym, ld-elfvers/vers32a.dsym, + ld-elfvers/vers32b.dsym, ld-elfvers/vers4.sym, ld-elfvers/vers4a.dsym, + ld-elfvers/vers4a.sym, ld-elfvers/vers6.dsym, ld-elfvers/vers6.sym, + ld-elfvers/vers7a.dsym, ld-elfvers/vers7a.sym, ld-elfvers/vers9.dsym, + ld-elfvers/vers9.sym: Likewise. + + 2010-11-30 Matthew Gretton-Dann + * ld-scripts/script.exp: Remove full path from REGION_ALIAS test + names. + + 2010-11-20 Richard Sandiford + * lib/ld-lib.exp (regexp_diff, simple_diff): Delete. + + 2010-11-20 Richard Sandiford + * lib/ld-lib.exp (load_common_lib): New function. Load + binutils-common.exp. + (is_elf_format, is_elf64, is_aout_format, is_pecoff_format): Delete. + + 2010-11-18 Alan Modra + * ld-elf/binutils.exp: Correct x86 gnu target match. + * ld-i386/i386.exp: Likewise. + * ld-ifunc/binutils.exp: Likewise. + * ld-ifunc/ifunc.exp: Likewise. + * ld-discard/discard.exp: Remove unnecessary line continuations. + * ld-elfvers/vers.exp: Likewise. Simplify linuxaout and linuxoldld + test. + * ld-elfweak/elfweak.exp: Likewise. + + 2010-11-17 Andreas Schwab + * ld-gc/pr11218-2.c: Declare + unresolved_detected_at_runtime_not_at_linktime. + + 2010-11-08 Thomas Schwinge + * lib/ld-lib.exp (is_elf_format): Consider for *-*-gnu*, too. + * ld-discard/discard.exp: Likewise. + * ld-elf/binutils.exp: Likewise. + * ld-elf/commonpage1.d (target): Likewise. + * ld-elf/compress1c.d (target): Likewise. + * ld-elf/discard1.d (target): Likewise. + * ld-elf/discard2.d (target): Likewise. + * ld-elf/discard3.d (target): Likewise. + * ld-elf/dynsym1.d (target): Likewise. + * ld-elf/eh6.d (target): Likewise. + * ld-elf/elf.exp: Likewise. + (array_tests): Move -static tests to... + (array_tests_static): ... here, and handle it accordingly. + * ld-elf/hash.d (target): Likewise. + * ld-elf/header.d (target): Likewise. + * ld-elf/loadaddr1.d (target): Likewise. + * ld-elf/loadaddr2.d (target): Likewise. + * ld-elf/loadaddr3a.d (target): Likewise. + * ld-elf/loadaddr3b.d (target): Likewise. + * ld-elf/local1.d (target): Likewise. + * ld-elf/maxpage1.d (target): Likewise. + * ld-elf/maxpage2.d (target): Likewise. + * ld-elf/maxpage3a.d (target): Likewise. + * ld-elf/multibss1.d (target): Likewise. + * ld-elf/noload-2.d (target): Likewise. + * ld-elf/seg.d (target): Likewise. + * ld-elf/textaddr1.d (target): Likewise. + * ld-elf/textaddr2.d (target): Likewise. + * ld-elf/textaddr3.d (target): Likewise. + * ld-elf/textaddr4.d (target): Likewise. + * ld-elf/textaddr5.d (target): Likewise. + * ld-elf/textaddr6.d (target): Likewise. + * ld-elf/textaddr7.d (target): Likewise. + * ld-elf/tls_common.exp: Likewise. + * ld-elf/unknown2.d (target): Likewise. + * ld-elfvers/vers.exp: Likewise. + * ld-elfvsb/elfvsb.exp: Likewise. + * ld-elfweak/elfweak.exp: Likewise. + (setup_xfail_gnu_hurd): New function. Use it where appropriate. + * ld-gc/abi-note.d (target): Likewise. + * ld-gc/gc.exp: Likewise. + * ld-gc/pr11218.d (target): Likewise. + * ld-gc/start.d (target): Likewise. + * ld-i386/i386.exp: Likewise. + * ld-ifunc/binutils.exp: Likewise. + * ld-ifunc/ifunc.exp: Likewise. + * ld-linkonce/linkonce.exp: Likewise. + * ld-linkonce/zeroehl32.d (target): Likewise. + * ld-pie/pie.exp: Likewise. + * ld-scripts/phdrs2.exp: Likewise. + * ld-scripts/rgn-at5.d (target): Likewise. + * ld-shared/shared.exp: Likewise. + * ld-undefined/entry-3.d (target): Likewise. + * ld-undefined/entry-4.d (target): Likewise. + * ld-undefined/weak-undef.exp: Likewise. + 2011-02-09 Alan Modra * ld-elfvsb/elfvsb.exp: Don't run any non-PIC tests on powerpc*-linux. diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp index 74b6a5ca6f8..d0563deb89e 100644 --- a/ld/testsuite/ld-bootstrap/bootstrap.exp +++ b/ld/testsuite/ld-bootstrap/bootstrap.exp @@ -1,6 +1,6 @@ # Expect script for LD Bootstrap Tests # Copyright 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2004, -# 2005, 2006, 2007, 2009 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -77,14 +77,14 @@ foreach flags {"" "strip" "--static" "--traditional-format" } # Plugin support requires linking with a dynamic library which - # means that these + # means that these tests will fail. if { $flags == "--static" && $plugins == "yes" } then { untested $testname continue } # If we only have a shared libbfd, we probably can't run the - # --static test.will fail. + # --static test. if { $flags == "--static" && ! [string match "*libbfd.a*" $BFDLIB] } then { untested $testname continue diff --git a/ld/testsuite/ld-discard/discard.exp b/ld/testsuite/ld-discard/discard.exp index deb5dfdefb3..f1038cdde06 100644 --- a/ld/testsuite/ld-discard/discard.exp +++ b/ld/testsuite/ld-discard/discard.exp @@ -1,5 +1,5 @@ # Expect script for ld discard tests -# Copyright 2001, 2002, 2005, 2007 Free Software Foundation, Inc. +# Copyright 2001, 2002, 2005, 2007, 2010 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -25,14 +25,14 @@ # Test for ELF here, so we don't have to qualify on ELF specifically # in every .d-file. -if { ![istarget *-*-linux*] \ - && ![istarget *-*-gnu] \ - && ![istarget hppa*64*-*-hpux*] \ +if { ![istarget *-*-linux*] + && ![istarget *-*-gnu*] + && ![istarget hppa*64*-*-hpux*] && ![istarget *-*-elf] } { return } -if { [istarget *-*-linux*aout*] \ +if { [istarget *-*-linux*aout*] || [istarget *-*-linux*oldld*] } { return } diff --git a/ld/testsuite/ld-elf/binutils.exp b/ld/testsuite/ld-elf/binutils.exp index 422c5d71ba9..6f881f34903 100644 --- a/ld/testsuite/ld-elf/binutils.exp +++ b/ld/testsuite/ld-elf/binutils.exp @@ -1,5 +1,5 @@ # Expect script for binutils tests -# Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# Copyright 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -23,8 +23,8 @@ # Make sure that binutils can correctly handle ld output in ELF. -# Run on Linux only. -if { ![istarget *-*-linux*] } { +if { ![istarget *-*-linux*] + && ![istarget *-*-gnu*]} { return } @@ -109,7 +109,8 @@ binutils_test strip "-z relro -shared" relro1 binutils_test objcopy "-z relro" relro1 binutils_test objcopy "-z relro -shared" relro1 if { ([istarget "i?86-*-elf*"] - || ([istarget "i?86-*-linux*"] + || (([istarget "i?86-*-linux*"] + || [istarget "i?86-*-gnu*"]) && ![istarget "*-*-*aout*"] && ![istarget "*-*-*oldld*"]) || [istarget "x86_64-*-linux*"] diff --git a/ld/testsuite/ld-elf/commonpage1.d b/ld/testsuite/ld-elf/commonpage1.d index 76dc0565b34..2b175740c52 100644 --- a/ld/testsuite/ld-elf/commonpage1.d +++ b/ld/testsuite/ld-elf/commonpage1.d @@ -1,7 +1,7 @@ #source: maxpage1.s #ld: -z max-page-size=0x200000 -z common-page-size=0x100000 #readelf: -l --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... LOAD+.*0x200000 diff --git a/ld/testsuite/ld-elf/compress1c.d b/ld/testsuite/ld-elf/compress1c.d index 50426942af6..90abe0ff072 100644 --- a/ld/testsuite/ld-elf/compress1c.d +++ b/ld/testsuite/ld-elf/compress1c.d @@ -2,7 +2,7 @@ #as: --compress-debug-sections #ld: -shared #readelf: -S --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #failif #... diff --git a/ld/testsuite/ld-elf/discard1.d b/ld/testsuite/ld-elf/discard1.d index b80fbf02dbd..99de88eaf88 100644 --- a/ld/testsuite/ld-elf/discard1.d +++ b/ld/testsuite/ld-elf/discard1.d @@ -1,7 +1,7 @@ #source: discard1.s #ld: -r -T discard.ld #readelf: -r -#target: x86_64-*-linux-gnu i?86-*-linux-gnu +#target: x86_64-*-linux-gnu i?86-*-linux-gnu i?86-*-gnu* Relocation section '.rel.*.debug_info' at offset 0x[0-9a-z]+ contains 1 entries: [ \t]+Offset[ \t]+Info[ \t]+Type[ \t]+Sym.* diff --git a/ld/testsuite/ld-elf/discard2.d b/ld/testsuite/ld-elf/discard2.d index 65a3abe29ba..df106199408 100644 --- a/ld/testsuite/ld-elf/discard2.d +++ b/ld/testsuite/ld-elf/discard2.d @@ -1,7 +1,7 @@ #source: discard2.s #ld: -r -T discard.ld #readelf: -r -#target: x86_64-*-linux-gnu i?86-*-linux-gnu +#target: x86_64-*-linux-gnu i?86-*-linux-gnu i?86-*-gnu* Relocation section '.rel.*.debug_info' at offset 0x[0-9a-z]+ contains 1 entries: [ \t]+Offset[ \t]+Info[ \t]+Type[ \t]+Sym.* diff --git a/ld/testsuite/ld-elf/discard3.d b/ld/testsuite/ld-elf/discard3.d index 07962b53748..693488247b9 100644 --- a/ld/testsuite/ld-elf/discard3.d +++ b/ld/testsuite/ld-elf/discard3.d @@ -2,7 +2,7 @@ #source: discard2.s #ld: -r -T discard.ld #readelf: -r -#target: x86_64-*-linux-gnu i?86-*-linux-gnu +#target: x86_64-*-linux-gnu i?86-*-linux-gnu i?86-*-gnu* Relocation section '.rel.*.debug_info' at offset 0x[0-9a-z]+ contains 2 entries: [ \t]+Offset[ \t]+Info[ \t]+Type[ \t]+Sym.* diff --git a/ld/testsuite/ld-elf/dynsym1.d b/ld/testsuite/ld-elf/dynsym1.d index 88037ef7bae..b354aae2f9a 100644 --- a/ld/testsuite/ld-elf/dynsym1.d +++ b/ld/testsuite/ld-elf/dynsym1.d @@ -1,7 +1,7 @@ #source: empty.s #ld: -shared #readelf: --dyn-syms -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... +[0-9]+: +[0-9a-f]+ +[0-9]+ +FUNC +GLOBAL +DEFAULT +[1-9] _start diff --git a/ld/testsuite/ld-elf/eh6.d b/ld/testsuite/ld-elf/eh6.d index 75eb54b9d52..76be60585bf 100644 --- a/ld/testsuite/ld-elf/eh6.d +++ b/ld/testsuite/ld-elf/eh6.d @@ -1,7 +1,7 @@ #source: eh6.s #ld: --gc-sections -shared #readelf: -wf -#target: x86_64-*-linux-gnu i?86-*-linux-gnu +#target: x86_64-*-linux-gnu i?86-*-linux-gnu i?86-*-gnu* Contents of the .eh_frame section: diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp index 1e1f738efef..cff216048d0 100644 --- a/ld/testsuite/ld-elf/elf.exp +++ b/ld/testsuite/ld-elf/elf.exp @@ -1,5 +1,5 @@ # Expect script for various ELF tests. -# Copyright 2002, 2003, 2005, 2007, 2009 Free Software Foundation, Inc. +# Copyright 2002, 2003, 2005, 2007, 2009, 2010 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -41,7 +41,8 @@ foreach t $test_list { run_dump_test [file rootname $t] } -if { [istarget *-*-linux*] } { +if { [istarget *-*-linux*] + || [istarget *-*-gnu*] } { run_ld_link_tests { {"Weak symbols in dynamic objects 1 (support)" "-shared" "" {weak-dyn-1a.s} @@ -71,14 +72,25 @@ if ![isnative] { set array_tests { {"preinit array" "" "" {preinit.c} "preinit" "preinit.out"} - {"static preinit array" "-static" "" {preinit.c} "preinit" "preinit.out"} {"init array" "" "" {init.c} "init" "init.out"} - {"static init array" "-static" "" {init.c} "init" "init.out"} {"fini array" "" "" {fini.c} "fini" "fini.out"} +} +set array_tests_static { + {"static preinit array" "-static" "" {preinit.c} "preinit" "preinit.out"} + {"static init array" "-static" "" {init.c} "init" "init.out"} {"static fini array" "-static" "" {fini.c} "fini" "fini.out"} } # NetBSD ELF systems do not currently support the .*_array sections. -run_ld_link_exec_tests [list "*-*-netbsdelf*"] $array_tests +set xfails [list "*-*-netbsdelf*"] +run_ld_link_exec_tests $xfails $array_tests +# Be cautious to not XFAIL for *-*-linux-gnu*, *-*-kfreebsd-gnu*, etc. +switch -regexp $target_triplet { + ^\[^-\]*-\[^-\]*-gnu.*$ { + # + lappend xfails "*-*-*" + } +} +run_ld_link_exec_tests $xfails $array_tests_static catch "exec rm -f tmpdir/preinit tmpdir/init tmpdir/fini" status diff --git a/ld/testsuite/ld-elf/hash.d b/ld/testsuite/ld-elf/hash.d index 9bcd9a974a5..473cd4d7b87 100644 --- a/ld/testsuite/ld-elf/hash.d +++ b/ld/testsuite/ld-elf/hash.d @@ -1,7 +1,7 @@ #source: start.s #readelf: -d -s -D #ld: -shared --hash-style=gnu -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #notarget: mips*-*-* #... diff --git a/ld/testsuite/ld-elf/header.d b/ld/testsuite/ld-elf/header.d index d4388323ddd..be3722d957f 100644 --- a/ld/testsuite/ld-elf/header.d +++ b/ld/testsuite/ld-elf/header.d @@ -1,4 +1,4 @@ -# target: *-*-linux* *-*-vxworks +# target: *-*-linux* *-*-gnu* *-*-vxworks # ld: -T header.t -z max-page-size=0x100 # objdump: -hpw diff --git a/ld/testsuite/ld-elf/loadaddr1.d b/ld/testsuite/ld-elf/loadaddr1.d index 2d3469be253..0fd96a78ea3 100644 --- a/ld/testsuite/ld-elf/loadaddr1.d +++ b/ld/testsuite/ld-elf/loadaddr1.d @@ -1,7 +1,7 @@ #source: loadaddr.s #ld: -T loadaddr1.t -T loadaddr.t -z max-page-size=0x200000 #readelf: -l --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... LOAD +0x000000 0xf*80000000 0xf*80000000 0x100050 0x100050 RWE 0x200000 diff --git a/ld/testsuite/ld-elf/loadaddr2.d b/ld/testsuite/ld-elf/loadaddr2.d index e447e384c37..5825fe8494c 100644 --- a/ld/testsuite/ld-elf/loadaddr2.d +++ b/ld/testsuite/ld-elf/loadaddr2.d @@ -1,7 +1,7 @@ #source: loadaddr.s #ld: -T loadaddr2.t -T loadaddr.t -z max-page-size=0x200000 #readelf: -l --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... LOAD +0x000000 0xf*80000000 0xf*80000000 0x100050 0x100050 RWE 0x200000 diff --git a/ld/testsuite/ld-elf/loadaddr3a.d b/ld/testsuite/ld-elf/loadaddr3a.d index b2ace667a92..10cb9a588f4 100644 --- a/ld/testsuite/ld-elf/loadaddr3a.d +++ b/ld/testsuite/ld-elf/loadaddr3a.d @@ -1,7 +1,7 @@ #source: loadaddr.s #ld: -T loadaddr3.t -z max-page-size=0x200000 #readelf: -l --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... LOAD +0x000000 0x0*00000000 0x0*00000000 0x0*0110 0x0*0110 R E 0x.* diff --git a/ld/testsuite/ld-elf/loadaddr3b.d b/ld/testsuite/ld-elf/loadaddr3b.d index af7e6e4e07e..63efa71c133 100644 --- a/ld/testsuite/ld-elf/loadaddr3b.d +++ b/ld/testsuite/ld-elf/loadaddr3b.d @@ -1,7 +1,7 @@ #source: loadaddr.s #ld: -T loadaddr3.t -z max-page-size=0x200000 #objdump: -t -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... 0+0000100 l d .text 0+0000000 .text diff --git a/ld/testsuite/ld-elf/local1.d b/ld/testsuite/ld-elf/local1.d index 5957d8f4b63..3025d419716 100644 --- a/ld/testsuite/ld-elf/local1.d +++ b/ld/testsuite/ld-elf/local1.d @@ -1,6 +1,6 @@ #ld: -shared --version-script local1.map #readelf: -s --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... .*: [0-9a-f]* +[0-9a-f]+ +OBJECT +LOCAL +DEFAULT +[0-9] +foo diff --git a/ld/testsuite/ld-elf/maxpage1.d b/ld/testsuite/ld-elf/maxpage1.d index 57acda090a9..f7762573998 100644 --- a/ld/testsuite/ld-elf/maxpage1.d +++ b/ld/testsuite/ld-elf/maxpage1.d @@ -1,7 +1,7 @@ #source: maxpage1.s #ld: -z max-page-size=0x200000 #readelf: -l --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... LOAD+.*0x200000 diff --git a/ld/testsuite/ld-elf/maxpage2.d b/ld/testsuite/ld-elf/maxpage2.d index 7fe93798846..7d732eb80ee 100644 --- a/ld/testsuite/ld-elf/maxpage2.d +++ b/ld/testsuite/ld-elf/maxpage2.d @@ -1,7 +1,7 @@ #source: maxpage1.s #ld: -z max-page-size=0x100000 #readelf: -l --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... LOAD+.*0x100000 diff --git a/ld/testsuite/ld-elf/maxpage3a.d b/ld/testsuite/ld-elf/maxpage3a.d index 0e46b6bb3e8..7d6f2d8ab99 100644 --- a/ld/testsuite/ld-elf/maxpage3a.d +++ b/ld/testsuite/ld-elf/maxpage3a.d @@ -1,7 +1,7 @@ #source: maxpage1.s #ld: -z max-page-size=0x10000000 -T maxpage3.t #readelf: -lS --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... \[[ 0-9]+\] \.data[ \t]+PROGBITS[ \t]+0*10000000[ \t]+[ \t0-9a-f]+WA?.* diff --git a/ld/testsuite/ld-elf/multibss1.d b/ld/testsuite/ld-elf/multibss1.d index a6fd9b3ed2b..89b94adfa1e 100644 --- a/ld/testsuite/ld-elf/multibss1.d +++ b/ld/testsuite/ld-elf/multibss1.d @@ -1,7 +1,7 @@ #source: multibss1.s #ld: -e 0 #readelf: -l --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #xfail: hppa64-*-* # hppa64 default script add 16 bytes at start of .data giving 0x500010 p_memsz diff --git a/ld/testsuite/ld-elf/noload-2.d b/ld/testsuite/ld-elf/noload-2.d index 633bf456383..0e25d9beef6 100644 --- a/ld/testsuite/ld-elf/noload-2.d +++ b/ld/testsuite/ld-elf/noload-2.d @@ -1,7 +1,7 @@ #source: noload-1.s #ld: -T noload-1.t -z max-page-size=0x200000 #readelf: -Sl --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... +LOAD +0x200000 +0x0+ +0x0+ +0x0+ +0x0+1 +RW +0x200000 diff --git a/ld/testsuite/ld-elf/pr9676.rd b/ld/testsuite/ld-elf/pr9676.rd index 44a11cea2b7..2d832dbe1e9 100644 --- a/ld/testsuite/ld-elf/pr9676.rd +++ b/ld/testsuite/ld-elf/pr9676.rd @@ -1,5 +1,5 @@ Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +LOCAL +DEFAULT +[0-9]+ +foo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +LOCAL +DEFAULT +[0-9]+ +_?foo #... diff --git a/ld/testsuite/ld-elf/pr9679.rd b/ld/testsuite/ld-elf/pr9679.rd index 44a11cea2b7..2d832dbe1e9 100644 --- a/ld/testsuite/ld-elf/pr9679.rd +++ b/ld/testsuite/ld-elf/pr9679.rd @@ -1,5 +1,5 @@ Symbol table '\.dynsym' contains [0-9]+ entries: +Num: +Value +Size Type +Bind +Vis +Ndx Name #... - +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +LOCAL +DEFAULT +[0-9]+ +foo + +[0-9]+: +[0-9a-f]+ +[0-9a-f]+ +FUNC +LOCAL +DEFAULT +[0-9]+ +_?foo #... diff --git a/ld/testsuite/ld-elf/seg.d b/ld/testsuite/ld-elf/seg.d index d9436aeb776..2255195dab1 100644 --- a/ld/testsuite/ld-elf/seg.d +++ b/ld/testsuite/ld-elf/seg.d @@ -1,4 +1,4 @@ -#target: *-*-linux* *-*-vxworks +#target: *-*-linux* *-*-gnu* *-*-vxworks #source: seg.s #ld: -T seg.t -z max-page-size=0x1000 #readelf: -l --wide diff --git a/ld/testsuite/ld-elf/textaddr1.d b/ld/testsuite/ld-elf/textaddr1.d index f7a3ad953e1..e1d6731a03d 100644 --- a/ld/testsuite/ld-elf/textaddr1.d +++ b/ld/testsuite/ld-elf/textaddr1.d @@ -1,7 +1,7 @@ #source: maxpage1.s #ld: -Ttext-segment 0x7000000 -z max-page-size=0x200000 #readelf: -l --wide -#target: *-*-linux-gnu +#target: *-*-linux-gnu *-*-gnu* #... LOAD +0x0+ 0x0*7000000 0x0*7000000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x200000 diff --git a/ld/testsuite/ld-elf/textaddr2.d b/ld/testsuite/ld-elf/textaddr2.d index 9d1b0e51b13..bcd3658bb75 100644 --- a/ld/testsuite/ld-elf/textaddr2.d +++ b/ld/testsuite/ld-elf/textaddr2.d @@ -1,8 +1,8 @@ #source: maxpage1.s #ld: -shared -Ttext-segment 0x7000000 -z max-page-size=0x200000 #readelf: -l --wide -#target: *-*-linux-gnu +#target: *-*-linux-gnu *-*-gnu* #... - LOAD +0x0+ 0x0*7000000 0x0*7000000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x200000 + LOAD +0x0+ 0x0*7000000 0x0*7000000 0x0*[0-9a-f]+ 0x0*[0-9a-f]+ R[ W]E 0x200000 #pass diff --git a/ld/testsuite/ld-elf/textaddr3.d b/ld/testsuite/ld-elf/textaddr3.d index d533e242bd0..29ed4984b4a 100644 --- a/ld/testsuite/ld-elf/textaddr3.d +++ b/ld/testsuite/ld-elf/textaddr3.d @@ -1,4 +1,4 @@ #source: maxpage1.s #ld: -Ttext-segment 0x10000 -z max-page-size=0x200000 -#target: *-*-linux-gnu +#target: *-*-linux-gnu *-*-gnu* #warning: .*address of `text-segment' isn't multiple of maximum page size diff --git a/ld/testsuite/ld-elf/textaddr4.d b/ld/testsuite/ld-elf/textaddr4.d index bfd7630e47b..16df9a8ab1e 100644 --- a/ld/testsuite/ld-elf/textaddr4.d +++ b/ld/testsuite/ld-elf/textaddr4.d @@ -1,7 +1,7 @@ #source: maxpage1.s #ld: -z max-page-size=0x10000 -Ttext-segment 0x10000 #readelf: -l --wide -#target: *-*-linux-gnu +#target: *-*-linux-gnu *-*-gnu* #... LOAD +0x0+ 0x0*10000 0x0*10000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x10000 diff --git a/ld/testsuite/ld-elf/textaddr5.d b/ld/testsuite/ld-elf/textaddr5.d index 5fe41d0aa9d..41d00c5af42 100644 --- a/ld/testsuite/ld-elf/textaddr5.d +++ b/ld/testsuite/ld-elf/textaddr5.d @@ -1,4 +1,4 @@ #source: maxpage1.s #ld: -shared -z max-page-size=0x200000 -Ttext-segment 0x10000 -#target: *-*-linux-gnu +#target: *-*-linux-gnu *-*-gnu* #warning: .*address of `text-segment' isn't multiple of maximum page size diff --git a/ld/testsuite/ld-elf/textaddr6.d b/ld/testsuite/ld-elf/textaddr6.d index b3b9f847328..584784b2d59 100644 --- a/ld/testsuite/ld-elf/textaddr6.d +++ b/ld/testsuite/ld-elf/textaddr6.d @@ -1,8 +1,8 @@ #source: maxpage1.s #ld: -shared -z max-page-size=0x10000 -Ttext-segment 0x10000 #readelf: -l --wide -#target: *-*-linux-gnu +#target: *-*-linux-gnu *-*-gnu* #... - LOAD +0x0+ 0x0*10000 0x0*10000 0x0*[0-9a-f][0-9a-f][0-9a-f] 0x0*[0-9a-f][0-9a-f][0-9a-f] R E 0x10000 + LOAD +0x0+ 0x0*10000 0x0*10000 0x0*[0-9a-f]+ 0x0*[0-9a-f]+ R[ W]E 0x10000 #pass diff --git a/ld/testsuite/ld-elf/textaddr7.d b/ld/testsuite/ld-elf/textaddr7.d index 54a571f5839..b4237db4f1c 100644 --- a/ld/testsuite/ld-elf/textaddr7.d +++ b/ld/testsuite/ld-elf/textaddr7.d @@ -1,7 +1,7 @@ #source: maxpage1.s #ld: -n -z max-page-size=0x200000 -Ttext-segment 0x10000 #readelf: -l --wide -#target: *-*-linux-gnu +#target: *-*-linux-gnu *-*-gnu* #... LOAD .* diff --git a/ld/testsuite/ld-elf/tls_common.exp b/ld/testsuite/ld-elf/tls_common.exp index 66a550ccdf7..77dca2c02e4 100644 --- a/ld/testsuite/ld-elf/tls_common.exp +++ b/ld/testsuite/ld-elf/tls_common.exp @@ -1,5 +1,5 @@ # Expect script for .tls_common tests -# Copyright 2006, 2007 Free Software Foundation, Inc. +# Copyright 2006, 2007, 2010 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -23,8 +23,8 @@ # Make sure that binutils can correctly handle ld output in ELF. -# Run on Linux only. -if { ![istarget *-*-linux*] } { +if { ![istarget *-*-linux*] + && ![istarget *-*-gnu*] } { return } diff --git a/ld/testsuite/ld-elf/unknown2.d b/ld/testsuite/ld-elf/unknown2.d index 467d5d346b5..8d6cdeef58b 100644 --- a/ld/testsuite/ld-elf/unknown2.d +++ b/ld/testsuite/ld-elf/unknown2.d @@ -1,7 +1,7 @@ #source: unknown2.s #ld: -shared #readelf: -S -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... \[[ 0-9]+\] \.note.foo[ \t]+NOTE[ \t]+.* diff --git a/ld/testsuite/ld-elfcomm/elfcomm.exp b/ld/testsuite/ld-elfcomm/elfcomm.exp index e45c6b199bf..572931b9489 100644 --- a/ld/testsuite/ld-elfcomm/elfcomm.exp +++ b/ld/testsuite/ld-elfcomm/elfcomm.exp @@ -209,8 +209,8 @@ if { [ld_simple_link $ld tmpdir/common1.o $options] } { } # This test fails on MIPS because the backend sets type_change_ok. -# The size change warning is suppressed. -if {[istarget mips*-*-*]} { +# The size change warning is suppressed. Same on hppa64. +if {[istarget mips*-*-*] || [istarget hppa*64*-*-*]} { if { ![regexp "Warning: alignment (\[0-9\]+) of symbol \`_?foo1\' in tmpdir/common1b.o is smaller than 64 in tmpdir/common1a.o" $link_output] } { fail $test1w1 } else { diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp index c4228aded84..d43c12e12e9 100644 --- a/ld/testsuite/ld-elfvers/vers.exp +++ b/ld/testsuite/ld-elfvers/vers.exp @@ -29,34 +29,34 @@ if ![isnative] then {return} # This test can only be run on a couple of ELF platforms. # Square bracket expressions seem to confuse istarget. # This is similar to the test that is used in ld-shared, BTW. -if { ![istarget hppa*64*-*-hpux*] \ - && ![istarget hppa*-*-linux*] \ - && ![istarget i?86-*-sysv4*] \ - && ![istarget i?86-*-unixware] \ - && ![istarget i?86-*-elf*] \ - && ![istarget i?86-*-linux*] \ - && ![istarget ia64-*-elf*] \ - && ![istarget ia64-*-linux*] \ - && ![istarget m68k-*-linux*] \ - && ![istarget mips*-*-irix5*] \ - && ![istarget powerpc*-*-elf*] \ - && ![istarget powerpc*-*-linux*] \ - && ![istarget powerpc*-*-sysv4*] \ - && ![istarget sparc*-*-elf] \ - && ![istarget sparc*-*-solaris2*] \ - && ![istarget sparc*-*-linux*] \ - && ![istarget arm*-*-linux*] \ - && ![istarget mips*-*-linux*] \ - && ![istarget alpha*-*-linux*] \ - && ![istarget s390*-*-linux*] \ - && ![istarget sh\[34\]*-*-linux*] \ +if { ![istarget hppa*64*-*-hpux*] + && ![istarget hppa*-*-linux*] + && ![istarget i?86-*-sysv4*] + && ![istarget i?86-*-unixware] + && ![istarget i?86-*-elf*] + && ![istarget i?86-*-linux*] + && ![istarget i?86-*-gnu*] + && ![istarget ia64-*-elf*] + && ![istarget ia64-*-linux*] + && ![istarget m68k-*-linux*] + && ![istarget mips*-*-irix5*] + && ![istarget powerpc*-*-elf*] + && ![istarget powerpc*-*-linux*] + && ![istarget powerpc*-*-sysv4*] + && ![istarget sparc*-*-elf] + && ![istarget sparc*-*-solaris2*] + && ![istarget sparc*-*-linux*] + && ![istarget arm*-*-linux*] + && ![istarget mips*-*-linux*] + && ![istarget alpha*-*-linux*] + && ![istarget s390*-*-linux*] + && ![istarget sh\[34\]*-*-linux*] && ![istarget x86_64-*-linux*] } { return } -if { [istarget i?86-*-linux*aout*] \ - || [istarget i?86-*-linux*oldld*] \ - || [istarget m68k-*-linux*aout*] } { +if { [istarget *-*-linux*aout*] + || [istarget *-*-linux*oldld*] } { return } @@ -83,9 +83,9 @@ if [istarget mips*-*-*] { catch "exec $CC $picflag" exec_output send_log "$exec_output\n" verbose "--" "$exec_output" - if { [string match "*illegal option*" $exec_output] \ - || [string match "*option ignored*" $exec_output] \ - || [string match "*unrecognized option*" $exec_output] \ + if { [string match "*illegal option*" $exec_output] + || [string match "*option ignored*" $exec_output] + || [string match "*unrecognized option*" $exec_output] || [string match "*passed to ld*" $exec_output] } { if [istarget *-*-sunos4*] { set picflag "-pic" @@ -803,11 +803,11 @@ build_exec "vers3" vers3.c vers3 "" vers1.so vers3.ver vers3.dsym "" setup_xfail "mips*-*-*" build_exec "vers4" vers4.c vers4 "" "" "" "" vers4.sym -build_exec "vers4a" vers4.c vers4a "-export-dynamic" "" vers4a.ver vers4a.dsym vers4a.sym +build_exec "vers4a" vers4.c vers4a "-Wl,-export-dynamic" "" vers4a.ver vers4a.dsym vers4a.sym # Verify that --no-export-dynamic undoes the effect of --export-dynamic. setup_xfail "mips*-*-*" -build_exec "vers4b" vers4.c vers4b "-export-dynamic -Wl,--no-export-dynamic" "" "" "" vers4.sym +build_exec "vers4b" vers4.c vers4b "-Wl,-export-dynamic -Wl,--no-export-dynamic" "" "" "" vers4.sym # @@ -848,7 +848,7 @@ build_vers_lib_pic "vers8" vers1.c vers8 vers8.map "" vers8.ver vers1.dsym vers1 # This test tries to make sure that version references to versioned symbols # don't collide with default definitions with the same symbol. # -build_exec "vers9" vers9.c vers9 "-export-dynamic" "" vers9.ver vers9.dsym vers9.sym +build_exec "vers9" vers9.c vers9 "-Wl,-export-dynamic" "" vers9.ver vers9.dsym vers9.sym # diff --git a/ld/testsuite/ld-elfvers/vers1.c b/ld/testsuite/ld-elfvers/vers1.c index c27bc3bce7e..86e2bd2ba16 100644 --- a/ld/testsuite/ld-elfvers/vers1.c +++ b/ld/testsuite/ld-elfvers/vers1.c @@ -3,6 +3,8 @@ * a bunch of definitions of the same symbol, and we can theoretically * then link applications against varying sets of these. */ +#include "vers.h" + const char * show_bar1 = "asdf"; const char * show_bar2 = "asdf"; @@ -47,10 +49,10 @@ hide_new_foo() } -__asm__(".symver hide_original_foo,show_foo@"); -__asm__(".symver hide_old_foo,show_foo@VERS_1.1"); -__asm__(".symver hide_old_foo1,show_foo@VERS_1.2"); -__asm__(".symver hide_new_foo,show_foo@@VERS_2.0"); +SYMVER(hide_original_foo, show_foo@); +SYMVER(hide_old_foo, show_foo@VERS_1.1); +SYMVER(hide_old_foo1, show_foo@VERS_1.2); +SYMVER(hide_new_foo, show_foo@@VERS_2.0); @@ -63,7 +65,7 @@ hide_new_bogus_foo() return 1000+bar(); } -__asm__(".symver hide_new_bogus_foo,show_foo@VERS_2.2"); +SYMVER(hide_new_bogus_foo, show_foo@VERS_2.2); #endif @@ -81,8 +83,8 @@ xyzzz() bar33(); } -__asm__(".symver new2_foo,fooVERS_2.0"); -__asm__(".symver bar33,bar@@VERS_2.0"); +SYMVER(new2_foo, fooVERS_2.0); +SYMVER(bar33, bar@@VERS_2.0); #endif #ifdef DO_TEST12 @@ -97,5 +99,5 @@ xyzzz() bar33(); } -__asm__(".symver bar33,bar@@VERS_2.0"); +SYMVER(bar33, bar@@VERS_2.0); #endif diff --git a/ld/testsuite/ld-elfvers/vers1.dsym b/ld/testsuite/ld-elfvers/vers1.dsym index d33ab2007de..9d1975288c7 100644 --- a/ld/testsuite/ld-elfvers/vers1.dsym +++ b/ld/testsuite/ld-elfvers/vers1.dsym @@ -1,9 +1,9 @@ 0+ g +DO \*ABS\* 0+ +VERS_1\.1 +VERS_1\.1 0+ g +DO \*ABS\* 0+ +VERS_1\.2 +VERS_1\.2 0+ g +DO \*ABS\* 0+ +VERS_2\.0 +VERS_2\.0 -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(Base\) +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.1\) +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.2\) +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ g +DO (\.s?data|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +show_bar1 -[0-9a-f]+ g +DO (\.s?data|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +show_bar2 +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(Base\) +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.1\) +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.2\) +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ g +DO (\.s?data|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +_?show_bar1 +[0-9a-f]+ g +DO (\.s?data|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +_?show_bar2 diff --git a/ld/testsuite/ld-elfvers/vers1.sym b/ld/testsuite/ld-elfvers/vers1.sym index ed589e83d70..f2bb9db2a4e 100644 --- a/ld/testsuite/ld-elfvers/vers1.sym +++ b/ld/testsuite/ld-elfvers/vers1.sym @@ -1,4 +1,4 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@VERS_1\.1 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@VERS_1\.2 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@@VERS_2\.0 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@ +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.1 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.2 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@@VERS_2\.0 diff --git a/ld/testsuite/ld-elfvers/vers15.c b/ld/testsuite/ld-elfvers/vers15.c index 4e22cac092a..2457d297555 100644 --- a/ld/testsuite/ld-elfvers/vers15.c +++ b/ld/testsuite/ld-elfvers/vers15.c @@ -3,6 +3,7 @@ * that we always get the right one. */ #include +#include "vers.h" int foo_1() @@ -31,6 +32,6 @@ main() return 0; } -__asm__(".symver foo_1,show_foo@"); -__asm__(".symver foo_2,show_foo@VERS_1.1"); -__asm__(".symver foo_3,show_foo@@VERS_1.2"); +SYMVER(foo_1, show_foo@); +SYMVER(foo_2, show_foo@VERS_1.1); +SYMVER(foo_3, show_foo@@VERS_1.2); diff --git a/ld/testsuite/ld-elfvers/vers15.dsym b/ld/testsuite/ld-elfvers/vers15.dsym index fc4c9962ea5..750c35832ab 100644 --- a/ld/testsuite/ld-elfvers/vers15.dsym +++ b/ld/testsuite/ld-elfvers/vers15.dsym @@ -1,5 +1,5 @@ 0+ g +DO \*ABS\* 0+ +VERS_1\.1 +VERS_1\.1 0+ g +DO \*ABS\* 0+ +VERS_1\.2 +VERS_1\.2 -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(Base\) +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.1\) +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1\.2 +(0x[0-9a-f]+ )?show_foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(Base\) +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.1\) +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1\.2 +(0x[0-9a-f]+ )?_?show_foo diff --git a/ld/testsuite/ld-elfvers/vers15.sym b/ld/testsuite/ld-elfvers/vers15.sym index ba9f83e1912..a642c9dbabc 100644 --- a/ld/testsuite/ld-elfvers/vers15.sym +++ b/ld/testsuite/ld-elfvers/vers15.sym @@ -1,3 +1,3 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@VERS_1\.1 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@@VERS_1\.2 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@ +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.1 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@@VERS_1\.2 diff --git a/ld/testsuite/ld-elfvers/vers16.dsym b/ld/testsuite/ld-elfvers/vers16.dsym index 6733ece6def..8ee49187924 100644 --- a/ld/testsuite/ld-elfvers/vers16.dsym +++ b/ld/testsuite/ld-elfvers/vers16.dsym @@ -1,2 +1,2 @@ -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+( +Base +)? (0x[0-9a-f]+ )?show_bar -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +(0x[0-9a-f]+ )?show_foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+( +Base +)? (0x[0-9a-f]+ )?_?show_bar +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +(0x[0-9a-f]+ )?_?show_foo diff --git a/ld/testsuite/ld-elfvers/vers16a.dsym b/ld/testsuite/ld-elfvers/vers16a.dsym index aaca9f5e332..c38d71aea9e 100644 --- a/ld/testsuite/ld-elfvers/vers16a.dsym +++ b/ld/testsuite/ld-elfvers/vers16a.dsym @@ -1,3 +1,3 @@ [0-9a-f]+ g +DO (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1\.1 +VERS_1\.1 -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1\.1 +(0x[0-9a-f]+ )?show_bar -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +Base +(0x[0-9a-f]+ )?show_foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1\.1 +(0x[0-9a-f]+ )?_?show_bar +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +Base +(0x[0-9a-f]+ )?_?show_foo diff --git a/ld/testsuite/ld-elfvers/vers17.dsym b/ld/testsuite/ld-elfvers/vers17.dsym index 98106593c9f..4cbb334dc0d 100644 --- a/ld/testsuite/ld-elfvers/vers17.dsym +++ b/ld/testsuite/ld-elfvers/vers17.dsym @@ -1,2 +1,2 @@ 0+ g +DO \*ABS\* 0+ +VERS_2\.0 +VERS_2\.0 -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?show_foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?_?show_foo diff --git a/ld/testsuite/ld-elfvers/vers18.c b/ld/testsuite/ld-elfvers/vers18.c index 25dcc25999c..9965b88a029 100644 --- a/ld/testsuite/ld-elfvers/vers18.c +++ b/ld/testsuite/ld-elfvers/vers18.c @@ -1,3 +1,5 @@ +#include "vers.h" + int bar () { @@ -36,7 +38,7 @@ hide_new_foo () return 1000 + bar (); } -__asm__(".symver hide_original_foo,show_foo@"); -__asm__(".symver hide_old_foo,show_foo@VERS_1.1"); -__asm__(".symver hide_old_foo1,show_foo@VERS_1.2"); -__asm__(".symver hide_new_foo,show_foo@@VERS_2.0"); +SYMVER(hide_original_foo, show_foo@); +SYMVER(hide_old_foo, show_foo@VERS_1.1); +SYMVER(hide_old_foo1, show_foo@VERS_1.2); +SYMVER(hide_new_foo, show_foo@@VERS_2.0); diff --git a/ld/testsuite/ld-elfvers/vers18.dsym b/ld/testsuite/ld-elfvers/vers18.dsym index 49bd7b2b356..38071cb456d 100644 --- a/ld/testsuite/ld-elfvers/vers18.dsym +++ b/ld/testsuite/ld-elfvers/vers18.dsym @@ -1,7 +1,7 @@ 0+ g +DO \*ABS\* 0+ +VERS_1\.1 +VERS_1\.1 0+ g +DO \*ABS\* 0+ +VERS_1\.2 +VERS_1\.2 0+ g +DO \*ABS\* 0+ +VERS_2\.0 +VERS_2\.0 -[0-9a-f]+ +w +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(Base\) +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ +w +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.1\) +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ +w +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.2\) +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ +w +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?show_foo +[0-9a-f]+ +w +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(Base\) +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ +w +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.1\) +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ +w +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.2\) +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ +w +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?_?show_foo diff --git a/ld/testsuite/ld-elfvers/vers18.sym b/ld/testsuite/ld-elfvers/vers18.sym index bcc88820da7..0b1183ccfd8 100644 --- a/ld/testsuite/ld-elfvers/vers18.sym +++ b/ld/testsuite/ld-elfvers/vers18.sym @@ -1,4 +1,4 @@ -[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@ -[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@VERS_1\.1 -[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@VERS_1\.2 -[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_foo@@VERS_2\.0 +[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@ +[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.1 +[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@VERS_1\.2 +[0-9a-f]+ +w +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_foo@@VERS_2\.0 diff --git a/ld/testsuite/ld-elfvers/vers19.dsym b/ld/testsuite/ld-elfvers/vers19.dsym index 7396deeca5f..a77f9490127 100644 --- a/ld/testsuite/ld-elfvers/vers19.dsym +++ b/ld/testsuite/ld-elfvers/vers19.dsym @@ -1 +1 @@ -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?show_foo +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?_?show_foo diff --git a/ld/testsuite/ld-elfvers/vers2.dsym b/ld/testsuite/ld-elfvers/vers2.dsym index 63f15db45f5..30ba91b82b4 100644 --- a/ld/testsuite/ld-elfvers/vers2.dsym +++ b/ld/testsuite/ld-elfvers/vers2.dsym @@ -1,3 +1,3 @@ -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?show_foo +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?_?show_foo 0+ g +DO \*ABS\* 0+ +VERS_XXX_1\.1 VERS_XXX_1\.1 -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_XXX_1\.1 (0x[0-9a-f]+ )?show_xyzzy +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_XXX_1\.1 (0x[0-9a-f]+ )?_?show_xyzzy diff --git a/ld/testsuite/ld-elfvers/vers20.dsym b/ld/testsuite/ld-elfvers/vers20.dsym index 559170c1b0c..fc13955b8d7 100644 --- a/ld/testsuite/ld-elfvers/vers20.dsym +++ b/ld/testsuite/ld-elfvers/vers20.dsym @@ -1,2 +1,2 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS_1\.1[ ]+VERS_1\.1 -[0-9a-f]+[ ]+g[ ]+DO[ ]+\.s?bss[ ]+[0-9a-f]+[ ]+VERS_1\.1[ ]+show_foo +[0-9a-f]+[ ]+g[ ]+DO[ ]+\.s?bss[ ]+[0-9a-f]+[ ]+VERS_1\.1[ ]+_?show_foo diff --git a/ld/testsuite/ld-elfvers/vers21.c b/ld/testsuite/ld-elfvers/vers21.c index 2879c7f0e3d..3a75b48add1 100644 --- a/ld/testsuite/ld-elfvers/vers21.c +++ b/ld/testsuite/ld-elfvers/vers21.c @@ -1,7 +1,9 @@ -__asm__(".symver _old_foo,foo@VERS.0"); -__asm__(".symver _old_bar,bar@VERS.0"); -__asm__(".symver _old_foobar,foobar@VERS.0"); -__asm__(".weak _old_bar"); +#include "vers.h" + +SYMVER(_old_foo, foo@VERS.0); +SYMVER(_old_bar, bar@VERS.0); +SYMVER(_old_foobar, foobar@VERS.0); +__asm__(".weak " SYMPFX(_old_bar)); int bar () diff --git a/ld/testsuite/ld-elfvers/vers21.dsym b/ld/testsuite/ld-elfvers/vers21.dsym index 4cb21882c25..7800a0c3499 100644 --- a/ld/testsuite/ld-elfvers/vers21.dsym +++ b/ld/testsuite/ld-elfvers/vers21.dsym @@ -1,4 +1,4 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+w[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+|)[ ]*bar -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+|)[ ]*foo -[0-9a-f]+[ ]+g[ ]+DO[ ]+\.s?data[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+foobar +[0-9a-f]+[ ]+w[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+|)[ ]*_?bar +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+|)[ ]*_?foo +[0-9a-f]+[ ]+g[ ]+DO[ ]+\.s?data[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+_?foobar diff --git a/ld/testsuite/ld-elfvers/vers21.sym b/ld/testsuite/ld-elfvers/vers21.sym index e7de74f4872..e2b2038e321 100644 --- a/ld/testsuite/ld-elfvers/vers21.sym +++ b/ld/testsuite/ld-elfvers/vers21.sym @@ -1,3 +1,3 @@ -[0-9a-f]+[ ]+g[ ]+O[ ]+\.s?data[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?foobar@VERS\.0 -[0-9a-f]+[ ]+w[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?bar@VERS\.0 -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?foo@VERS\.0 +[0-9a-f]+[ ]+g[ ]+O[ ]+\.s?data[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?foobar@VERS\.0 +[0-9a-f]+[ ]+w[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?bar@VERS\.0 +[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?foo@VERS\.0 diff --git a/ld/testsuite/ld-elfvers/vers22.dsym b/ld/testsuite/ld-elfvers/vers22.dsym index 5dfa465b90d..db2aeec4bc3 100644 --- a/ld/testsuite/ld-elfvers/vers22.dsym +++ b/ld/testsuite/ld-elfvers/vers22.dsym @@ -1 +1 @@ -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS\.0 +(0x[0-9a-f]+ )?bar +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS\.0 +(0x[0-9a-f]+ )?_?bar diff --git a/ld/testsuite/ld-elfvers/vers22a.c b/ld/testsuite/ld-elfvers/vers22a.c index 288c82093e3..bc5777bb83c 100644 --- a/ld/testsuite/ld-elfvers/vers22a.c +++ b/ld/testsuite/ld-elfvers/vers22a.c @@ -1,4 +1,6 @@ -__asm__(".symver _old_bar,bar@VERS.0"); +#include "vers.h" + +SYMVER(_old_bar, bar@VERS.0); void _old_bar () diff --git a/ld/testsuite/ld-elfvers/vers22a.dsym b/ld/testsuite/ld-elfvers/vers22a.dsym index af061233866..0c8d0278279 100644 --- a/ld/testsuite/ld-elfvers/vers22a.dsym +++ b/ld/testsuite/ld-elfvers/vers22a.dsym @@ -1,2 +1,2 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+ )?bar +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+ )?_?bar diff --git a/ld/testsuite/ld-elfvers/vers22a.sym b/ld/testsuite/ld-elfvers/vers22a.sym index ff077087532..c3f4150ccaa 100644 --- a/ld/testsuite/ld-elfvers/vers22a.sym +++ b/ld/testsuite/ld-elfvers/vers22a.sym @@ -1 +1 @@ -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?bar@VERS.0 +[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?bar@VERS.0 diff --git a/ld/testsuite/ld-elfvers/vers22b.dsym b/ld/testsuite/ld-elfvers/vers22b.dsym index 88c31b303f1..47f0606a81b 100644 --- a/ld/testsuite/ld-elfvers/vers22b.dsym +++ b/ld/testsuite/ld-elfvers/vers22b.dsym @@ -1,2 +1,2 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?bar +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?_?bar diff --git a/ld/testsuite/ld-elfvers/vers23.dsym b/ld/testsuite/ld-elfvers/vers23.dsym index 8c85a4ae9f5..dfd6a3321ad 100644 --- a/ld/testsuite/ld-elfvers/vers23.dsym +++ b/ld/testsuite/ld-elfvers/vers23.dsym @@ -1 +1 @@ -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS\.0 +(0x[0-9a-f]+ )?foo +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS\.0 +(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers23a.c b/ld/testsuite/ld-elfvers/vers23a.c index 250d6f9eefa..13c8edd6e35 100644 --- a/ld/testsuite/ld-elfvers/vers23a.c +++ b/ld/testsuite/ld-elfvers/vers23a.c @@ -1,4 +1,6 @@ -__asm__(".symver _old_bar,bar@VERS.0"); +#include "vers.h" + +SYMVER(_old_bar, bar@VERS.0); void _old_bar (void) diff --git a/ld/testsuite/ld-elfvers/vers23a.dsym b/ld/testsuite/ld-elfvers/vers23a.dsym index 4450665ff92..04385b002d4 100644 --- a/ld/testsuite/ld-elfvers/vers23a.dsym +++ b/ld/testsuite/ld-elfvers/vers23a.dsym @@ -1,3 +1,3 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+ )?bar -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+ )?_?bar +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers23a.sym b/ld/testsuite/ld-elfvers/vers23a.sym index ff077087532..c3f4150ccaa 100644 --- a/ld/testsuite/ld-elfvers/vers23a.sym +++ b/ld/testsuite/ld-elfvers/vers23a.sym @@ -1 +1 @@ -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?bar@VERS.0 +[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?bar@VERS.0 diff --git a/ld/testsuite/ld-elfvers/vers23b.dsym b/ld/testsuite/ld-elfvers/vers23b.dsym index 88c31b303f1..47f0606a81b 100644 --- a/ld/testsuite/ld-elfvers/vers23b.dsym +++ b/ld/testsuite/ld-elfvers/vers23b.dsym @@ -1,2 +1,2 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?bar +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?_?bar diff --git a/ld/testsuite/ld-elfvers/vers23d.dsym b/ld/testsuite/ld-elfvers/vers23d.dsym index b31b82b05a1..ab5fbd834e7 100644 --- a/ld/testsuite/ld-elfvers/vers23d.dsym +++ b/ld/testsuite/ld-elfvers/vers23d.dsym @@ -1,2 +1,2 @@ -[0-9a-f]* DF \*UND\* [0-9a-f]* VERS.0 (0x[0-9a-f][0-9a-f] )?bar -[0-9a-f]* DF \*UND\* [0-9a-f]* VERS.0 (0x[0-9a-f][0-9a-f] )?foo +[0-9a-f]* DF \*UND\* [0-9a-f]* VERS.0 (0x[0-9a-f][0-9a-f] )?_?bar +[0-9a-f]* DF \*UND\* [0-9a-f]* VERS.0 (0x[0-9a-f][0-9a-f] )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers24.rd b/ld/testsuite/ld-elfvers/vers24.rd index e5b55b169be..42e81e42d9c 100644 --- a/ld/testsuite/ld-elfvers/vers24.rd +++ b/ld/testsuite/ld-elfvers/vers24.rd @@ -1,15 +1,15 @@ Relocation section .* # Ensure there is a dynamic relocation against x #... -[0-9a-f]+ +[0-9a-f]+ R_.* +x(| \+ 0) +[0-9a-f]+ +[0-9a-f]+ R_.* +_?x(| \+ 0) #... Symbol table '.dynsym' contains [0-9]+ entries: # And ensure the dynamic symbol table contains at least x@VERS.0 # and foo@@VERS.0 symbols #... - +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ x|[0-9]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ foo@)@VERS\.0 + +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ _?foo@)@VERS\.0 #... - +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ x|[0-9]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ foo@)@VERS\.0 + +[0-9]+: [0-9a-f]+ +(4 +OBJECT +GLOBAL +DEFAULT +[0-9]+ _?x|[0-9]+ +FUNC +GLOBAL +DEFAULT +[0-9]+ _?foo@)@VERS\.0 #... Symbol table '.symtab' contains [0-9]+ entries: #pass diff --git a/ld/testsuite/ld-elfvers/vers24a.c b/ld/testsuite/ld-elfvers/vers24a.c index 7fef8d8a766..10073d43634 100644 --- a/ld/testsuite/ld-elfvers/vers24a.c +++ b/ld/testsuite/ld-elfvers/vers24a.c @@ -1,5 +1,7 @@ /* Test whether .symver x, x@foo causes relocations against x within the same shared library to become dynamic relocations against x@foo. */ +#include "vers.h" + int x = 12; -__asm__ (".symver x, x@VERS.0"); +SYMVER(x, x@VERS.0); diff --git a/ld/testsuite/ld-elfvers/vers24c.c b/ld/testsuite/ld-elfvers/vers24c.c index 267c4243b56..6e69b334ba1 100644 --- a/ld/testsuite/ld-elfvers/vers24c.c +++ b/ld/testsuite/ld-elfvers/vers24c.c @@ -1,8 +1,10 @@ /* Test whether .symver x, x@foo causes relocations against x within the same shared library to become dynamic relocations against x@foo. */ +#include "vers.h" + int x = 12; -__asm__ (".symver x, x@VERS.0"); +SYMVER(x, x@VERS.0); void foo (void) { x = 24; diff --git a/ld/testsuite/ld-elfvers/vers25a.dsym b/ld/testsuite/ld-elfvers/vers25a.dsym index 6e6573acacb..a9d0313952f 100644 --- a/ld/testsuite/ld-elfvers/vers25a.dsym +++ b/ld/testsuite/ld-elfvers/vers25a.dsym @@ -1,2 +1,2 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers26a.dsym b/ld/testsuite/ld-elfvers/vers26a.dsym index 6e6573acacb..a9d0313952f 100644 --- a/ld/testsuite/ld-elfvers/vers26a.dsym +++ b/ld/testsuite/ld-elfvers/vers26a.dsym @@ -1,2 +1,2 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers27a.dsym b/ld/testsuite/ld-elfvers/vers27a.dsym index 6e6573acacb..a9d0313952f 100644 --- a/ld/testsuite/ld-elfvers/vers27a.dsym +++ b/ld/testsuite/ld-elfvers/vers27a.dsym @@ -1,2 +1,2 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers27b.c b/ld/testsuite/ld-elfvers/vers27b.c index 7b164c480b8..3fe5615baa4 100644 --- a/ld/testsuite/ld-elfvers/vers27b.c +++ b/ld/testsuite/ld-elfvers/vers27b.c @@ -1,2 +1,3 @@ +#include "vers.h" void foo () {} -asm (".hidden foo"); +asm (".hidden " SYMPFX(foo)); diff --git a/ld/testsuite/ld-elfvers/vers27d.dsym b/ld/testsuite/ld-elfvers/vers27d.dsym index 58b56e85227..c585799effb 100644 --- a/ld/testsuite/ld-elfvers/vers27d.dsym +++ b/ld/testsuite/ld-elfvers/vers27d.dsym @@ -1,2 +1,2 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+\(VERS\.0\)[ ]+(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers27d.sym b/ld/testsuite/ld-elfvers/vers27d.sym index d4946f5e205..d20bd1d2349 100644 --- a/ld/testsuite/ld-elfvers/vers27d.sym +++ b/ld/testsuite/ld-elfvers/vers27d.sym @@ -1 +1 @@ -[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?foo@VERS\.0 +[0-9a-f]+[ ]+g[ ]+F[ ]+\.(text|opd)[ ]+[0-9a-f]+ (0x[0-9a-f]+ )?_?foo@VERS\.0 diff --git a/ld/testsuite/ld-elfvers/vers27d1.c b/ld/testsuite/ld-elfvers/vers27d1.c index 3fc60b04bcd..107e1c1de89 100644 --- a/ld/testsuite/ld-elfvers/vers27d1.c +++ b/ld/testsuite/ld-elfvers/vers27d1.c @@ -1,6 +1,8 @@ +#include "vers.h" + void foo () { } -asm (".symver foo,foo@VERS.0"); +SYMVER(foo, foo@VERS.0); diff --git a/ld/testsuite/ld-elfvers/vers27d4.dsym b/ld/testsuite/ld-elfvers/vers27d4.dsym index 8c85a4ae9f5..dfd6a3321ad 100644 --- a/ld/testsuite/ld-elfvers/vers27d4.dsym +++ b/ld/testsuite/ld-elfvers/vers27d4.dsym @@ -1 +1 @@ -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS\.0 +(0x[0-9a-f]+ )?foo +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS\.0 +(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers28b.dsym b/ld/testsuite/ld-elfvers/vers28b.dsym index 750ee8809c7..6c35c9be707 100644 --- a/ld/testsuite/ld-elfvers/vers28b.dsym +++ b/ld/testsuite/ld-elfvers/vers28b.dsym @@ -1,2 +1,2 @@ 0+[ ]+g[ ]+DO[ ]+\*ABS\*[ ]+0+[ ]+VERS\.0[ ]+VERS\.0 -[0-9a-f]+[ ]+w[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+[ ]+w[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers28c.dsym b/ld/testsuite/ld-elfvers/vers28c.dsym index 99f6d881f83..7ad56789eea 100644 --- a/ld/testsuite/ld-elfvers/vers28c.dsym +++ b/ld/testsuite/ld-elfvers/vers28c.dsym @@ -1 +1 @@ -[0-9a-f]+[ ]+DF[ ]+\*UND\*[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?foo +[0-9a-f]+[ ]+DF[ ]+\*UND\*[ ]+[0-9a-f]+[ ]+VERS\.0[ ]+(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers29.dsym b/ld/testsuite/ld-elfvers/vers29.dsym index ed8a230de08..f983d43477e 100644 --- a/ld/testsuite/ld-elfvers/vers29.dsym +++ b/ld/testsuite/ld-elfvers/vers29.dsym @@ -1 +1 @@ -[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+vers29\.so[ ]+(0x[0-9a-f]+ )?show +[0-9a-f]+[ ]+g[ ]+DF[ ]+\.(text|opd)[ ]+[0-9a-f]+[ ]+vers29\.so[ ]+(0x[0-9a-f]+ )?_?show diff --git a/ld/testsuite/ld-elfvers/vers3.dsym b/ld/testsuite/ld-elfvers/vers3.dsym index 7396deeca5f..a77f9490127 100644 --- a/ld/testsuite/ld-elfvers/vers3.dsym +++ b/ld/testsuite/ld-elfvers/vers3.dsym @@ -1 +1 @@ -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?show_foo +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2\.0 +(0x[0-9a-f]+ )?_?show_foo diff --git a/ld/testsuite/ld-elfvers/vers30.dsym b/ld/testsuite/ld-elfvers/vers30.dsym index ddb21eb38b0..5762f01843c 100644 --- a/ld/testsuite/ld-elfvers/vers30.dsym +++ b/ld/testsuite/ld-elfvers/vers30.dsym @@ -1,5 +1,5 @@ 0+ g DO \*ABS\* 0+ VERS_30\.0 VERS_30\.0 -[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_30\.0 global -[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_30\.0 foo -[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_30\.0 info -[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_30\.0 extern +[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_30\.0 _?global +[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_30\.0 _?foo +[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_30\.0 _?info +[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_30\.0 _?extern diff --git a/ld/testsuite/ld-elfvers/vers31.dsym b/ld/testsuite/ld-elfvers/vers31.dsym index 72dec06aff2..fb22f5b87ca 100644 --- a/ld/testsuite/ld-elfvers/vers31.dsym +++ b/ld/testsuite/ld-elfvers/vers31.dsym @@ -1,2 +1,2 @@ 0+ g +DO \*ABS\* 0+ +VERS_31\.0 +VERS_31\.0 -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_31\.0 +_Z1fIA3_icEvPT_T0 +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_31\.0 +_?_Z1fIA3_icEvPT_T0 diff --git a/ld/testsuite/ld-elfvers/vers32a.dsym b/ld/testsuite/ld-elfvers/vers32a.dsym index 47d1b06bff9..24deae4987d 100644 --- a/ld/testsuite/ld-elfvers/vers32a.dsym +++ b/ld/testsuite/ld-elfvers/vers32a.dsym @@ -1,2 +1,2 @@ 0+ g +DO \*ABS\* 0+ +VERS_1 +VERS_1 -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1 +(0x[0-9a-f]+ )?foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1 +(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers32b.dsym b/ld/testsuite/ld-elfvers/vers32b.dsym index 88b34744722..a2fc578bba8 100644 --- a/ld/testsuite/ld-elfvers/vers32b.dsym +++ b/ld/testsuite/ld-elfvers/vers32b.dsym @@ -1,2 +1,2 @@ -[0-9a-f]+ g +D +\*ABS\* [0-9a-f]+ +VERS_1 +(0x[0-9a-f]+ )?foo +[0-9a-f]+ g +D +\*ABS\* [0-9a-f]+ +VERS_1 +(0x[0-9a-f]+ )?_?foo 0+ g +DO \*ABS\* 0+ +VERS_1 +VERS_1 diff --git a/ld/testsuite/ld-elfvers/vers4.c b/ld/testsuite/ld-elfvers/vers4.c index 453f2eb4d9c..46ac43258de 100644 --- a/ld/testsuite/ld-elfvers/vers4.c +++ b/ld/testsuite/ld-elfvers/vers4.c @@ -5,6 +5,7 @@ * -export-dynamic. */ #include +#include "vers.h" extern int foo (); @@ -21,7 +22,7 @@ new_foo() } -__asm__(".symver new_foo,foo@@VERS_2.0"); +SYMVER(new_foo, foo@@VERS_2.0); int main() diff --git a/ld/testsuite/ld-elfvers/vers4.sym b/ld/testsuite/ld-elfvers/vers4.sym index 395e69910bb..c48d1bb09f1 100644 --- a/ld/testsuite/ld-elfvers/vers4.sym +++ b/ld/testsuite/ld-elfvers/vers4.sym @@ -1 +1 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?foo@@VERS_2\.0 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@@VERS_2\.0 diff --git a/ld/testsuite/ld-elfvers/vers4a.dsym b/ld/testsuite/ld-elfvers/vers4a.dsym index a7efb0aef61..96dfea8a976 100644 --- a/ld/testsuite/ld-elfvers/vers4a.dsym +++ b/ld/testsuite/ld-elfvers/vers4a.dsym @@ -1,2 +1,2 @@ 0+ g DO \*ABS\* 0+ VERS_2\.0 VERS_2\.0 -[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_2\.0 (0x[0-9a-f]+ )?foo +[0-9a-f]+ g DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ VERS_2\.0 (0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers4a.sym b/ld/testsuite/ld-elfvers/vers4a.sym index 395e69910bb..c48d1bb09f1 100644 --- a/ld/testsuite/ld-elfvers/vers4a.sym +++ b/ld/testsuite/ld-elfvers/vers4a.sym @@ -1 +1 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?foo@@VERS_2\.0 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@@VERS_2\.0 diff --git a/ld/testsuite/ld-elfvers/vers5.c b/ld/testsuite/ld-elfvers/vers5.c index cc6ea40b678..3cae67ebc92 100644 --- a/ld/testsuite/ld-elfvers/vers5.c +++ b/ld/testsuite/ld-elfvers/vers5.c @@ -2,6 +2,8 @@ * Testcase to verify that foo@BAR and foo@@BAR are correctly detected * as a multiply defined symbol. */ +#include "vers.h" + const char * bar1 = "asdf"; const char * bar2 = "asdf"; @@ -39,10 +41,10 @@ new_foo() } -__asm__(".symver original_foo,foo@"); -__asm__(".symver old_foo,foo@VERS_1.1"); -__asm__(".symver old_foo1,foo@VERS_1.2"); -__asm__(".symver new_foo,foo@@VERS_1.2"); +SYMVER(original_foo, foo@); +SYMVER(old_foo, foo@VERS_1.1); +SYMVER(old_foo1, foo@VERS_1.2); +SYMVER(new_foo, foo@@VERS_1.2); int main () diff --git a/ld/testsuite/ld-elfvers/vers6.c b/ld/testsuite/ld-elfvers/vers6.c index 9e48df9b400..cb1c93f635a 100644 --- a/ld/testsuite/ld-elfvers/vers6.c +++ b/ld/testsuite/ld-elfvers/vers6.c @@ -3,6 +3,7 @@ * that we always get the right one. */ #include +#include "vers.h" extern int foo_1(); extern int foo_2(); @@ -19,7 +20,7 @@ main() return 0; } -__asm__(".symver foo_1,show_foo@"); -__asm__(".symver foo_2,show_foo@VERS_1.1"); -__asm__(".symver foo_3,show_foo@VERS_1.2"); -__asm__(".symver foo_4,show_foo@VERS_2.0"); +SYMVER(foo_1, show_foo@); +SYMVER(foo_2, show_foo@VERS_1.1); +SYMVER(foo_3, show_foo@VERS_1.2); +SYMVER(foo_4, show_foo@VERS_2.0); diff --git a/ld/testsuite/ld-elfvers/vers6.dsym b/ld/testsuite/ld-elfvers/vers6.dsym index 79e9061a92b..a53099bbedb 100644 --- a/ld/testsuite/ld-elfvers/vers6.dsym +++ b/ld/testsuite/ld-elfvers/vers6.dsym @@ -1,4 +1,4 @@ -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2.0 +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_1.2 +(0x[0-9a-f]+ )?show_foo -[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_1.1 +(0x[0-9a-f]+ )?show_foo +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_2.0 +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_1.2 +(0x[0-9a-f]+ )?_?show_foo +[0-9a-f]+ +DF \*UND\* [0-9a-f]+ +VERS_1.1 +(0x[0-9a-f]+ )?_?show_foo diff --git a/ld/testsuite/ld-elfvers/vers6.sym b/ld/testsuite/ld-elfvers/vers6.sym index 801f7b3618a..ae68d724e20 100644 --- a/ld/testsuite/ld-elfvers/vers6.sym +++ b/ld/testsuite/ld-elfvers/vers6.sym @@ -1,4 +1,4 @@ -0+ *F? *\*UND\* 0+ show_foo@ -0+ *F? *\*UND\* 0+ show_foo@VERS_1\.1 -0+ *F? *\*UND\* 0+ show_foo@VERS_1\.2 -0+ *F? *\*UND\* 0+ show_foo@VERS_2\.0 +0+ *F? *\*UND\* 0+ _?show_foo@ +0+ *F? *\*UND\* 0+ _?show_foo@VERS_1\.1 +0+ *F? *\*UND\* 0+ _?show_foo@VERS_1\.2 +0+ *F? *\*UND\* 0+ _?show_foo@VERS_2\.0 diff --git a/ld/testsuite/ld-elfvers/vers7a.c b/ld/testsuite/ld-elfvers/vers7a.c index 7bee8c70bfe..f3d2a2d9897 100644 --- a/ld/testsuite/ld-elfvers/vers7a.c +++ b/ld/testsuite/ld-elfvers/vers7a.c @@ -2,6 +2,8 @@ * Test supplied by Ulrich. Verify that we can correctly force 'a' * to local scope. */ +#include "vers.h" + int __a_internal (int e) { @@ -14,5 +16,5 @@ __b_internal (int e) return e + 42; } -asm (".symver __a_internal,hide_a@@VERS_1"); -asm (".symver __b_internal,show_b@@VERS_1"); +SYMVER(__a_internal, hide_a@@VERS_1); +SYMVER(__b_internal, show_b@@VERS_1); diff --git a/ld/testsuite/ld-elfvers/vers7a.dsym b/ld/testsuite/ld-elfvers/vers7a.dsym index 8434925f674..89a45a54308 100644 --- a/ld/testsuite/ld-elfvers/vers7a.dsym +++ b/ld/testsuite/ld-elfvers/vers7a.dsym @@ -1,2 +1,2 @@ 0+ g +DO \*ABS\* 0+ +VERS_1 +VERS_1 -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1 +(0x[0-9a-f]+ )?show_b +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1 +(0x[0-9a-f]+ )?_?show_b diff --git a/ld/testsuite/ld-elfvers/vers7a.sym b/ld/testsuite/ld-elfvers/vers7a.sym index 94d9312bd4d..ef8d04be0bb 100644 --- a/ld/testsuite/ld-elfvers/vers7a.sym +++ b/ld/testsuite/ld-elfvers/vers7a.sym @@ -1,2 +1,2 @@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?hide_a@@VERS_1 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?show_b@@VERS_1 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?hide_a@@VERS_1 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?show_b@@VERS_1 diff --git a/ld/testsuite/ld-elfvers/vers9.c b/ld/testsuite/ld-elfvers/vers9.c index bef1402d269..50793640915 100644 --- a/ld/testsuite/ld-elfvers/vers9.c +++ b/ld/testsuite/ld-elfvers/vers9.c @@ -2,6 +2,8 @@ * Testcase to verify that reference to foo@BAR and a definition of foo@@BAR * are not treated as a multiple def. */ +#include "vers.h" + const char * bar1 = "asdf"; const char * bar2 = "asdf"; @@ -41,7 +43,7 @@ main() return 0; } -__asm__(".symver original_foo,foo@"); -__asm__(".symver old_foo,foo@VERS_1.1"); -__asm__(".symver old_foo1,foo@VERS_1.2"); -__asm__(".symver new_foo,foo@@VERS_1.2"); +SYMVER(original_foo, foo@); +SYMVER(old_foo, foo@VERS_1.1); +SYMVER(old_foo1, foo@VERS_1.2); +SYMVER(new_foo, foo@@VERS_1.2); diff --git a/ld/testsuite/ld-elfvers/vers9.dsym b/ld/testsuite/ld-elfvers/vers9.dsym index 5443e67dd0b..411451a28b3 100644 --- a/ld/testsuite/ld-elfvers/vers9.dsym +++ b/ld/testsuite/ld-elfvers/vers9.dsym @@ -1,4 +1,4 @@ 0+ g +DO \*ABS\* 0+ +VERS_1\.1 +VERS_1\.1 0+ g +DO \*ABS\* 0+ +VERS_1\.2 +VERS_1\.2 -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.1\) +(0x[0-9a-f]+ )?foo -[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1\.2 +(0x[0-9a-f]+ )?foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ \(VERS_1\.1\) +(0x[0-9a-f]+ )?_?foo +[0-9a-f]+ g +DF (\.text|\.opd|\*ABS\*) [0-9a-f]+ +VERS_1\.2 +(0x[0-9a-f]+ )?_?foo diff --git a/ld/testsuite/ld-elfvers/vers9.sym b/ld/testsuite/ld-elfvers/vers9.sym index 6d6585fd6ce..be0e6ddb200 100644 --- a/ld/testsuite/ld-elfvers/vers9.sym +++ b/ld/testsuite/ld-elfvers/vers9.sym @@ -1,4 +1,4 @@ -0+ *F? *\*UND\* 0+ foo@VERS_1\.2 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?foo@ -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?foo@VERS_1\.1 -[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?foo@@VERS_1\.2 +0+ *F? *\*UND\* 0+ _?foo@VERS_1\.2 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@ +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@VERS_1\.1 +[0-9a-f]+ g +F \.(text|opd) [0-9a-f]+ (0x[0-9a-f]+ )?_?foo@@VERS_1\.2 diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp index 36c12d9f147..d288774adae 100644 --- a/ld/testsuite/ld-elfvsb/elfvsb.exp +++ b/ld/testsuite/ld-elfvsb/elfvsb.exp @@ -1,5 +1,5 @@ # Expect script for ld-visibility tests -# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 +# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2010 # Free Software Foundation, Inc. # # This file is part of the GNU Binutils. @@ -30,6 +30,7 @@ if { ![istarget hppa*64*-*-hpux*] \ && ![istarget hppa*-*-linux*] \ && ![istarget i?86-*-linux*] \ + && ![istarget i?86-*-gnu*] \ && ![istarget ia64-*-linux*] \ && ![istarget m68k-*-linux*] \ && ![istarget mips*-*-linux*] \ @@ -115,7 +116,8 @@ if [istarget arm*-*-linux*] { set support_protected "no" -if [istarget *-*-linux*] { +if { [istarget *-*-linux*] + || [istarget *-*-gnu*] } { if [ld_compile "$CC -g $CFLAGS -DPROTECTED_CHECK" $srcdir/$subdir/main.c $tmpdir/main.o] { if [ld_simple_link $CC $tmpdir/main "$tmpdir/main.o"] { catch "exec $tmpdir/main" support_protected diff --git a/ld/testsuite/ld-elfweak/elfweak.exp b/ld/testsuite/ld-elfweak/elfweak.exp index cac613b7252..0cc1299351e 100644 --- a/ld/testsuite/ld-elfweak/elfweak.exp +++ b/ld/testsuite/ld-elfweak/elfweak.exp @@ -1,5 +1,6 @@ # Expect script for ld-weak tests -# Copyright 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation, Inc. +# Copyright 2001, 2002, 2003, 2004, 2005, 2007, 2010 +# Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -28,32 +29,32 @@ if ![isnative] then {return} # This test can only be run on a couple of ELF platforms. # Square bracket expressions seem to confuse istarget. # This is similar to the test that is used in ld-shared, BTW. -if { ![istarget alpha*-*-linux*] \ - && ![istarget arm*-*-linux*] \ - && ![istarget hppa*64*-*-hpux*] \ - && ![istarget hppa*-*-linux*] \ - && ![istarget i?86-*-sysv4*] \ - && ![istarget i?86-*-unixware] \ - && ![istarget i?86-*-elf*] \ - && ![istarget i?86-*-linux*] \ - && ![istarget ia64-*-elf*] \ - && ![istarget ia64-*-linux*] \ - && ![istarget m68k-*-linux*] \ - && ![istarget mips*-*-irix5*] \ - && ![istarget mips*-*-linux*] \ - && ![istarget powerpc*-*-elf*] \ - && ![istarget powerpc*-*-linux*] \ - && ![istarget powerpc*-*-sysv4*] \ - && ![istarget sh\[34\]*-*-linux*] \ - && ![istarget sparc*-*-elf] \ - && ![istarget sparc*-*-solaris2*] \ +if { ![istarget alpha*-*-linux*] + && ![istarget arm*-*-linux*] + && ![istarget hppa*64*-*-hpux*] + && ![istarget hppa*-*-linux*] + && ![istarget i?86-*-sysv4*] + && ![istarget i?86-*-unixware] + && ![istarget i?86-*-elf*] + && ![istarget i?86-*-linux*] + && ![istarget i?86-*-gnu*] + && ![istarget ia64-*-elf*] + && ![istarget ia64-*-linux*] + && ![istarget m68k-*-linux*] + && ![istarget mips*-*-irix5*] + && ![istarget mips*-*-linux*] + && ![istarget powerpc*-*-elf*] + && ![istarget powerpc*-*-linux*] + && ![istarget powerpc*-*-sysv4*] + && ![istarget sh\[34\]*-*-linux*] + && ![istarget sparc*-*-elf] + && ![istarget sparc*-*-solaris2*] && ![istarget sparc*-*-linux*] } { return } -if { [istarget i?86-*-linux*aout*] \ - || [istarget i?86-*-linux*oldld*] \ - || [istarget m68k-*-linux*aout*] } { +if { [istarget *-*-linux*aout*] + || [istarget *-*-linux*oldld*] } { return } @@ -67,6 +68,18 @@ set DOBJDUMP_FLAGS --dynamic-syms set SOBJDUMP_FLAGS --syms set shared --shared + +# +proc setup_xfail_gnu_hurd {} { + global target_triplet + # Be cautious to not XFAIL for *-*-linux-gnu*, *-*-kfreebsd-gnu*, etc. + switch -regexp $target_triplet { + ^\[^-\]*-\[^-\]*-gnu.*$ { + setup_xfail "*-*-*" + } + } +} + # # objdump_symstuff # Dump non-dynamic symbol stuff and make sure that it is sane. @@ -290,7 +303,7 @@ proc build_lib {test libname objs dynsymexp} { return } - if {![string match "" $dynsymexp] \ + if {![string match "" $dynsymexp] && ![objdump_dynsymstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$dynsymexp]} { fail $test return @@ -368,9 +381,9 @@ if [istarget mips*-*-*] { catch "exec $CC $picflag" exec_output send_log "$exec_output\n" verbose "--" "$exec_output" - if { [string match "*illegal option*" $exec_output] \ - || [string match "*option ignored*" $exec_output] \ - || [string match "*unrecognized option*" $exec_output] \ + if { [string match "*illegal option*" $exec_output] + || [string match "*option ignored*" $exec_output] + || [string match "*unrecognized option*" $exec_output] || [string match "*passed to ld*" $exec_output] } { if [istarget *-*-sunos4*] { set picflag "-pic" @@ -452,7 +465,9 @@ build_lib "ELF DSO weak func first DSO" libfoo "foo.o libbar.so" dsow.dsym build_lib "ELF DSO weak func last DSO" libfoo "libbar.so foo.o" dsow.dsym build_exec "ELF weak func first" foo "main.o bar.o" "" strong "" strong.sym build_exec "ELF weak func last" foo "bar.o main.o" "" strong "" strong.sym +setup_xfail_gnu_hurd build_exec "ELF weak func first DSO" foo "main.o libbar.so" "-Wl,-rpath,." weak weak.dsym "" +setup_xfail_gnu_hurd build_exec "ELF weak func last DSO" foo "libbar.so main.o" "-Wl,-rpath,." weak weak.dsym "" build_lib "ELF DSO weak data first" libfoo "bar1a.o foo1a.o" dsodata.dsym @@ -465,9 +480,13 @@ build_exec "ELF weak data first" foo "main1.o bar1a.o foo1a.o" "" strongdata "" build_exec "ELF weak data last" foo "foo1a.o main1.o bar1a.o" "" strongdata "" strongdata.sym build_exec "ELF weak data first common" foo "main1.o bar1a.o foo1b.o" "" strongdata "" strongcomm.sym build_exec "ELF weak data last common" foo "foo1b.o main1.o bar1a.o" "" strongdata "" strongcomm.sym +setup_xfail_gnu_hurd build_exec "ELF weak data first DSO" foo "main1.o libbar1a.so libfoo1a.so" "-Wl,-rpath,." weakdata weakdata.dsym "" +setup_xfail_gnu_hurd build_exec "ELF weak data last DSO" foo "libfoo1a.so main1.o libbar1a.so" "-Wl,-rpath,." weakdata weakdata.dsym "" +setup_xfail_gnu_hurd build_exec "ELF weak data first DSO common" foo "main1.o libbar1a.so libfoo1b.so" "-Wl,-rpath,." weakdata weakdata.dsym "" +setup_xfail_gnu_hurd build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o libbar1a.so" "-Wl,-rpath,." weakdata weakdata.dsym "" if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/size_foo.c $tmpdir/size_foo.o] { diff --git a/ld/testsuite/ld-gc/abi-note.d b/ld/testsuite/ld-gc/abi-note.d index aed0a8b61e4..d796ccccfe6 100644 --- a/ld/testsuite/ld-gc/abi-note.d +++ b/ld/testsuite/ld-gc/abi-note.d @@ -1,7 +1,7 @@ #name: --gc-sections with note section #ld: --gc-sections -e _start #readelf: -S --wide -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #notarget: *-*-*aout *-*-*oldld #... diff --git a/ld/testsuite/ld-gc/gc.exp b/ld/testsuite/ld-gc/gc.exp index 095f7642d9f..b7d6dffd90b 100644 --- a/ld/testsuite/ld-gc/gc.exp +++ b/ld/testsuite/ld-gc/gc.exp @@ -98,7 +98,8 @@ run_dump_test "noent" run_dump_test "abi-note" run_dump_test "start" if { [is_remote host] || [which $CC] != 0 } { - if { [istarget "*-*-linux*"] } { + if { [istarget "*-*-linux*"] + || [istarget "*-*-gnu*"] } { ld_compile "$CC -fPIC $CFLAGS $cflags" $srcdir/$subdir/pr11218-1.c tmpdir/pr11218-1.o ld_simple_link $ld tmpdir/pr11218-1.so "-shared tmpdir/pr11218-1.o" ld_compile "$CC -c $CFLAGS $cflags" $srcdir/$subdir/pr11218-2.c tmpdir/pr11218-2.o diff --git a/ld/testsuite/ld-gc/pr11218-2.c b/ld/testsuite/ld-gc/pr11218-2.c index 2515bc6013c..5f158026f83 100644 --- a/ld/testsuite/ld-gc/pr11218-2.c +++ b/ld/testsuite/ld-gc/pr11218-2.c @@ -1,4 +1,5 @@ extern void foo_in_so(void); +extern void unresolved_detected_at_runtime_not_at_linktime (void); void call_unresolved(void) { diff --git a/ld/testsuite/ld-gc/pr11218.d b/ld/testsuite/ld-gc/pr11218.d index 27019a801fa..fc269402338 100644 --- a/ld/testsuite/ld-gc/pr11218.d +++ b/ld/testsuite/ld-gc/pr11218.d @@ -1,5 +1,5 @@ # name: --gc-sections with shared library # source: dummy.s # ld: --gc-sections -e main tmpdir/pr11218-2.o tmpdir/pr11218-1.so -# target: *-*-linux* +# target: *-*-linux* *-*-gnu* # error: undefined reference to `unresolved_detected_at_runtime_not_at_linktime' diff --git a/ld/testsuite/ld-gc/start.d b/ld/testsuite/ld-gc/start.d index 80c43d9e4c0..28007353744 100644 --- a/ld/testsuite/ld-gc/start.d +++ b/ld/testsuite/ld-gc/start.d @@ -1,7 +1,7 @@ #name: --gc-sections with __start_ #ld: --gc-sections -e _start #nm: -n -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #notarget: *-*-*aout *-*-*oldld #... diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 6777c5f6755..de8f892e0a5 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -1,5 +1,5 @@ # Expect script for ld-i386 tests -# Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009 +# Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010 # Free Software Foundation # # This file is part of the GNU Binutils. @@ -99,7 +99,8 @@ if [istarget "*-*-go32*"] { } if { !([istarget "i?86-*-elf*"] - || ([istarget "i?86-*-linux*"] + || (([istarget "i?86-*-linux*"] + || [istarget "i?86-*-gnu*"]) && ![istarget "*-*-*aout*"] && ![istarget "*-*-*oldld*"]) || [istarget "x86_64-*-linux*"] @@ -194,6 +195,7 @@ run_dump_test "nogot2" run_dump_test "discarded1" if { !([istarget "i?86-*-linux*"] + || [istarget "i?86-*-gnu*"] || [istarget "x86_64-*-linux*"]) } { return } diff --git a/ld/testsuite/ld-ifunc/binutils.exp b/ld/testsuite/ld-ifunc/binutils.exp index bd6c9536449..d24caf8edf1 100644 --- a/ld/testsuite/ld-ifunc/binutils.exp +++ b/ld/testsuite/ld-ifunc/binutils.exp @@ -1,5 +1,5 @@ # Expect script for binutils tests -# Copyright 2009 Free Software Foundation, Inc. +# Copyright 2009, 2010 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -24,9 +24,9 @@ # Make sure that binutils can correctly handle ld output in ELF with # STT_GNU_IFUNC symbols. -# Run on Linux/x86 only. if { !([istarget "i?86-*-elf*"] - || ([istarget "i?86-*-linux*"] + || (([istarget "i?86-*-linux*"] + || [istarget "i?86-*-gnu*"]) && ![istarget "*-*-*aout*"] && ![istarget "*-*-*oldld*"]) || [istarget "x86_64-*-linux*"] diff --git a/ld/testsuite/ld-ifunc/ifunc.exp b/ld/testsuite/ld-ifunc/ifunc.exp index 38fe2d39046..6c20dc079b9 100644 --- a/ld/testsuite/ld-ifunc/ifunc.exp +++ b/ld/testsuite/ld-ifunc/ifunc.exp @@ -1,6 +1,6 @@ # Expect script for linker support of IFUNC symbols and relocations. # -# Copyright 2009 Free Software Foundation, Inc. +# Copyright 2009, 2010 Free Software Foundation, Inc. # Contributed by Red Hat. # # This file is part of the GNU Binutils. @@ -30,7 +30,8 @@ if {!(([istarget "i?86-*-*"] || [istarget "powerpc*-*-*"] || [istarget "sparc*-*-*"]) && ([istarget "*-*-elf*"] - || ([istarget "*-*-linux*"] + || (([istarget "*-*-linux*"] + || [istarget "*-*-gnu*"]) && ![istarget "*-*-*aout*"] && ![istarget "*-*-*oldld*"]))) } { verbose "IFUNC tests not run - target does not support IFUNC" diff --git a/ld/testsuite/ld-linkonce/linkonce.exp b/ld/testsuite/ld-linkonce/linkonce.exp index 53287340e1a..e8b85ac65e4 100644 --- a/ld/testsuite/ld-linkonce/linkonce.exp +++ b/ld/testsuite/ld-linkonce/linkonce.exp @@ -1,5 +1,5 @@ # Expect script for ld linkonce tests -# Copyright 2001, 2002, 2005, 2007 Free Software Foundation, Inc. +# Copyright 2001, 2002, 2005, 2007, 2010 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -25,7 +25,7 @@ # have to qualify on ELF specifically in every .d-file. if { ![istarget *-*-linux*] \ - && ![istarget *-*-gnu] \ + && ![istarget *-*-gnu*] \ && ![istarget hppa*64*-*-hpux*] \ && ![istarget *-*-elf] } { return diff --git a/ld/testsuite/ld-linkonce/zeroehl32.d b/ld/testsuite/ld-linkonce/zeroehl32.d index 5b51836588c..bd8fc6f67ea 100644 --- a/ld/testsuite/ld-linkonce/zeroehl32.d +++ b/ld/testsuite/ld-linkonce/zeroehl32.d @@ -2,7 +2,7 @@ #source: y.s #ld: -Ttext 0xa00 -T zeroeh.ld #objdump: -s -#target: cris-*-elf cris-*-linux* i?86-*-elf i?86-*-linux* +#target: cris-*-elf cris-*-linux* i?86-*-elf i?86-*-linux* i?86-*-gnu* # The word at address 201c, for the linkonce-excluded section, must be zero. diff --git a/ld/testsuite/ld-pie/pie.exp b/ld/testsuite/ld-pie/pie.exp index 19a2ac01c40..ea4370c66fd 100644 --- a/ld/testsuite/ld-pie/pie.exp +++ b/ld/testsuite/ld-pie/pie.exp @@ -1,5 +1,5 @@ # Expect script for various PIE tests. -# Copyright 2006, 2007, 2009 Free Software Foundation, Inc. +# Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc. # # This file is part of the GNU Binutils. # @@ -22,8 +22,8 @@ # This test can only be run if ld generates native executables. if ![isnative] then {return} -# Run on Linux only. -if { ![istarget *-*-linux*] } { +if { ![istarget *-*-linux*] + && ![istarget *-*-gnu*] } { return } diff --git a/ld/testsuite/ld-scripts/phdrs2.exp b/ld/testsuite/ld-scripts/phdrs2.exp index 57778d20e90..e75acfb7671 100644 --- a/ld/testsuite/ld-scripts/phdrs2.exp +++ b/ld/testsuite/ld-scripts/phdrs2.exp @@ -1,5 +1,5 @@ # Test PHDRS with empty sections in a linker script. -# Copyright 2006, 2005, 2007 Free Software Foundation, Inc, +# Copyright 2006, 2005, 2007, 2010 Free Software Foundation, Inc, # # This file is part of the GNU Binutils. # @@ -25,6 +25,7 @@ if { ![istarget *-*-sysv4*] \ && ![istarget *-*-eabi*] \ && ![istarget hppa*64*-*-hpux*] \ && ![istarget *-*-linux*] \ + && ![istarget *-*-gnu*] \ && ![istarget *-*-irix5*] \ && ![istarget *-*-irix6*] \ && ![istarget *-*-solaris2*] } { diff --git a/ld/testsuite/ld-scripts/rgn-at5.d b/ld/testsuite/ld-scripts/rgn-at5.d index 972c6c2da59..7ba9cafb2f1 100644 --- a/ld/testsuite/ld-scripts/rgn-at5.d +++ b/ld/testsuite/ld-scripts/rgn-at5.d @@ -2,7 +2,7 @@ # source: rgn-at5.s # ld: -T rgn-at5.t -z max-page-size=0x1000 # objdump: -w -h -# target: *-*-linux* +# target: *-*-linux* *-*-gnu* # xfail: rx-*-* # FAILS on the RX because the linker has to set LMA == VMA for the # Renesas loader. diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp index 2e699228ad1..267c0be7278 100644 --- a/ld/testsuite/ld-scripts/script.exp +++ b/ld/testsuite/ld-scripts/script.exp @@ -130,9 +130,10 @@ if ![ld_simple_link $ld tmpdir/script "$flags -T $srcdir/$subdir/memory.t tmpdir set test_script_list [lsort [glob $srcdir/$subdir/region-alias-*.t]] foreach test_script $test_script_list { + set testname [file tail $test_script] if ![ld_simple_link $ld tmpdir/script "$flags -T $test_script tmpdir/script.o"] { - xfail "REGION_ALIAS: $test_script" + xfail "REGION_ALIAS: $testname" } else { - xpass "REGION_ALIAS: $test_script" + xpass "REGION_ALIAS: $testname" } } diff --git a/ld/testsuite/ld-selective/selective.exp b/ld/testsuite/ld-selective/selective.exp index b563d355b2f..81870c2a054 100644 --- a/ld/testsuite/ld-selective/selective.exp +++ b/ld/testsuite/ld-selective/selective.exp @@ -60,7 +60,7 @@ set seltests { } set cflags "-w -O -ffunction-sections -fdata-sections" -set cxxflags "-fvtable-gc -fno-exceptions -fno-rtti" +set cxxflags "-fno-exceptions -fno-rtti" set ldflags "--gc-sections -Bstatic" if [istarget mips*-*] { @@ -106,14 +106,16 @@ foreach testitem $seltests { # It's either C or C++ at the moment. if { $testtype == "C++" } { - set testflags "$cflags $cxxflags" set compiler "$CXX" # Starting with 3.4.0, -fvtable-gc is no longer supported and thus # the functionality we try to test for cannot be expected to work. set version [remote_exec host "$CXX -dumpversion"] set version [lindex $version 1] if [regexp "^(\[1-9\]\[0-9\]+|\[4-9\]|3.(\[1-9\]\[0-9\]+|\[4-9\]))\\." $version] { + set testflags "$cflags $cxxflags" setup_xfail {*-*-*} + } else { + set testflags "$cflags $cxxflags -fvtable-gc" } } else { set testflags "$cflags" diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp index 521b9255722..b77b9cea2a6 100644 --- a/ld/testsuite/ld-shared/shared.exp +++ b/ld/testsuite/ld-shared/shared.exp @@ -1,6 +1,6 @@ # Expect script for ld-shared tests # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, -# 2004, 2005, 2007, 2008, 2009 +# 2004, 2005, 2007, 2008, 2009, 2010 # Free Software Foundation, Inc. # # This file is part of the GNU Binutils. @@ -38,6 +38,7 @@ if { ![istarget hppa*64*-*-hpux*] \ && ![istarget i?86-*-unixware] \ && ![istarget i?86-*-elf*] \ && ![istarget i?86-*-linux*] \ + && ![istarget i?86-*-gnu*] \ && ![istarget ia64-*-elf*] \ && ![istarget ia64-*-linux*] \ && ![istarget m68k-*-linux*] \ diff --git a/ld/testsuite/ld-undefined/entry-3.d b/ld/testsuite/ld-undefined/entry-3.d index 184f4788a0c..ca917659790 100644 --- a/ld/testsuite/ld-undefined/entry-3.d +++ b/ld/testsuite/ld-undefined/entry-3.d @@ -2,7 +2,7 @@ #source: dummy.s #ld: -shared --entry foo tmpdir/libentry.a #nm: -n -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... [0-9a-f]+ T +foo diff --git a/ld/testsuite/ld-undefined/entry-4.d b/ld/testsuite/ld-undefined/entry-4.d index 44006aa85c6..d02808e0d40 100644 --- a/ld/testsuite/ld-undefined/entry-4.d +++ b/ld/testsuite/ld-undefined/entry-4.d @@ -2,7 +2,7 @@ #source: dummy.s #ld: -shared --entry foo -u foo tmpdir/libentry.a #nm: -n -#target: *-*-linux* +#target: *-*-linux* *-*-gnu* #... [0-9a-f]+ T +foo diff --git a/ld/testsuite/ld-undefined/weak-undef.exp b/ld/testsuite/ld-undefined/weak-undef.exp index a4f35e4189d..e7e949ac8bf 100644 --- a/ld/testsuite/ld-undefined/weak-undef.exp +++ b/ld/testsuite/ld-undefined/weak-undef.exp @@ -1,5 +1,5 @@ # Test handling of weak undefined symbols -# Copyright 2001, 2002, 2004, 2005, 2007 +# Copyright 2001, 2002, 2004, 2005, 2007, 2010 # Free Software Foundation, Inc. # # This file is part of the GNU Binutils. @@ -30,6 +30,7 @@ if { ![istarget *-*-sysv4*] \ && ![istarget *-*-eabi*] \ && ![istarget hppa*64*-*-hpux*] \ && ![istarget *-*-linux*] \ + && ![istarget *-*-gnu*] \ && ![istarget *-*-irix5*] \ && ![istarget *-*-irix6*] \ && ![is_pecoff_format] \ diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 3d120c8264b..48e9635d03f 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -19,6 +19,13 @@ # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, # MA 02110-1301, USA. +proc load_common_lib { name } { + global srcdir + load_file $srcdir/../../binutils/testsuite/lib/$name +} + +load_common_lib binutils-common.exp + # Extract and print the version number of ld. # proc default_ld_version { ld } { @@ -401,206 +408,6 @@ proc ld_simple_link_defsyms {} { return $flags } -# True if the object format is known to be ELF. -# -proc is_elf_format {} { - if { ![istarget *-*-sysv4*] - && ![istarget *-*-unixware*] - && ![istarget *-*-elf*] - && ![istarget *-*-eabi*] - && ![istarget *-*-rtems*] - && ![istarget hppa*64*-*-hpux*] - && ![istarget ia64-*-hpux*] - && ![istarget *-*-linux*] - && ![istarget frv-*-uclinux*] - && ![istarget bfin-*-uclinux] - && ![istarget sh*-*-uclinux*] - && ![istarget *-*-irix5*] - && ![istarget *-*-irix6*] - && ![istarget *-*-netbsd*] - && ![istarget *-*-openbsd*] - && ![istarget *-*-solaris2*] } { - return 0 - } - - if { [istarget *-*-linux*aout*] - || [istarget *-*-linux*oldld*] - || [istarget h8500-*-rtems*] - || [istarget i960-*-rtems*] - || [istarget *-*-rtemscoff*] } { - return 0 - } - - if { ![istarget *-*-netbsdelf*] - && ([istarget *-*-netbsd*aout*] - || [istarget *-*-netbsdpe*] - || [istarget arm*-*-netbsd*] - || [istarget sparc-*-netbsd*] - || [istarget i*86-*-netbsd*] - || [istarget m68*-*-netbsd*] - || [istarget vax-*-netbsd*] - || [istarget ns32k-*-netbsd*]) } { - return 0 - } - - if { [istarget arm-*-openbsd*] - || [istarget i386-*-openbsd\[0-2\].*] - || [istarget i386-*-openbsd3.\[0-2\]] - || [istarget m68*-*-openbsd*] - || [istarget ns32k-*-openbsd*] - || [istarget sparc-*-openbsd\[0-2\].*] - || [istarget sparc-*-openbsd3.\[0-1\]] - || [istarget vax-*-openbsd*] } { - return 0 - } - - return 1 -} - -# True if the object format is known to be 64-bit ELF. -# -proc is_elf64 { binary_file } { - global READELF - global READELFFLAGS - - set readelf_size "" - catch "exec $READELF $READELFFLAGS -h $binary_file > readelf.out" got - - if ![string match "" $got] then { - return 0 - } - - if { ![regexp "\n\[ \]*Class:\[ \]*ELF(\[0-9\]+)\n" \ - [file_contents readelf.out] nil readelf_size] } { - return 0 - } - - if { $readelf_size == "64" } { - return 1 - } - - return 0 -} - -# True if the object format is known to be a.out. -# -proc is_aout_format {} { - if { [istarget *-*-netbsdelf] - || [istarget sparc64-*-netbsd*] - || [istarget sparc64-*-openbsd*] } { - return 0 - } - if { [istarget *-*-*\[ab\]out*] - || [istarget *-*-linux*oldld*] - || [istarget *-*-bsd*] - || [istarget *-*-msdos*] - || [istarget arm-*-netbsd*] - || [istarget arm-*-openbsd*] - || [istarget arm-*-riscix*] - || [istarget i?86-*-freebsd\[12\]*] - || [istarget i?86-*-netbsd*] - || [istarget i?86-*-openbsd\[0-2\]*] - || [istarget i?86-*-openbsd3.\[0-2\]*] - || [istarget i?86-*-vsta] - || [istarget i?86-*-mach*] - || [istarget m68*-*-netbsd*] - || [istarget m68*-*-openbsd*] - || [istarget ns32k-*-*] - || [istarget pdp11-*-*] - || [istarget sparc*-*-sunos4*] - || [istarget sparc*-*-netbsd*] - || [istarget sparc*-*-openbsd\[0-2\]*] - || [istarget sparc*-*-openbsd3.\[0-1\]*] - || [istarget sparc*-fujitsu-none] - || [istarget vax-dec-ultrix*] - || [istarget vax-*-netbsd] } { - return 1 - } - return 0 -} - -# True if the object format is known to be PE COFF. -# -proc is_pecoff_format {} { - if { ![istarget *-*-mingw*] - && ![istarget *-*-cygwin*] - && ![istarget *-*-cegcc*] - && ![istarget *-*-pe*] } { - return 0 - } - - return 1 -} - -# Compares two files line-by-line. -# Returns differences if exist. -# Returns null if file(s) cannot be opened. -# -proc simple_diff { file_1 file_2 } { - global target - - set eof -1 - set differences 0 - - if [file exists $file_1] then { - set file_a [open $file_1 r] - } else { - warning "$file_1 doesn't exist" - return - } - - if [file exists $file_2] then { - set file_b [open $file_2 r] - } else { - fail "$file_2 doesn't exist" - return - } - - verbose "# Diff'ing: $file_1 $file_2\n" 2 - - while { [gets $file_a line] != $eof } { - if [regexp "^#.*$" $line] then { - continue - } else { - lappend list_a $line - } - } - close $file_a - - while { [gets $file_b line] != $eof } { - if [regexp "^#.*$" $line] then { - continue - } else { - lappend list_b $line - } - } - close $file_b - - for { set i 0 } { $i < [llength $list_a] } { incr i } { - set line_a [lindex $list_a $i] - set line_b [lindex $list_b $i] - - verbose "\t$file_1: $i: $line_a\n" 3 - verbose "\t$file_2: $i: $line_b\n" 3 - if [string compare $line_a $line_b] then { - verbose -log "\t$file_1: $i: $line_a\n" - verbose -log "\t$file_2: $i: $line_b\n" - - fail "Test: $target" - return - } - } - - if { [llength $list_a] != [llength $list_b] } { - fail "Test: $target" - return - } - - if $differences<1 then { - pass "Test: $target" - } -} - # run_dump_test FILE # Copied from gas testsuite, tweaked and further extended. # @@ -701,8 +508,8 @@ proc simple_diff { file_1 file_2 } { # # After the option lines come regexp lines. `run_dump_test' calls # `regexp_diff' to compare the output of the dumping tool against the -# regexps in FILE.d. `regexp_diff' is defined later in this file; see -# further comments there. +# regexps in FILE.d. `regexp_diff' is defined in binutils-common.exp; +# see further comments there. # proc run_dump_test { name } { global subdir srcdir @@ -1067,123 +874,6 @@ proc slurp_options { file } { return $opt_array } -# regexp_diff, copied from gas, based on simple_diff above. -# compares two files line-by-line -# file1 contains strings, file2 contains regexps and #-comments -# blank lines are ignored in either file -# returns non-zero if differences exist -# -proc regexp_diff { file_1 file_2 } { - - set eof -1 - set end_1 0 - set end_2 0 - set differences 0 - set diff_pass 0 - set fail_if_match 0 - - if [file exists $file_1] then { - set file_a [open $file_1 r] - } else { - warning "$file_1 doesn't exist" - return 1 - } - - if [file exists $file_2] then { - set file_b [open $file_2 r] - } else { - fail "$file_2 doesn't exist" - close $file_a - return 1 - } - - verbose " Regexp-diff'ing: $file_1 $file_2" 2 - - while { 1 } { - set line_a "" - set line_b "" - while { [string length $line_a] == 0 } { - if { [gets $file_a line_a] == $eof } { - set end_1 1 - break - } - } - while { [string length $line_b] == 0 || [string match "#*" $line_b] } { - if [ string match "#pass" $line_b ] { - set end_2 1 - set diff_pass 1 - break - } elseif [ string match "#failif" $line_b ] { - send_log "fail if no difference\n" - verbose "fail if no difference" 3 - set fail_if_match 1 - } elseif [ string match "#..." $line_b ] { - if { [gets $file_b line_b] == $eof } { - set end_2 1 - set diff_pass 1 - break - } - verbose "looking for \"^$line_b$\"" 3 - while { ![regexp "^$line_b$" "$line_a"] } { - verbose "skipping \"$line_a\"" 3 - if { [gets $file_a line_a] == $eof } { - set end_1 1 - break - } - } - break - } - if { [gets $file_b line_b] == $eof } { - set end_2 1 - break - } - } - - if { $diff_pass } { - break - } elseif { $end_1 && $end_2 } { - break - } elseif { $end_1 } { - send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n" - verbose "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1" 3 - set differences 1 - break - } elseif { $end_2 } { - send_log "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" - verbose "extra lines in $file_1 starting with \"^$line_a$\"\nEOF from $file_2\n" 3 - set differences 1 - break - } else { - verbose "regexp \"^$line_b$\"\nline \"$line_a\"" 3 - if ![regexp "^$line_b$" "$line_a"] { - verbose "regexp_diff match failure\n" 3 - send_log "regexp_diff match failure\n" - send_log "regexp \"^$line_b$\"\nline \"$line_a\"\n" - set differences 1 - } - } - } - - if { $differences == 0 && !$diff_pass && [eof $file_a] != [eof $file_b] } { - send_log "$file_1 and $file_2 are different lengths\n" - verbose "$file_1 and $file_2 are different lengths" 3 - set differences 1 - } - - if { $fail_if_match } { - if { $differences == 0 } { - set differences 1 - } else { - set differences 0 - } - } - - close $file_a - close $file_b - - return $differences -} - proc file_contents { filename } { set file [open $filename r] set contents [read $file]