From 75517b77b595b05bd37bf337c1fb23557efbf4bc Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Thu, 8 May 2008 18:44:33 +0000 Subject: [PATCH] * symtab.c (Symbol::init_base_output_data): Add version parameter. Change all callers. (Symbol::init_base_output_segment): Likewise. (Symbol::init_base_constant): Likewise. (Symbol::init_base_undefined): Likewise. (Sized_symbol::init_output_data): Likewise. (Sized_symbol::init_output_segment): Likewise. (Sized_symbol::init_constant): Likewise. (Sized_symbol::init_undefined): Likewise. (Symbol_table::do_define_in_output_data): If the new symbol has a version, mark it as the default. (Symbol_table::do_define_in_output_segment): Likewise. (Symbol_table::do_define_as_constant): Likewise. * symtab.h (class Symbol): Update declarations. (class Sized_symbol): Likewise. * resolve.cc (Symbol::override_version): New function. (Symbol::override_base: Call override_version. (Symbol::override_base_with_special): Likewise. * testsuite/ver_script_8.script: New file. * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8. (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define. (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define. (ver_test_8_1.so, ver_test_8_2.so): New targets. --- gold/ChangeLog | 26 +++++++++ gold/resolve.cc | 43 ++++++++++---- gold/symtab.cc | 96 +++++++++++++++++--------------- gold/symtab.h | 50 ++++++++++------- gold/testsuite/Makefile.am | 10 ++++ gold/testsuite/Makefile.in | 31 +++++++++-- gold/testsuite/ver_test_8.script | 26 +++++++++ 7 files changed, 201 insertions(+), 81 deletions(-) create mode 100644 gold/testsuite/ver_test_8.script diff --git a/gold/ChangeLog b/gold/ChangeLog index 49acc33792..9a95d327fd 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,29 @@ +2008-05-08 Ian Lance Taylor + + * symtab.c (Symbol::init_base_output_data): Add version + parameter. Change all callers. + (Symbol::init_base_output_segment): Likewise. + (Symbol::init_base_constant): Likewise. + (Symbol::init_base_undefined): Likewise. + (Sized_symbol::init_output_data): Likewise. + (Sized_symbol::init_output_segment): Likewise. + (Sized_symbol::init_constant): Likewise. + (Sized_symbol::init_undefined): Likewise. + (Symbol_table::do_define_in_output_data): If the new symbol has a + version, mark it as the default. + (Symbol_table::do_define_in_output_segment): Likewise. + (Symbol_table::do_define_as_constant): Likewise. + * symtab.h (class Symbol): Update declarations. + (class Sized_symbol): Likewise. + * resolve.cc (Symbol::override_version): New function. + (Symbol::override_base: Call override_version. + (Symbol::override_base_with_special): Likewise. + * testsuite/ver_script_8.script: New file. + * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8. + (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define. + (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define. + (ver_test_8_1.so, ver_test_8_2.so): New targets. + 2008-05-06 Ian Lance Taylor PR 6049 diff --git a/gold/resolve.cc b/gold/resolve.cc index 291bca6967..d564aed19e 100644 --- a/gold/resolve.cc +++ b/gold/resolve.cc @@ -32,6 +32,36 @@ namespace gold // Symbol methods used in this file. +// This symbol is being overridden by another symbol whose version is +// VERSION. Update the VERSION_ field accordingly. + +inline void +Symbol::override_version(const char* version) +{ + if (version == NULL) + { + // This is the case where this symbol is NAME/VERSION, and the + // version was not marked as hidden. That makes it the default + // version, so we create NAME/NULL. Later we see another symbol + // NAME/NULL, and that symbol is overriding this one. In this + // case, since NAME/VERSION is the default, we make NAME/NULL + // override NAME/VERSION as well. They are already the same + // Symbol structure. Setting the VERSION_ field to NULL ensures + // that it will be output with the correct, empty, version. + this->version_ = version; + } + else + { + // This is the case where this symbol is NAME/VERSION_ONE, and + // now we see NAME/VERSION_TWO, and NAME/VERSION_TWO is + // overriding NAME. If VERSION_ONE and VERSION_TWO are + // different, then this can only happen when VERSION_ONE is NULL + // and VERSION_TWO is not hidden. + gold_assert(this->version_ == version || this->version_ == NULL); + this->version_ = version; + } +} + // Override the fields in Symbol. template @@ -42,11 +72,7 @@ Symbol::override_base(const elfcpp::Sym& sym, { gold_assert(this->source_ == FROM_OBJECT); this->u_.from_object.object = object; - if (version != NULL && this->version() != version) - { - gold_assert(this->version() == NULL); - this->version_ = version; - } + this->override_version(version); this->u_.from_object.shndx = st_shndx; this->is_ordinary_shndx_ = is_ordinary; this->type_ = sym.get_st_type(); @@ -673,12 +699,7 @@ Symbol::override_base_with_special(const Symbol* from) break; } - if (from->version_ != NULL && this->version_ != from->version_) - { - gold_assert(this->version_ == NULL); - this->version_ = from->version_; - } - + this->override_version(from->version_); this->type_ = from->type_; this->binding_ = from->binding_; this->visibility_ = from->visibility_; diff --git a/gold/symtab.cc b/gold/symtab.cc index 4d463e2156..d5718b87ea 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -123,12 +123,12 @@ Symbol::init_base_object(const char* name, const char* version, Object* object, // in an Output_data. void -Symbol::init_base_output_data(const char* name, Output_data* od, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis, - bool offset_is_from_end) +Symbol::init_base_output_data(const char* name, const char* version, + Output_data* od, elfcpp::STT type, + elfcpp::STB binding, elfcpp::STV visibility, + unsigned char nonvis, bool offset_is_from_end) { - this->init_fields(name, NULL, type, binding, visibility, nonvis); + this->init_fields(name, version, type, binding, visibility, nonvis); this->u_.in_output_data.output_data = od; this->u_.in_output_data.offset_is_from_end = offset_is_from_end; this->source_ = IN_OUTPUT_DATA; @@ -139,12 +139,13 @@ Symbol::init_base_output_data(const char* name, Output_data* od, // in an Output_segment. void -Symbol::init_base_output_segment(const char* name, Output_segment* os, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis, +Symbol::init_base_output_segment(const char* name, const char* version, + Output_segment* os, elfcpp::STT type, + elfcpp::STB binding, elfcpp::STV visibility, + unsigned char nonvis, Segment_offset_base offset_base) { - this->init_fields(name, NULL, type, binding, visibility, nonvis); + this->init_fields(name, version, type, binding, visibility, nonvis); this->u_.in_output_segment.output_segment = os; this->u_.in_output_segment.offset_base = offset_base; this->source_ = IN_OUTPUT_SEGMENT; @@ -155,11 +156,11 @@ Symbol::init_base_output_segment(const char* name, Output_segment* os, // as a constant. void -Symbol::init_base_constant(const char* name, elfcpp::STT type, - elfcpp::STB binding, elfcpp::STV visibility, - unsigned char nonvis) +Symbol::init_base_constant(const char* name, const char* version, + elfcpp::STT type, elfcpp::STB binding, + elfcpp::STV visibility, unsigned char nonvis) { - this->init_fields(name, NULL, type, binding, visibility, nonvis); + this->init_fields(name, version, type, binding, visibility, nonvis); this->source_ = IS_CONSTANT; this->in_reg_ = true; } @@ -168,11 +169,11 @@ Symbol::init_base_constant(const char* name, elfcpp::STT type, // symbol. void -Symbol::init_base_undefined(const char* name, elfcpp::STT type, - elfcpp::STB binding, elfcpp::STV visibility, - unsigned char nonvis) +Symbol::init_base_undefined(const char* name, const char* version, + elfcpp::STT type, elfcpp::STB binding, + elfcpp::STV visibility, unsigned char nonvis) { - this->init_fields(name, NULL, type, binding, visibility, nonvis); + this->init_fields(name, version, type, binding, visibility, nonvis); this->source_ = IS_UNDEFINED; this->in_reg_ = true; } @@ -208,15 +209,16 @@ Sized_symbol::init_object(const char* name, const char* version, template void -Sized_symbol::init_output_data(const char* name, Output_data* od, - Value_type value, Size_type symsize, - elfcpp::STT type, elfcpp::STB binding, +Sized_symbol::init_output_data(const char* name, const char* version, + Output_data* od, Value_type value, + Size_type symsize, elfcpp::STT type, + elfcpp::STB binding, elfcpp::STV visibility, unsigned char nonvis, bool offset_is_from_end) { - this->init_base_output_data(name, od, type, binding, visibility, nonvis, - offset_is_from_end); + this->init_base_output_data(name, version, od, type, binding, visibility, + nonvis, offset_is_from_end); this->value_ = value; this->symsize_ = symsize; } @@ -226,15 +228,16 @@ Sized_symbol::init_output_data(const char* name, Output_data* od, template void -Sized_symbol::init_output_segment(const char* name, Output_segment* os, - Value_type value, Size_type symsize, - elfcpp::STT type, elfcpp::STB binding, +Sized_symbol::init_output_segment(const char* name, const char* version, + Output_segment* os, Value_type value, + Size_type symsize, elfcpp::STT type, + elfcpp::STB binding, elfcpp::STV visibility, unsigned char nonvis, Segment_offset_base offset_base) { - this->init_base_output_segment(name, os, type, binding, visibility, nonvis, - offset_base); + this->init_base_output_segment(name, version, os, type, binding, visibility, + nonvis, offset_base); this->value_ = value; this->symsize_ = symsize; } @@ -244,12 +247,12 @@ Sized_symbol::init_output_segment(const char* name, Output_segment* os, template void -Sized_symbol::init_constant(const char* name, Value_type value, - Size_type symsize, elfcpp::STT type, - elfcpp::STB binding, elfcpp::STV visibility, - unsigned char nonvis) +Sized_symbol::init_constant(const char* name, const char* version, + Value_type value, Size_type symsize, + elfcpp::STT type, elfcpp::STB binding, + elfcpp::STV visibility, unsigned char nonvis) { - this->init_base_constant(name, type, binding, visibility, nonvis); + this->init_base_constant(name, version, type, binding, visibility, nonvis); this->value_ = value; this->symsize_ = symsize; } @@ -258,11 +261,11 @@ Sized_symbol::init_constant(const char* name, Value_type value, template void -Sized_symbol::init_undefined(const char* name, elfcpp::STT type, - elfcpp::STB binding, elfcpp::STV visibility, - unsigned char nonvis) +Sized_symbol::init_undefined(const char* name, const char* version, + elfcpp::STT type, elfcpp::STB binding, + elfcpp::STV visibility, unsigned char nonvis) { - this->init_base_undefined(name, type, binding, visibility, nonvis); + this->init_base_undefined(name, version, type, binding, visibility, nonvis); this->value_ = 0; this->symsize_ = 0; } @@ -1371,15 +1374,16 @@ Symbol_table::do_define_in_output_data( if (sym == NULL) return NULL; - gold_assert(version == NULL || oldsym != NULL); - sym->init_output_data(name, od, value, symsize, type, binding, visibility, - nonvis, offset_is_from_end); + sym->init_output_data(name, version, od, value, symsize, type, binding, + visibility, nonvis, offset_is_from_end); if (oldsym == NULL) { if (binding == elfcpp::STB_LOCAL || this->version_script_.symbol_is_local(name)) this->force_local(sym); + else if (version != NULL) + sym->set_is_default(); return sym; } @@ -1471,8 +1475,7 @@ Symbol_table::do_define_in_output_segment( if (sym == NULL) return NULL; - gold_assert(version == NULL || oldsym != NULL); - sym->init_output_segment(name, os, value, symsize, type, binding, + sym->init_output_segment(name, version, os, value, symsize, type, binding, visibility, nonvis, offset_base); if (oldsym == NULL) @@ -1480,6 +1483,8 @@ Symbol_table::do_define_in_output_segment( if (binding == elfcpp::STB_LOCAL || this->version_script_.symbol_is_local(name)) this->force_local(sym); + else if (version != NULL) + sym->set_is_default(); return sym; } @@ -1571,8 +1576,8 @@ Symbol_table::do_define_as_constant( if (sym == NULL) return NULL; - gold_assert(version == NULL || version == name || oldsym != NULL); - sym->init_constant(name, value, symsize, type, binding, visibility, nonvis); + sym->init_constant(name, version, value, symsize, type, binding, visibility, + nonvis); if (oldsym == NULL) { @@ -1584,6 +1589,9 @@ Symbol_table::do_define_as_constant( && (binding == elfcpp::STB_LOCAL || this->version_script_.symbol_is_local(name))) this->force_local(sym); + else if (version != NULL + && (name != version || value != 0)) + sym->set_is_default(); return sym; } @@ -1775,7 +1783,7 @@ Symbol_table::do_add_undefined_symbols_from_command_line() gold_assert(oldsym == NULL); - sym->init_undefined(name, elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL, + sym->init_undefined(name, version, elfcpp::STT_NOTYPE, elfcpp::STB_GLOBAL, elfcpp::STV_DEFAULT, 0); ++this->saw_undefined_; } diff --git a/gold/symtab.h b/gold/symtab.h index b58909be9c..d4ca787495 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -668,26 +668,29 @@ class Symbol // Initialize fields for an Output_data. void - init_base_output_data(const char* name, Output_data*, elfcpp::STT, - elfcpp::STB, elfcpp::STV, unsigned char nonvis, - bool offset_is_from_end); + init_base_output_data(const char* name, const char* version, Output_data*, + elfcpp::STT, elfcpp::STB, elfcpp::STV, + unsigned char nonvis, bool offset_is_from_end); // Initialize fields for an Output_segment. void - init_base_output_segment(const char* name, Output_segment* os, - elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis, + init_base_output_segment(const char* name, const char* version, + Output_segment* os, elfcpp::STT type, + elfcpp::STB binding, elfcpp::STV visibility, + unsigned char nonvis, Segment_offset_base offset_base); // Initialize fields for a constant. void - init_base_constant(const char* name, elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis); + init_base_constant(const char* name, const char* version, elfcpp::STT type, + elfcpp::STB binding, elfcpp::STV visibility, + unsigned char nonvis); // Initialize fields for an undefined symbol. void - init_base_undefined(const char* name, elfcpp::STT type, elfcpp::STB binding, - elfcpp::STV visibility, unsigned char nonvis); + init_base_undefined(const char* name, const char* version, elfcpp::STT type, + elfcpp::STB binding, elfcpp::STV visibility, + unsigned char nonvis); // Override existing symbol. template @@ -699,6 +702,10 @@ class Symbol void override_base_with_special(const Symbol* from); + // Override symbol version. + void + override_version(const char* version); + // Allocate a common symbol by giving it a location in the output // file. void @@ -849,25 +856,28 @@ class Sized_symbol : public Symbol // Initialize fields for an Output_data. void - init_output_data(const char* name, Output_data*, Value_type value, - Size_type symsize, elfcpp::STT, elfcpp::STB, elfcpp::STV, - unsigned char nonvis, bool offset_is_from_end); + init_output_data(const char* name, const char* version, Output_data*, + Value_type value, Size_type symsize, elfcpp::STT, + elfcpp::STB, elfcpp::STV, unsigned char nonvis, + bool offset_is_from_end); // Initialize fields for an Output_segment. void - init_output_segment(const char* name, Output_segment*, Value_type value, - Size_type symsize, elfcpp::STT, elfcpp::STB, elfcpp::STV, - unsigned char nonvis, Segment_offset_base offset_base); + init_output_segment(const char* name, const char* version, Output_segment*, + Value_type value, Size_type symsize, elfcpp::STT, + elfcpp::STB, elfcpp::STV, unsigned char nonvis, + Segment_offset_base offset_base); // Initialize fields for a constant. void - init_constant(const char* name, Value_type value, Size_type symsize, - elfcpp::STT, elfcpp::STB, elfcpp::STV, unsigned char nonvis); + init_constant(const char* name, const char* version, Value_type value, + Size_type symsize, elfcpp::STT, elfcpp::STB, elfcpp::STV, + unsigned char nonvis); // Initialize fields for an undefined symbol. void - init_undefined(const char* name, elfcpp::STT, elfcpp::STB, elfcpp::STV, - unsigned char nonvis); + init_undefined(const char* name, const char* version, elfcpp::STT, + elfcpp::STB, elfcpp::STV, unsigned char nonvis); // Override existing symbol. template diff --git a/gold/testsuite/Makefile.am b/gold/testsuite/Makefile.am index 9f8caeb977..75c9c92eb5 100644 --- a/gold/testsuite/Makefile.am +++ b/gold/testsuite/Makefile.am @@ -750,6 +750,16 @@ check_DATA += ver_test_7.syms ver_test_7.syms: ver_test_7.so $(TEST_READELF) -s $< >$@ 2>/dev/null +check_PROGRAMS += ver_test_8 +ver_test_8_SOURCES = two_file_test_main.cc +ver_test_8_DEPENDENCIES = gcctestdir/ld ver_test_8_1.so ver_test_8_2.so +ver_test_8_LDFLAGS = -Bgcctestdir/ -Wl,-R,. +ver_test_8_LDADD = ver_test_8_1.so ver_test_8_2.so +ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld + $(CXXLINK) -Bgcctestdir/ -shared two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so +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 += 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 877249d629..5231c983ea 100644 --- a/gold/testsuite/Makefile.in +++ b/gold/testsuite/Makefile.in @@ -226,10 +226,11 @@ 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 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_TRUE@@NATIVE_LINKER_TRUE@ ver_test_6 ver_test_8 \ +@GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_1 protected_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@ script_test_3 @GCC_FALSE@script_test_1_DEPENDENCIES = libgoldtest.a ../libgold.a \ @GCC_FALSE@ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \ @GCC_FALSE@ $(am__DEPENDENCIES_1) @@ -342,6 +343,7 @@ 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@ ver_test_8$(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) \ @@ -710,6 +712,10 @@ am__ver_test_6_SOURCES_DIST = ver_test_6.c @GCC_TRUE@@NATIVE_LINKER_TRUE@am_ver_test_6_OBJECTS = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ ver_test_6.$(OBJEXT) ver_test_6_OBJECTS = $(am_ver_test_6_OBJECTS) +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__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) @@ -781,8 +787,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) \ - $(weak_alias_test_SOURCES) $(weak_test_SOURCES) \ - $(weak_undef_nonpic_test_SOURCES) $(weak_undef_test_SOURCES) + $(ver_test_8_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) \ @@ -834,6 +841,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__weak_alias_test_SOURCES_DIST) \ $(am__weak_test_SOURCES_DIST) \ $(am__weak_undef_nonpic_test_SOURCES_DIST) \ @@ -1282,6 +1290,10 @@ 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@ver_test_8_SOURCES = two_file_test_main.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@protected_1_SOURCES = \ @GCC_TRUE@@NATIVE_LINKER_TRUE@ protected_main_1.cc protected_main_2.cc protected_main_3.cc @@ -1570,6 +1582,9 @@ ver_test_2$(EXEEXT): $(ver_test_2_OBJECTS) $(ver_test_2_DEPENDENCIES) ver_test_6$(EXEEXT): $(ver_test_6_OBJECTS) $(ver_test_6_DEPENDENCIES) @rm -f ver_test_6$(EXEEXT) $(LINK) $(ver_test_6_LDFLAGS) $(ver_test_6_OBJECTS) $(ver_test_6_LDADD) $(LIBS) +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) 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) @@ -2163,6 +2178,10 @@ 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@ver_test_8_1.so: two_file_test_1_pic.o two_file_test_1b_pic.o ver_test_8_2.so gcctestdir/ld +@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@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_8.script b/gold/testsuite/ver_test_8.script new file mode 100644 index 0000000000..b5bfc3f019 --- /dev/null +++ b/gold/testsuite/ver_test_8.script @@ -0,0 +1,26 @@ +## ver_test_8.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. + +VER_TEST_8 { + global: + *; +};