Use is_xcoff_format in ld testsuite

* testsuite/ld-checks/checks.exp: Use is_xcoff_format.
	* testsuite/ld-powerpc/powerpc.exp: Likewise.
	* testsuite/ld-scripts/print-memory-usage.exp: Likewise.
	* testsuite/ld-srec/srec.exp: Likewise.
	* testsuite/ld-undefined/require-defined.exp: Likewise.
	* testsuite/ld-scripts/expr2.d: Likewise.
	* testsuite/ld-scripts/section-match-1.d: Only run for ELF.
	* testsuite/ld-elfvers/vers.exp: Delete dead code.
	* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
	* testsuite/ld-elfweak/elfweak.exp: Likewise.
This commit is contained in:
Alan Modra 2020-07-07 12:41:55 +09:30
parent 34e7979860
commit 7193487fa8
11 changed files with 64 additions and 117 deletions

View File

@ -1,3 +1,16 @@
2020-07-07 Alan Modra <amodra@gmail.com>
* testsuite/ld-checks/checks.exp: Use is_xcoff_format.
* testsuite/ld-powerpc/powerpc.exp: Likewise.
* testsuite/ld-scripts/print-memory-usage.exp: Likewise.
* testsuite/ld-srec/srec.exp: Likewise.
* testsuite/ld-undefined/require-defined.exp: Likewise.
* testsuite/ld-scripts/expr2.d: Likewise.
* testsuite/ld-scripts/section-match-1.d: Only run for ELF.
* testsuite/ld-elfvers/vers.exp: Delete dead code.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
2020-07-07 Alan Modra <amodra@gmail.com>
* emultempl/aix.em (gld${EMULATION_NAME}_find_exp_assignment): Handle

View File

@ -27,11 +27,8 @@ proc section_check {} {
global srcdir
global subdir
# The usage of .lcomm in asm.s is incompatible with ia64 and ppc coff.
if { [istarget ia64-*-*]
|| [istarget powerpc*-*-aix*]
|| [istarget powerpc-*-beos*]
|| [istarget rs6000-*-*] } {
# The usage of .lcomm in asm.s is incompatible with ia64 and ppc xcoff.
if { [istarget ia64-*-*] || [is_xcoff_format] } {
return
}
set test "check sections 1"

View File

@ -57,10 +57,6 @@ if { ![istarget hppa*64*-*-hpux*]
return
}
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
return
}
set diff diff
set tmpdir tmpdir
set VOBJDUMP_FLAGS --private-headers

View File

@ -61,36 +61,6 @@ set SHCFLAG ""
set shared_needs_pic "no"
set COMPRESS_LDFLAG "-Wl,--compress-debug-sections=zlib-gabi"
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
# AIX shared libraries do not seem to support useful features,
# like overriding the shared library function or letting the
# shared library refer to objects defined in the main program. We
# avoid testing those features.
set SHCFLAG "-DXCOFF_TEST"
# The AIX 3.2.5 loader appears to randomly fail when loading
# shared libraries from NSF mounted partitions, so we avoid any
# potential problems by using a local directory.
catch {exec /bin/sh -c "echo $$"} pid
set tmpdir /usr/tmp/ld.$pid
catch "exec mkdir $tmpdir" exec_status
# On AIX, we need to explicitly export the symbols the shared
# library is going to provide, and need.
set file [open $tmpdir/xcoff.exp w]
puts $file shlibvar1
puts $file shlibvar2
puts $file shlib_shlibvar1
puts $file shlib_shlibvar2
puts $file shlib_shlibcall
puts $file shlib_shlibcalled
puts $file shlib_checkfunptr1
puts $file shlib_getfunptr1
puts $file shlib_check
close $file
}
if [istarget arm*-*-linux*] {
# On ARM section anchors can change the symbol pre-emptability for
# non-PIC shared libraries, causing these tests to fail. Turn section
@ -137,11 +107,7 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
if [llength $args] { set shldflags [lindex $args 0] } else { set shldflags "" }
# Build the shared library.
# On AIX, we need to use an export file.
set shared -shared
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
set shared "-bM:SRE -bE:$tmpdir/xcoff.exp"
}
if { [is_elf_format] && [check_shared_lib_support] } {
append shared " -Wl,-z,notext"
}
@ -162,12 +128,7 @@ proc visibility_test { visibility progname testname main sh1 sh2 dat args } {
# Link against the shared library. Use -rpath so that the
# dynamic linker can locate the shared library at runtime.
# On AIX, we must include /lib in -rpath, as otherwise the loader
# can not find -lc.
set rpath $tmpdir
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
set rpath /lib:$tmpdir
}
if ![ld_link $CC $tmpdir/$progname "-Wl,-rpath,$rpath $tmpdir/$main $tmpdir/$progname.so"] {
if { [ string match $visibility "hidden" ]
&& [regexp "undefined reference to \`\.?visibility\'" $link_output]
@ -287,8 +248,6 @@ proc visibility_run {visibility} {
if { ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
|| ![ld_compile "$CC -g $NOPIE_CFLAGS $PLT_CFLAGS $CFLAGS $SHCFLAG $VSBCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unresolved "visibility ($visibility) (non PIC)"
} else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o xcoff
} else {
# SunOS non PIC shared libraries don't permit some cases of
# overriding.
@ -371,7 +330,7 @@ proc visibility_run {visibility} {
visibility_test $visibility vnp "visibility ($visibility) (non PIC, load offset)" \
mainnp.o sh1np.o sh2np.o elfvsb \
"-Wl,-T,$srcdir/$subdir/elf-offset.ld,--hash-style=sysv"
} }
}
# Now compile the code using -fpic.
@ -385,11 +344,7 @@ proc visibility_run {visibility} {
setup_xfail $target_triplet
}
}
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o xcoff
} else {
visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o elfvsb $COMPRESS_LDFLAG
}
visibility_test $visibility vp "visibility ($visibility)" mainnp.o sh1p.o sh2p.o elfvsb $COMPRESS_LDFLAG
}
}}
@ -403,44 +358,40 @@ proc visibility_run {visibility} {
} else {
if { [ remote_file host exists $tmpdir/sh1np.o ]
&& [ remote_file host exists $tmpdir/sh2np.o ] } {
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o xcoff
} else {
# SunOS non PIC shared libraries don't permit some cases of
# overriding.
if { [ string match $visibility "protected" ]
|| [ string match $visibility "protected_undef_def" ] } {
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
# SunOS non PIC shared libraries don't permit some cases of
# overriding.
if { [ string match $visibility "protected" ]
|| [ string match $visibility "protected_undef_def" ] } {
if [ string match $support_protected "no" ] {
setup_xfail $target_triplet
}
if { ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "protected_undef" ] } {
setup_xfail "ia64-*-linux*"
setup_xfail "alpha*-*-linux*"
}
if { ![ string match $visibility "hidden" ]
&& ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "hidden_undef_def" ]
&& ![ string match $visibility "protected_undef" ] } {
setup_xfail "s390x-*-linux*"
if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainp.o] } {
setup_xfail "sparc*-*-linux*"
}
}
if { [is_elf64 $tmpdir/mainp.o] } {
setup_xfail "x86_64-*-linux*"
}
setup_xfail "x86_64-*-linux-gnux32"
if { ![istarget hppa*64*-*-linux*] } {
setup_xfail "hppa*-*-linux*"
}
if [ string match $shared_needs_pic "yes" ] {
setup_xfail "arm*-*-linux*"
}
visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o elfvsb
}
if { ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "protected_undef" ] } {
setup_xfail "ia64-*-linux*"
setup_xfail "alpha*-*-linux*"
}
if { ![ string match $visibility "hidden" ]
&& ![ string match $visibility "hidden_undef" ]
&& ![ string match $visibility "hidden_undef_def" ]
&& ![ string match $visibility "protected_undef" ] } {
setup_xfail "s390x-*-linux*"
if { [istarget sparc*-*-linux*] && [is_elf64 $tmpdir/mainp.o] } {
setup_xfail "sparc*-*-linux*"
}
}
if { [is_elf64 $tmpdir/mainp.o] } {
setup_xfail "x86_64-*-linux*"
}
setup_xfail "x86_64-*-linux-gnux32"
if { ![istarget hppa*64*-*-linux*] } {
setup_xfail "hppa*-*-linux*"
}
if [ string match $shared_needs_pic "yes" ] {
setup_xfail "arm*-*-linux*"
}
visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o elfvsb
} else {
unresolved "visibility (PIC main, non PIC so)"
}
@ -453,11 +404,7 @@ proc visibility_run {visibility} {
setup_xfail $target_triplet
}
}
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o xcoff
} else {
visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o elfvsb
}
visibility_test $visibility vmpp "visibility ($visibility) (PIC main)" mainp.o sh1p.o sh2p.o elfvsb
} else {
unresolved "visibility ($visibility) (PIC main)"
}
@ -529,8 +476,3 @@ if { ![ld_compile "$CC -g $CFLAGS" $srcdir/$subdir/test.c tmpdir/test.o] } {
}
}
}
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
# Remove the temporary directory.
catch "exec rm -rf $tmpdir" exec_status
}

View File

@ -55,9 +55,6 @@ if { ![istarget alpha*-*-linux*]
&& ![istarget *-*-nacl*] } {
return
}
if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
return
}
set diff diff
set tmpdir tmpdir

View File

@ -70,10 +70,10 @@ if {[istarget "*-*-vxworks"]} {
# is ELF, because we pass -melf32ppc to ld and powerpc-nto-ld wants
# -melf32ppcnto.
if { [istarget "*-*-macos*"]
if { [is_xcoff_format]
|| [istarget "*-*-pe"] || [istarget "*-*-winnt*"]
|| [istarget "*-*-cygwin*"] || [istarget "*-*-aix*"]
|| [istarget "*-*-beos*"] || [istarget "*-*-lynxos*"]
|| [istarget "*-*-cygwin*"]
|| [istarget "*-*-lynxos*"]
|| [istarget "*-*-nto*"] } {
return
}

View File

@ -1,6 +1,6 @@
# ld: -T expr2.t
#nm: -B
#xfail: arm-*-*aout powerpc*-*-aix* rs6000-*-aix*
#xfail: arm-*-*aout [is_xcoff_format]
#...
.* D defined

View File

@ -29,8 +29,7 @@ if { [istarget mips*-*-*]
|| [istarget pdp11*-*-*]
|| [istarget tic30*-*-*]
|| [istarget tic54x*-*-*]
|| [istarget *-*-aix*]
|| [istarget *-*-xcoff*] } {
|| [is_xcoff_format] } {
return
}

View File

@ -1,8 +1,8 @@
#source: section-match-1.s
#ld: -T section-match-1.t
#objdump: -s
#notarget: *-*-osf* *-*-aix* *-*-pe *-*-*aout *-*-ecoff *-*-netbsd *-*-vms h8300-*-* ns32k-*-* tic30-*-*
# This test uses arbitrary section names, which are not support by some
#target: [is_elf_format]
# This test uses arbitrary section names, which are not supported by some
# file formats. Also these section names must be present in the
# output, not translated into some other name, eg .text

View File

@ -384,7 +384,9 @@ setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-linux*"
# The S-record linker doesn't do the magic TOC handling that XCOFF
# linkers do.
setup_xfail "*-*-aix*" "*-*-xcoff*"
if [is_xcoff_format] {
setup_xfail *-*-*
}
# The S-record linker is not supported for ARC.
setup_xfail "arc*-*-*"
@ -454,7 +456,9 @@ if ![ld_compile "$CXX $CXXFLAGS -fno-exceptions" $srcdir/$subdir/sr3.cc tmpdir/s
# See above.
setup_xfail "i*86-*-aout*"
setup_xfail "mips*-*-irix5*" "mips*-*-irix6*" "mips*-*-linux*"
setup_xfail "*-*-aix*" "*-*-xcoff*"
if [is_xcoff_format] {
setup_xfail *-*-*
}
setup_xfail "arc*-*-*"
setup_xfail "arm*-*-*"
setup_xfail "v850*-*-elf"

View File

@ -35,9 +35,8 @@ if { [istarget "powerpcle-*-*"] \
|| [istarget "cris-axis-elf"] \
|| [istarget "ns32k-*-*"] \
|| [istarget "*-*-coff"] \
|| [istarget "*-*-xcoff"] \
|| [istarget "*-*-*aout*"] \
|| [istarget "*-*-*aix*"] } {
|| [is_xcoff_format] } {
unsupported "require-defined testing"
return
}