aboutsummaryrefslogtreecommitdiff
path: root/gold/testsuite
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2008-12-16 19:19:16 +0000
committerCary Coutant <ccoutant@google.com>2008-12-16 19:19:16 +0000
commitabc8dcbad2b489919dfb608e82d75f204b14b594 (patch)
tree1a4f81ab8dbe68df1497f5c4d4425784a25fc060 /gold/testsuite
parentbb5ef15eff1baa44a382c9be60383e66cc26badd (diff)
downloadgdb-abc8dcbad2b489919dfb608e82d75f204b14b594.zip
gdb-abc8dcbad2b489919dfb608e82d75f204b14b594.tar.gz
gdb-abc8dcbad2b489919dfb608e82d75f204b14b594.tar.bz2
* plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
vector. (Plugin_manager::claim_file): Create plugin object even if plugin did not call the add_symbols callback. (Plugin_obj::get_symbol_resolution_info): Guard against plugin asking for more symbols than were added. * testsuite/Makefile.am (plugin_test_1): Add test case with no global symbols. (empty.syms): New target. * testsuite/Makefile.in: Regenerate. * testsuite/plugin_test.c (claim_file_hook): Add new debug message. Don't call add_symbols if no globals. (all_symbols_read_hook): Don't provide replacement for empty claimed file.
Diffstat (limited to 'gold/testsuite')
-rw-r--r--gold/testsuite/Makefile.am7
-rw-r--r--gold/testsuite/Makefile.in11
-rw-r--r--gold/testsuite/plugin_test.c8
3 files changed, 19 insertions, 7 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 78c0529..c5f52ac 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -958,8 +958,8 @@ check_PROGRAMS += plugin_test_1
check_SCRIPTS += plugin_test_1.sh
check_DATA += plugin_test_1.err
MOSTLYCLEANFILES += plugin_test_1.err
-plugin_test_1: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
- $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms 2>plugin_test_1.err
+plugin_test_1: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
+ $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_1.err
plugin_test_1.err: plugin_test_1
@touch plugin_test_1.err
@@ -985,6 +985,9 @@ two_file_test_1b.syms: two_file_test_1b.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
two_file_test_2.syms: two_file_test_2.o
$(TEST_READELF) -sW $< >$@ 2>/dev/null
+empty.syms:
+ @echo "" >empty.syms
+ @echo "Symbol table" >>empty.syms
endif PLUGINS
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index bb9d0ce..5509ab1 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -1463,9 +1463,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu testsuite/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile'; \
cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu testsuite/Makefile
+ $(AUTOMAKE) --foreign testsuite/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -2453,8 +2453,8 @@ uninstall-am: uninstall-info-am
@GCC_TRUE@@NATIVE_LINKER_TRUE@alt/thin_archive_test_4.o: thin_archive_test_4.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ test -d alt || mkdir -p alt
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -o $@ $<
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_1: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms gcctestdir/ld plugin_test.so
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms 2>plugin_test_1.err
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_1: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms gcctestdir/ld plugin_test.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z4f13iv" two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_test_2.syms empty.syms 2>plugin_test_1.err
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_1.err: plugin_test_1
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ @touch plugin_test_1.err
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_2: two_file_test_main.o two_file_test_1.syms two_file_test_1b.syms two_file_shared_2.so gcctestdir/ld plugin_test.so
@@ -2475,6 +2475,9 @@ uninstall-am: uninstall-info-am
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(TEST_READELF) -sW $< >$@ 2>/dev/null
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@two_file_test_2.syms: two_file_test_2.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(TEST_READELF) -sW $< >$@ 2>/dev/null
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@empty.syms:
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ @echo "" >empty.syms
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ @echo "Symbol table" >>empty.syms
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gold/testsuite/plugin_test.c b/gold/testsuite/plugin_test.c
index c60c7a1..c36fee4 100644
--- a/gold/testsuite/plugin_test.c
+++ b/gold/testsuite/plugin_test.c
@@ -319,7 +319,11 @@ claim_file_hook (const struct ld_plugin_input_file* file, int* claimed)
last_claimed_file->next = claimed_file;
last_claimed_file = claimed_file;
- (*add_symbols)(file->handle, nsyms, syms);
+ (*message)(LDPL_INFO, "%s: claiming file, adding %d symbols",
+ file->name, nsyms);
+
+ if (nsyms > 0)
+ (*add_symbols)(file->handle, nsyms, syms);
*claimed = 1;
return LDPS_OK;
@@ -398,6 +402,8 @@ all_symbols_read_hook(void)
claimed_file != NULL;
claimed_file = claimed_file->next)
{
+ if (claimed_file->nsyms == 0)
+ continue;
if (strlen(claimed_file->name) >= sizeof(buf))
{
(*message)(LDPL_FATAL, "%s: filename too long", claimed_file->name);