diff options
author | Sriraman Tallam <tmsriram@google.com> | 2018-02-15 17:35:16 -0800 |
---|---|---|
committer | Sriraman Tallam <tmsriram@google.com> | 2018-02-15 17:35:16 -0800 |
commit | 3281b315c89caf1d539a316e41cc095e46482f75 (patch) | |
tree | c324284c8a21bf2bac30f2bb5678cbb430e63867 /gold/testsuite/Makefile.in | |
parent | 43859909e2982252d136e19258431f3aa8afb890 (diff) | |
download | gdb-3281b315c89caf1d539a316e41cc095e46482f75.zip gdb-3281b315c89caf1d539a316e41cc095e46482f75.tar.gz gdb-3281b315c89caf1d539a316e41cc095e46482f75.tar.bz2 |
Fix symbol resolution with linker plugins for defsym symbols.
2018-02-07 Sriraman Tallam <tmsriram@google.com>
* expression.cc (Symbol_expression::set_expr_sym_in_real_elf):
New method.
(Unary_expression::set_expr_sym_in_real_elf): New method.
(Binary_expression::set_expr_sym_in_real_elf): New method.
(Trinary_expression::set_expr_sym_in_real_elf): New method.
* plugin.cc (get_symbol_resolution_info): Fix symbol resolution if
defined or used in defsyms.
* plugin.h (Plugin_manager::is_defsym_def): New method.
(Plugin_manager::Plugin_manager): Initialize defsym_defines_set_.
(Plugin_manager::defsym_defines_set_): New member.
(Plugin_manager::Defsym_defines_set): New typedef.
* script.cc (Script_options::set_defsym_uses_in_real_elf): New method.
(Script_options::find_defsym_defs): New method.
* script.h (Expression::set_expr_sym_in_real_elf): New method.
(Symbol_assignment::is_defsym): New method.
(Symbol_assignment::value): New method.
(Script_options::find_defsym_defs): New method.
(Script_options::set_defsym_uses_in_real_elf): New method.
* testsuite/Makefile.am (plugin_test_defsym): New test.
* testsuite/Makefile.in: Regenerate.
* testsuite/plugin_test.c: Check for new symbol resolution.
* testsuite/plugin_test_defsym.sh: New script.
* testsuite/plugin_test_defsym.c: New test source.
Diffstat (limited to 'gold/testsuite/Makefile.in')
-rw-r--r-- | gold/testsuite/Makefile.in | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index bbf8dc1..ca79238 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -535,7 +535,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_10 \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_11 \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_12 \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_defsym @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@am__append_45 = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_1.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_2.sh \ @@ -546,7 +547,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_10.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_11.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_12.sh \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib.sh +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib.sh \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_defsym.sh # Test that symbols known in the IR file but not in the replacement file # produce an unresolved symbol error. @@ -566,7 +568,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_10.sections \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_11.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_12.err \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib.err +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib.err \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_defsym.err # Make a copy of two_file_test_1.o, which does not define the symbol _Z4t16av. @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@am__append_47 = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_1.err \ @@ -583,7 +586,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_11.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_thin.a \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_12.err \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib.err +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib.err \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_defsym.err @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@@TLS_TRUE@am__append_48 = plugin_test_tls @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@@TLS_TRUE@am__append_49 = plugin_test_tls.sh @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@@TLS_TRUE@am__append_50 = plugin_test_tls.err @@ -1211,7 +1215,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_10$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_11$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_12$(EXEEXT) \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib$(EXEEXT) +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_defsym$(EXEEXT) @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@@TLS_TRUE@am__EXEEXT_25 = plugin_test_tls$(EXEEXT) @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_26 = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ exclude_libs_test$(EXEEXT) \ @@ -1932,6 +1937,13 @@ plugin_test_8_DEPENDENCIES = libgoldtest.a ../libgold.a \ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) +plugin_test_defsym_SOURCES = plugin_test_defsym.c +plugin_test_defsym_OBJECTS = plugin_test_defsym.$(OBJEXT) +plugin_test_defsym_LDADD = $(LDADD) +plugin_test_defsym_DEPENDENCIES = libgoldtest.a ../libgold.a \ + ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) plugin_test_start_lib_SOURCES = plugin_test_start_lib.c plugin_test_start_lib_OBJECTS = plugin_test_start_lib.$(OBJEXT) plugin_test_start_lib_LDADD = $(LDADD) @@ -2475,8 +2487,8 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \ plugin_test_10.c plugin_test_11.c plugin_test_12.c \ plugin_test_2.c plugin_test_3.c plugin_test_4.c \ plugin_test_5.c plugin_test_6.c plugin_test_7.c \ - plugin_test_8.c plugin_test_start_lib.c plugin_test_tls.c \ - pr17704a_test.c $(pr20216a_test_SOURCES) \ + plugin_test_8.c plugin_test_defsym.c plugin_test_start_lib.c \ + plugin_test_tls.c pr17704a_test.c $(pr20216a_test_SOURCES) \ $(pr20216b_test_SOURCES) $(pr20216c_test_SOURCES) \ $(pr20216d_test_SOURCES) $(pr20216e_test_SOURCES) \ $(pr20308a_test_SOURCES) $(pr20308b_test_SOURCES) \ @@ -4108,6 +4120,15 @@ pie_copyrelocs_test$(EXEEXT): $(pie_copyrelocs_test_OBJECTS) $(pie_copyrelocs_te @PLUGINS_FALSE@plugin_test_8$(EXEEXT): $(plugin_test_8_OBJECTS) $(plugin_test_8_DEPENDENCIES) $(EXTRA_plugin_test_8_DEPENDENCIES) @PLUGINS_FALSE@ @rm -f plugin_test_8$(EXEEXT) @PLUGINS_FALSE@ $(LINK) $(plugin_test_8_OBJECTS) $(plugin_test_8_LDADD) $(LIBS) +@GCC_FALSE@plugin_test_defsym$(EXEEXT): $(plugin_test_defsym_OBJECTS) $(plugin_test_defsym_DEPENDENCIES) $(EXTRA_plugin_test_defsym_DEPENDENCIES) +@GCC_FALSE@ @rm -f plugin_test_defsym$(EXEEXT) +@GCC_FALSE@ $(LINK) $(plugin_test_defsym_OBJECTS) $(plugin_test_defsym_LDADD) $(LIBS) +@NATIVE_LINKER_FALSE@plugin_test_defsym$(EXEEXT): $(plugin_test_defsym_OBJECTS) $(plugin_test_defsym_DEPENDENCIES) $(EXTRA_plugin_test_defsym_DEPENDENCIES) +@NATIVE_LINKER_FALSE@ @rm -f plugin_test_defsym$(EXEEXT) +@NATIVE_LINKER_FALSE@ $(LINK) $(plugin_test_defsym_OBJECTS) $(plugin_test_defsym_LDADD) $(LIBS) +@PLUGINS_FALSE@plugin_test_defsym$(EXEEXT): $(plugin_test_defsym_OBJECTS) $(plugin_test_defsym_DEPENDENCIES) $(EXTRA_plugin_test_defsym_DEPENDENCIES) +@PLUGINS_FALSE@ @rm -f plugin_test_defsym$(EXEEXT) +@PLUGINS_FALSE@ $(LINK) $(plugin_test_defsym_OBJECTS) $(plugin_test_defsym_LDADD) $(LIBS) @GCC_FALSE@plugin_test_start_lib$(EXEEXT): $(plugin_test_start_lib_OBJECTS) $(plugin_test_start_lib_DEPENDENCIES) $(EXTRA_plugin_test_start_lib_DEPENDENCIES) @GCC_FALSE@ @rm -f plugin_test_start_lib$(EXEEXT) @GCC_FALSE@ $(LINK) $(plugin_test_start_lib_OBJECTS) $(plugin_test_start_lib_LDADD) $(LIBS) @@ -4520,6 +4541,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_6.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_7.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_8.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_defsym.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_start_lib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_tls.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pr17704a_test.Po@am__quote@ @@ -5293,6 +5315,8 @@ plugin_test_12.sh.log: plugin_test_12.sh @p='plugin_test_12.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) plugin_test_start_lib.sh.log: plugin_test_start_lib.sh @p='plugin_test_start_lib.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +plugin_test_defsym.sh.log: plugin_test_defsym.sh + @p='plugin_test_defsym.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) plugin_test_tls.sh.log: plugin_test_tls.sh @p='plugin_test_tls.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) plugin_final_layout.sh.log: plugin_final_layout.sh @@ -5661,6 +5685,8 @@ plugin_test_12.log: plugin_test_12$(EXEEXT) @p='plugin_test_12$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) plugin_test_start_lib.log: plugin_test_start_lib$(EXEEXT) @p='plugin_test_start_lib$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +plugin_test_defsym.log: plugin_test_defsym$(EXEEXT) + @p='plugin_test_defsym$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) plugin_test_tls.log: plugin_test_tls$(EXEEXT) @p='plugin_test_tls$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) exclude_libs_test.log: exclude_libs_test$(EXEEXT) @@ -7010,6 +7036,14 @@ uninstall-am: @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ -Wl,--start-lib plugin_start_lib_test_2.syms -Wl,--end-lib 2>plugin_test_start_lib.err @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_start_lib.err: plugin_test_start_lib @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ @touch plugin_test_start_lib.err +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_defsym.syms: plugin_test_defsym.o +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(TEST_READELF) -sW $< >$@ 2>/dev/null +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_defsym.o: plugin_test_defsym.c +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(COMPILE) -c -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_defsym: plugin_test_defsym.o plugin_test_defsym.syms gcctestdir/ld plugin_test.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" -Wl,--defsym,bar=foo plugin_test_defsym.syms 2>plugin_test_defsym.err +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_defsym.err: plugin_test_defsym +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ @touch plugin_test_defsym.err @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_start_lib_test_2.syms: plugin_start_lib_test_2.o @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(TEST_READELF) -sW $< >$@ 2>/dev/null |