From 5482377ddc6d4104399a7e2e49518a6e893dca65 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 29 Sep 2006 22:34:01 +0000 Subject: Clean up HAVE_MEMBER_TEMPLATE_SPECIFICATIONS somewhat. --- gold/symtab.cc | 66 ++++++++++------------------------------------------------ 1 file changed, 11 insertions(+), 55 deletions(-) (limited to 'gold/symtab.cc') diff --git a/gold/symtab.cc b/gold/symtab.cc index cc77b37..2251ea7 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -133,11 +133,10 @@ Symbol_table::lookup(const char* name, const char* version) const // version is the default version. Because this is unusual, we do // this the slow way, by converting back to an ELF symbol. -#ifdef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS - template void -Symbol_table::resolve(Sized_symbol* to, const Sized_symbol* from) +Symbol_table::resolve(Sized_symbol* to, const Sized_symbol* from + ACCEPT_SIZE_ENDIAN) { unsigned char buf[elfcpp::Elf_sizes::sym_size]; elfcpp::Sym_write esym(buf); @@ -150,40 +149,6 @@ Symbol_table::resolve(Sized_symbol* to, const Sized_symbol* from) Symbol_table::resolve(to, esym.sym(), from->object()); } -#else - -template -void -Symbol_table::resolve(Sized_symbol* to, const Sized_symbol* from, - bool big_endian) -{ - unsigned char buf[elfcpp::Elf_sizes::sym_size]; - if (big_endian) - { - elfcpp::Sym_write esym(buf); - // We don't bother to set the st_name field. - esym.put_st_value(from->value()); - esym.put_st_size(from->symsize()); - esym.put_st_info(from->binding(), from->type()); - esym.put_st_other(from->visibility(), from->other()); - esym.put_st_shndx(from->shnum()); - Symbol_table::resolve(to, esym.sym(), from->object()); - } - else - { - elfcpp::Sym_write esym(buf); - // We don't bother to set the st_name field. - esym.put_st_value(from->value()); - esym.put_st_size(from->symsize()); - esym.put_st_info(from->binding(), from->type()); - esym.put_st_other(from->visibility(), from->other()); - esym.put_st_shndx(from->shnum()); - Symbol_table::resolve(to, esym.sym(), from->object()); - } -} - -#endif - // Add one symbol from OBJECT to the symbol table. NAME is symbol // name and VERSION is the version; both are canonicalized. DEF is // whether this is the default version. @@ -236,12 +201,8 @@ Symbol_table::add_from_object(Sized_object* object, if (!ins.second) { // We already have an entry for NAME/VERSION. -#ifdef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS - ret = this->get_sized_symbol(ins.first->second); -#else - assert(size == this->get_size()); - ret = static_cast*>(ins.first->second); -#endif + ret = this->get_sized_symbol SELECT_SIZE_NAME (ins.first->second + SELECT_SIZE(size)); assert(ret != NULL); Symbol_table::resolve(ret, sym, object); @@ -258,13 +219,11 @@ Symbol_table::add_from_object(Sized_object* object, // This is the unfortunate case where we already have // entries for both NAME/VERSION and NAME/NULL. const Sized_symbol* sym2; -#ifdef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS - sym2 = this->get_sized_symbol(insdef.first->second); - Symbol_table::resolve(ret, sym2); -#else - sym2 = static_cast*>(insdef.first->second); - Symbol_table::resolve(ret, sym2, big_endian); -#endif + sym2 = this->get_sized_symbol SELECT_SIZE_NAME ( + insdef.first->second + SELECT_SIZE(size)); + Symbol_table::resolve SELECT_SIZE_ENDIAN_NAME ( + ret, sym2 SELECT_SIZE_ENDIAN(size, big_endian)); this->make_forwarder(insdef.first->second, ret); insdef.first->second = ret; } @@ -278,11 +237,8 @@ Symbol_table::add_from_object(Sized_object* object, { // We already have an entry for NAME/NULL. Make // NAME/VERSION point to it. -#ifdef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS - ret = this->get_sized_symbol(insdef.first->second); -#else - ret = static_cast*>(insdef.first->second); -#endif + ret = this->get_sized_symbol SELECT_SIZE_NAME (insdef.first->second + SELECT_SIZE(size)); Symbol_table::resolve(ret, sym, object); ins.first->second = ret; } -- cgit v1.1