* symtab.cc (Symbol_table::resolve): Remove version parameter.
authorIan Lance Taylor <ian@airs.com>
Wed, 23 Jul 2008 14:36:09 +0000 (14:36 +0000)
committerIan Lance Taylor <ian@airs.com>
Wed, 23 Jul 2008 14:36:09 +0000 (14:36 +0000)
Change all callers.
* symtab.h (class Symbol_table): Update declaration.
* testsuite/ver_test_9.cc: New file.
* testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
(ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
(ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
(ver_test_9.so, ver_test_9.o): New targets.
* testsuite/Makefile.in: Rebuild.

gold/ChangeLog
gold/resolve.cc
gold/symtab.cc
gold/symtab.h
gold/testsuite/Makefile.am
gold/testsuite/Makefile.in
gold/testsuite/ver_test_9.cc [new file with mode: 0644]

index 6fb10a1649bbaf455fa360e91e26563522c973e1..8693c76f4a6d99c3f73319731156673e47693ceb 100644 (file)
@@ -1,3 +1,15 @@
+2008-07-23  Ian Lance Taylor  <iant@google.com>
+
+       * symtab.cc (Symbol_table::resolve): Remove version parameter.
+       Change all callers.
+       * symtab.h (class Symbol_table): Update declaration.
+       * testsuite/ver_test_9.cc: New file.
+       * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
+       (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
+       (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
+       (ver_test_9.so, ver_test_9.o): New targets.
+       * testsuite/Makefile.in: Rebuild.
+
 2008-07-22  Ian Lance Taylor  <iant@google.com>
 
        * options.h (class General_options): Define --check-sections.
index d564aed19e377ca6124fc50240d7248546680a8e..0ad990cd055db328df05adf6a657a00d04931a52 100644 (file)
@@ -210,7 +210,7 @@ symbol_to_bits(elfcpp::STB binding, bool is_dynamic,
 // IS_ORDINARY is whether ST_SHNDX is a normal section index rather
 // than a special code.  ORIG_ST_SHNDX is the original section index,
 // before any munging because of discarded sections, except that all
-// non-ordinary section indexes are mapped to SHN_UNDEF.  VERSION of
+// non-ordinary section indexes are mapped to SHN_UNDEF.  VERSION is
 // the version of SYM.
 
 template<int size, bool big_endian>
index 03e592e6587e157c4cb99dfb91c4d06a2a6ac557..e3b0d9d03548a009e13b86268a99157ca62df5ed 100644 (file)
@@ -489,8 +489,7 @@ Symbol_table::lookup(const char* name, const char* version) const
 
 template<int size, bool big_endian>
 void
-Symbol_table::resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from,
-                     const char* version)
+Symbol_table::resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from)
 {
   unsigned char buf[elfcpp::Elf_sizes<size>::sym_size];
   elfcpp::Sym_write<size, big_endian> esym(buf);
@@ -502,7 +501,7 @@ Symbol_table::resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from,
   bool is_ordinary;
   unsigned int shndx = from->shndx(&is_ordinary);
   this->resolve(to, esym.sym(), shndx, is_ordinary, shndx, from->object(),
-               version);
+               from->version());
   if (from->in_reg())
     to->set_in_reg();
   if (from->in_dyn())
@@ -735,7 +734,7 @@ Symbol_table::add_from_object(Object* object,
                {
                  const Sized_symbol<size>* sym2;
                  sym2 = this->get_sized_symbol<size>(insdef.first->second);
-                 Symbol_table::resolve<size, big_endian>(ret, sym2, version);
+                 Symbol_table::resolve<size, big_endian>(ret, sym2);
                  this->make_forwarder(insdef.first->second, ret);
                  insdef.first->second = ret;
                }
index 9afdfe92996bcbde8e2779fe67ca17e57fd8b21f..3c998f8244451e1efcc11d405ddb3420ea6f4a7d 100644 (file)
@@ -1292,8 +1292,7 @@ class Symbol_table
 
   template<int size, bool big_endian>
   void
-  resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from,
-          const char* version);
+  resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from);
 
   // Record that a symbol is forced to be local by a version script.
   void
index 590e4355f4bed0d25c0c4efdaf1d5b608a594250..8e4ae0d4fac698dc01bd198b72fbeba2cfa5e9ed 100644 (file)
@@ -774,6 +774,16 @@ ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gc
 ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
        $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
 
+check_PROGRAMS += ver_test_9
+ver_test_9_SOURCES = ver_test_main.cc
+ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
+ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
+ver_test_9_LDADD = ver_test_9.so
+ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
+       $(CXXLINK) -Bgcctestdir/ -shared ver_test_9.o ver_test_5.so ver_test_4.so
+ver_test_9.o: ver_test_9.cc
+       $(CXXCOMPILE) -c -fpic -o $@ $<
+
 check_PROGRAMS += protected_1
 protected_1_SOURCES = \
        protected_main_1.cc protected_main_2.cc protected_main_3.cc
index 52aed26975570f6399d1a79b171cf20113b458c4..beec5be80929bdfb3f233cf9b59153fcf89e2ce7 100644 (file)
@@ -226,7 +226,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
 
 # Test symbol versioning.
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_19 = ver_test ver_test_2 \
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_6 ver_test_8 \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_6 ver_test_8 ver_test_9 \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_1 protected_2 \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_test script_test_1 \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2 justsyms \
@@ -345,6 +345,7 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_2$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_6$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_8$(EXEEXT) \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_9$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_1$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_2$(EXEEXT) \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ relro_test$(EXEEXT) \
@@ -726,6 +727,10 @@ am__ver_test_8_SOURCES_DIST = two_file_test_main.cc
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am_ver_test_8_OBJECTS =  \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ two_file_test_main.$(OBJEXT)
 ver_test_8_OBJECTS = $(am_ver_test_8_OBJECTS)
+am__ver_test_9_SOURCES_DIST = ver_test_main.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@am_ver_test_9_OBJECTS =  \
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_main.$(OBJEXT)
+ver_test_9_OBJECTS = $(am_ver_test_9_OBJECTS)
 am__weak_alias_test_SOURCES_DIST = weak_alias_test_main.cc
 @GCC_TRUE@@NATIVE_LINKER_TRUE@am_weak_alias_test_OBJECTS =  \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ weak_alias_test_main.$(OBJEXT)
@@ -797,9 +802,9 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
        $(two_file_static_test_SOURCES) two_file_strip_test.c \
        $(two_file_test_SOURCES) $(ver_test_SOURCES) \
        $(ver_test_2_SOURCES) $(ver_test_6_SOURCES) \
-       $(ver_test_8_SOURCES) $(weak_alias_test_SOURCES) \
-       $(weak_test_SOURCES) $(weak_undef_nonpic_test_SOURCES) \
-       $(weak_undef_test_SOURCES)
+       $(ver_test_8_SOURCES) $(ver_test_9_SOURCES) \
+       $(weak_alias_test_SOURCES) $(weak_test_SOURCES) \
+       $(weak_undef_nonpic_test_SOURCES) $(weak_undef_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) \
@@ -852,7 +857,7 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
        $(am__two_file_static_test_SOURCES_DIST) two_file_strip_test.c \
        $(am__two_file_test_SOURCES_DIST) $(am__ver_test_SOURCES_DIST) \
        $(am__ver_test_2_SOURCES_DIST) $(am__ver_test_6_SOURCES_DIST) \
-       $(am__ver_test_8_SOURCES_DIST) \
+       $(am__ver_test_8_SOURCES_DIST) $(am__ver_test_9_SOURCES_DIST) \
        $(am__weak_alias_test_SOURCES_DIST) \
        $(am__weak_test_SOURCES_DIST) \
        $(am__weak_undef_nonpic_test_SOURCES_DIST) \
@@ -1310,6 +1315,10 @@ binary_unittest_SOURCES = binary_unittest.cc
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_9_SOURCES = ver_test_main.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_9_DEPENDENCIES = gcctestdir/ld ver_test_9.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_9_LDFLAGS = -Bgcctestdir/ -Wl,-R,.
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_9_LDADD = ver_test_9.so
 @GCC_TRUE@@NATIVE_LINKER_TRUE@protected_1_SOURCES = \
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_main_1.cc protected_main_2.cc protected_main_3.cc
 
@@ -1611,6 +1620,9 @@ ver_test_6$(EXEEXT): $(ver_test_6_OBJECTS) $(ver_test_6_DEPENDENCIES)
 ver_test_8$(EXEEXT): $(ver_test_8_OBJECTS) $(ver_test_8_DEPENDENCIES) 
        @rm -f ver_test_8$(EXEEXT)
        $(CXXLINK) $(ver_test_8_LDFLAGS) $(ver_test_8_OBJECTS) $(ver_test_8_LDADD) $(LIBS)
+ver_test_9$(EXEEXT): $(ver_test_9_OBJECTS) $(ver_test_9_DEPENDENCIES) 
+       @rm -f ver_test_9$(EXEEXT)
+       $(CXXLINK) $(ver_test_9_LDFLAGS) $(ver_test_9_OBJECTS) $(ver_test_9_LDADD) $(LIBS)
 weak_alias_test$(EXEEXT): $(weak_alias_test_OBJECTS) $(weak_alias_test_DEPENDENCIES) 
        @rm -f weak_alias_test$(EXEEXT)
        $(CXXLINK) $(weak_alias_test_LDFLAGS) $(weak_alias_test_OBJECTS) $(weak_alias_test_LDADD) $(LIBS)
@@ -2218,6 +2230,10 @@ uninstall-am: uninstall-info-am
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_8_2.so: two_file_test_2_pic.o $(srcdir)/ver_test_8.script gcctestdir/ld
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_8.script two_file_test_2_pic.o
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared ver_test_9.o ver_test_5.so ver_test_4.so
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_9.o: ver_test_9.cc
+@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $<
 
 @GCC_TRUE@@NATIVE_LINKER_TRUE@protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o
 @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o
diff --git a/gold/testsuite/ver_test_9.cc b/gold/testsuite/ver_test_9.cc
new file mode 100644 (file)
index 0000000..5d06d4e
--- /dev/null
@@ -0,0 +1,50 @@
+// ver_test_9.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 "ver_test.h"
+
+bool
+t1()
+{
+  return true;
+}
+
+int
+t2_2()
+{
+  TRACE
+  return 22;
+}
+
+int
+t3_2()
+{
+  TRACE
+  return 12;
+}
+
+int
+t4_2()
+{
+  TRACE
+  return 42;
+}