Add -rpath-link to various tests
authorAlan Modra <amodra@gmail.com>
Tue, 3 Jan 2017 01:57:19 +0000 (12:27 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 3 Jan 2017 02:06:02 +0000 (12:36 +1030)
Needed for cross-builds without --sysroot, where USE_LIBPATH isn't
set.  See elf32.em after_open.  Perhap ld ought to look at -rpath in
this case?

* testsuite/ld-elf/shared.exp: Add -rpath-link and -no-as-needed
to various tests.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
* testsuite/ld-elfvers/vers.exp (vers19): Fix -rpath-link option.

ld/ChangeLog
ld/testsuite/ld-elf/shared.exp
ld/testsuite/ld-elfvers/vers.exp
ld/testsuite/ld-elfweak/elfweak.exp

index d46deefbd0de828e1b33e628f8e074e29310d778..159b5221e722fef392999b6c6a0178ef49d8589c 100644 (file)
@@ -1,3 +1,10 @@
+2017-01-03  Alan Modra  <amodra@gmail.com>
+
+       * testsuite/ld-elf/shared.exp: Add -rpath-link and -no-as-needed
+       to various tests.
+       * testsuite/ld-elfweak/elfweak.exp: Likewise.
+       * testsuite/ld-elfvers/vers.exp (vers19): Fix -rpath-link option.
+
 2017-01-03  Alan Modra  <amodra@gmail.com>
 
        * testsuite/ld-elf/elf.exp: Check that $CC exists before C tests.
index 52baadd49041da9e36a12c9e89edaf5b3a06791b..aac3accd8559cf493f1504c2b9d9878a039cdae9 100644 (file)
@@ -190,16 +190,16 @@ set build_tests {
    "-r -nostdlib" "-fPIC"
    {needed1c.c} {} "libneeded1pic.o"}
   {"Build needed1a.so with --add-needed"
-   "-shared tmpdir/libneeded1pic.o -Wl,--add-needed,-rpath=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
+   "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--add-needed,-rpath=tmpdir,-rpath-link=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
    {dummy.c} {} "needed1a.so"}
   {"Build needed1b.so with --copy-dt-needed-entries"
-   "-shared tmpdir/libneeded1pic.o -Wl,--copy-dt-needed-entries,-rpath=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
+   "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--copy-dt-needed-entries,-rpath=tmpdir,-rpath-link=tmpdir,-z,defs -Ltmpdir -lneeded1a" ""
    {dummy.c} {} "needed1b.so"}
   {"Build needed1a.so with --no-add-needed"
-   "-shared tmpdir/libneeded1pic.o -Wl,--no-add-needed -Ltmpdir -lneeded1a" ""
+   "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--no-add-needed -Ltmpdir -lneeded1a" ""
    {dummy.c} {} "needed1c.so"}
   {"Build needed1b.so with --no-copy-dt-needed-entries"
-   "-shared tmpdir/libneeded1pic.o -Wl,--no-copy-dt-needed-entries -Ltmpdir -lneeded1a" ""
+   "-shared tmpdir/libneeded1pic.o -Wl,--no-as-needed,--no-copy-dt-needed-entries -Ltmpdir -lneeded1a" ""
    {dummy.c} {} "needed1d.so"}
   {"Build librel.so"
    "-shared" "-fPIC"
@@ -247,7 +247,7 @@ set build_tests {
    "" "-fPIC"
    {pr16496b.c} {} "libpr16496b.a"}
   {"Build libpr16496b.so"
-   "-shared tmpdir/pr16496b.o tmpdir/libpr16496a.so" ""
+   "-shared -Wl,--no-as-needed tmpdir/pr16496b.o tmpdir/libpr16496a.so" ""
    {dummy.c} {{objdump {-R} pr16496b.od}} "libpr16496b.so"}
   {"Build libpr16452a.so"
    "-shared -Wl,-soname,libpr16452a.so,--version-script=pr16452.map" "-fPIC"
@@ -256,10 +256,10 @@ set build_tests {
    "-shared -Wl,-soname,libpr16452b.so,--no-as-needed tmpdir/libpr16452a.so" "-fPIC"
    {dummy.c} {} "libpr16452b.so"}
   {"Build pr16452"
-   "tmpdir/libpr16452b.so -Wl,-rpath=tmpdir" ""
+   "-Wl,--no-as-needed,-rpath=tmpdir,-rpath-link=tmpdir tmpdir/libpr16452b.so" ""
    {pr16452b.c} {{objdump {-p} pr16452.od}} "pr16452"}
   {"Build pr16457"
-   "tmpdir/libpr16452b.so -Wl,-rpath=tmpdir" ""
+   "-Wl,--no-as-needed,-rpath=tmpdir,-rpath-link=tmpdir tmpdir/libpr16452b.so" ""
    {pr16452b.c} {{objdump {-p} pr16457.od}} "pr16457"}
   {"Build libpr18458a.so"
    "-shared -Wl,-z,now" "-fPIC"
@@ -412,10 +412,10 @@ set run_tests [list \
      "-Wl,--as-needed tmpdir/libpr14862-1.o tmpdir/libpr14862.so" "" \
      {dummy.c} "pr14862" "pr14862.out" ] \
     [list "Link with --add-needed" \
-     "tmpdir/libneeded1c.o -Wl,--no-as-needed,--add-needed,-rpath=tmpdir -Ltmpdir -lneeded1a" "" \
+     "tmpdir/libneeded1c.o -Wl,--no-as-needed,--add-needed,-rpath=tmpdir,-rpath-link=tmpdir -Ltmpdir -lneeded1a" "" \
      {dummy.c} "needed1a" "needed1.out" ] \
     [list "Link with --copy-dt-needed-entries" \
-     "tmpdir/libneeded1c.o -Wl,--no-as-needed,--copy-dt-needed-entries,-rpath=tmpdir -Ltmpdir -lneeded1a" "" \
+     "tmpdir/libneeded1c.o -Wl,--no-as-needed,--copy-dt-needed-entries,-rpath=tmpdir,-rpath-link=tmpdir -Ltmpdir -lneeded1a" "" \
      {dummy.c} "needed1b" "needed1.out" ] \
     [list "Run relmain" \
      "-Wl,--no-as-needed,-rpath=tmpdir -Ltmpdir -lrel" "" \
index bd35ae2defa3d871805f59ffae34840602daeb96..55875917fdf19a0b410bcdd89d587a9b14d886a8 100644 (file)
@@ -909,7 +909,7 @@ build_exec "vers16" vers16.c vers16 "-Wl,--no-as-needed" vers16a.so "" vers16.ds
 # Test a weak versioned symbol.
 build_vers_lib_pic "vers17" vers17.c vers17 "" vers17.map vers17.ver vers17.dsym ""
 build_vers_lib_pic "vers18" vers18.c vers18 vers17.so vers18.map vers18.ver vers18.dsym vers18.sym
-build_exec "vers19" vers19.c vers19 "-Wl,-rpath,. -Wl,-rpath-link,--no-as-needed" vers18.so vers19.ver vers19.dsym ""
+build_exec "vers19" vers19.c vers19 "-Wl,--no-as-needed,-rpath,.,-rpath-link,." vers18.so vers19.ver vers19.dsym ""
 
 build_vers_lib_no_pic "vers20a" vers20.c vers20a "" vers20.map vers20a.ver vers20.dsym ""
 exec cp $tmpdir/vers20a.so $tmpdir/vers20b.so
index e62291e142c2aa38280a547b822a87816d1145bc..49b6c565349be32468f8a91b1cd60001d9bcb3a5 100644 (file)
@@ -479,8 +479,8 @@ build_exec "ELF weak data first common" foo "main1.o bar1a.o foo1b.o" "" strongd
 build_exec "ELF weak data last common" foo "foo1b.o main1.o bar1a.o" "" strongdata "" strongcomm.sym
 build_exec "ELF weak data first DSO" foo "main1.o libbar1a.so libfoo1a.so" "-Wl,-rpath,.,--no-as-needed" weakdata weakdata.dsym ""
 build_exec "ELF weak data last DSO" foo "libfoo1a.so main1.o libbar1a.so" "-Wl,-rpath,.,--no-as-needed" weakdata weakdata.dsym ""
-build_exec "ELF weak data first DSO common" foo "main1.o libbar1a.so libfoo1b.so" "-Wl,-rpath,.,--no-as-needed" weakdata weakdata.dsym ""
-build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o libbar1a.so" "-Wl,-rpath,.,--no-as-needed" weakdata weakdata.dsym ""
+build_exec "ELF weak data first DSO common" foo "main1.o libbar1a.so libfoo1b.so" "-Wl,--no-as-needed,-rpath,.,-rpath-link,." weakdata weakdata.dsym ""
+build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o libbar1a.so" "-Wl,--no-as-needed,-rpath,.,-rpath-link,." weakdata weakdata.dsym ""
 
 if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/size_foo.c $tmpdir/size_foo.o] {
     unresolved "ELF weak (size)"