aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-01-15 20:06:43 +0000
committerIan Lance Taylor <ian@airs.com>1996-01-15 20:06:43 +0000
commit21a3c2ff37b7814667f52cd15de2fdef3d8c9d12 (patch)
tree917d55909b403f3641a084a0e705f0e48fe58085 /ld/testsuite
parent1ec02944ebf2f0197c995aebd823b5c2a1b0cca4 (diff)
downloadfsf-binutils-gdb-21a3c2ff37b7814667f52cd15de2fdef3d8c9d12.zip
fsf-binutils-gdb-21a3c2ff37b7814667f52cd15de2fdef3d8c9d12.tar.gz
fsf-binutils-gdb-21a3c2ff37b7814667f52cd15de2fdef3d8c9d12.tar.bz2
* ld-bootstrap/bootstrap.exp: Expect failure for mips*-*-irix5*
when doing the --static test. * ld-shared/shared.exp: Run tests on mips*-*-irix5*.
Diffstat (limited to 'ld/testsuite')
-rw-r--r--ld/testsuite/ChangeLog11
-rw-r--r--ld/testsuite/ld-bootstrap/bootstrap.exp17
-rw-r--r--ld/testsuite/ld-shared/shared.exp132
3 files changed, 133 insertions, 27 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 3ecfb8d..3f66802 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,14 @@
+Mon Jan 15 15:05:53 1996 Ian Lance Taylor <ian@cygnus.com>
+
+ * ld-bootstrap/bootstrap.exp: Expect failure for mips*-*-irix5*
+ when doing the --static test.
+ * ld-shared/shared.exp: Run tests on mips*-*-irix5*.
+
+Fri Dec 29 12:33:09 1995 Ian Lance Taylor <ian@cygnus.com>
+
+ * ld-bootstrap/bootstrap.exp: On AIX, don't pass the -bI option
+ when creating ld-partial.o.
+
Tue Dec 26 17:37:23 1995 Ian Lance Taylor <ian@cygnus.com>
* ld-srec/srec.exp: If powerpc*-*-eabi*, use --defsym to define
diff --git a/ld/testsuite/ld-bootstrap/bootstrap.exp b/ld/testsuite/ld-bootstrap/bootstrap.exp
index c149744..d8a247d 100644
--- a/ld/testsuite/ld-bootstrap/bootstrap.exp
+++ b/ld/testsuite/ld-bootstrap/bootstrap.exp
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Written by Jeffrey Wheat (cassidy@cygnus.com)
# Rewritten by Ian Lance Taylor (ian@cygnus.com)
@@ -50,6 +50,21 @@ foreach flags {"" "--static" "--traditional-format" "--no-keep-memory"} {
continue
}
+ # On AIX, you need to specify an import list when using --static.
+ # You only want the import list when creating the final
+ # executable.
+ if [istarget "*-*-aix*"] {
+ if {"$flags" == "--static"} {
+ set flags "--static -bI:/lib/syscalls.exp"
+ }
+ }
+
+ # On Irix 5, linking with --static only works if all the files are
+ # compiled using -non_shared.
+ if {"$flags" == "--static"} {
+ setup_xfail "mips*-*-irix5*"
+ }
+
if ![ld_link $ld tmpdir/ld1 "$flags tmpdir/ld-partial.o $BFDLIB $LIBIBERTY"] {
fail $testname
continue
diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp
index 18bdaf9..b0f006e 100644
--- a/ld/testsuite/ld-shared/shared.exp
+++ b/ld/testsuite/ld-shared/shared.exp
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Written by Ian Lance Taylor (ian@cygnus.com)
#
@@ -36,36 +36,85 @@ if { ![istarget i386-*-sysv4*] \
&& ![istarget i386-*-elf*] \
&& ![istarget i486-*-elf*] \
&& ![istarget i586-*-elf*] \
+ && ![istarget mips*-*-irix5*] \
&& ![istarget sparc*-*-elf] \
- && ![istarget sparc*-*-solaris2*]} then {
+ && ![istarget sparc*-*-solaris2*] \
+ && ![istarget sparc*-*-sunos4*] \
+ && ![istarget rs6000*-*-aix*] \
+ && ![istarget powerpc*-*-aix*] } {
return
}
+set tmpdir tmpdir
+set SHCFLAG ""
+
+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
+}
+
# The test procedure.
-proc shared_test { progname testname main sh1 sh2 } {
+proc shared_test { progname testname main sh1 sh2 dat } {
global ld
global srcdir
global subdir
global exec_output
global host_triplet
+ global tmpdir
# Build the shared library.
- if {![ld_simple_link $ld tmpdir/$progname.so "-shared tmpdir/$sh1 tmpdir/$sh2"]} {
+ # 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 {![ld_simple_link $ld $tmpdir/$progname.so "$shared $tmpdir/$sh1 $tmpdir/$sh2"]} {
fail "$testname"
return
}
# Link against the shared library. Use -rpath so that the
# dynamic linker can locate the shared library at runtime.
- if ![ld_link $ld tmpdir/$progname "-rpath tmpdir tmpdir/$main tmpdir/$progname.so"] {
+ # 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 $ld $tmpdir/$progname "-rpath $rpath $tmpdir/$main $tmpdir/$progname.so"] {
fail "$testname"
return
}
# Run the resulting program
- send_log "tmpdir/$progname >tmpdir/$progname.out\n"
- verbose "tmpdir/$progname >tmpdir/$progname.out"
- catch "exec tmpdir/$progname >tmpdir/$progname.out" exec_output
+ send_log "$tmpdir/$progname >$tmpdir/$progname.out\n"
+ verbose "$tmpdir/$progname >$tmpdir/$progname.out"
+ catch "exec $tmpdir/$progname >$tmpdir/$progname.out" exec_output
if ![string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output"
@@ -73,9 +122,9 @@ proc shared_test { progname testname main sh1 sh2 } {
return
}
- send_log "diff tmpdir/$progname.out $srcdir$subdir/shared.dat\n"
- verbose "diff tmpdir/$progname.out $srcdir$subdir/shared.dat"
- catch "exec diff tmpdir/$progname.out $srcdir$subdir/shared.dat" exec_output
+ send_log "diff $tmpdir/$progname.out $srcdir/$subdir/$dat.dat\n"
+ verbose "diff $tmpdir/$progname.out $srcdir/$subdir/$dat.dat"
+ catch "exec diff $tmpdir/$progname.out $srcdir/$subdir/$dat.dat" exec_output
set exec_output [prune_system_crud $host_triplet $exec_output]
if {![string match "" $exec_output]} then {
@@ -99,13 +148,18 @@ 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] } then {
- set picflag "-KPIC"
+ || [string match "*unrecognized option*" $exec_output] \
+ || [string match "*passed to ld*" $exec_output] } {
+ if [istarget *-*-sunos4*] {
+ set picflag "-pic"
+ } else {
+ set picflag "-KPIC"
+ }
}
verbose "Using $picflag to compile PIC code"
# Compile the main program.
-if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/main.c tmpdir/mainnp.o] {
+if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] {
unresolved "shared (non PIC)"
unresolved "shared"
} else {
@@ -115,37 +169,63 @@ if ![ld_compile "$CC $CFLAGS" $srcdir$subdir/main.c tmpdir/mainnp.o] {
# will need to do more relocation work. However, note that not
# using -fpic will cause some of the tests to return different
# results.
- if { ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh1.c tmpdir/sh1np.o]
- || ![ld_compile "$CC $CFLAGS" $srcdir$subdir/sh2.c tmpdir/sh2np.o] } {
+ if { ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/sh1.c $tmpdir/sh1np.o]
+ || ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/sh2.c $tmpdir/sh2np.o] } {
unresolved "shared (non PIC)"
+ } else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
+ shared_test shnp "shared (nonPIC)" mainnp.o sh1np.o sh2np.o xcoff
} else {
- shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o
- }
+ # SunOS can not handle non PIC code in a shared library
+ setup_xfail "*-*-sunos4*"
+ shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared
+ } }
# Now compile the code using -fpic.
- if { ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh1.c tmpdir/sh1p.o]
- || ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/sh2.c tmpdir/sh2p.o] } {
+ if { ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/sh1.c $tmpdir/sh1p.o]
+ || ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/sh2.c $tmpdir/sh2p.o] } {
unresolved "shared"
} else {
- shared_test shp "shared" mainnp.o sh1p.o sh2p.o
+ # SunOS can not compare function pointers correctly
+ if [istarget "*-*-sunos4*"] {
+ shared_test shp "shared" mainnp.o sh1p.o sh2p.o sun4
+ } else { if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
+ shared_test shp "shared" mainnp.o sh1p.o sh2p.o xcoff
+ } else {
+ shared_test shp "shared" mainnp.o sh1p.o sh2p.o shared
+ } }
}
}
# Now do the same tests again, but this time compile main.c PIC.
-if ![ld_compile "$CC $CFLAGS $picflag" $srcdir$subdir/main.c tmpdir/mainp.o] {
+if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/mainp.o] {
unresolved "shared (PIC main, non PIC so)"
unresolved "shared (PIC main)"
} else {
- if { [file exists tmpdir/sh1np.o ] && [ file exists tmpdir/sh2np.o ] } {
- shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o
+ if { [file exists $tmpdir/sh1np.o ] && [ file exists $tmpdir/sh2np.o ] } {
+ if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
+ shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o xcoff
+ } else {
+ # SunOS can not handle non PIC code in a shared library
+ setup_xfail "*-*-sunos4*"
+ shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared
+ }
} else {
unresolved "shared (PIC main, non PIC so)"
}
- if { [file exists tmpdir/sh1p.o ] && [ file exists tmpdir/sh2p.o ] } {
- shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o
+ if { [file exists $tmpdir/sh1p.o ] && [ file exists $tmpdir/sh2p.o ] } {
+ if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
+ shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o xcoff
+ } else {
+ shared_test shmpp "shared (PIC main)" mainp.o sh1p.o sh2p.o shared
+ }
} else {
unresolved "shared (PIC main)"
}
}
+
+if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
+ # Remove the temporary directory.
+ catch "exec rm -rf $tmpdir" exec_status
+}