diff options
author | Sriraman Tallam <tmsriram@google.com> | 2018-02-22 13:56:46 -0800 |
---|---|---|
committer | Sriraman Tallam <tmsriram@google.com> | 2018-02-22 13:56:46 -0800 |
commit | 0b65c07b97c43e8891c2e14061270878a85222c8 (patch) | |
tree | a9c9e130a0045291605c400a0d086d99b1c515b0 /gold/testsuite | |
parent | 0bccfb2994d307601ceba5c3a6223b7ca7cf5338 (diff) | |
download | gdb-0b65c07b97c43e8891c2e14061270878a85222c8.zip gdb-0b65c07b97c43e8891c2e14061270878a85222c8.tar.gz gdb-0b65c07b97c43e8891c2e14061270878a85222c8.tar.bz2 |
New plugin interface to get list of symbols wrapped with --wrap option.
2018-02-22 Sriraman Tallam <tmsriram@google.com>
* plugin.cc (get_wrap_symbols): New plugin interface.
(load): Add get_wrap_symbols to transfer vector.
* plugin-api.h (ld_plugin_get_wrap_symbols): New plugin interface.
* testsuite/plugin_test.c (onload): Call and check get_wrap_symbols
interface.
* testsuite/plugin_test_wrap_symbols.sh: New test script.
* testsuite/plugin_test_wrap_symbols_1.cc: New file.
* testsuite/plugin_test_wrap_symbols_2.cc: New file.
* testsuite/Makefile.am (plugin_test_wrap_symbols): New test.
* testsuite/Makefile.in: Regenerate.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 13 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 48 | ||||
-rw-r--r-- | gold/testsuite/plugin_test.c | 26 | ||||
-rwxr-xr-x | gold/testsuite/plugin_test_wrap_symbols.sh | 52 | ||||
-rw-r--r-- | gold/testsuite/plugin_test_wrap_symbols_1.cc | 40 | ||||
-rw-r--r-- | gold/testsuite/plugin_test_wrap_symbols_2.cc | 33 |
6 files changed, 205 insertions, 7 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 7ec3e8d..bb486ed 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -2322,6 +2322,19 @@ plugin_test_12: export_dynamic_plugin.o gcctestdir/ld plugin_test.so export_dyna plugin_test_12.err: plugin_test_12 @touch plugin_test_12.err +check_PROGRAMS += plugin_test_wrap_symbols +check_SCRIPTS += plugin_test_wrap_symbols.sh +check_DATA += plugin_test_wrap_symbols.err +MOSTLYCLEANFILES += plugin_test_wrap_symbols.err +plugin_test_wrap_symbols_1.o: plugin_test_wrap_symbols_1.cc + $(COMPILE) -c -o $@ $< +plugin_test_wrap_symbols_2.o: plugin_test_wrap_symbols_2.cc + $(COMPILE) -c -o $@ $< +plugin_test_wrap_symbols: plugin_test_wrap_symbols_1.o plugin_test_wrap_symbols_2.o gcctestdir/ld plugin_test.so + $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_test.so" -Wl,--wrap=hello,--wrap=jello plugin_test_wrap_symbols_1.o plugin_test_wrap_symbols_2.o 2>plugin_test_wrap_symbols.err +plugin_test_wrap_symbols.err: plugin_test_wrap_symbols + @touch plugin_test_wrap_symbols.err + check_PROGRAMS += plugin_test_start_lib check_SCRIPTS += plugin_test_start_lib.sh check_DATA += plugin_test_start_lib.err diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index ca79238..ec851d5 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -535,6 +535,7 @@ 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_wrap_symbols \ @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 = \ @@ -547,6 +548,7 @@ 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_wrap_symbols.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_start_lib.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_defsym.sh @@ -568,6 +570,7 @@ 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_wrap_symbols.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. @@ -586,6 +589,7 @@ 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_wrap_symbols.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 @@ -1215,6 +1219,7 @@ 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_wrap_symbols$(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) @@ -1958,6 +1963,13 @@ plugin_test_tls_DEPENDENCIES = libgoldtest.a ../libgold.a \ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) +plugin_test_wrap_symbols_SOURCES = plugin_test_wrap_symbols.c +plugin_test_wrap_symbols_OBJECTS = plugin_test_wrap_symbols.$(OBJEXT) +plugin_test_wrap_symbols_LDADD = $(LDADD) +plugin_test_wrap_symbols_DEPENDENCIES = libgoldtest.a ../libgold.a \ + ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) pr17704a_test_SOURCES = pr17704a_test.c pr17704a_test_OBJECTS = pr17704a_test.$(OBJEXT) pr17704a_test_LDADD = $(LDADD) @@ -2488,13 +2500,13 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.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_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) \ - $(pr20308c_test_SOURCES) $(pr20308d_test_SOURCES) \ - $(pr20308e_test_SOURCES) pr20976.c pr22266.c \ - $(protected_1_SOURCES) $(protected_2_SOURCES) \ + plugin_test_tls.c plugin_test_wrap_symbols.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) $(pr20308c_test_SOURCES) \ + $(pr20308d_test_SOURCES) $(pr20308e_test_SOURCES) pr20976.c \ + pr22266.c $(protected_1_SOURCES) $(protected_2_SOURCES) \ $(relro_now_test_SOURCES) $(relro_script_test_SOURCES) \ $(relro_strip_test_SOURCES) $(relro_test_SOURCES) \ $(script_test_1_SOURCES) script_test_11.c script_test_12.c \ @@ -4150,6 +4162,15 @@ pie_copyrelocs_test$(EXEEXT): $(pie_copyrelocs_test_OBJECTS) $(pie_copyrelocs_te @TLS_FALSE@plugin_test_tls$(EXEEXT): $(plugin_test_tls_OBJECTS) $(plugin_test_tls_DEPENDENCIES) $(EXTRA_plugin_test_tls_DEPENDENCIES) @TLS_FALSE@ @rm -f plugin_test_tls$(EXEEXT) @TLS_FALSE@ $(LINK) $(plugin_test_tls_OBJECTS) $(plugin_test_tls_LDADD) $(LIBS) +@GCC_FALSE@plugin_test_wrap_symbols$(EXEEXT): $(plugin_test_wrap_symbols_OBJECTS) $(plugin_test_wrap_symbols_DEPENDENCIES) $(EXTRA_plugin_test_wrap_symbols_DEPENDENCIES) +@GCC_FALSE@ @rm -f plugin_test_wrap_symbols$(EXEEXT) +@GCC_FALSE@ $(LINK) $(plugin_test_wrap_symbols_OBJECTS) $(plugin_test_wrap_symbols_LDADD) $(LIBS) +@NATIVE_LINKER_FALSE@plugin_test_wrap_symbols$(EXEEXT): $(plugin_test_wrap_symbols_OBJECTS) $(plugin_test_wrap_symbols_DEPENDENCIES) $(EXTRA_plugin_test_wrap_symbols_DEPENDENCIES) +@NATIVE_LINKER_FALSE@ @rm -f plugin_test_wrap_symbols$(EXEEXT) +@NATIVE_LINKER_FALSE@ $(LINK) $(plugin_test_wrap_symbols_OBJECTS) $(plugin_test_wrap_symbols_LDADD) $(LIBS) +@PLUGINS_FALSE@plugin_test_wrap_symbols$(EXEEXT): $(plugin_test_wrap_symbols_OBJECTS) $(plugin_test_wrap_symbols_DEPENDENCIES) $(EXTRA_plugin_test_wrap_symbols_DEPENDENCIES) +@PLUGINS_FALSE@ @rm -f plugin_test_wrap_symbols$(EXEEXT) +@PLUGINS_FALSE@ $(LINK) $(plugin_test_wrap_symbols_OBJECTS) $(plugin_test_wrap_symbols_LDADD) $(LIBS) @DEFAULT_TARGET_X86_64_FALSE@pr17704a_test$(EXEEXT): $(pr17704a_test_OBJECTS) $(pr17704a_test_DEPENDENCIES) $(EXTRA_pr17704a_test_DEPENDENCIES) @DEFAULT_TARGET_X86_64_FALSE@ @rm -f pr17704a_test$(EXEEXT) @DEFAULT_TARGET_X86_64_FALSE@ $(LINK) $(pr17704a_test_OBJECTS) $(pr17704a_test_LDADD) $(LIBS) @@ -4544,6 +4565,7 @@ distclean-compile: @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)/plugin_test_wrap_symbols.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pr17704a_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pr20216a_test-pr20216_def.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pr20216a_test-pr20216_main.Po@am__quote@ @@ -5313,6 +5335,8 @@ plugin_test_11.sh.log: plugin_test_11.sh @p='plugin_test_11.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) 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_wrap_symbols.sh.log: plugin_test_wrap_symbols.sh + @p='plugin_test_wrap_symbols.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 @@ -5683,6 +5707,8 @@ plugin_test_11.log: plugin_test_11$(EXEEXT) @p='plugin_test_11$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) plugin_test_12.log: plugin_test_12$(EXEEXT) @p='plugin_test_12$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post) +plugin_test_wrap_symbols.log: plugin_test_wrap_symbols$(EXEEXT) + @p='plugin_test_wrap_symbols$(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) @@ -7031,6 +7057,14 @@ uninstall-am: @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so",--plugin-opt,"_Z3foov" -Wl,--export-dynamic-symbol,"_Z3foov" export_dynamic_plugin.o.syms 2>plugin_test_12.err @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_12.err: plugin_test_12 @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ @touch plugin_test_12.err +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_wrap_symbols_1.o: plugin_test_wrap_symbols_1.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(COMPILE) -c -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_wrap_symbols_2.o: plugin_test_wrap_symbols_2.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(COMPILE) -c -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_wrap_symbols: plugin_test_wrap_symbols_1.o plugin_test_wrap_symbols_2.o gcctestdir/ld plugin_test.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--plugin,"./plugin_test.so" -Wl,--wrap=hello,--wrap=jello plugin_test_wrap_symbols_1.o plugin_test_wrap_symbols_2.o 2>plugin_test_wrap_symbols.err +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_wrap_symbols.err: plugin_test_wrap_symbols +@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ @touch plugin_test_wrap_symbols.err @GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_start_lib: unused.o plugin_start_lib_test.o plugin_start_lib_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_start_lib_test.o \ @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 diff --git a/gold/testsuite/plugin_test.c b/gold/testsuite/plugin_test.c index c6df7b6..e80f926 100644 --- a/gold/testsuite/plugin_test.c +++ b/gold/testsuite/plugin_test.c @@ -68,6 +68,7 @@ static ld_plugin_get_input_section_name get_input_section_name = NULL; static ld_plugin_get_input_section_contents get_input_section_contents = NULL; static ld_plugin_update_section_order update_section_order = NULL; static ld_plugin_allow_section_ordering allow_section_ordering = NULL; +static ld_plugin_get_wrap_symbols get_wrap_symbols = NULL; #define MAXOPTS 10 @@ -158,6 +159,9 @@ onload(struct ld_plugin_tv *tv) case LDPT_ALLOW_SECTION_ORDERING: allow_section_ordering = *entry->tv_u.tv_allow_section_ordering; break; + case LDPT_GET_WRAP_SYMBOLS: + get_wrap_symbols = *entry->tv_u.tv_get_wrap_symbols; + break; default: break; } @@ -247,6 +251,28 @@ onload(struct ld_plugin_tv *tv) return LDPS_ERR; } + if (get_wrap_symbols == NULL) + { + fprintf(stderr, "tv_get_wrap_symbols interface missing\n"); + return LDPS_ERR; + } + else + { + const char **wrap_symbols; + uint64_t count = 0; + if (get_wrap_symbols(&count, &wrap_symbols) == LDPS_OK) + { + (*message)(LDPL_INFO, "Number of wrap symbols = %lu", count); + for (; count > 0; --count) + (*message)(LDPL_INFO, "Wrap symbol %s", wrap_symbols[count - 1]); + } + else + { + fprintf(stderr, "tv_get_wrap_symbols interface call failed\n"); + return LDPS_ERR; + } + } + return LDPS_OK; } diff --git a/gold/testsuite/plugin_test_wrap_symbols.sh b/gold/testsuite/plugin_test_wrap_symbols.sh new file mode 100755 index 0000000..2133bf0 --- /dev/null +++ b/gold/testsuite/plugin_test_wrap_symbols.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +# plugin_test_wrap_symbols.sh -- a test case for the plugin API. + +# Copyright (C) 2017 onwards Free Software Foundation, Inc. +# Written by Teresa Johnson <tejohnson@google.com>. + +# This file is part of gold. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +# This file goes with plugin_test.c, a simple plug-in library that +# exercises the basic interfaces and prints out version numbers and +# options passed to the plugin. + +# This checks if the get_wrap_symbols plugin interface works as +# expected. + +check() +{ + if ! grep -q "$2" "$1" + then + echo "Did not find expected output in $1:" + echo " $2" + echo "" + echo "Actual output below:" + cat "$1" + exit 1 + fi +} + +check plugin_test_wrap_symbols.err "API version:" +check plugin_test_wrap_symbols.err "gold version:" +check plugin_test_wrap_symbols.err "Number of wrap symbols = 2" +check plugin_test_wrap_symbols.err "Wrap symbol hello" +check plugin_test_wrap_symbols.err "Wrap symbol jello" +check plugin_test_wrap_symbols.err "cleanup hook called" + +exit 0 diff --git a/gold/testsuite/plugin_test_wrap_symbols_1.cc b/gold/testsuite/plugin_test_wrap_symbols_1.cc new file mode 100644 index 0000000..90587ef --- /dev/null +++ b/gold/testsuite/plugin_test_wrap_symbols_1.cc @@ -0,0 +1,40 @@ +/* plugin_test_wrap_symbols -- a test case for gold + + Copyright (C) 2017 onwards Free Software Foundation, Inc. + Written by Sriraman Tallam <tmsriram@google.com>. + + This file is part of gold. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +extern "C" { +int __real_hello(); +int __wrap_hello() +{ + return __real_hello(); +} +int hello(); +int __real_jello(); +int __wrap_jello() +{ + return __real_jello(); +} +int jello(); +int main() +{ + return 0; +} +} diff --git a/gold/testsuite/plugin_test_wrap_symbols_2.cc b/gold/testsuite/plugin_test_wrap_symbols_2.cc new file mode 100644 index 0000000..902cc3c --- /dev/null +++ b/gold/testsuite/plugin_test_wrap_symbols_2.cc @@ -0,0 +1,33 @@ +/* plugin_test_wrap_symbols -- a test case for gold + + Copyright (C) 2017 onwards Free Software Foundation, Inc. + Written by Sriraman Tallam <tmsriram@google.com>. + + This file is part of gold. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +extern "C" { +int hello() +{ + return 0; +} + +int jello() +{ + return 0; +} +} |