mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 20:28:28 +08:00
[ld, testsuite] Restrict dl1*main and dl6*main tests on platforms which have libdl support
ld/ * 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*.
This commit is contained in:
@ -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>
|
2017-02-01 Maciej W. Rozycki <macro@imgtec.com>
|
||||||
|
|
||||||
* testsuite/ld-mips-elf/vxworks-forced-local-1.d: Correct the
|
* testsuite/ld-mips-elf/vxworks-forced-local-1.d: Correct the
|
||||||
|
@ -373,12 +373,6 @@ set run_tests [list \
|
|||||||
[list "Run hidden libbar.so with versioned libfoo.so" \
|
[list "Run hidden libbar.so with versioned libfoo.so" \
|
||||||
"-Wl,--no-as-needed tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" \
|
"-Wl,--no-as-needed tmpdir/libbarhfoov.so tmpdir/libfoov.so" "" \
|
||||||
{main.c} "hidden" "hidden.out" ] \
|
{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" \
|
[list "Run with libdl2a.so" \
|
||||||
"-Wl,--no-as-needed tmpdir/libdl2a.so" "" \
|
"-Wl,--no-as-needed tmpdir/libdl2a.so" "" \
|
||||||
{dl2main.c} "dl2a" "dl2a.out" ] \
|
{dl2main.c} "dl2a" "dl2a.out" ] \
|
||||||
@ -406,39 +400,6 @@ set run_tests [list \
|
|||||||
[list "Run with libdl4f.so" \
|
[list "Run with libdl4f.so" \
|
||||||
"-Wl,--no-as-needed tmpdir/libdl4f.so" "" \
|
"-Wl,--no-as-needed tmpdir/libdl4f.so" "" \
|
||||||
{dl4main.c} "dl4f" "dl4a.out" ] \
|
{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" \
|
[list "Run with libdata1.so" \
|
||||||
"-Wl,--no-as-needed tmpdir/libdata1.so" "" \
|
"-Wl,--no-as-needed tmpdir/libdata1.so" "" \
|
||||||
{dynbss1.c} "dynbss1" "pass.out" ] \
|
{dynbss1.c} "dynbss1" "pass.out" ] \
|
||||||
@ -486,6 +447,56 @@ set run_tests [list \
|
|||||||
# NetBSD ELF systems do not currently support the .*_array sections.
|
# NetBSD ELF systems do not currently support the .*_array sections.
|
||||||
run_ld_link_exec_tests $run_tests "*-*-netbsdelf*"
|
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
|
# Check --no-add-needed and --no-copy-dt-needed-entries
|
||||||
set testname "--no-add-needed"
|
set testname "--no-add-needed"
|
||||||
set exec_output [run_host_cmd "$CC" "tmpdir/libneeded1c.o -Wl,--no-add-needed,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
|
set exec_output [run_host_cmd "$CC" "tmpdir/libneeded1c.o -Wl,--no-add-needed,-rpath-link=tmpdir -Ltmpdir -lneeded1a"]
|
||||||
|
@ -2120,3 +2120,38 @@ proc istarget { target } {
|
|||||||
}
|
}
|
||||||
return [istarget_ld $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
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user