From 8cfc7cf8c273677b5c83290cd1b143f18eeeb9c4 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 3 Jan 2017 12:27:19 +1030 Subject: [PATCH] Add -rpath-link to various tests 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 | 7 +++++++ ld/testsuite/ld-elf/shared.exp | 18 +++++++++--------- ld/testsuite/ld-elfvers/vers.exp | 2 +- ld/testsuite/ld-elfweak/elfweak.exp | 4 ++-- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index d46deefbd0d..159b5221e72 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2017-01-03 Alan Modra + + * 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 * testsuite/ld-elf/elf.exp: Check that $CC exists before C tests. diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index 52baadd4904..aac3accd855 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -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" "" \ diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp index bd35ae2defa..55875917fdf 100644 --- a/ld/testsuite/ld-elfvers/vers.exp +++ b/ld/testsuite/ld-elfvers/vers.exp @@ -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 diff --git a/ld/testsuite/ld-elfweak/elfweak.exp b/ld/testsuite/ld-elfweak/elfweak.exp index e62291e142c..49b6c565349 100644 --- a/ld/testsuite/ld-elfweak/elfweak.exp +++ b/ld/testsuite/ld-elfweak/elfweak.exp @@ -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)" -- 2.30.2