aboutsummaryrefslogtreecommitdiff
path: root/gold/testsuite
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>2009-12-31 05:07:22 +0000
committerIan Lance Taylor <ian@airs.com>2009-12-31 05:07:22 +0000
commiteda294df6d71e405810e6b56e2bab2bff91a1799 (patch)
treecae358d1e57adf539483db13d65defa840bf0397 /gold/testsuite
parentd7bb5745008bb111becc3dc87e7ce243f59b7170 (diff)
downloadbinutils-eda294df6d71e405810e6b56e2bab2bff91a1799.zip
binutils-eda294df6d71e405810e6b56e2bab2bff91a1799.tar.gz
binutils-eda294df6d71e405810e6b56e2bab2bff91a1799.tar.bz2
PR 10979
* common.cc (Sort_commons::operator()): Stabilize sort when both entries are NULL. (Symbol_table::do_allocate_commons_list): When allocating common symbols, skip a symbol which is no longer common. * symtab.h (Symbol::is_common): Test whether the symbol comes from an object before checking its type. * testsuite/common_test_2.c: New file. * testsuite/common_test_3.c: New file. * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2. (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define. (common_test_2_LDFLAGS, common_test_2_LDADD): Define. (common_test_2_pic.o, common_test_2.so): New targets. (common_test_3_pic.o, common_test_3.so): New targets. * testsuite/Makefile.in: Rebuild.
Diffstat (limited to 'gold/testsuite')
-rw-r--r--gold/testsuite/Makefile.am14
-rw-r--r--gold/testsuite/Makefile.in32
-rw-r--r--gold/testsuite/common_test_2.c33
-rw-r--r--gold/testsuite/common_test_3.c32
4 files changed, 107 insertions, 4 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 61934aa..7b5532e 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -407,6 +407,20 @@ common_test_1_DEPENDENCIES = gcctestdir/ld
common_test_1_LDFLAGS = -Bgcctestdir/
common_test_1_LDADD =
+check_PROGRAMS += common_test_2
+common_test_2_SOURCES = common_test_1.c
+common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
+common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
+common_test_2_LDADD = common_test_2.so common_test_3.so
+common_test_2_pic.o: common_test_2.c
+ $(COMPILE) -c -fpic -o $@ $<
+common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
+ $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
+common_test_3_pic.o: common_test_3.c
+ $(COMPILE) -c -fpic -o $@ $<
+common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
+ $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
+
check_PROGRAMS += exception_test
check_PROGRAMS += exception_static_test
check_PROGRAMS += exception_shared_1_test
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 81b8b7f..291eab7 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -140,7 +140,8 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_mixed_2_shared_test
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_6 = two_file_strip_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_strip_test \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ common_test_1 exception_test \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ common_test_1 common_test_2 \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_static_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_1_test \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_2_test \
@@ -366,6 +367,7 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_strip_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_same_shared_strip_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ common_test_1$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ common_test_2$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_static_test$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_shared_1_test$(EXEEXT) \
@@ -476,6 +478,12 @@ am__common_test_1_SOURCES_DIST = common_test_1.c
common_test_1_OBJECTS = $(am_common_test_1_OBJECTS)
common_test_1_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(common_test_1_LDFLAGS) $(LDFLAGS) -o $@
+am__common_test_2_SOURCES_DIST = common_test_1.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am_common_test_2_OBJECTS = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ common_test_1.$(OBJEXT)
+common_test_2_OBJECTS = $(am_common_test_2_OBJECTS)
+common_test_2_LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(common_test_2_LDFLAGS) $(LDFLAGS) -o $@
am__constructor_static_test_SOURCES_DIST = constructor_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__objects_1 = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ constructor_test.$(OBJEXT)
@@ -1064,9 +1072,9 @@ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c basic_pie_test.c \
basic_static_pic_test.c basic_static_test.c basic_test.c \
$(binary_test_SOURCES) $(binary_unittest_SOURCES) \
- $(common_test_1_SOURCES) $(constructor_static_test_SOURCES) \
- $(constructor_test_SOURCES) $(copy_test_SOURCES) \
- $(discard_locals_test_SOURCES) \
+ $(common_test_1_SOURCES) $(common_test_2_SOURCES) \
+ $(constructor_static_test_SOURCES) $(constructor_test_SOURCES) \
+ $(copy_test_SOURCES) $(discard_locals_test_SOURCES) \
$(exception_same_shared_test_SOURCES) \
$(exception_separate_shared_12_test_SOURCES) \
$(exception_separate_shared_21_test_SOURCES) \
@@ -1119,6 +1127,7 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
basic_pie_test.c basic_static_pic_test.c basic_static_test.c \
basic_test.c $(am__binary_test_SOURCES_DIST) \
$(binary_unittest_SOURCES) $(am__common_test_1_SOURCES_DIST) \
+ $(am__common_test_2_SOURCES_DIST) \
$(am__constructor_static_test_SOURCES_DIST) \
$(am__constructor_test_SOURCES_DIST) \
$(am__copy_test_SOURCES_DIST) \
@@ -1505,6 +1514,10 @@ binary_unittest_SOURCES = binary_unittest.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_1_DEPENDENCIES = gcctestdir/ld
@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_1_LDFLAGS = -Bgcctestdir/
@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_1_LDADD =
+@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_2_SOURCES = common_test_1.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_2_DEPENDENCIES = common_test_2.so common_test_3.so gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
+@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_2_LDADD = common_test_2.so common_test_3.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_test_SOURCES = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_main.cc \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ exception_test_1.cc \
@@ -1806,6 +1819,9 @@ binary_unittest$(EXEEXT): $(binary_unittest_OBJECTS) $(binary_unittest_DEPENDENC
common_test_1$(EXEEXT): $(common_test_1_OBJECTS) $(common_test_1_DEPENDENCIES)
@rm -f common_test_1$(EXEEXT)
$(common_test_1_LINK) $(common_test_1_OBJECTS) $(common_test_1_LDADD) $(LIBS)
+common_test_2$(EXEEXT): $(common_test_2_OBJECTS) $(common_test_2_DEPENDENCIES)
+ @rm -f common_test_2$(EXEEXT)
+ $(common_test_2_LINK) $(common_test_2_OBJECTS) $(common_test_2_LDADD) $(LIBS)
constructor_static_test$(EXEEXT): $(constructor_static_test_OBJECTS) $(constructor_static_test_DEPENDENCIES)
@rm -f constructor_static_test$(EXEEXT)
$(constructor_static_test_LINK) $(constructor_static_test_OBJECTS) $(constructor_static_test_LDADD) $(LIBS)
@@ -2642,6 +2658,14 @@ uninstall-am:
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_STRIP) -o two_file_strip_test two_file_test
@GCC_TRUE@@NATIVE_LINKER_TRUE@two_file_shared_strip.so: two_file_shared.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_STRIP) -S -o two_file_shared_strip.so two_file_shared.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_2_pic.o: common_test_2.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -fpic -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_2.so: common_test_2_pic.o common_test_3.so gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ -shared common_test_2_pic.o common_test_3.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_3_pic.o: common_test_3.c
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(COMPILE) -c -fpic -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@common_test_3.so: common_test_3_pic.o ver_test_2.script gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(LINK) -Bgcctestdir/ -shared common_test_3_pic.o -Wl,--version-script,$(srcdir)/ver_test_2.script
@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_test_1_pic.o: exception_test_1.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@exception_test_2_pic.o: exception_test_2.cc
diff --git a/gold/testsuite/common_test_2.c b/gold/testsuite/common_test_2.c
new file mode 100644
index 0000000..ef6d83d
--- /dev/null
+++ b/gold/testsuite/common_test_2.c
@@ -0,0 +1,33 @@
+/* common_test_2.c -- test common symbol name conflicts
+
+ Copyright 2009 Free Software Foundation, Inc.
+ Written by Ian Lance Taylor <iant@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. */
+
+/* Call a function. The function will come from a shared library. */
+
+extern void c1 (void);
+
+void fn (void);
+
+void
+fn (void)
+{
+ c1 ();
+}
diff --git a/gold/testsuite/common_test_3.c b/gold/testsuite/common_test_3.c
new file mode 100644
index 0000000..ba8960c
--- /dev/null
+++ b/gold/testsuite/common_test_3.c
@@ -0,0 +1,32 @@
+/* common_test_3.c -- test common symbol name conflicts
+
+ Copyright 2009 Free Software Foundation, Inc.
+ Written by Ian Lance Taylor <iant@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. */
+
+/* Define a function with a default version whose name is the same as
+ a common symbol. This file will wind up in a shared library. */
+
+void c1_v1 (void);
+
+void
+c1_v1 (void)
+{
+}
+__asm__ (".symver c1_v1,c1@@VER1");