2000-10-19 H.J. Lu (hjl@gnu.org)
[deliverable/binutils-gdb.git] / ld / testsuite / ld-shared / shared.exp
index d1ea6668005fe8332b524f0880d38ab83d5478a7..fd01aa47f4fd19a35b5e34c80dcdea456e55933e 100644 (file)
@@ -1,5 +1,5 @@
 # Expect script for ld-shared tests
-#   Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation
+#   Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -41,21 +41,20 @@ if { ![istarget i386-*-sysv4*] \
      && ![istarget i586-*-linux*] \
      && ![istarget m68k-*-linux*] \
      && ![istarget mips*-*-irix5*] \
+     && ![istarget powerpc-*-elf*] \
+     && ![istarget powerpc-*-linux*] \
+     && ![istarget powerpc-*-sysv4*] \
      && ![istarget sparc*-*-elf] \
      && ![istarget sparc*-*-solaris2*] \
      && ![istarget sparc*-*-sunos4*] \
+     && ![istarget sparc*-*-linux*] \
      && ![istarget rs6000*-*-aix*] \
      && ![istarget powerpc*-*-aix*] } {
     return
 }
 
-if { [istarget i386-*-linuxaout*] \
-     || [istarget i486-*-linuxaout*] \
-     || [istarget i586-*-linuxaout*] \
-     || [istarget i386-*-linuxoldld*] \
-     || [istarget i486-*-linuxoldld*] \
-     || [istarget i586-*-linuxoldld*] \
-     || [istarget m68k-*-linuxaout*] } {
+if { [istarget *-*-linux*aout*] \
+     || [istarget *-*-linux*oldld*] } {
     return
 }
 
@@ -93,7 +92,7 @@ if { [istarget rs6000*-*-aix*] || [istarget powerpc*-*-aix*] } {
 }
 
 # The test procedure.
-proc shared_test { progname testname main sh1 sh2 dat } {
+proc shared_test { progname testname main sh1 sh2 dat args } {
     global ld
     global srcdir
     global subdir
@@ -101,13 +100,15 @@ proc shared_test { progname testname main sh1 sh2 dat } {
     global host_triplet
     global tmpdir
 
+    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 {![ld_simple_link $ld $tmpdir/$progname.so "$shared $tmpdir/$sh1 $tmpdir/$sh2"]} {
+    if {![ld_simple_link $ld $tmpdir/$progname.so "$shared $shldflags $tmpdir/$sh1 $tmpdir/$sh2"]} {
         fail "$testname"
        return
     }
@@ -195,11 +196,18 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o]
        # SunOS non PIC shared libraries don't permit some cases of
        # overriding.
        setup_xfail "*-*-sunos4*"
-       # On Linux/m68k this fails because non-pic references to symbols
-       # in the same section may be resolved by the assembler if they
-       # are pc-relative.
-       setup_xfail "m68k-*-linux*"
        shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared
+
+       # Test ELF shared library relocations with a non-zero load
+       # address for the library.  Near as I can tell, the R_*_RELATIVE
+       # relocations for various targets are broken in the case where
+       # the load address is not zero (which is the default).
+       setup_xfail "*-*-sunos4*"
+       setup_xfail "*-*-linux*libc1"
+       setup_xfail "powerpc-*-linux*"
+       shared_test shnp "shared (non PIC, load offset)" \
+               mainnp.o sh1np.o sh2np.o shared \
+               "-T $srcdir/$subdir/elf-offset.ld"
     } }
 
     # Now compile the code using -fpic.
@@ -231,10 +239,6 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m
            # SunOS non PIC shared libraries don't permit some cases of
            # overriding.
            setup_xfail "*-*-sunos4*"
-           # On Linux/m68k this fails because non-pic references to symbols
-           # in the same section may be resolved by the assembler if they
-           # are pc-relative.
-           setup_xfail "m68k-*-linux*"
            shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared
        }
     } else {
This page took 0.024317 seconds and 4 git commands to generate.