+2011-02-10 Alan Modra <amodra@gmail.com>
+
+ Apply from mainline
+ 2010-11-20 Richard Sandiford <rdsandiford@googlemail.com>
+ * lib/binutils-common.exp (regexp_diff): New procedure.
+ * lib/utils-lib.exp (regexp_diff): Delete.
+
+ 2010-11-20 Richard Sandiford <rdsandiford@googlemail.com>
+ * 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 <thomas@schwinge.name>
+ * 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 <amodra@gmail.com>
Backport from mainline
#source: empty.s
#readelf: -h
#name: Update ELF header 2
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#...
ELF Header:
#source: empty.s
#readelf: -h
#name: Update ELF header 3
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#...
ELF Header:
# 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
}
set add_libs ""
}
- if { [istarget *-*-linux*] } {
+ if { [istarget *-*-linux*]
+ || [istarget *-*-gnu*] } {
foreach i $gcc_gas_flag {
set flags "additional_flags=$i $flags"
}
#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]+.*
# 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:
#
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
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
}
# 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
# This file was written by Rob Savoye <rob@cygnus.com>
# and extended by Ian Lance Taylor <ian@cygnus.com>
+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]
}
}
-# 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.
#
# 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
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]
+2011-02-10 Alan Modra <amodra@gmail.com>
+
+ Apply from mainline
+ 2010-11-20 Richard Sandiford <rdsandiford@googlemail.com>
+ * 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 <rdsandiford@googlemail.com>
+ * 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 <thomas@schwinge.name>
+ * 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 <vincent.riviere@freesbee.fr>
PR gas/3041
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
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
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
# 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*"]
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
}
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 }
}
}
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 }
}
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
if { ([istarget "*-*-elf*"]
|| [istarget "m6811-*"]
|| [istarget "m6812-*"]
- || [istarget "*-*-linux*"])
+ || [istarget "*-*-linux*"]
+ || [istarget "*-*-gnu*"])
&& ![istarget *-*-linux*aout*]
&& ![istarget *-*-linux*oldld*] } then {
# 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
# 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 {
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 {} {
#
# 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
}
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] {
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]
}
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
}
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
+2011-02-10 Alan Modra <amodra@gmail.com>
+
+ Apply from mainline
+ 2010-11-08 Thomas Schwinge <thomas@schwinge.name>
+ * configure.host: Add stanza for *-*-gnu*.
+
2011-02-01 Alan Modra <amodra@gmail.com>
Backport from mainline
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,
+ # <http://www.gnu.org/software/hurd/open_issues/binutils.html#static>,
+ # 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.
*-*-freebsd* | *-*-kfreebsd*-gnu | *-*-dragonfly*)
;;
-*-*-linux*)
+*-*-linux* | *-*-gnu*)
;;
*-*-netbsd*)
+2011-02-10 Alan Modra <amodra@gmail.com>
+
+ Apply from mainline
+ 2011-01-08 Nick Clifton <nickc@redhat.com>
+ 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 <dave.anglin@nrc-cnrc.gc.ca>
+ PR ld/12360
+ * ld-elfcomm/elfcomm.exp (test1w1): Use same check as MIPS on
+ hppa*64*-*-*.
+
+ 2010-12-20 Alan Modra <amodra@gmail.com>
+ * ld-bootstrap/bootstrap.exp: Fix misplaced comment.
+
+ 2010-12-04 H.J. Lu <hongjiu.lu@intel.com>
+ * ld-selective/selective.exp: Don't pass -fvtable-gc to GCC
+ 3.4.0 or above.
+
+ 2010-12-04 H.J. Lu <hongjiu.lu@intel.com>
+ * ld-elfvers/vers.exp: Replace -export-dynamic with
+ -Wl,-export-dynamic.
+
+ 2010-12-11 Alan Modra <amodra@gmail.com>
+ * ld-elfvers/vers25a.dsym: Really include _? in match.
+
+ 2010-12-10 Mike Frysinger <vapier@gentoo.org>
+ * 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 <matthew.gretton-dann@arm.com>
+ * ld-scripts/script.exp: Remove full path from REGION_ALIAS test
+ names.
+
+ 2010-11-20 Richard Sandiford <rdsandiford@googlemail.com>
+ * lib/ld-lib.exp (regexp_diff, simple_diff): Delete.
+
+ 2010-11-20 Richard Sandiford <rdsandiford@googlemail.com>
+ * 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 <amodra@gmail.com>
+ * 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 <schwab@linux-m68k.org>
+ * ld-gc/pr11218-2.c: Declare
+ unresolved_detected_at_runtime_not_at_linktime.
+
+ 2010-11-08 Thomas Schwinge <thomas@schwinge.name>
+ * 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 <amodra@gmail.com>
* ld-elfvsb/elfvsb.exp: Don't run any non-PIC tests on powerpc*-linux.
# 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.
#
}
# 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
# 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.
#
# 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
}
# 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.
#
# Make sure that binutils can correctly handle ld output in ELF.
-# Run on Linux only.
-if { ![istarget *-*-linux*] } {
+if { ![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]} {
return
}
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*"]
#source: maxpage1.s
#ld: -z max-page-size=0x200000 -z common-page-size=0x100000
#readelf: -l --wide
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#...
LOAD+.*0x200000
#as: --compress-debug-sections
#ld: -shared
#readelf: -S --wide
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#failif
#...
#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.*
#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.*
#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.*
#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
#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:
# 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.
#
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}
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.*$ {
+ # <http://www.gnu.org/software/hurd/open_issues/binutils.html#static>
+ lappend xfails "*-*-*"
+ }
+}
+run_ld_link_exec_tests $xfails $array_tests_static
catch "exec rm -f tmpdir/preinit tmpdir/init tmpdir/fini" status
#source: start.s
#readelf: -d -s -D
#ld: -shared --hash-style=gnu
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#notarget: mips*-*-*
#...
-# target: *-*-linux* *-*-vxworks
+# target: *-*-linux* *-*-gnu* *-*-vxworks
# ld: -T header.t -z max-page-size=0x100
# objdump: -hpw
#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
#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
#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.*
#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
#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
#source: maxpage1.s
#ld: -z max-page-size=0x200000
#readelf: -l --wide
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#...
LOAD+.*0x200000
#source: maxpage1.s
#ld: -z max-page-size=0x100000
#readelf: -l --wide
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#...
LOAD+.*0x100000
#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?.*
#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
#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
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
#...
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
#...
-#target: *-*-linux* *-*-vxworks
+#target: *-*-linux* *-*-gnu* *-*-vxworks
#source: seg.s
#ld: -T seg.t -z max-page-size=0x1000
#readelf: -l --wide
#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
#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
#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
#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
#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
#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
#source: maxpage1.s
#ld: -n -z max-page-size=0x200000 -Ttext-segment 0x10000
#readelf: -l --wide
-#target: *-*-linux-gnu
+#target: *-*-linux-gnu *-*-gnu*
#...
LOAD .*
# 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.
#
# Make sure that binutils can correctly handle ld output in ELF.
-# Run on Linux only.
-if { ![istarget *-*-linux*] } {
+if { ![istarget *-*-linux*]
+ && ![istarget *-*-gnu*] } {
return
}
#source: unknown2.s
#ld: -shared
#readelf: -S
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#...
\[[ 0-9]+\] \.note.foo[ \t]+NOTE[ \t]+.*
}
# 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 {
# 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
}
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"
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
#
# 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
#
* 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";
}
-__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);
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
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
bar33();
}
-__asm__(".symver bar33,bar@@VERS_2.0");
+SYMVER(bar33, bar@@VERS_2.0);
#endif
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
-[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
* that we always get the right one.
*/
#include <stdio.h>
+#include "vers.h"
int
foo_1()
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);
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
-[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
-[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
[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
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
+#include "vers.h"
+
int
bar ()
{
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);
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
-[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
-[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-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
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
-__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 ()
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
-[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
-[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
-__asm__(".symver _old_bar,bar@VERS.0");
+#include "vers.h"
+
+SYMVER(_old_bar, bar@VERS.0);
void
_old_bar ()
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
-[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
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
-[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
-__asm__(".symver _old_bar,bar@VERS.0");
+#include "vers.h"
+
+SYMVER(_old_bar, bar@VERS.0);
void
_old_bar (void)
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
-[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
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
-[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
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
/* 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);
/* 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;
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
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
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
+#include "vers.h"
void foo () {}
-asm (".hidden foo");
+asm (".hidden " SYMPFX(foo));
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
-[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
+#include "vers.h"
+
void
foo ()
{
}
-asm (".symver foo,foo@VERS.0");
+SYMVER(foo, foo@VERS.0);
-[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
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
-[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
-[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
-[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_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
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
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
-[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
* -export-dynamic.
*/
#include <stdio.h>
+#include "vers.h"
extern int foo ();
}
-__asm__(".symver new_foo,foo@@VERS_2.0");
+SYMVER(new_foo, foo@@VERS_2.0);
int
main()
-[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
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
-[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
* 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";
}
-__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 ()
* that we always get the right one.
*/
#include <stdio.h>
+#include "vers.h"
extern int foo_1();
extern int foo_2();
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);
-[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
-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
* Test supplied by Ulrich. Verify that we can correctly force 'a'
* to local scope.
*/
+#include "vers.h"
+
int
__a_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);
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
-[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
* 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";
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);
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
-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
# 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.
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*] \
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
# 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.
#
# 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
}
set SOBJDUMP_FLAGS --syms
set shared --shared
+
+# <http://www.gnu.org/software/hurd/open_issues/binutils.html#weak>
+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.
return
}
- if {![string match "" $dynsymexp] \
+ if {![string match "" $dynsymexp]
&& ![objdump_dynsymstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$dynsymexp]} {
fail $test
return
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"
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
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] {
#name: --gc-sections with note section
#ld: --gc-sections -e _start
#readelf: -S --wide
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#notarget: *-*-*aout *-*-*oldld
#...
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
extern void foo_in_so(void);
+extern void unresolved_detected_at_runtime_not_at_linktime (void);
void call_unresolved(void)
{
# 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'
#name: --gc-sections with __start_
#ld: --gc-sections -e _start
#nm: -n
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#notarget: *-*-*aout *-*-*oldld
#...
# 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.
}
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*"]
run_dump_test "discarded1"
if { !([istarget "i?86-*-linux*"]
+ || [istarget "i?86-*-gnu*"]
|| [istarget "x86_64-*-linux*"]) } {
return
}
# 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.
#
# 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*"]
# 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.
|| [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"
# 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.
#
# have to qualify on ELF specifically in every .d-file.
if { ![istarget *-*-linux*] \
- && ![istarget *-*-gnu] \
+ && ![istarget *-*-gnu*] \
&& ![istarget hppa*64*-*-hpux*] \
&& ![istarget *-*-elf] } {
return
#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.
# 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.
#
# 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
}
# 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.
#
&& ![istarget *-*-eabi*] \
&& ![istarget hppa*64*-*-hpux*] \
&& ![istarget *-*-linux*] \
+ && ![istarget *-*-gnu*] \
&& ![istarget *-*-irix5*] \
&& ![istarget *-*-irix6*] \
&& ![istarget *-*-solaris2*] } {
# 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.
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"
}
}
}
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*-*] {
# 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"
# 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.
&& ![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*] \
#source: dummy.s
#ld: -shared --entry foo tmpdir/libentry.a
#nm: -n
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#...
[0-9a-f]+ T +foo
#source: dummy.s
#ld: -shared --entry foo -u foo tmpdir/libentry.a
#nm: -n
-#target: *-*-linux*
+#target: *-*-linux* *-*-gnu*
#...
[0-9a-f]+ T +foo
# 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.
&& ![istarget *-*-eabi*] \
&& ![istarget hppa*64*-*-hpux*] \
&& ![istarget *-*-linux*] \
+ && ![istarget *-*-gnu*] \
&& ![istarget *-*-irix5*] \
&& ![istarget *-*-irix6*] \
&& ![is_pecoff_format] \
# 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 } {
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.
#
#
# 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
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]