aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2008-03-14 05:57:19 +0000
committerIan Lance Taylor <iant@google.com>2008-03-14 05:57:19 +0000
commitbe3e620119165a017266af64ae310cd6343a370a (patch)
tree57915f9f4f0cdf98cba70ce17782e116ba16dc4e
parent36cf3ec26ac5ecc440b4fe014404981136778d2d (diff)
downloadgdb-be3e620119165a017266af64ae310cd6343a370a.zip
gdb-be3e620119165a017266af64ae310cd6343a370a.tar.gz
gdb-be3e620119165a017266af64ae310cd6343a370a.tar.bz2
Don't get confused about whether a symbol is the default version if we
see a later reference to it. Add tests for this case.
-rw-r--r--gold/Makefile.in2
-rwxr-xr-xgold/configure21
-rw-r--r--gold/configure.ac2
-rw-r--r--gold/symtab.cc3
-rw-r--r--gold/symtab.h6
-rw-r--r--gold/testsuite/Makefile.am15
-rw-r--r--gold/testsuite/Makefile.in43
-rwxr-xr-xgold/testsuite/ver_test_2.sh45
-rw-r--r--gold/testsuite/ver_test_main_2.cc32
9 files changed, 152 insertions, 17 deletions
diff --git a/gold/Makefile.in b/gold/Makefile.in
index 4e87352..08f87eb 100644
--- a/gold/Makefile.in
+++ b/gold/Makefile.in
@@ -220,6 +220,8 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
RANLIB = @RANLIB@
+READELF_FALSE = @READELF_FALSE@
+READELF_TRUE = @READELF_TRUE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STATIC_TLS_FALSE = @STATIC_TLS_FALSE@
diff --git a/gold/configure b/gold/configure
index 2caa368..45e84d9 100755
--- a/gold/configure
+++ b/gold/configure
@@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar THREADS_TRUE THREADS_FALSE TARGETOBJS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE YACC RANLIB ac_ct_RANLIB LN_S USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE NATIVE_LINKER_TRUE NATIVE_LINKER_FALSE GCC_TRUE GCC_FALSE OBJDUMP_AND_CPPFILT_TRUE OBJDUMP_AND_CPPFILT_FALSE FN_PTRS_IN_SO_WITHOUT_PIC_TRUE FN_PTRS_IN_SO_WITHOUT_PIC_FALSE TLS_TRUE TLS_FALSE STATIC_TLS_TRUE STATIC_TLS_FALSE WARN_CFLAGS NO_WERROR WARN_CXXFLAGS LFS_CFLAGS LIBOBJS CPP EGREP CXXCPP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar THREADS_TRUE THREADS_FALSE TARGETOBJS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE YACC RANLIB ac_ct_RANLIB LN_S USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS DATADIRNAME INSTOBJEXT GENCAT CATOBJEXT MKINSTALLDIRS MSGFMT MSGMERGE NATIVE_LINKER_TRUE NATIVE_LINKER_FALSE GCC_TRUE GCC_FALSE OBJDUMP_AND_CPPFILT_TRUE OBJDUMP_AND_CPPFILT_FALSE READELF_TRUE READELF_FALSE FN_PTRS_IN_SO_WITHOUT_PIC_TRUE FN_PTRS_IN_SO_WITHOUT_PIC_FALSE TLS_TRUE TLS_FALSE STATIC_TLS_TRUE STATIC_TLS_FALSE WARN_CFLAGS NO_WERROR WARN_CXXFLAGS LFS_CFLAGS LIBOBJS CPP EGREP CXXCPP MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -4513,6 +4513,16 @@ fi
+if readelf --help >/dev/null; then
+ READELF_TRUE=
+ READELF_FALSE='#'
+else
+ READELF_TRUE='#'
+ READELF_FALSE=
+fi
+
+
+
if
case $target_cpu in
@@ -6396,6 +6406,13 @@ echo "$as_me: error: conditional \"OBJDUMP_AND_CPPFILT\" was never defined.
Usually this means the macro was only invoked conditionally." >&2;}
{ (exit 1); exit 1; }; }
fi
+if test -z "${READELF_TRUE}" && test -z "${READELF_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"READELF\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"READELF\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
if test -z "${FN_PTRS_IN_SO_WITHOUT_PIC_TRUE}" && test -z "${FN_PTRS_IN_SO_WITHOUT_PIC_FALSE}"; then
{ { echo "$as_me:$LINENO: error: conditional \"FN_PTRS_IN_SO_WITHOUT_PIC\" was never defined.
Usually this means the macro was only invoked conditionally." >&5
@@ -7050,6 +7067,8 @@ s,@GCC_TRUE@,$GCC_TRUE,;t t
s,@GCC_FALSE@,$GCC_FALSE,;t t
s,@OBJDUMP_AND_CPPFILT_TRUE@,$OBJDUMP_AND_CPPFILT_TRUE,;t t
s,@OBJDUMP_AND_CPPFILT_FALSE@,$OBJDUMP_AND_CPPFILT_FALSE,;t t
+s,@READELF_TRUE@,$READELF_TRUE,;t t
+s,@READELF_FALSE@,$READELF_FALSE,;t t
s,@FN_PTRS_IN_SO_WITHOUT_PIC_TRUE@,$FN_PTRS_IN_SO_WITHOUT_PIC_TRUE,;t t
s,@FN_PTRS_IN_SO_WITHOUT_PIC_FALSE@,$FN_PTRS_IN_SO_WITHOUT_PIC_FALSE,;t t
s,@TLS_TRUE@,$TLS_TRUE,;t t
diff --git a/gold/configure.ac b/gold/configure.ac
index 45e65ab..e930fd6 100644
--- a/gold/configure.ac
+++ b/gold/configure.ac
@@ -188,6 +188,8 @@ AM_CONDITIONAL(NATIVE_LINKER,
AM_CONDITIONAL(GCC, test "$GCC" = yes)
AM_CONDITIONAL(OBJDUMP_AND_CPPFILT,
[objdump --help >/dev/null && c++filt --help >/dev/null])
+AM_CONDITIONAL(READELF,
+ [readelf --help >/dev/null])
dnl Some architectures do not support taking pointers of functions
dnl defined in shared libraries except in -fPIC mode. We need to
diff --git a/gold/symtab.cc b/gold/symtab.cc
index 1232d05..b32dcb4 100644
--- a/gold/symtab.cc
+++ b/gold/symtab.cc
@@ -643,7 +643,8 @@ Symbol_table::add_from_object(Object* object,
if (!was_common && ret->is_common())
this->commons_.push_back(ret);
- ret->set_is_default(def);
+ if (def)
+ ret->set_is_default();
return ret;
}
diff --git a/gold/symtab.h b/gold/symtab.h
index 5e5e1d3..8da9e6d 100644
--- a/gold/symtab.h
+++ b/gold/symtab.h
@@ -121,10 +121,10 @@ class Symbol
return this->is_def_;
}
- // Set whether this version is the default for this symbol name.
+ // Set that this version is the default for this symbol name.
void
- set_is_default(bool def)
- { this->is_def_ = def; }
+ set_is_default()
+ { this->is_def_ = true; }
// Return the symbol source.
Source
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am
index 0d1db37..191618a 100644
--- a/gold/testsuite/Makefile.am
+++ b/gold/testsuite/Makefile.am
@@ -534,6 +534,21 @@ ver_test_3.o: ver_test_3.cc
ver_test_4.o: ver_test_4.cc
$(CXXCOMPILE) -c -fpic -o $@ $<
+check_PROGRAMS += ver_test_2
+ver_test_2_SOURCES = ver_test_main_2.cc
+ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
+ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
+ver_test_2_LDADD = ver_test_4.so ver_test_2.so
+
+if READELF
+
+check_SCRIPTS += ver_test_2.sh
+check_DATA += ver_test_2.syms
+ver_test_2.syms: ver_test_2
+ readelf -s $< >$@ 2>/dev/null
+
+endif
+
check_PROGRAMS += script_test_1
script_test_1_SOURCES = script_test_1.cc
script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in
index 7b3a6c5..bf38504 100644
--- a/gold/testsuite/Makefile.in
+++ b/gold/testsuite/Makefile.in
@@ -175,9 +175,11 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_10 = flagstest_compress_debug_sections \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile_and_compress_debug_sections \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test script_test_1 \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2 justsyms \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ binary_test
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test ver_test_2 \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_1 script_test_2 \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms binary_test
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@am__append_11 = ver_test_2.sh
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@am__append_12 = ver_test_2.syms
@GCC_FALSE@script_test_1_DEPENDENCIES = libgoldtest.a ../libgold.a \
@GCC_FALSE@ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
@GCC_FALSE@ $(am__DEPENDENCIES_1)
@@ -206,13 +208,13 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
@NATIVE_LINKER_FALSE@ ../libgold.a ../../libiberty/libiberty.a \
@NATIVE_LINKER_FALSE@ $(am__DEPENDENCIES_1) \
@NATIVE_LINKER_FALSE@ $(am__DEPENDENCIES_1)
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@am__append_11 = ver_matching_test.sh \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@am__append_13 = ver_matching_test.sh \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@ script_test_3.sh
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@am__append_12 = ver_matching_test.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@am__append_14 = ver_matching_test.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@ script_test_3.stdout
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@am__append_13 = ver_matching_test.stdout \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@am__append_15 = ver_matching_test.stdout \
@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@ script_test_3.stdout
-@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@am__append_14 = script_test_3
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@OBJDUMP_AND_CPPFILT_TRUE@am__append_16 = script_test_3
subdir = testsuite
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -278,6 +280,7 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ flagstest_o_specialfile_and_compress_debug_sections$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_2$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_1$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2$(EXEEXT) \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ justsyms$(EXEEXT) \
@@ -578,6 +581,10 @@ am__ver_test_SOURCES_DIST = ver_test_main.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@am_ver_test_OBJECTS = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_main.$(OBJEXT)
ver_test_OBJECTS = $(am_ver_test_OBJECTS)
+am__ver_test_2_SOURCES_DIST = ver_test_main_2.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am_ver_test_2_OBJECTS = \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_main_2.$(OBJEXT)
+ver_test_2_OBJECTS = $(am_ver_test_2_OBJECTS)
am__weak_test_SOURCES_DIST = weak_test.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@am_weak_test_OBJECTS = \
@GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_test.$(OBJEXT)
@@ -630,7 +637,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
$(two_file_shared_2_pic_1_test_SOURCES) \
$(two_file_shared_2_test_SOURCES) \
$(two_file_static_test_SOURCES) $(two_file_test_SOURCES) \
- $(ver_test_SOURCES) $(weak_test_SOURCES)
+ $(ver_test_SOURCES) $(ver_test_2_SOURCES) $(weak_test_SOURCES)
DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
basic_static_pic_test.c basic_static_test.c basic_test.c \
$(am__binary_test_SOURCES_DIST) $(binary_unittest_SOURCES) \
@@ -673,7 +680,7 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
$(am__two_file_shared_2_test_SOURCES_DIST) \
$(am__two_file_static_test_SOURCES_DIST) \
$(am__two_file_test_SOURCES_DIST) $(am__ver_test_SOURCES_DIST) \
- $(am__weak_test_SOURCES_DIST)
+ $(am__ver_test_2_SOURCES_DIST) $(am__weak_test_SOURCES_DIST)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -747,6 +754,8 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
POSUB = @POSUB@
RANLIB = @RANLIB@
+READELF_FALSE = @READELF_FALSE@
+READELF_TRUE = @READELF_TRUE@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STATIC_TLS_FALSE = @STATIC_TLS_FALSE@
@@ -826,13 +835,13 @@ INCLUDES = \
# .o's), but not all of them (such as .so's and .err files). We
# improve on that here. automake-1.9 info docs say "mostlyclean" is
# the right choice for files 'make' builds that people rebuild.
-MOSTLYCLEANFILES = *.so $(am__append_9) $(am__append_13)
+MOSTLYCLEANFILES = *.so $(am__append_9) $(am__append_15)
# We will add to these later, for each individual test. Note
# that we add each test under check_SCRIPTS or check_PROGRAMS;
# the TESTS variable is automatically populated from these.
-check_SCRIPTS = $(am__append_7) $(am__append_11)
-check_DATA = $(am__append_8) $(am__append_12)
+check_SCRIPTS = $(am__append_7) $(am__append_11) $(am__append_13)
+check_DATA = $(am__append_8) $(am__append_12) $(am__append_14)
TESTS = $(check_SCRIPTS) $(check_PROGRAMS)
# ---------------------------------------------------------------------
@@ -1039,6 +1048,10 @@ binary_unittest_SOURCES = binary_unittest.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_DEPENDENCIES = gcctestdir/ld ver_test_1.so ver_test_2.so ver_test_4.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_LDADD = ver_test_1.so ver_test_2.so ver_test_4.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_2_SOURCES = ver_test_main_2.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_2_DEPENDENCIES = gcctestdir/ld ver_test_4.so ver_test_2.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_2_LDADD = ver_test_4.so ver_test_2.so
@GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_1_SOURCES = script_test_1.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_1_DEPENDENCIES = gcctestdir/ld script_test_1.t
@GCC_TRUE@@NATIVE_LINKER_TRUE@script_test_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. -T $(srcdir)/script_test_1.t
@@ -1268,6 +1281,9 @@ two_file_test$(EXEEXT): $(two_file_test_OBJECTS) $(two_file_test_DEPENDENCIES)
ver_test$(EXEEXT): $(ver_test_OBJECTS) $(ver_test_DEPENDENCIES)
@rm -f ver_test$(EXEEXT)
$(CXXLINK) $(ver_test_LDFLAGS) $(ver_test_OBJECTS) $(ver_test_LDADD) $(LIBS)
+ver_test_2$(EXEEXT): $(ver_test_2_OBJECTS) $(ver_test_2_DEPENDENCIES)
+ @rm -f ver_test_2$(EXEEXT)
+ $(CXXLINK) $(ver_test_2_LDFLAGS) $(ver_test_2_OBJECTS) $(ver_test_2_LDADD) $(LIBS)
weak_test$(EXEEXT): $(weak_test_OBJECTS) $(weak_test_DEPENDENCIES)
@rm -f weak_test$(EXEEXT)
$(CXXLINK) $(weak_test_LDFLAGS) $(weak_test_OBJECTS) $(weak_test_LDADD) $(LIBS)
@@ -1309,6 +1325,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_test_2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/two_file_test_main.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ver_test_main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ver_test_main_2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/weak_test.Po@am__quote@
.c.o:
@@ -1748,6 +1765,8 @@ uninstall-am: uninstall-info-am
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_4.o: ver_test_4.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ver_test_2.syms: ver_test_2
+@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ readelf -s $< >$@ 2>/dev/null
@GCC_TRUE@@NATIVE_LINKER_TRUE@justsyms_2.o: justsyms_2.cc
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -o $@ $<
@GCC_TRUE@@NATIVE_LINKER_TRUE@justsyms_2r.o: justsyms_2.o gcctestdir/ld
diff --git a/gold/testsuite/ver_test_2.sh b/gold/testsuite/ver_test_2.sh
new file mode 100755
index 0000000..0bd0f90
--- /dev/null
+++ b/gold/testsuite/ver_test_2.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# ver_test_2.sh -- test that symbol has correct version
+
+# Copyright 2008 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.
+
+# This file goes with ver_matching_def.cc, a C++ source file
+# constructed with several symbols mapped via version_script.map. We
+# run readelf on the resulting shared object and check that each
+# symbol has the correct version.
+
+check()
+{
+ if ! grep -q "$2" "$1"
+ then
+ echo "Did not find expected symbol in $1:"
+ echo " $2"
+ echo ""
+ echo "Actual output below:"
+ cat "$1"
+ exit 1
+ fi
+}
+
+check ver_test_2.syms "t1_2@VER2"
+
+exit 0
diff --git a/gold/testsuite/ver_test_main_2.cc b/gold/testsuite/ver_test_main_2.cc
new file mode 100644
index 0000000..1599e0f
--- /dev/null
+++ b/gold/testsuite/ver_test_main_2.cc
@@ -0,0 +1,32 @@
+// ver_test_main_2.cc -- a test case for gold
+
+// Copyright 2008 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.
+
+#include <cassert>
+
+#include "ver_test.h"
+
+int
+main()
+{
+ assert(t1_2() == 12);
+ return 0;
+}