diff options
-rw-r--r-- | gold/common.cc | 21 | ||||
-rw-r--r-- | gold/config.in | 3 | ||||
-rwxr-xr-x | gold/configure | 53 | ||||
-rw-r--r-- | gold/configure.ac | 13 | ||||
-rw-r--r-- | gold/dynobj.cc | 62 | ||||
-rw-r--r-- | gold/dynobj.h | 15 | ||||
-rw-r--r-- | gold/gold.h | 56 | ||||
-rw-r--r-- | gold/i386.cc | 4 | ||||
-rw-r--r-- | gold/layout.cc | 49 | ||||
-rw-r--r-- | gold/layout.h | 3 | ||||
-rw-r--r-- | gold/object.h | 10 | ||||
-rw-r--r-- | gold/output.cc | 26 | ||||
-rw-r--r-- | gold/output.h | 6 | ||||
-rw-r--r-- | gold/resolve.cc | 18 | ||||
-rw-r--r-- | gold/symtab.cc | 68 | ||||
-rw-r--r-- | gold/symtab.h | 16 | ||||
-rw-r--r-- | gold/x86_64.cc | 4 |
17 files changed, 110 insertions, 317 deletions
diff --git a/gold/common.cc b/gold/common.cc index e6f3910..286a112 100644 --- a/gold/common.cc +++ b/gold/common.cc @@ -90,12 +90,8 @@ Sort_commons<size>::operator()(const Symbol* pa, const Symbol* pb) const return true; const Symbol_table* symtab = this->symtab_; - const Sized_symbol<size>* psa; - psa = symtab->get_sized_symbol SELECT_SIZE_NAME(size) (pa - SELECT_SIZE(size)); - const Sized_symbol<size>* psb; - psb = symtab->get_sized_symbol SELECT_SIZE_NAME(size) (pb - SELECT_SIZE(size)); + const Sized_symbol<size>* psa = symtab->get_sized_symbol<size>(pa); + const Sized_symbol<size>* psb = symtab->get_sized_symbol<size>(pb); typename Sized_symbol<size>::Size_type sa = psa->symsize(); typename Sized_symbol<size>::Size_type sb = psb->symsize(); @@ -171,10 +167,7 @@ Symbol_table::do_allocate_commons(const General_options&, else { any = true; - Sized_symbol<size>* ssym; - ssym = this->get_sized_symbol SELECT_SIZE_NAME(size) ( - sym - SELECT_SIZE(size)); + Sized_symbol<size>* ssym = this->get_sized_symbol<size>(sym); if (ssym->value() > addralign) addralign = ssym->value(); } @@ -205,15 +198,9 @@ Symbol_table::do_allocate_commons(const General_options&, Symbol* sym = *p; if (sym == NULL) break; - - Sized_symbol<size>* ssym; - ssym = this->get_sized_symbol SELECT_SIZE_NAME(size) (sym - SELECT_SIZE(size)); - + Sized_symbol<size>* ssym = this->get_sized_symbol<size>(sym); off = align_address(off, ssym->value()); - ssym->allocate_common(poc, off); - off += ssym->symsize(); } diff --git a/gold/config.in b/gold/config.in index 4dc6141..81da6aa 100644 --- a/gold/config.in +++ b/gold/config.in @@ -28,9 +28,6 @@ /* Define to 1 if you have the `mallinfo' function. */ #undef HAVE_MALLINFO -/* Whether the C++ compiler can call a template member with no arguments */ -#undef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS - /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H diff --git a/gold/configure b/gold/configure index d2006a3..2caa368 100755 --- a/gold/configure +++ b/gold/configure @@ -6223,59 +6223,6 @@ fi done -echo "$as_me:$LINENO: checking template member calls" >&5 -echo $ECHO_N "checking template member calls... $ECHO_C" >&6 -if test "${gold_cv_c_membertemplates+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF - -class c { public: template<int i> void fn(); }; -template<int i> void foo(c cv) { cv.fn<i>(); } -template void foo<1>(c cv); -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_cxx_werror_flag" - || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - gold_cv_c_membertemplates=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -gold_cv_c_membertemplates=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $gold_cv_c_membertemplates" >&5 -echo "${ECHO_T}$gold_cv_c_membertemplates" >&6 - -if test "$gold_cv_c_membertemplates" = "yes"; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_MEMBER_TEMPLATE_SPECIFICATIONS -_ACEOF - -fi - ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' diff --git a/gold/configure.ac b/gold/configure.ac index c719e78..45e65ab 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -242,19 +242,6 @@ AC_CHECK_HEADERS(tr1/unordered_set tr1/unordered_map) AC_CHECK_HEADERS(ext/hash_map ext/hash_set) AC_CHECK_FUNCS(mallinfo) -dnl Test whether the compiler can specify a member templates to call. -AC_CACHE_CHECK([template member calls], [gold_cv_c_membertemplates], -[AC_COMPILE_IFELSE([ -class c { public: template<int i> void fn(); }; -template<int i> void foo(c cv) { cv.fn<i>(); } -template void foo<1>(c cv);], -[gold_cv_c_membertemplates=yes], [gold_cv_c_membertemplates=no])]) - -if test "$gold_cv_c_membertemplates" = "yes"; then - AC_DEFINE(HAVE_MEMBER_TEMPLATE_SPECIFICATIONS, [], - [Whether the C++ compiler can call a template member with no arguments]) -fi - AC_LANG_POP(C++) AM_MAINTAINER_MODE diff --git a/gold/dynobj.cc b/gold/dynobj.cc index bfcc78a..6c0a4b2 100644 --- a/gold/dynobj.cc +++ b/gold/dynobj.cc @@ -1110,8 +1110,7 @@ Dynobj::sized_create_gnu_hash_table( template<int size, bool big_endian> unsigned char* -Verdef::write(const Stringpool* dynpool, bool is_last, unsigned char* pb - ACCEPT_SIZE_ENDIAN) const +Verdef::write(const Stringpool* dynpool, bool is_last, unsigned char* pb) const { const int verdef_size = elfcpp::Elf_sizes<size>::verdef_size; const int verdaux_size = elfcpp::Elf_sizes<size>::verdaux_size; @@ -1190,7 +1189,7 @@ Verneed::finalize(unsigned int index) template<int size, bool big_endian> unsigned char* Verneed::write(const Stringpool* dynpool, bool is_last, - unsigned char* pb ACCEPT_SIZE_ENDIAN) const + unsigned char* pb) const { const int verneed_size = elfcpp::Elf_sizes<size>::verneed_size; const int vernaux_size = elfcpp::Elf_sizes<size>::vernaux_size; @@ -1512,8 +1511,7 @@ Versions::symbol_section_contents(const Symbol_table* symtab, unsigned int local_symcount, const std::vector<Symbol*>& syms, unsigned char** pp, - unsigned int* psize - ACCEPT_SIZE_ENDIAN) const + unsigned int* psize) const { gold_assert(this->is_finalized_); @@ -1553,8 +1551,7 @@ template<int size, bool big_endian> void Versions::def_section_contents(const Stringpool* dynpool, unsigned char** pp, unsigned int* psize, - unsigned int* pentries - ACCEPT_SIZE_ENDIAN) const + unsigned int* pentries) const { gold_assert(this->is_finalized_); gold_assert(!this->defs_.empty()); @@ -1579,9 +1576,9 @@ Versions::def_section_contents(const Stringpool* dynpool, for (p = this->defs_.begin(), i = 0; p != this->defs_.end(); ++p, ++i) - pb = (*p)->write SELECT_SIZE_ENDIAN_NAME(size, big_endian)( - dynpool, i + 1 >= this->defs_.size(), pb - SELECT_SIZE_ENDIAN(size, big_endian)); + pb = (*p)->write<size, big_endian>(dynpool, + i + 1 >= this->defs_.size(), + pb); gold_assert(static_cast<unsigned int>(pb - pbuf) == sz); @@ -1597,8 +1594,7 @@ template<int size, bool big_endian> void Versions::need_section_contents(const Stringpool* dynpool, unsigned char** pp, unsigned int *psize, - unsigned int *pentries - ACCEPT_SIZE_ENDIAN) const + unsigned int *pentries) const { gold_assert(this->is_finalized_); gold_assert(!this->needs_.empty()); @@ -1623,9 +1619,9 @@ Versions::need_section_contents(const Stringpool* dynpool, for (p = this->needs_.begin(), i = 0; p != this->needs_.end(); ++p, ++i) - pb = (*p)->write SELECT_SIZE_ENDIAN_NAME(size, big_endian)( - dynpool, i + 1 >= this->needs_.size(), pb - SELECT_SIZE_ENDIAN(size, big_endian)); + pb = (*p)->write<size, big_endian>(dynpool, + i + 1 >= this->needs_.size(), + pb); gold_assert(static_cast<unsigned int>(pb - pbuf) == sz); @@ -1666,8 +1662,7 @@ Versions::symbol_section_contents<32, false>( unsigned int, const std::vector<Symbol*>&, unsigned char**, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_32_BIG @@ -1679,8 +1674,7 @@ Versions::symbol_section_contents<32, true>( unsigned int, const std::vector<Symbol*>&, unsigned char**, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_64_LITTLE @@ -1692,8 +1686,7 @@ Versions::symbol_section_contents<64, false>( unsigned int, const std::vector<Symbol*>&, unsigned char**, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_64_BIG @@ -1705,8 +1698,7 @@ Versions::symbol_section_contents<64, true>( unsigned int, const std::vector<Symbol*>&, unsigned char**, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_32_LITTLE @@ -1716,8 +1708,7 @@ Versions::def_section_contents<32, false>( const Stringpool*, unsigned char**, unsigned int*, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_32_BIG @@ -1727,8 +1718,7 @@ Versions::def_section_contents<32, true>( const Stringpool*, unsigned char**, unsigned int*, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_64_LITTLE @@ -1738,8 +1728,7 @@ Versions::def_section_contents<64, false>( const Stringpool*, unsigned char**, unsigned int*, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_64_BIG @@ -1749,8 +1738,7 @@ Versions::def_section_contents<64, true>( const Stringpool*, unsigned char**, unsigned int*, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_32_LITTLE @@ -1760,8 +1748,7 @@ Versions::need_section_contents<32, false>( const Stringpool*, unsigned char**, unsigned int*, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(32, false)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_32_BIG @@ -1771,8 +1758,7 @@ Versions::need_section_contents<32, true>( const Stringpool*, unsigned char**, unsigned int*, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(32, true)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_64_LITTLE @@ -1782,8 +1768,7 @@ Versions::need_section_contents<64, false>( const Stringpool*, unsigned char**, unsigned int*, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(64, false)) const; + unsigned int*) const; #endif #ifdef HAVE_TARGET_64_BIG @@ -1793,8 +1778,7 @@ Versions::need_section_contents<64, true>( const Stringpool*, unsigned char**, unsigned int*, - unsigned int* - ACCEPT_SIZE_ENDIAN_EXPLICIT(64, true)) const; + unsigned int*) const; #endif } // End namespace gold. diff --git a/gold/dynobj.h b/gold/dynobj.h index cdfa9ce..b55ae35 100644 --- a/gold/dynobj.h +++ b/gold/dynobj.h @@ -365,8 +365,7 @@ class Verdef : public Version_base // Write contents to buffer. template<int size, bool big_endian> unsigned char* - write(const Stringpool*, bool is_last, unsigned char* - ACCEPT_SIZE_ENDIAN) const; + write(const Stringpool*, bool is_last, unsigned char*) const; private: Verdef(const Verdef&); @@ -451,8 +450,7 @@ class Verneed // Write contents to buffer. template<int size, bool big_endian> unsigned char* - write(const Stringpool*, bool is_last, unsigned char* - ACCEPT_SIZE_ENDIAN) const; + write(const Stringpool*, bool is_last, unsigned char*) const; private: Verneed(const Verneed&); @@ -508,24 +506,21 @@ class Versions symbol_section_contents(const Symbol_table*, const Stringpool*, unsigned int local_symcount, const std::vector<Symbol*>& syms, - unsigned char**, unsigned int* - ACCEPT_SIZE_ENDIAN) const; + unsigned char**, unsigned int*) const; // Build an allocated buffer holding the contents of the version // definition section (.gnu.version_d). template<int size, bool big_endian> void def_section_contents(const Stringpool*, unsigned char**, - unsigned int* psize, unsigned int* pentries - ACCEPT_SIZE_ENDIAN) const; + unsigned int* psize, unsigned int* pentries) const; // Build an allocated buffer holding the contents of the version // reference section (.gnu.version_r). template<int size, bool big_endian> void need_section_contents(const Stringpool*, unsigned char**, - unsigned int* psize, unsigned int* pentries - ACCEPT_SIZE_ENDIAN) const; + unsigned int* psize, unsigned int* pentries) const; const Version_script_info& version_script() const diff --git a/gold/gold.h b/gold/gold.h index 520f2e3..ad26d46 100644 --- a/gold/gold.h +++ b/gold/gold.h @@ -104,62 +104,6 @@ extern "C" ssize_t pread(int, void*, size_t, off_t); namespace gold { -// This is a hack to work around a problem with older versions of g++. -// The problem is that they don't support calling a member template by -// specifying the template parameters. It works to pass in an -// argument for argument dependent lookup. - -// To use this, the member template method declaration should put -// ACCEPT_SIZE or ACCEPT_SIZE_ENDIAN after the last parameter. If the -// method takes no parameters, use ACCEPT_SIZE_ONLY or -// ACCEPT_SIZE_ENDIAN_ONLY. - -// When calling the method, instead of using fn<size>, use fn -// SELECT_SIZE_NAME or SELECT_SIZE_ENDIAN_NAME. And after the last -// argument, put SELECT_SIZE(size) or SELECT_SIZE_ENDIAN(size, -// big_endian). If there is only one argment, use the _ONLY variants. - -#ifdef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS - -#define SELECT_SIZE_NAME(size) <size> -#define SELECT_SIZE(size) -#define SELECT_SIZE_ONLY(size) -#define ACCEPT_SIZE -#define ACCEPT_SIZE_ONLY -#define ACCEPT_SIZE_EXPLICIT(size) - -#define SELECT_SIZE_ENDIAN_NAME(size, big_endian) <size, big_endian> -#define SELECT_SIZE_ENDIAN(size, big_endian) -#define SELECT_SIZE_ENDIAN_ONLY(size, big_endian) -#define ACCEPT_SIZE_ENDIAN -#define ACCEPT_SIZE_ENDIAN_ONLY -#define ACCEPT_SIZE_ENDIAN_EXPLICIT(size, big_endian) - -#else // !defined(HAVE_MEMBER_TEMPLATE_SPECIFICATIONS) - -template<int size> -class Select_size { }; -template<int size, bool big_endian> -class Select_size_endian { }; - -#define SELECT_SIZE_NAME(size) -#define SELECT_SIZE(size) , Select_size<size>() -#define SELECT_SIZE_ONLY(size) Select_size<size>() -#define ACCEPT_SIZE , Select_size<size> -#define ACCEPT_SIZE_ONLY Select_size<size> -#define ACCEPT_SIZE_EXPLICIT(size) , Select_size<size> - -#define SELECT_SIZE_ENDIAN_NAME(size, big_endian) -#define SELECT_SIZE_ENDIAN(size, big_endian) \ - , Select_size_endian<size, big_endian>() -#define SELECT_SIZE_ENDIAN_ONLY(size, big_endian) \ - Select_size_endian<size, big_endian>() -#define ACCEPT_SIZE_ENDIAN , Select_size_endian<size, big_endian> -#define ACCEPT_SIZE_ENDIAN_ONLY Select_size_endian<size, big_endian> -#define ACCEPT_SIZE_ENDIAN_EXPLICIT(size, big_endian) \ - , Select_size_endian<size, big_endian> - -#endif // !defined(HAVE_MEMBER_TEMPLATE_SPECIFICATIONS) // General declarations. diff --git a/gold/i386.cc b/gold/i386.cc index 4303a2a..18faa4a 100644 --- a/gold/i386.cc +++ b/gold/i386.cc @@ -726,9 +726,7 @@ Target_i386::copy_reloc(const General_options* options, Symbol* gsym, const elfcpp::Rel<32, false>& rel) { - Sized_symbol<32>* ssym; - ssym = symtab->get_sized_symbol SELECT_SIZE_NAME(32) (gsym - SELECT_SIZE(32)); + Sized_symbol<32>* ssym = symtab->get_sized_symbol<32>(gsym); if (!Copy_relocs<32, false>::need_copy_reloc(options, object, data_shndx, ssym)) diff --git a/gold/layout.cc b/gold/layout.cc index b2fd971..97c13ea 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -1985,34 +1985,30 @@ Layout::create_version_sections(const Versions* versions, { #ifdef HAVE_TARGET_32_LITTLE case Parameters::TARGET_32_LITTLE: - this->sized_create_version_sections - SELECT_SIZE_ENDIAN_NAME(32, false)( - versions, symtab, local_symcount, dynamic_symbols, dynstr - SELECT_SIZE_ENDIAN(32, false)); + this->sized_create_version_sections<32, false>(versions, symtab, + local_symcount, + dynamic_symbols, dynstr); break; #endif #ifdef HAVE_TARGET_32_BIG case Parameters::TARGET_32_BIG: - this->sized_create_version_sections - SELECT_SIZE_ENDIAN_NAME(32, true)( - versions, symtab, local_symcount, dynamic_symbols, dynstr - SELECT_SIZE_ENDIAN(32, true)); + this->sized_create_version_sections<32, true>(versions, symtab, + local_symcount, + dynamic_symbols, dynstr); break; #endif #ifdef HAVE_TARGET_64_LITTLE case Parameters::TARGET_64_LITTLE: - this->sized_create_version_sections - SELECT_SIZE_ENDIAN_NAME(64, false)( - versions, symtab, local_symcount, dynamic_symbols, dynstr - SELECT_SIZE_ENDIAN(64, false)); + this->sized_create_version_sections<64, false>(versions, symtab, + local_symcount, + dynamic_symbols, dynstr); break; #endif #ifdef HAVE_TARGET_64_BIG case Parameters::TARGET_64_BIG: - this->sized_create_version_sections - SELECT_SIZE_ENDIAN_NAME(64, true)( - versions, symtab, local_symcount, dynamic_symbols, dynstr - SELECT_SIZE_ENDIAN(64, true)); + this->sized_create_version_sections<64, true>(versions, symtab, + local_symcount, + dynamic_symbols, dynstr); break; #endif default: @@ -2029,8 +2025,7 @@ Layout::sized_create_version_sections( const Symbol_table* symtab, unsigned int local_symcount, const std::vector<Symbol*>& dynamic_symbols, - const Output_section* dynstr - ACCEPT_SIZE_ENDIAN) + const Output_section* dynstr) { Output_section* vsec = this->choose_output_section(NULL, ".gnu.version", elfcpp::SHT_GNU_versym, @@ -2039,9 +2034,10 @@ Layout::sized_create_version_sections( unsigned char* vbuf; unsigned int vsize; - versions->symbol_section_contents SELECT_SIZE_ENDIAN_NAME(size, big_endian)( - symtab, &this->dynpool_, local_symcount, dynamic_symbols, &vbuf, &vsize - SELECT_SIZE_ENDIAN(size, big_endian)); + versions->symbol_section_contents<size, big_endian>(symtab, &this->dynpool_, + local_symcount, + dynamic_symbols, + &vbuf, &vsize); Output_section_data* vdata = new Output_data_const_buffer(vbuf, vsize, 2); @@ -2063,9 +2059,8 @@ Layout::sized_create_version_sections( unsigned char* vdbuf; unsigned int vdsize; unsigned int vdentries; - versions->def_section_contents SELECT_SIZE_ENDIAN_NAME(size, big_endian)( - &this->dynpool_, &vdbuf, &vdsize, &vdentries - SELECT_SIZE_ENDIAN(size, big_endian)); + versions->def_section_contents<size, big_endian>(&this->dynpool_, &vdbuf, + &vdsize, &vdentries); Output_section_data* vddata = new Output_data_const_buffer(vdbuf, vdsize, @@ -2090,9 +2085,9 @@ Layout::sized_create_version_sections( unsigned char* vnbuf; unsigned int vnsize; unsigned int vnentries; - versions->need_section_contents SELECT_SIZE_ENDIAN_NAME(size, big_endian) - (&this->dynpool_, &vnbuf, &vnsize, &vnentries - SELECT_SIZE_ENDIAN(size, big_endian)); + versions->need_section_contents<size, big_endian>(&this->dynpool_, + &vnbuf, &vnsize, + &vnentries); Output_section_data* vndata = new Output_data_const_buffer(vnbuf, vnsize, diff --git a/gold/layout.h b/gold/layout.h index d1caa2c..1005183 100644 --- a/gold/layout.h +++ b/gold/layout.h @@ -434,8 +434,7 @@ class Layout const Symbol_table*, unsigned int local_symcount, const std::vector<Symbol*>& dynamic_symbols, - const Output_section* dynstr - ACCEPT_SIZE_ENDIAN); + const Output_section* dynstr); // Return whether to include this section in the link. template<int size, bool big_endian> diff --git a/gold/object.h b/gold/object.h index 80047b0..8a51550 100644 --- a/gold/object.h +++ b/gold/object.h @@ -202,7 +202,7 @@ class Object // appropriate checked type. template<int size, bool big_endian> Sized_target<size, big_endian>* - sized_target(ACCEPT_SIZE_ENDIAN_ONLY) const; + sized_target() const; // Get the number of sections. unsigned int @@ -457,7 +457,7 @@ class Object template<int size, bool big_endian> inline Sized_target<size, big_endian>* -Object::sized_target(ACCEPT_SIZE_ENDIAN_ONLY) const +Object::sized_target() const { gold_assert(this->target_->get_size() == size); gold_assert(this->target_->is_big_endian() ? big_endian : !big_endian); @@ -1054,11 +1054,7 @@ class Sized_relobj : public Relobj // Return the appropriate Sized_target structure. Sized_target<size, big_endian>* sized_target() - { - return this->Object::sized_target - SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( - SELECT_SIZE_ENDIAN_ONLY(size, big_endian)); - } + { return this->Object::sized_target<size, big_endian>(); } // Return the value of the local symbol symndx. Address diff --git a/gold/output.cc b/gold/output.cc index 31a2531..622e983 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -1381,8 +1381,7 @@ template<int size, bool big_endian> void Output_data_dynamic::Dynamic_entry::write( unsigned char* pov, - const Stringpool* pool - ACCEPT_SIZE_ENDIAN) const + const Stringpool* pool) const { typename elfcpp::Elf_types<size>::Elf_WXword val; switch (this->classification_) @@ -1500,8 +1499,7 @@ Output_data_dynamic::sized_write(Output_file* of) p != this->entries_.end(); ++p) { - p->write SELECT_SIZE_ENDIAN_NAME(size, big_endian)( - pov, this->pool_ SELECT_SIZE_ENDIAN(size, big_endian)); + p->write<size, big_endian>(pov, this->pool_); pov += dyn_size; } @@ -2737,8 +2735,7 @@ unsigned char* Output_segment::write_section_headers(const Layout* layout, const Stringpool* secnamepool, unsigned char* v, - unsigned int *pshndx - ACCEPT_SIZE_ENDIAN) const + unsigned int *pshndx) const { // Every section that is attached to a segment must be attached to a // PT_LOAD segment, so we only write out section headers for PT_LOAD @@ -2746,14 +2743,12 @@ Output_segment::write_section_headers(const Layout* layout, if (this->type_ != elfcpp::PT_LOAD) return v; - v = this->write_section_headers_list - SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( - layout, secnamepool, &this->output_data_, v, pshndx - SELECT_SIZE_ENDIAN(size, big_endian)); - v = this->write_section_headers_list - SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( - layout, secnamepool, &this->output_bss_, v, pshndx - SELECT_SIZE_ENDIAN(size, big_endian)); + v = this->write_section_headers_list<size, big_endian>(layout, secnamepool, + &this->output_data_, + v, pshndx); + v = this->write_section_headers_list<size, big_endian>(layout, secnamepool, + &this->output_bss_, + v, pshndx); return v; } @@ -2763,8 +2758,7 @@ Output_segment::write_section_headers_list(const Layout* layout, const Stringpool* secnamepool, const Output_data_list* pdl, unsigned char* v, - unsigned int* pshndx - ACCEPT_SIZE_ENDIAN) const + unsigned int* pshndx) const { const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size; for (Output_data_list::const_iterator p = pdl->begin(); diff --git a/gold/output.h b/gold/output.h index 8d0a853..a004515 100644 --- a/gold/output.h +++ b/gold/output.h @@ -1618,7 +1618,7 @@ class Output_data_dynamic : public Output_section_data // Write the dynamic entry to an output view. template<int size, bool big_endian> void - write(unsigned char* pov, const Stringpool* ACCEPT_SIZE_ENDIAN) const; + write(unsigned char* pov, const Stringpool*) const; private: enum Classification @@ -2607,7 +2607,7 @@ class Output_segment template<int size, bool big_endian> unsigned char* write_section_headers(const Layout*, const Stringpool*, unsigned char* v, - unsigned int* pshndx ACCEPT_SIZE_ENDIAN) const; + unsigned int* pshndx) const; private: Output_segment(const Output_segment&); @@ -2649,7 +2649,7 @@ class Output_segment unsigned char* write_section_headers_list(const Layout*, const Stringpool*, const Output_data_list*, unsigned char* v, - unsigned int* pshdx ACCEPT_SIZE_ENDIAN) const; + unsigned int* pshdx) const; // The list of output data with contents attached to this segment. Output_data_list output_data_; diff --git a/gold/resolve.cc b/gold/resolve.cc index c244ad4..3300000 100644 --- a/gold/resolve.cc +++ b/gold/resolve.cc @@ -85,16 +85,13 @@ Symbol_table::override(Sized_symbol<size>* tosym, { Symbol* sym = this->weak_aliases_[tosym]; gold_assert(sym != NULL); - Sized_symbol<size>* ssym; - ssym = this->get_sized_symbol SELECT_SIZE_NAME(size) (sym - SELECT_SIZE(size)); + Sized_symbol<size>* ssym = this->get_sized_symbol<size>(sym); do { ssym->override(fromsym, object, version); sym = this->weak_aliases_[ssym]; gold_assert(sym != NULL); - ssym = this->get_sized_symbol SELECT_SIZE_NAME(size) ( - sym SELECT_SIZE(size)); + ssym = this->get_sized_symbol<size>(sym); } while (ssym != tosym); } @@ -194,9 +191,7 @@ Symbol_table::resolve(Sized_symbol<size>* to, if (object->target()->has_resolve()) { Sized_target<size, big_endian>* sized_target; - sized_target = object->sized_target - SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( - SELECT_SIZE_ENDIAN_ONLY(size, big_endian)); + sized_target = object->sized_target<size, big_endian>(); sized_target->resolve(to, sym, object, version); return; } @@ -715,16 +710,13 @@ Symbol_table::override_with_special(Sized_symbol<size>* tosym, { Symbol* sym = this->weak_aliases_[tosym]; gold_assert(sym != NULL); - Sized_symbol<size>* ssym; - ssym = this->get_sized_symbol SELECT_SIZE_NAME(size) (sym - SELECT_SIZE(size)); + Sized_symbol<size>* ssym = this->get_sized_symbol<size>(sym); do { ssym->override_with_special(fromsym); sym = this->weak_aliases_[ssym]; gold_assert(sym != NULL); - ssym = this->get_sized_symbol SELECT_SIZE_NAME(size) ( - sym SELECT_SIZE(size)); + ssym = this->get_sized_symbol<size>(sym); } while (ssym != tosym); } diff --git a/gold/symtab.cc b/gold/symtab.cc index cb2a798..1232d05 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -444,7 +444,7 @@ Symbol_table::lookup(const char* name, const char* version) const template<int size, bool big_endian> void Symbol_table::resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from, - const char* version ACCEPT_SIZE_ENDIAN) + const char* version) { unsigned char buf[elfcpp::Elf_sizes<size>::sym_size]; elfcpp::Sym_write<size, big_endian> esym(buf); @@ -542,8 +542,7 @@ Symbol_table::add_from_object(Object* object, if (!ins.second) { // We already have an entry for NAME/VERSION. - ret = this->get_sized_symbol SELECT_SIZE_NAME(size) (ins.first->second - SELECT_SIZE(size)); + ret = this->get_sized_symbol<size>(ins.first->second); gold_assert(ret != NULL); was_undefined = ret->is_undefined(); @@ -572,11 +571,8 @@ Symbol_table::add_from_object(Object* object, // object. const Sized_symbol<size>* sym2; - sym2 = this->get_sized_symbol SELECT_SIZE_NAME(size) ( - insdef.first->second - SELECT_SIZE(size)); - Symbol_table::resolve SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( - ret, sym2, version SELECT_SIZE_ENDIAN(size, big_endian)); + sym2 = this->get_sized_symbol<size>(insdef.first->second); + Symbol_table::resolve<size, big_endian>(ret, sym2, version); this->make_forwarder(insdef.first->second, ret); insdef.first->second = ret; } @@ -594,17 +590,14 @@ Symbol_table::add_from_object(Object* object, { // We already have an entry for NAME/NULL. If we override // it, then change it to NAME/VERSION. - ret = this->get_sized_symbol SELECT_SIZE_NAME(size) ( - insdef.first->second - SELECT_SIZE(size)); + ret = this->get_sized_symbol<size>(insdef.first->second); this->resolve(ret, sym, orig_sym, object, version); ins.first->second = ret; } else { Sized_target<size, big_endian>* target = - object->sized_target SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( - SELECT_SIZE_ENDIAN_ONLY(size, big_endian)); + object->sized_target<size, big_endian>(); if (!target->has_make_symbol()) ret = new Sized_symbol<size>(); else @@ -1029,8 +1022,7 @@ template<int size, bool big_endian> Sized_symbol<size>* Symbol_table::define_special_symbol(const char** pname, const char** pversion, bool only_if_ref, - Sized_symbol<size>** poldsym - ACCEPT_SIZE_ENDIAN) + Sized_symbol<size>** poldsym) { Symbol* oldsym; Sized_symbol<size>* sym; @@ -1107,8 +1099,7 @@ Symbol_table::define_special_symbol(const char** pname, const char** pversion, else gold_assert(oldsym != NULL); - *poldsym = this->get_sized_symbol SELECT_SIZE_NAME(size) (oldsym - SELECT_SIZE(size)); + *poldsym = this->get_sized_symbol<size>(oldsym); return sym; } @@ -1179,9 +1170,8 @@ Symbol_table::do_define_in_output_data( if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) ( - &name, &version, only_if_ref, &oldsym - SELECT_SIZE_ENDIAN(size, true)); + sym = this->define_special_symbol<size, true>(&name, &version, + only_if_ref, &oldsym); #else gold_unreachable(); #endif @@ -1189,9 +1179,8 @@ Symbol_table::do_define_in_output_data( else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) ( - &name, &version, only_if_ref, &oldsym - SELECT_SIZE_ENDIAN(size, false)); + sym = this->define_special_symbol<size, false>(&name, &version, + only_if_ref, &oldsym); #else gold_unreachable(); #endif @@ -1281,9 +1270,8 @@ Symbol_table::do_define_in_output_segment( if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) ( - &name, &version, only_if_ref, &oldsym - SELECT_SIZE_ENDIAN(size, true)); + sym = this->define_special_symbol<size, true>(&name, &version, + only_if_ref, &oldsym); #else gold_unreachable(); #endif @@ -1291,9 +1279,8 @@ Symbol_table::do_define_in_output_segment( else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) ( - &name, &version, only_if_ref, &oldsym - SELECT_SIZE_ENDIAN(size, false)); + sym = this->define_special_symbol<size, false>(&name, &version, + only_if_ref, &oldsym); #else gold_unreachable(); #endif @@ -1383,9 +1370,8 @@ Symbol_table::do_define_as_constant( if (parameters->target().is_big_endian()) { #if defined(HAVE_TARGET_32_BIG) || defined(HAVE_TARGET_64_BIG) - sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) ( - &name, &version, only_if_ref, &oldsym - SELECT_SIZE_ENDIAN(size, true)); + sym = this->define_special_symbol<size, true>(&name, &version, + only_if_ref, &oldsym); #else gold_unreachable(); #endif @@ -1393,9 +1379,8 @@ Symbol_table::do_define_as_constant( else { #if defined(HAVE_TARGET_32_LITTLE) || defined(HAVE_TARGET_64_LITTLE) - sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) ( - &name, &version, only_if_ref, &oldsym - SELECT_SIZE_ENDIAN(size, false)); + sym = this->define_special_symbol<size, false>(&name, &version, + only_if_ref, &oldsym); #else gold_unreachable(); #endif @@ -1964,9 +1949,8 @@ Symbol_table::sized_write_globals(const Input_objects* input_objects, sym_index -= first_global_index; gold_assert(sym_index < output_count); unsigned char* ps = psyms + (sym_index * sym_size); - this->sized_write_symbol SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( - sym, sym_value, shndx, sympool, ps - SELECT_SIZE_ENDIAN(size, big_endian)); + this->sized_write_symbol<size, big_endian>(sym, sym_value, shndx, + sympool, ps); } if (dynsym_index != -1U) @@ -1974,9 +1958,8 @@ Symbol_table::sized_write_globals(const Input_objects* input_objects, dynsym_index -= first_dynamic_global_index; gold_assert(dynsym_index < dynamic_count); unsigned char* pd = dynamic_view + (dynsym_index * sym_size); - this->sized_write_symbol SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( - sym, dynsym_value, shndx, dynpool, pd - SELECT_SIZE_ENDIAN(size, big_endian)); + this->sized_write_symbol<size, big_endian>(sym, dynsym_value, shndx, + dynpool, pd); } } @@ -1995,8 +1978,7 @@ Symbol_table::sized_write_symbol( typename elfcpp::Elf_types<size>::Elf_Addr value, unsigned int shndx, const Stringpool* pool, - unsigned char* p - ACCEPT_SIZE_ENDIAN) const + unsigned char* p) const { elfcpp::Sym_write<size, big_endian> osym(p); osym.put_st_name(pool->get_offset(sym->name())); diff --git a/gold/symtab.h b/gold/symtab.h index 9a54187..c8a5d86 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -1112,11 +1112,11 @@ class Symbol_table // Return the sized version of a symbol in this table. template<int size> Sized_symbol<size>* - get_sized_symbol(Symbol* ACCEPT_SIZE) const; + get_sized_symbol(Symbol*) const; template<int size> const Sized_symbol<size>* - get_sized_symbol(const Symbol* ACCEPT_SIZE) const; + get_sized_symbol(const Symbol*) const; // Return the count of undefined symbols seen. int @@ -1224,7 +1224,7 @@ class Symbol_table template<int size, bool big_endian> void resolve(Sized_symbol<size>* to, const Sized_symbol<size>* from, - const char* version ACCEPT_SIZE_ENDIAN); + const char* version); // Record that a symbol is forced to be local by a version script. void @@ -1262,8 +1262,7 @@ class Symbol_table template<int size, bool big_endian> Sized_symbol<size>* define_special_symbol(const char** pname, const char** pversion, - bool only_if_ref, Sized_symbol<size>** poldsym - ACCEPT_SIZE_ENDIAN); + bool only_if_ref, Sized_symbol<size>** poldsym); // Define a symbol in an Output_data, sized version. template<int size> @@ -1335,8 +1334,7 @@ class Symbol_table sized_write_symbol(Sized_symbol<size>*, typename elfcpp::Elf_types<size>::Elf_Addr value, unsigned int shndx, - const Stringpool*, unsigned char* p - ACCEPT_SIZE_ENDIAN) const; + const Stringpool*, unsigned char* p) const; // Possibly warn about an undefined symbol from a dynamic object. void @@ -1458,7 +1456,7 @@ class Symbol_table template<int size> Sized_symbol<size>* -Symbol_table::get_sized_symbol(Symbol* sym ACCEPT_SIZE) const +Symbol_table::get_sized_symbol(Symbol* sym) const { gold_assert(size == parameters->target().get_size()); return static_cast<Sized_symbol<size>*>(sym); @@ -1466,7 +1464,7 @@ Symbol_table::get_sized_symbol(Symbol* sym ACCEPT_SIZE) const template<int size> const Sized_symbol<size>* -Symbol_table::get_sized_symbol(const Symbol* sym ACCEPT_SIZE) const +Symbol_table::get_sized_symbol(const Symbol* sym) const { gold_assert(size == parameters->target().get_size()); return static_cast<const Sized_symbol<size>*>(sym); diff --git a/gold/x86_64.cc b/gold/x86_64.cc index 257be65..584303d 100644 --- a/gold/x86_64.cc +++ b/gold/x86_64.cc @@ -683,9 +683,7 @@ Target_x86_64::copy_reloc(const General_options* options, Symbol* gsym, const elfcpp::Rela<64, false>& rela) { - Sized_symbol<64>* ssym; - ssym = symtab->get_sized_symbol SELECT_SIZE_NAME(64) (gsym - SELECT_SIZE(64)); + Sized_symbol<64>* ssym = symtab->get_sized_symbol<64>(gsym); if (!Copy_relocs<64, false>::need_copy_reloc(options, object, data_shndx, ssym)) |