From: Ian Lance Taylor Date: Wed, 23 Jul 2008 14:36:09 +0000 (+0000) Subject: * symtab.cc (Symbol_table::resolve): Remove version parameter. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=95d14cd31e8c12b180adeba4aa840250004ca534;p=binutils-gdb.git * 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. --- diff --git a/gold/ChangeLog b/gold/ChangeLog index 6fb10a1649b..8693c76f4a6 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,15 @@ +2008-07-23 Ian Lance Taylor + + * 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 * options.h (class General_options): Define --check-sections. diff --git a/gold/resolve.cc b/gold/resolve.cc index d564aed19e3..0ad990cd055 100644 --- a/gold/resolve.cc +++ b/gold/resolve.cc @@ -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 diff --git a/gold/symtab.cc b/gold/symtab.cc index 03e592e6587..e3b0d9d0354 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -489,8 +489,7 @@ Symbol_table::lookup(const char* name, const char* version) const template void -Symbol_table::resolve(Sized_symbol* to, const Sized_symbol* from, - const char* version) +Symbol_table::resolve(Sized_symbol* to, const Sized_symbol* from) { unsigned char buf[elfcpp::Elf_sizes::sym_size]; elfcpp::Sym_write esym(buf); @@ -502,7 +501,7 @@ Symbol_table::resolve(Sized_symbol* to, const Sized_symbol* 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* sym2; sym2 = this->get_sized_symbol(insdef.first->second); - Symbol_table::resolve(ret, sym2, version); + Symbol_table::resolve(ret, sym2); this->make_forwarder(insdef.first->second, ret); insdef.first->second = ret; } diff --git a/gold/symtab.h b/gold/symtab.h index 9afdfe92996..3c998f82444 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -1292,8 +1292,7 @@ class Symbol_table template void - resolve(Sized_symbol* to, const Sized_symbol* from, - const char* version); + resolve(Sized_symbol* to, const Sized_symbol* from); // Record that a symbol is forced to be local by a version script. void diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 590e4355f4b..8e4ae0d4fac 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -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 diff --git a/gold/testsuite/Makefile.in b/gold/testsuite/Makefile.in index 52aed269755..beec5be8092 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -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 index 00000000000..5d06d4ec193 --- /dev/null +++ b/gold/testsuite/ver_test_9.cc @@ -0,0 +1,50 @@ +// ver_test_9.cc -- a test case for gold + +// Copyright 2008 Free Software Foundation, Inc. +// Written by Ian Lance Taylor . + +// 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; +}