From c4139418925416279f6d3fbc454d3892d6b7fb76 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 7 Dec 2012 19:14:41 +0000 Subject: Add plugin visibility test * ld-plugin/func1p.c: New file. * ld-plugin/func2i.c: Likewise. * ld-plugin/func3h.c: Likewise. * ld-plugin/plugin.exp (plugin_extra_elf_tests): Add plugin visibility test. --- ld/testsuite/ChangeLog | 9 +++++++++ ld/testsuite/ld-plugin/func1p.c | 8 ++++++++ ld/testsuite/ld-plugin/func2i.c | 8 ++++++++ ld/testsuite/ld-plugin/func3h.c | 8 ++++++++ ld/testsuite/ld-plugin/plugin.exp | 11 +++++++++-- 5 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 ld/testsuite/ld-plugin/func1p.c create mode 100644 ld/testsuite/ld-plugin/func2i.c create mode 100644 ld/testsuite/ld-plugin/func3h.c (limited to 'ld') diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index c957324..3a1d437 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,5 +1,14 @@ 2012-12-07 H.J. Lu + * ld-plugin/func1p.c: New file. + * ld-plugin/func2i.c: Likewise. + * ld-plugin/func3h.c: Likewise. + + * ld-plugin/plugin.exp (plugin_extra_elf_tests): Add plugin + visibility test. + +2012-12-07 H.J. Lu + * lib/ld-lib.exp (check_lto_available): New. Check if compiler supports LTO. diff --git a/ld/testsuite/ld-plugin/func1p.c b/ld/testsuite/ld-plugin/func1p.c new file mode 100644 index 0000000..917dcbb --- /dev/null +++ b/ld/testsuite/ld-plugin/func1p.c @@ -0,0 +1,8 @@ +extern int retval; + +int +__attribute__ ((visibility ("protected"))) +func1 (void) +{ + return retval; +} diff --git a/ld/testsuite/ld-plugin/func2i.c b/ld/testsuite/ld-plugin/func2i.c new file mode 100644 index 0000000..00d7cdd --- /dev/null +++ b/ld/testsuite/ld-plugin/func2i.c @@ -0,0 +1,8 @@ +extern int retval; + +int +__attribute__ ((visibility ("internal"))) +func2 (void) +{ + return retval; +} diff --git a/ld/testsuite/ld-plugin/func3h.c b/ld/testsuite/ld-plugin/func3h.c new file mode 100644 index 0000000..525de63 --- /dev/null +++ b/ld/testsuite/ld-plugin/func3h.c @@ -0,0 +1,8 @@ +extern int retval; + +int +__attribute__ ((visibility ("hidden"))) +func3 (void) +{ + return retval; +} diff --git a/ld/testsuite/ld-plugin/plugin.exp b/ld/testsuite/ld-plugin/plugin.exp index d28505d..803ccee 100644 --- a/ld/testsuite/ld-plugin/plugin.exp +++ b/ld/testsuite/ld-plugin/plugin.exp @@ -157,7 +157,11 @@ set plugin_extra_elf_tests [list \ -plugin-opt sym:${_}func3::0:3:0 \ -plugin-opt dumpresolutions \ -plugin-opt add:tmpdir/func.o \ - $testobjfiles $libs --verbose=2" "" "" {{ld plugin-12.d}} "main.x" ] \ + -plugin-opt add:tmpdir/func1p.o \ + -plugin-opt add:tmpdir/func2i.o \ + -plugin-opt add:tmpdir/func3h.o \ + $testobjfiles $libs --verbose=2" "" "" {{ld plugin-12.d} \ + {readelf -s plugin-vis-1.d}} "main.x" ] \ ] if { !$can_compile || $failed_compile } { @@ -174,7 +178,10 @@ if { !$can_compile || $failed_compile } { run_ld_link_tests $plugin_tests -if { [is_elf_format] } { +if { [is_elf_format] \ + && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \ + && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \ + && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } { run_ld_link_tests $plugin_extra_elf_tests } -- cgit v1.1