diff options
author | Ian Lance Taylor <ian@airs.com> | 2008-03-27 06:11:57 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2008-03-27 06:11:57 +0000 |
commit | 5871526fc2745a477d3dcd5807934ce410568ffa (patch) | |
tree | b35de04252f4cb7921faf74885fb7b1da3b6d9ec /gold/testsuite | |
parent | 42972f502e79cd88a7f011ead7b75dab5222b7c9 (diff) | |
download | gdb-5871526fc2745a477d3dcd5807934ce410568ffa.zip gdb-5871526fc2745a477d3dcd5807934ce410568ffa.tar.gz gdb-5871526fc2745a477d3dcd5807934ce410568ffa.tar.bz2 |
* symtab.cc (Symbol_table::add_from_relobj): Don't set the version
of an undefined symbol from a version script.
* testsuite/Makefile.am (ver_test_5.so): New target.
(ver_test_5.o): New target.
(check_SCRIPTS): Add ver_test_5.sh.
(check_DATA): Add ver_test_5.syms.
(ver_test_5.syms): New target.
* testsuite/ver_test_5.cc: New file.
* testsuite/ver_test_5.script: New file.
* testsuite/ver_test_5.sh: New file.
* Makefile.in, testsuite/Makefile.in: Rebuild.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 13 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 15 | ||||
-rw-r--r-- | gold/testsuite/ver_test_5.cc | 29 | ||||
-rw-r--r-- | gold/testsuite/ver_test_5.script | 31 | ||||
-rwxr-xr-x | gold/testsuite/ver_test_5.sh | 44 |
5 files changed, 130 insertions, 2 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 191618a..e529629 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -549,6 +549,19 @@ ver_test_2.syms: ver_test_2 endif +if READELF + +ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld + $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so +ver_test_5.o: ver_test_5.cc + $(CXXCOMPILE) -c -fpic -o $@ $< +check_SCRIPTS += ver_test_5.sh +check_DATA += ver_test_5.syms +ver_test_5.syms: ver_test_5.so + 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 bf38504..cd81bcd 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -178,8 +178,12 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \ @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_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@am__append_11 = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ ver_test_2.sh \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ ver_test_5.sh +@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@am__append_12 = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ ver_test_2.syms \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ ver_test_5.syms @GCC_FALSE@script_test_1_DEPENDENCIES = libgoldtest.a ../libgold.a \ @GCC_FALSE@ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ @GCC_FALSE@ $(am__DEPENDENCIES_1) @@ -1767,6 +1771,13 @@ uninstall-am: uninstall-info-am @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@@READELF_TRUE@ver_test_5.so: ver_test_5.o $(srcdir)/ver_test_5.script ver_test_4.so gcctestdir/ld +@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ $(CXXLINK) -Bgcctestdir/ -shared -Wl,--version-script,$(srcdir)/ver_test_5.script ver_test_5.o ver_test_4.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ver_test_5.o: ver_test_5.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@@READELF_TRUE@ver_test_5.syms: ver_test_5.so +@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_5.cc b/gold/testsuite/ver_test_5.cc new file mode 100644 index 0000000..cffeae6 --- /dev/null +++ b/gold/testsuite/ver_test_5.cc @@ -0,0 +1,29 @@ +// ver_test_5.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" + +int +t3_2() +{ + return t2_2(); +} diff --git a/gold/testsuite/ver_test_5.script b/gold/testsuite/ver_test_5.script new file mode 100644 index 0000000..028cdd6 --- /dev/null +++ b/gold/testsuite/ver_test_5.script @@ -0,0 +1,31 @@ +## ver_test_5.script -- 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. + +# This tests that we don't break when assigning a version to an +# undefined symbol. This is used with ver_test_2.cc, which defines +# t3_2 but only refers to t2_2. + +VER5 { + global: + t2_2; + t3_2; +}; diff --git a/gold/testsuite/ver_test_5.sh b/gold/testsuite/ver_test_5.sh new file mode 100755 index 0000000..2eacb45 --- /dev/null +++ b/gold/testsuite/ver_test_5.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +# ver_test_5.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_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_5.syms "t3_2@@VER5" +check ver_test_5.syms "t2_2@VER2" + +exit 0 |