A a testcase for common symbol handling with plugins.

2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>

	* testsuite/Makefile.am (plugin_test_10): New test.
	* testsuite/Makefile.in: Regenerate
	* testsuite/plugin_common_test_2.c (c1): Align to 8.
	* testsuite/plugin_test_10.sh: New file.
This commit is contained in:
Rafael Ávila de Espíndola 2014-09-18 13:58:16 -04:00
parent 2b4fd423cf
commit c0c71592f7
5 changed files with 94 additions and 14 deletions

View file

@ -1,3 +1,10 @@
2014-09-18 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* testsuite/Makefile.am (plugin_test_10): New test.
* testsuite/Makefile.in: Regenerate
* testsuite/plugin_common_test_2.c (c1): Align to 8.
* testsuite/plugin_test_10.sh: New file.
2014-09-17 Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
* plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.

View file

@ -1657,6 +1657,17 @@ MOSTLYCLEANFILES += two_file_test_1c.o
two_file_test_1c.o: two_file_test_1.o
cp two_file_test_1.o $@
check_PROGRAMS += plugin_test_10
check_SCRIPTS += plugin_test_10.sh
check_DATA += plugin_test_10.sections
MOSTLYCLEANFILES += plugin_test_10.sections
plugin_test_10: plugin_common_test_1.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
$(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.o
plugin_test_10.sections: plugin_test_10
$(TEST_READELF) -SW $< >$@ 2>/dev/null
plugin_test.so: plugin_test.o
$(LINK) -Bgcctestdir/ -shared plugin_test.o
plugin_test.o: plugin_test.c

View file

@ -350,14 +350,16 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_5 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_6 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_7 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_8
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_8 \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_10
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@am__append_34 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_1.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_2.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_3.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_4.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_6.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_7.sh
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_7.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_10.sh
# Test that symbols known in the IR file but not in the replacement file
# produce an unresolved symbol error.
@ -369,7 +371,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_6.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_7.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_7.syms \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_9.err
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_9.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_10.sections
# 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_36 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_1.err \
@ -380,7 +383,8 @@ check_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_6.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_7.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_9.err \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ two_file_test_1c.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ two_file_test_1c.o \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_10.sections
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@@TLS_TRUE@am__append_37 = plugin_test_tls
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@@TLS_TRUE@am__append_38 = plugin_test_tls.sh
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@@TLS_TRUE@am__append_39 = plugin_test_tls.err
@ -874,7 +878,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_5$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_6$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_7$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_8$(EXEEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_8$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ plugin_test_10$(EXEEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@@TLS_TRUE@am__EXEEXT_24 = plugin_test_tls$(EXEEXT)
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_25 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exclude_libs_test$(EXEEXT) \
@ -1425,6 +1430,12 @@ plugin_test_1_LDADD = $(LDADD)
plugin_test_1_DEPENDENCIES = libgoldtest.a ../libgold.a \
../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
plugin_test_10_SOURCES = plugin_test_10.c
plugin_test_10_OBJECTS = plugin_test_10.$(OBJEXT)
plugin_test_10_LDADD = $(LDADD)
plugin_test_10_DEPENDENCIES = libgoldtest.a ../libgold.a \
../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
plugin_test_2_SOURCES = plugin_test_2.c
plugin_test_2_OBJECTS = plugin_test_2.$(OBJEXT)
plugin_test_2_LDADD = $(LDADD)
@ -1888,14 +1899,14 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
local_labels_test.c many_sections_r_test.c \
$(many_sections_test_SOURCES) $(object_unittest_SOURCES) \
permission_test.c $(pie_copyrelocs_test_SOURCES) \
plugin_test_1.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_tls.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_2_SOURCES) script_test_3.c \
plugin_test_1.c plugin_test_10.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_tls.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_2_SOURCES) script_test_3.c \
$(searched_file_test_SOURCES) start_lib_test.c \
$(thin_archive_test_1_SOURCES) $(thin_archive_test_2_SOURCES) \
$(tls_phdrs_script_test_SOURCES) $(tls_pic_test_SOURCES) \
@ -3274,6 +3285,15 @@ pie_copyrelocs_test$(EXEEXT): $(pie_copyrelocs_test_OBJECTS) $(pie_copyrelocs_te
@PLUGINS_FALSE@plugin_test_1$(EXEEXT): $(plugin_test_1_OBJECTS) $(plugin_test_1_DEPENDENCIES)
@PLUGINS_FALSE@ @rm -f plugin_test_1$(EXEEXT)
@PLUGINS_FALSE@ $(LINK) $(plugin_test_1_OBJECTS) $(plugin_test_1_LDADD) $(LIBS)
@GCC_FALSE@plugin_test_10$(EXEEXT): $(plugin_test_10_OBJECTS) $(plugin_test_10_DEPENDENCIES)
@GCC_FALSE@ @rm -f plugin_test_10$(EXEEXT)
@GCC_FALSE@ $(LINK) $(plugin_test_10_OBJECTS) $(plugin_test_10_LDADD) $(LIBS)
@NATIVE_LINKER_FALSE@plugin_test_10$(EXEEXT): $(plugin_test_10_OBJECTS) $(plugin_test_10_DEPENDENCIES)
@NATIVE_LINKER_FALSE@ @rm -f plugin_test_10$(EXEEXT)
@NATIVE_LINKER_FALSE@ $(LINK) $(plugin_test_10_OBJECTS) $(plugin_test_10_LDADD) $(LIBS)
@PLUGINS_FALSE@plugin_test_10$(EXEEXT): $(plugin_test_10_OBJECTS) $(plugin_test_10_DEPENDENCIES)
@PLUGINS_FALSE@ @rm -f plugin_test_10$(EXEEXT)
@PLUGINS_FALSE@ $(LINK) $(plugin_test_10_OBJECTS) $(plugin_test_10_LDADD) $(LIBS)
@GCC_FALSE@plugin_test_2$(EXEEXT): $(plugin_test_2_OBJECTS) $(plugin_test_2_DEPENDENCIES)
@GCC_FALSE@ @rm -f plugin_test_2$(EXEEXT)
@GCC_FALSE@ $(LINK) $(plugin_test_2_OBJECTS) $(plugin_test_2_LDADD) $(LIBS)
@ -3657,6 +3677,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/permission_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pie_copyrelocs_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_1.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_10.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_3.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin_test_4.Po@am__quote@
@ -4107,6 +4128,8 @@ plugin_test_6.sh.log: plugin_test_6.sh
@p='plugin_test_6.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
plugin_test_7.sh.log: plugin_test_7.sh
@p='plugin_test_7.sh'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
plugin_test_10.sh.log: plugin_test_10.sh
@p='plugin_test_10.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
@ -4387,6 +4410,8 @@ plugin_test_7.log: plugin_test_7$(EXEEXT)
@p='plugin_test_7$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
plugin_test_8.log: plugin_test_8$(EXEEXT)
@p='plugin_test_8$(EXEEXT)'; $(am__check_pre) $(LOG_COMPILE) "$$tst" $(am__check_post)
plugin_test_10.log: plugin_test_10$(EXEEXT)
@p='plugin_test_10$(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)
@ -5324,6 +5349,10 @@ uninstall-am:
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ mv -f $@.tmp $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@two_file_test_1c.o: two_file_test_1.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ cp two_file_test_1.o $@
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_10: plugin_common_test_1.syms plugin_common_test_2.o gcctestdir/ld plugin_test.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(CXXLINK) -Bgcctestdir/ -Wl,--no-demangle,--plugin,"./plugin_test.so" plugin_common_test_1.syms plugin_common_test_2.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test_10.sections: plugin_test_10
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(TEST_READELF) -SW $< >$@ 2>/dev/null
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@plugin_test.so: plugin_test.o
@GCC_TRUE@@NATIVE_LINKER_TRUE@@PLUGINS_TRUE@ $(LINK) -Bgcctestdir/ -shared plugin_test.o

View file

@ -26,7 +26,7 @@
#include <assert.h>
int c1;
int c1 __attribute__((aligned (8)));
extern int c2;
int c3;
int c4 = 40;

View file

@ -0,0 +1,33 @@
#!/bin/sh
# plugin_test_10.sh -- a test case for the plugin API.
# Copyright (C) 2010-2014 Free Software Foundation, Inc.
# Written by Rafael Ávila de Espíndola <rafael.espindola@gmail.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_common_test_1.c and plugin_common_test_2.c.
# The first file is claimed by the plugin, the second one is not. We test
# the bigger alignment in plugin_common_test_2.c is used.
set -e
grep -q ".bss.* 8$" plugin_test_10.sections
exit 0