* [ld, testsuite] Restrict dl1*main and dl6*main tests on platforms which have libdl support
@ 2017-02-01 17:17 Jiong Wang
2017-02-02 7:13 ` Alan Modra
2017-03-10 16:24 ` [ld, testsuite] Only run rdynamic-1 when "-rdynamic" option is supported by compiler Jiong Wang
0 siblings, 2 replies; 6+ messages in thread
From: Jiong Wang @ 2017-02-01 17:17 UTC (permalink / raw)
To: Binutils
[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]
Some tests in ld-elf/share.exp require dlopen support. One platforms where
there are not such support I got the following compilation errors:
ld/testsuite/ld-elf/dl1main.c:2:10: fatal error: dlfcn.h: No such file or directory
#include <dlfcn.h>
^~~~~~~~~
ERROR: /work/BLD/8.3/src/binutils-gdb/ld/testsuite/ld-elf/dl6amain.c: compilation failed
UNRESOLVED: Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so
This patch restricts those tests on platform where libdl is available. The
availability check is done through compiling a sample test file which includes
"dlfcn.h".
This patch cut off 13 unresolved testcases on my arm-none-eabi environment and no regression.
Also no regression on arm-none-linux-gnu/x86-64 native check-ld.
OK for master?
Thanks.
ld/
2017-02-01 Jiong Wang <jiong.wang@arm.com>
* testsuite/lib/ld-lib.exp (check_libdl_available): New function.
* testsuite/ld-elf/shared.exp (run_tests): Split tests which require
dlopen support into "dlopen_run_tests". These tests include dl1*main
and dl6*main.
(dlopen_run_tests): New and only run it when check_libdl_available
returns true.
[-- Attachment #2: new.patch --]
[-- Type: text/x-diff, Size: 7346 bytes --]
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index eea9453..e9d465d 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -373,12 +373,6 @@ set run_tests [list \
[list "Run hidden libbar.so with versioned libfoo.so" \
"-Wl,--no-as-needed tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" \
{main.c} "hidden" "hidden.out" ] \
- [list "Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so" \
- "-Wl,--no-as-needed,--dynamic-list=dl1.list $extralibs" "" \
- {dl1main.c} "dl1a" "dl1.out" ] \
- [list "Run dl1b with --dynamic-list-data and dlopen on libdl1.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl1main.c} "dl1b" "dl1.out" ] \
[list "Run with libdl2a.so" \
"-Wl,--no-as-needed tmpdir/libdl2a.so" "" \
{dl2main.c} "dl2a" "dl2a.out" ] \
@@ -406,39 +400,6 @@ set run_tests [list \
[list "Run with libdl4f.so" \
"-Wl,--no-as-needed tmpdir/libdl4f.so" "" \
{dl4main.c} "dl4f" "dl4a.out" ] \
- [list "Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl6amain.c} "dl6a1" "dl6a.out" ] \
- [list "Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
- {dl6amain.c} "dl6a2" "dl6b.out" ] \
- [list "Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic $extralibs" "" \
- {dl6amain.c} "dl6a3" "dl6b.out" ] \
- [list "Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic,--dynamic-list-data $extralibs" "" \
- {dl6amain.c} "dl6a4" "dl6a.out" ] \
- [list "Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
- {dl6amain.c} "dl6a5" "dl6b.out" ] \
- [list "Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
- {dl6amain.c} "dl6a6" "dl6b.out" ] \
- [list "Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
- {dl6amain.c} "dl6a7" "dl6a.out" ] \
- [list "Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl6bmain.c} "dl6b1" "dl6a.out" ] \
- [list "Run dl6b2 with dlopen on libdl6b.so" \
- "-Wl,--no-as-needed $extralibs" "" \
- {dl6bmain.c} "dl6b2" "dl6b.out" ] \
- [list "Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl6cmain.c} "dl6c1" "dl6b.out" ] \
- [list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl6dmain.c} "dl6d1" "dl6b.out" ] \
[list "Run with libdata1.so" \
"-Wl,--no-as-needed tmpdir/libdata1.so" "" \
{dynbss1.c} "dynbss1" "pass.out" ] \
@@ -486,6 +447,54 @@ set run_tests [list \
# NetBSD ELF systems do not currently support the .*_array sections.
run_ld_link_exec_tests $run_tests "*-*-netbsdelf*"
+# These tests require dlopen support.
+set dlopen_run_tests [list \
+ [list "Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so" \
+ "-Wl,--no-as-needed,--dynamic-list=dl1.list $extralibs" "" \
+ {dl1main.c} "dl1a" "dl1.out" ] \
+ [list "Run dl1b with --dynamic-list-data and dlopen on libdl1.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl1main.c} "dl1b" "dl1.out" ] \
+ [list "Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl6amain.c} "dl6a1" "dl6a.out" ] \
+ [list "Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
+ {dl6amain.c} "dl6a2" "dl6b.out" ] \
+ [list "Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,-Bsymbolic $extralibs" "" \
+ {dl6amain.c} "dl6a3" "dl6b.out" ] \
+ [list "Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,-Bsymbolic,--dynamic-list-data $extralibs" "" \
+ {dl6amain.c} "dl6a4" "dl6a.out" ] \
+ [list "Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
+ {dl6amain.c} "dl6a5" "dl6b.out" ] \
+ [list "Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
+ {dl6amain.c} "dl6a6" "dl6b.out" ] \
+ [list "Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
+ {dl6amain.c} "dl6a7" "dl6a.out" ] \
+ [list "Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl6bmain.c} "dl6b1" "dl6a.out" ] \
+ [list "Run dl6b2 with dlopen on libdl6b.so" \
+ "-Wl,--no-as-needed $extralibs" "" \
+ {dl6bmain.c} "dl6b2" "dl6b.out" ] \
+ [list "Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl6cmain.c} "dl6c1" "dl6b.out" ] \
+ [list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl6dmain.c} "dl6d1" "dl6b.out" ] \
+]
+
+# Only run them when libdl is available.
+if [check_libdl_available] {
+ run_ld_link_exec_tests $dlopen_run_tests
+}
+
# Check --no-add-needed and --no-copy-dt-needed-entries
set testname "--no-add-needed"
set exec_output [run_host_cmd "$CC" "tmpdir/libneeded1c.o -Wl,--no-add-needed,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index a44358e..61626ec 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -2120,3 +2120,38 @@ proc istarget { target } {
}
return [istarget_ld $target]
}
+
+# Return true if libdl is supported.
+
+proc check_libdl_available { } {
+ global libdl_available_saved
+ global CC
+
+ if {![info exists libdl_available_saved]} {
+ if { [which $CC] == 0 } {
+ set libdl_available_saved 0
+ return 0
+ }
+
+ set basename "tmpdir/dl_avail_test[pid]"
+ set src ${basename}.c
+ set output ${basename}.out
+ set f [open $src "w"]
+ # Sample test file.
+ puts $f "#include <dlfcn.h>"
+ puts $f "int main (void)"
+ puts $f "{"
+ puts $f " dlopen (\"dummy.so\", RTLD_NOW);"
+ puts $f " return 0; "
+ puts $f "}"
+ close $f
+ if [is_remote host] {
+ set src [remote_download host $src]
+ }
+ set libdl_available_saved [run_host_cmd_yesno "$CC" "$src -o $output -ldl"]
+ remote_file host delete $src
+ remote_file host delete $output
+ file delete $src
+ }
+ return $libdl_available_saved
+}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ld, testsuite] Restrict dl1*main and dl6*main tests on platforms which have libdl support
2017-02-01 17:17 [ld, testsuite] Restrict dl1*main and dl6*main tests on platforms which have libdl support Jiong Wang
@ 2017-02-02 7:13 ` Alan Modra
2017-02-02 10:06 ` [committed][ld, " Jiong Wang
2017-03-10 16:24 ` [ld, testsuite] Only run rdynamic-1 when "-rdynamic" option is supported by compiler Jiong Wang
1 sibling, 1 reply; 6+ messages in thread
From: Alan Modra @ 2017-02-02 7:13 UTC (permalink / raw)
To: Jiong Wang; +Cc: Binutils
On Wed, Feb 01, 2017 at 05:17:07PM +0000, Jiong Wang wrote:
> * testsuite/lib/ld-lib.exp (check_libdl_available): New function.
> * testsuite/ld-elf/shared.exp (run_tests): Split tests which require
> dlopen support into "dlopen_run_tests". These tests include dl1*main
> and dl6*main.
> (dlopen_run_tests): New and only run it when check_libdl_available
> returns true.
OK, except
> @@ -486,6 +447,54 @@ set run_tests [list \
> # NetBSD ELF systems do not currently support the .*_array sections.
> run_ld_link_exec_tests $run_tests "*-*-netbsdelf*"
[snip]
> +# Only run them when libdl is available.
> +if [check_libdl_available] {
> + run_ld_link_exec_tests $dlopen_run_tests
You missed the netbsdelf xfail here.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 6+ messages in thread
* [committed][ld, testsuite] Restrict dl1*main and dl6*main tests on platforms which have libdl support
2017-02-02 7:13 ` Alan Modra
@ 2017-02-02 10:06 ` Jiong Wang
0 siblings, 0 replies; 6+ messages in thread
From: Jiong Wang @ 2017-02-02 10:06 UTC (permalink / raw)
To: Alan Modra; +Cc: Binutils
[-- Attachment #1: Type: text/plain, Size: 414 bytes --]
>> @@ -486,6 +447,54 @@ set run_tests [list \
>> # NetBSD ELF systems do not currently support the .*_array sections.
>> run_ld_link_exec_tests $run_tests "*-*-netbsdelf*"
> [snip]
>> +# Only run them when libdl is available.
>> +if [check_libdl_available] {
>> + run_ld_link_exec_tests $dlopen_run_tests
> You missed the netbsdelf xfail here.
>
Thanks for the review, fixed, and committed attached patch.
[-- Attachment #2: v2.patch --]
[-- Type: text/x-diff, Size: 8088 bytes --]
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 6b0484f..1ce8439 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,12 @@
+2017-02-02 Jiong Wang <jiong.wang@arm.com>
+
+ * testsuite/lib/ld-lib.exp (check_libdl_available): New function.
+ * testsuite/ld-elf/shared.exp (run_tests): Split tests which require
+ dlopen support into "dlopen_run_tests". These tests include dl1*main
+ and dl6*main.
+ (dlopen_run_tests): New and only run it when check_libdl_available
+ returns true. XFAIL on *-*-netbsdelf*.
+
2017-02-01 Maciej W. Rozycki <macro@imgtec.com>
* testsuite/ld-mips-elf/vxworks-forced-local-1.d: Correct the
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index eea9453..2946262 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -373,12 +373,6 @@ set run_tests [list \
[list "Run hidden libbar.so with versioned libfoo.so" \
"-Wl,--no-as-needed tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" \
{main.c} "hidden" "hidden.out" ] \
- [list "Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so" \
- "-Wl,--no-as-needed,--dynamic-list=dl1.list $extralibs" "" \
- {dl1main.c} "dl1a" "dl1.out" ] \
- [list "Run dl1b with --dynamic-list-data and dlopen on libdl1.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl1main.c} "dl1b" "dl1.out" ] \
[list "Run with libdl2a.so" \
"-Wl,--no-as-needed tmpdir/libdl2a.so" "" \
{dl2main.c} "dl2a" "dl2a.out" ] \
@@ -406,39 +400,6 @@ set run_tests [list \
[list "Run with libdl4f.so" \
"-Wl,--no-as-needed tmpdir/libdl4f.so" "" \
{dl4main.c} "dl4f" "dl4a.out" ] \
- [list "Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl6amain.c} "dl6a1" "dl6a.out" ] \
- [list "Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
- {dl6amain.c} "dl6a2" "dl6b.out" ] \
- [list "Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic $extralibs" "" \
- {dl6amain.c} "dl6a3" "dl6b.out" ] \
- [list "Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic,--dynamic-list-data $extralibs" "" \
- {dl6amain.c} "dl6a4" "dl6a.out" ] \
- [list "Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
- {dl6amain.c} "dl6a5" "dl6b.out" ] \
- [list "Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
- {dl6amain.c} "dl6a6" "dl6b.out" ] \
- [list "Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" \
- "-Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
- {dl6amain.c} "dl6a7" "dl6a.out" ] \
- [list "Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl6bmain.c} "dl6b1" "dl6a.out" ] \
- [list "Run dl6b2 with dlopen on libdl6b.so" \
- "-Wl,--no-as-needed $extralibs" "" \
- {dl6bmain.c} "dl6b2" "dl6b.out" ] \
- [list "Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl6cmain.c} "dl6c1" "dl6b.out" ] \
- [list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \
- "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
- {dl6dmain.c} "dl6d1" "dl6b.out" ] \
[list "Run with libdata1.so" \
"-Wl,--no-as-needed tmpdir/libdata1.so" "" \
{dynbss1.c} "dynbss1" "pass.out" ] \
@@ -486,6 +447,56 @@ set run_tests [list \
# NetBSD ELF systems do not currently support the .*_array sections.
run_ld_link_exec_tests $run_tests "*-*-netbsdelf*"
+# These tests require dlopen support.
+set dlopen_run_tests [list \
+ [list "Run dl1a with --dynamic-list=dl1.list and dlopen on libdl1.so" \
+ "-Wl,--no-as-needed,--dynamic-list=dl1.list $extralibs" "" \
+ {dl1main.c} "dl1a" "dl1.out" ] \
+ [list "Run dl1b with --dynamic-list-data and dlopen on libdl1.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl1main.c} "dl1b" "dl1.out" ] \
+ [list "Run dl6a1 with --dynamic-list-data and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl6amain.c} "dl6a1" "dl6a.out" ] \
+ [list "Run dl6a2 with -Bsymbolic-functions and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,-Bsymbolic-functions $extralibs" "" \
+ {dl6amain.c} "dl6a2" "dl6b.out" ] \
+ [list "Run dl6a3 with -Bsymbolic and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,-Bsymbolic $extralibs" "" \
+ {dl6amain.c} "dl6a3" "dl6b.out" ] \
+ [list "Run dl6a4 with -Bsymbolic --dynamic-list-data and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,-Bsymbolic,--dynamic-list-data $extralibs" "" \
+ {dl6amain.c} "dl6a4" "dl6a.out" ] \
+ [list "Run dl6a5 with -Bsymbolic-functions --dynamic-list-cpp-new and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,-Bsymbolic-functions,--dynamic-list-cpp-new $extralibs" "" \
+ {dl6amain.c} "dl6a5" "dl6b.out" ] \
+ [list "Run dl6a6 with --dynamic-list-cpp-new -Bsymbolic-functions and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,--dynamic-list-cpp-new,-Bsymbolic-functions $extralibs" "" \
+ {dl6amain.c} "dl6a6" "dl6b.out" ] \
+ [list "Run dl6a7 with --dynamic-list-data -Bsymbolic and dlopen on libdl6a.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data,-Bsymbolic $extralibs" "" \
+ {dl6amain.c} "dl6a7" "dl6a.out" ] \
+ [list "Run dl6b1 with --dynamic-list-data and dlopen on libdl6b.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl6bmain.c} "dl6b1" "dl6a.out" ] \
+ [list "Run dl6b2 with dlopen on libdl6b.so" \
+ "-Wl,--no-as-needed $extralibs" "" \
+ {dl6bmain.c} "dl6b2" "dl6b.out" ] \
+ [list "Run dl6c1 with --dynamic-list-data and dlopen on libdl6c.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl6cmain.c} "dl6c1" "dl6b.out" ] \
+ [list "Run dl6d1 with --dynamic-list-data and dlopen on libdl6d.so" \
+ "-Wl,--no-as-needed,--dynamic-list-data $extralibs" "" \
+ {dl6dmain.c} "dl6d1" "dl6b.out" ] \
+]
+
+# Only run them when libdl is available.
+if [check_libdl_available] {
+ # XFAIL on NetBSD ELF systems as they do not currently support the .*_array
+ # sections.
+ run_ld_link_exec_tests $dlopen_run_tests "*-*-netbsdelf*"
+}
+
# Check --no-add-needed and --no-copy-dt-needed-entries
set testname "--no-add-needed"
set exec_output [run_host_cmd "$CC" "tmpdir/libneeded1c.o -Wl,--no-add-needed,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index a44358e..61626ec 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -2120,3 +2120,38 @@ proc istarget { target } {
}
return [istarget_ld $target]
}
+
+# Return true if libdl is supported.
+
+proc check_libdl_available { } {
+ global libdl_available_saved
+ global CC
+
+ if {![info exists libdl_available_saved]} {
+ if { [which $CC] == 0 } {
+ set libdl_available_saved 0
+ return 0
+ }
+
+ set basename "tmpdir/dl_avail_test[pid]"
+ set src ${basename}.c
+ set output ${basename}.out
+ set f [open $src "w"]
+ # Sample test file.
+ puts $f "#include <dlfcn.h>"
+ puts $f "int main (void)"
+ puts $f "{"
+ puts $f " dlopen (\"dummy.so\", RTLD_NOW);"
+ puts $f " return 0; "
+ puts $f "}"
+ close $f
+ if [is_remote host] {
+ set src [remote_download host $src]
+ }
+ set libdl_available_saved [run_host_cmd_yesno "$CC" "$src -o $output -ldl"]
+ remote_file host delete $src
+ remote_file host delete $output
+ file delete $src
+ }
+ return $libdl_available_saved
+}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [ld, testsuite] Only run rdynamic-1 when "-rdynamic" option is supported by compiler
2017-02-01 17:17 [ld, testsuite] Restrict dl1*main and dl6*main tests on platforms which have libdl support Jiong Wang
2017-02-02 7:13 ` Alan Modra
@ 2017-03-10 16:24 ` Jiong Wang
2017-03-10 22:17 ` Alan Modra
1 sibling, 1 reply; 6+ messages in thread
From: Jiong Wang @ 2017-03-10 16:24 UTC (permalink / raw)
To: Binutils
[-- Attachment #1: Type: text/plain, Size: 888 bytes --]
This is the following error on arm bare-metal
FAIL: Build rdynamic-1
"-rdynamic" is not supported by most bare-metal GCC, the only bare-metal I am
aware of is
https://gcc.gnu.org/ml/gcc-patches/2011-02/msg00567.html
This patch implemented a -rdynamic availability check and gated "rdynamic-1"
build test. GCC testsuite has added similar checks this week.
https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00258.html
No regression on X86-64/AArch64 native ld check.
OK for master?
Thanks.
ld/
2017-03-10 Jiong Wang <jiong.wang@arm.com>
* testsuite/lib/ld-lib.exp (check_rdynamic_available): New function.
* testsuite/ld-elf/shared.exp (build_tests): Split tests which require
GCC "-rdynamic" option support into "rdynamic_build_tests".
(rdynamic_build_tests): New and only run it when
check_rdynamic_available returns true.
[-- Attachment #2: rdynamic-check.patch --]
[-- Type: text/x-diff, Size: 2351 bytes --]
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 070915a791d6055e1ebc29262c8bccfbb7f9d764..dcbb52e0cdd4aa24c09ed2a5a21084f1bcca7eac 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -327,9 +327,6 @@ set build_tests {
{"Build libpr2404b.a"
"" ""
{pr2404b.c} {} "libpr2404b.a"}
- {"Build rdynamic-1"
- "-rdynamic -Wl,--gc-sections" "-ffunction-sections"
- {rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"}
{"Build dynamic-1"
"-Wl,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections"
{dynamic-1.c} {{readelf {-s} dynamic-1.rd}} "dynamic-1"}
@@ -370,6 +367,17 @@ set build_tests {
run_cc_link_tests $build_tests
+set rdynamic_build_tests {
+ {"Build rdynamic-1"
+ "-rdynamic -Wl,--gc-sections" "-ffunction-sections"
+ {rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"}
+}
+
+# Only build them when -rdynamic is supported by compiler.
+if [check_rdynamic_available] {
+ run_cc_link_tests $rdynamic_build_tests
+}
+
set run_tests [list \
[list "Run normal with libfoo.so" \
"-Wl,--no-as-needed tmpdir/begin.o tmpdir/libfoo.so tmpdir/end.o" "" \
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index 42cfe1c824f7f40249baf694295f9f8e501e543a..7fb7efb2bc1297aca8228ee94aefd5dd2eec7bcc 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -2210,3 +2210,36 @@ proc check_libdl_available { } {
}
return $libdl_available_saved
}
+
+# Return true if compiler driver support -rdynamic.
+
+proc check_rdynamic_available { } {
+ global rdynamic_available_saved
+ global CC
+
+ if {![info exists rdynamic_available_saved]} {
+ if { [which $CC] == 0 } {
+ set rdynamic_available_saved 0
+ return 0
+ }
+
+ set basename "tmpdir/rdynamic_avail_test[pid]"
+ set src ${basename}.c
+ set output ${basename}.out
+ set f [open $src "w"]
+ # Sample test file.
+ puts $f "int main (void)"
+ puts $f "{"
+ puts $f " return 0; "
+ puts $f "}"
+ close $f
+ if [is_remote host] {
+ set src [remote_download host $src]
+ }
+ set rdynamic_available_saved [run_host_cmd_yesno "$CC" "$src -o $output -rdynamic"]
+ remote_file host delete $src
+ remote_file host delete $output
+ file delete $src
+ }
+ return $rdynamic_available_saved
+}
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ld, testsuite] Only run rdynamic-1 when "-rdynamic" option is supported by compiler
2017-03-10 16:24 ` [ld, testsuite] Only run rdynamic-1 when "-rdynamic" option is supported by compiler Jiong Wang
@ 2017-03-10 22:17 ` Alan Modra
2017-03-13 9:49 ` Jiong Wang
0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2017-03-10 22:17 UTC (permalink / raw)
To: Jiong Wang; +Cc: Binutils
On Fri, Mar 10, 2017 at 04:24:39PM +0000, Jiong Wang wrote:
> This is the following error on arm bare-metal
>
> FAIL: Build rdynamic-1
>
> "-rdynamic" is not supported by most bare-metal GCC, the only bare-metal I am
> aware of is
> https://gcc.gnu.org/ml/gcc-patches/2011-02/msg00567.html
>
> This patch implemented a -rdynamic availability check and gated "rdynamic-1"
> build test. GCC testsuite has added similar checks this week.
>
> https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00258.html
>
> No regression on X86-64/AArch64 native ld check.
> OK for master?
No. I'll commit the following simpler patch after a test run.
diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp
index 070915a..300100a 100644
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -328,7 +328,7 @@ set build_tests {
"" ""
{pr2404b.c} {} "libpr2404b.a"}
{"Build rdynamic-1"
- "-rdynamic -Wl,--gc-sections" "-ffunction-sections"
+ "-Wl,-export-dynamic,--gc-sections" "-ffunction-sections"
{rdynamic-1.c} {{readelf {-s} rdynamic-1.rd}} "rdynamic-1"}
{"Build dynamic-1"
"-Wl,--dynamic-list,dynamic-1.syms -Wl,--gc-sections" "-ffunction-sections"
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [ld, testsuite] Only run rdynamic-1 when "-rdynamic" option is supported by compiler
2017-03-10 22:17 ` Alan Modra
@ 2017-03-13 9:49 ` Jiong Wang
0 siblings, 0 replies; 6+ messages in thread
From: Jiong Wang @ 2017-03-13 9:49 UTC (permalink / raw)
To: Alan Modra; +Cc: Binutils
On 10/03/17 22:17, Alan Modra wrote:
> On Fri, Mar 10, 2017 at 04:24:39PM +0000, Jiong Wang wrote:
>> This is the following error on arm bare-metal
>>
>> FAIL: Build rdynamic-1
>>
>> "-rdynamic" is not supported by most bare-metal GCC, the only bare-metal I am
>> aware of is
>> https://gcc.gnu.org/ml/gcc-patches/2011-02/msg00567.html
>>
>> This patch implemented a -rdynamic availability check and gated "rdynamic-1"
>> build test. GCC testsuite has added similar checks this week.
>>
>> https://gcc.gnu.org/ml/gcc-patches/2017-03/msg00258.html
>>
>> No regression on X86-64/AArch64 native ld check.
>> OK for master?
> No. I'll commit the following simpler patch after a test run.
That's better indeed, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-03-13 9:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-01 17:17 [ld, testsuite] Restrict dl1*main and dl6*main tests on platforms which have libdl support Jiong Wang
2017-02-02 7:13 ` Alan Modra
2017-02-02 10:06 ` [committed][ld, " Jiong Wang
2017-03-10 16:24 ` [ld, testsuite] Only run rdynamic-1 when "-rdynamic" option is supported by compiler Jiong Wang
2017-03-10 22:17 ` Alan Modra
2017-03-13 9:49 ` Jiong Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).