diff options
author | Ian Lance Taylor <ian@airs.com> | 2008-05-06 22:24:26 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2008-05-06 22:24:26 +0000 |
commit | 8bdcdf2c7708338645fa9bc512a3cc0f2e438a80 (patch) | |
tree | 7d52c57dc3c214c17b5c6c2b0b916a3c73469e1c /gold/testsuite | |
parent | b5dd68e23111c3ca966a99118e032fc0cd817f9b (diff) | |
download | gdb-8bdcdf2c7708338645fa9bc512a3cc0f2e438a80.zip gdb-8bdcdf2c7708338645fa9bc512a3cc0f2e438a80.tar.gz gdb-8bdcdf2c7708338645fa9bc512a3cc0f2e438a80.tar.bz2 |
* symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
symbol, change it to have default visibility.
* testsuite/protected_1.cc: New file.
* testsuite/protected_2.cc: New file.
* testsuite/protected_3.cc: New file.
* testsuite/protected_main_1.cc: New file.
* testsuite/protected_main_2.cc: New file.
* testsuite/protected_main_3.cc: New file.
* testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
(protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
(protected_1_LDFLAGS, protected_1_LDADD): Define.
(protected_1.so): New target.
(protected_1_pic.o, protected_2_pic.o): New targets.
(protected_3_pic.o): New target.
(check_PROGRAMS): Add protected_2.
(protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
(protected_2_LDFLAGS, protected_2_LDADD): Define.
* testsuite/Makefile.in: Rebuild.
Diffstat (limited to 'gold/testsuite')
-rw-r--r-- | gold/testsuite/Makefile.am | 22 | ||||
-rw-r--r-- | gold/testsuite/Makefile.in | 55 | ||||
-rw-r--r-- | gold/testsuite/protected_1.cc | 33 | ||||
-rw-r--r-- | gold/testsuite/protected_2.cc | 31 | ||||
-rw-r--r-- | gold/testsuite/protected_3.cc | 33 | ||||
-rw-r--r-- | gold/testsuite/protected_main_1.cc | 36 | ||||
-rw-r--r-- | gold/testsuite/protected_main_2.cc | 29 | ||||
-rw-r--r-- | gold/testsuite/protected_main_3.cc | 31 |
8 files changed, 267 insertions, 3 deletions
diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 9cbf83c..9f8caeb 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -750,6 +750,28 @@ check_DATA += ver_test_7.syms ver_test_7.syms: ver_test_7.so $(TEST_READELF) -s $< >$@ 2>/dev/null +check_PROGRAMS += protected_1 +protected_1_SOURCES = \ + protected_main_1.cc protected_main_2.cc protected_main_3.cc +protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so +protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +protected_1_LDADD = protected_1.so + +protected_1.so: gcctestdir/ld protected_1_pic.o protected_2_pic.o protected_3_pic.o + $(CXXLINK) -Bgcctestdir/ -shared protected_1_pic.o protected_2_pic.o protected_3_pic.o +protected_1_pic.o: protected_1.cc + $(CXXCOMPILE) -c -fpic -o $@ $< +protected_2_pic.o: protected_2.cc + $(CXXCOMPILE) -c -fpic -o $@ $< +protected_3_pic.o: protected_3.cc + $(CXXCOMPILE) -c -fpic -o $@ $< + +check_PROGRAMS += protected_2 +protected_2_SOURCES = protected_main_1.cc protected_3.cc +protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so +protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +protected_2_LDADD = protected_1.so + 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 9a4596f..877249d 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -226,7 +226,8 @@ 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 script_test_1 \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_6 protected_1 \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_2 script_test_1 \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_2 justsyms \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ binary_test script_test_3 @GCC_FALSE@script_test_1_DEPENDENCIES = libgoldtest.a ../libgold.a \ @@ -263,7 +264,9 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/../config/depstand.m4 \ $(top_srcdir)/../config/gettext-sister.m4 \ $(top_srcdir)/../config/lead-dot.m4 \ - $(top_srcdir)/../config/nls.m4 $(top_srcdir)/../config/po.m4 \ + $(top_srcdir)/../config/nls.m4 \ + $(top_srcdir)/../config/override.m4 \ + $(top_srcdir)/../config/po.m4 \ $(top_srcdir)/../config/proginstall.m4 \ $(top_srcdir)/../config/progtest.m4 \ $(top_srcdir)/../bfd/warning.m4 $(top_srcdir)/configure.ac @@ -339,6 +342,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS) @GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_15 = ver_test$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_2$(EXEEXT) \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_6$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_1$(EXEEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_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) \ @@ -495,6 +500,18 @@ object_unittest_LDADD = $(LDADD) object_unittest_DEPENDENCIES = libgoldtest.a ../libgold.a \ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) +am__protected_1_SOURCES_DIST = protected_main_1.cc protected_main_2.cc \ + protected_main_3.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_protected_1_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_main_1.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_main_2.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_main_3.$(OBJEXT) +protected_1_OBJECTS = $(am_protected_1_OBJECTS) +am__protected_2_SOURCES_DIST = protected_main_1.cc protected_3.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@am_protected_2_OBJECTS = \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_main_1.$(OBJEXT) \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_3.$(OBJEXT) +protected_2_OBJECTS = $(am_protected_2_OBJECTS) am__script_test_1_SOURCES_DIST = script_test_1.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@am_script_test_1_OBJECTS = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ script_test_1.$(OBJEXT) @@ -736,6 +753,7 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \ flagstest_o_specialfile_and_compress_debug_sections.c \ $(initpri1_SOURCES) $(justsyms_SOURCES) many_sections_r_test.c \ $(many_sections_test_SOURCES) $(object_unittest_SOURCES) \ + $(protected_1_SOURCES) $(protected_2_SOURCES) \ $(script_test_1_SOURCES) $(script_test_2_SOURCES) \ script_test_3.c $(tls_pic_test_SOURCES) \ $(tls_shared_gd_to_ie_test_SOURCES) \ @@ -782,7 +800,9 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \ flagstest_o_specialfile_and_compress_debug_sections.c \ $(am__initpri1_SOURCES_DIST) $(am__justsyms_SOURCES_DIST) \ many_sections_r_test.c $(am__many_sections_test_SOURCES_DIST) \ - $(object_unittest_SOURCES) $(am__script_test_1_SOURCES_DIST) \ + $(object_unittest_SOURCES) $(am__protected_1_SOURCES_DIST) \ + $(am__protected_2_SOURCES_DIST) \ + $(am__script_test_1_SOURCES_DIST) \ $(am__script_test_2_SOURCES_DIST) script_test_3.c \ $(am__tls_pic_test_SOURCES_DIST) \ $(am__tls_shared_gd_to_ie_test_SOURCES_DIST) \ @@ -1262,6 +1282,16 @@ binary_unittest_SOURCES = binary_unittest.cc @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_6_DEPENDENCIES = gcctestdir/ld ver_test_2.so @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_6_LDFLAGS = -Bgcctestdir/ -Wl,-R,. @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_6_LDADD = ver_test_2.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 + +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_1_DEPENDENCIES = gcctestdir/ld protected_1.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_1_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_1_LDADD = protected_1.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_2_SOURCES = protected_main_1.cc protected_3.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_2_DEPENDENCIES = gcctestdir/ld protected_1.so +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_2_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_2_LDADD = protected_1.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 @@ -1420,6 +1450,12 @@ many_sections_test$(EXEEXT): $(many_sections_test_OBJECTS) $(many_sections_test_ object_unittest$(EXEEXT): $(object_unittest_OBJECTS) $(object_unittest_DEPENDENCIES) @rm -f object_unittest$(EXEEXT) $(CXXLINK) $(object_unittest_LDFLAGS) $(object_unittest_OBJECTS) $(object_unittest_LDADD) $(LIBS) +protected_1$(EXEEXT): $(protected_1_OBJECTS) $(protected_1_DEPENDENCIES) + @rm -f protected_1$(EXEEXT) + $(CXXLINK) $(protected_1_LDFLAGS) $(protected_1_OBJECTS) $(protected_1_LDADD) $(LIBS) +protected_2$(EXEEXT): $(protected_2_OBJECTS) $(protected_2_DEPENDENCIES) + @rm -f protected_2$(EXEEXT) + $(CXXLINK) $(protected_2_LDFLAGS) $(protected_2_OBJECTS) $(protected_2_LDADD) $(LIBS) script_test_1$(EXEEXT): $(script_test_1_OBJECTS) $(script_test_1_DEPENDENCIES) @rm -f script_test_1$(EXEEXT) $(CXXLINK) $(script_test_1_LDFLAGS) $(script_test_1_OBJECTS) $(script_test_1_LDADD) $(LIBS) @@ -1572,6 +1608,10 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/many_sections_r_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/many_sections_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/object_unittest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protected_3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protected_main_1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protected_main_2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protected_main_3.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script_test_1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script_test_2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script_test_2a.Po@am__quote@ @@ -2123,6 +2163,15 @@ uninstall-am: uninstall-info-am @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< @GCC_TRUE@@NATIVE_LINKER_TRUE@ver_test_7.syms: ver_test_7.so @GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_READELF) -s $< >$@ 2>/dev/null + +@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 +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_1_pic.o: protected_1.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_2_pic.o: protected_2.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< +@GCC_TRUE@@NATIVE_LINKER_TRUE@protected_3_pic.o: protected_3.cc +@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -fpic -o $@ $< @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 $(srcdir)/justsyms.t diff --git a/gold/testsuite/protected_1.cc b/gold/testsuite/protected_1.cc new file mode 100644 index 0000000..9183312 --- /dev/null +++ b/gold/testsuite/protected_1.cc @@ -0,0 +1,33 @@ +// protected_1.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. + +// The function f1 is protected, which means that other callers in the +// same shared library will call this version. + +int +f1() __attribute__ ((__visibility__ ("protected"))); + +int +f1() +{ + return 1; +} diff --git a/gold/testsuite/protected_2.cc b/gold/testsuite/protected_2.cc new file mode 100644 index 0000000..19d8276 --- /dev/null +++ b/gold/testsuite/protected_2.cc @@ -0,0 +1,31 @@ +// protected_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. + +// This should call the protected version of f1. + +extern int f1(); + +bool +t1() +{ + return f1() == 1; +} diff --git a/gold/testsuite/protected_3.cc b/gold/testsuite/protected_3.cc new file mode 100644 index 0000000..8a27a2a --- /dev/null +++ b/gold/testsuite/protected_3.cc @@ -0,0 +1,33 @@ +// protected_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. + +// This will also call the protected version of f1. In some versions +// of the test this will be overridden by a version in the main +// program. + +extern int f1(); + +bool +t2() +{ + return f1() == 1; +} diff --git a/gold/testsuite/protected_main_1.cc b/gold/testsuite/protected_main_1.cc new file mode 100644 index 0000000..cc387a4 --- /dev/null +++ b/gold/testsuite/protected_main_1.cc @@ -0,0 +1,36 @@ +// protected_main_1.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> + +// This function in the shared library will call the protected version +// of f1 in the shared library. + +extern bool t1(); +extern bool t2(); + +int +main() +{ + assert(t1()); + assert(t2()); +} diff --git a/gold/testsuite/protected_main_2.cc b/gold/testsuite/protected_main_2.cc new file mode 100644 index 0000000..6960322 --- /dev/null +++ b/gold/testsuite/protected_main_2.cc @@ -0,0 +1,29 @@ +// protected_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. + +// This version of f1 will not be called by the shared library code. + +int +f1() +{ + return 2; +} diff --git a/gold/testsuite/protected_main_3.cc b/gold/testsuite/protected_main_3.cc new file mode 100644 index 0000000..f356f3d --- /dev/null +++ b/gold/testsuite/protected_main_3.cc @@ -0,0 +1,31 @@ +// protected_main_3.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. + +// This should call the unprotected version of f1. + +extern int f1(); + +bool +t2() +{ + return f1() == 2; +} |