From 057ead223193b365a6fcd11939a89a63eb4b94e0 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 23 Jul 2008 23:44:02 +0000 Subject: PR 6647 * script.cc (Version_script_info::get_versions): Don't add empty version tag to return value. (Version_script_info::get_symbol_version_helper): Change return type to bool. Add pversion parameter. Change all callers. (script_register_vers_node): Don't require a non-NULL tag. * script.h (class Version_script_info): Update declarations. (Version_script_info::get_symbol_version): Change return type to bool. Add version parameter. Change all callers. * symtab.cc (Sized_symbol::add_from_relobj): Rework version handling. Handle an empty version from a version script. (Symbol_table::define_special_symbol): Likewise. * testsuite/ver_test_10.script: New file. * testsuite/ver_test_10.sh: New file. * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh. (check_DATA): Add ver_test_10.syms. (ver_test_10.syms, ver_test_10.so): New target. * testsuite/Makefile.in: Rebuild. --- gold/testsuite/Makefile.am | 7 +++++++ gold/testsuite/Makefile.in | 8 +++++-- gold/testsuite/ver_test_10.script | 30 ++++++++++++++++++++++++++ gold/testsuite/ver_test_10.sh | 44 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 gold/testsuite/ver_test_10.script create mode 100755 gold/testsuite/ver_test_10.sh (limited to 'gold/testsuite') diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 8e4ae0d..9c91c24 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -784,6 +784,13 @@ ver_test_9.so: ver_test_9.o ver_test_4.so ver_test_5.so gcctestdir/ld ver_test_9.o: ver_test_9.cc $(CXXCOMPILE) -c -fpic -o $@ $< +check_SCRIPTS += ver_test_10.sh +check_DATA += ver_test_10.syms +ver_test_10.syms: ver_test_10.so + $(TEST_READELF) -s $< >$@ 2>/dev/null +ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script + $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.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 beec5be..29fad42 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -186,7 +186,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_14 = debug_msg.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.sh ver_test_2.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.sh ver_test_5.sh \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.sh \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.sh ver_test_10.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_matching_test.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.sh \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_4.sh @@ -202,7 +202,7 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ debug_msg_ndebug.err \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ undef_symbol.err ver_test_2.syms \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_4.syms ver_test_5.syms \ -@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.syms \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_7.syms ver_test_10.syms \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_matching_test.stdout \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_3.stdout \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_4.stdout @@ -2234,6 +2234,10 @@ uninstall-am: uninstall-info-am @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@ver_test_10.syms: ver_test_10.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -s $< >$@ 2>/dev/null +@GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_10.so: gcctestdir/ld ver_test_2.o ver_test_10.script +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_10.script ver_test_2.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_10.script b/gold/testsuite/ver_test_10.script new file mode 100644 index 0000000..fa9f175 --- /dev/null +++ b/gold/testsuite/ver_test_10.script @@ -0,0 +1,30 @@ +## ver_test_10.script -- 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. + +# Test having a version script with no version. + +{ + global: + t3_2; + local: + *; +}; diff --git a/gold/testsuite/ver_test_10.sh b/gold/testsuite/ver_test_10.sh new file mode 100755 index 0000000..68138a6 --- /dev/null +++ b/gold/testsuite/ver_test_10.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# ver_test_10.sh -- test global/local symbols + +# 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. + +# This file goes with ver_test_4.script and ver_test_5.script. The +# symbol t2_2 is not defined when ver_test_5.script is used. + +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_10.syms "GLOBAL.*t3_2" +check ver_test_10.syms "LOCAL.*t4_2" + +exit 0 -- cgit v1.1