diff options
-rw-r--r-- | gold/common.cc | 17 | ||||
-rw-r--r-- | gold/gold.h | 8 | ||||
-rw-r--r-- | gold/object.h | 5 | ||||
-rw-r--r-- | gold/output.cc | 18 | ||||
-rw-r--r-- | gold/resolve.cc | 5 | ||||
-rw-r--r-- | gold/symtab.cc | 44 | ||||
-rw-r--r-- | gold/symtab.h | 3 |
7 files changed, 60 insertions, 40 deletions
diff --git a/gold/common.cc b/gold/common.cc index 9738f98..28ca2f6 100644 --- a/gold/common.cc +++ b/gold/common.cc @@ -84,11 +84,11 @@ Sort_commons<size>::operator()(const Symbol* pa, const Symbol* pb) const const Symbol_table* symtab = this->symtab_; const Sized_symbol<size>* psa; - psa = symtab->get_sized_symbol SELECT_SIZE_NAME (pa - SELECT_SIZE(size)); + 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 (pb - SELECT_SIZE(size)); + psb = symtab->get_sized_symbol SELECT_SIZE_NAME(size) (pb + SELECT_SIZE(size)); typename Sized_symbol<size>::Size_type sa = psa->symsize(); typename Sized_symbol<size>::Size_type sb = psb->symsize(); @@ -153,8 +153,9 @@ Symbol_table::do_allocate_commons(const General_options&, { any = true; Sized_symbol<size>* ssym; - ssym = this->get_sized_symbol SELECT_SIZE_NAME (sym - SELECT_SIZE(size)); + ssym = this->get_sized_symbol SELECT_SIZE_NAME(size) ( + sym + SELECT_SIZE(size)); if (ssym->value() > addralign) addralign = ssym->value(); } @@ -187,8 +188,8 @@ Symbol_table::do_allocate_commons(const General_options&, break; Sized_symbol<size>* ssym; - ssym = this->get_sized_symbol SELECT_SIZE_NAME (sym - SELECT_SIZE(size)); + ssym = this->get_sized_symbol SELECT_SIZE_NAME(size) (sym + SELECT_SIZE(size)); off = align_address(off, ssym->value()); diff --git a/gold/gold.h b/gold/gold.h index 1140d66..d55d1f6 100644 --- a/gold/gold.h +++ b/gold/gold.h @@ -96,13 +96,13 @@ namespace gold #ifdef HAVE_MEMBER_TEMPLATE_SPECIFICATIONS -#define SELECT_SIZE_NAME <size> +#define SELECT_SIZE_NAME(size) <size> #define SELECT_SIZE(size) #define SELECT_SIZE_ONLY(size) #define ACCEPT_SIZE #define ACCEPT_SIZE_ONLY -#define SELECT_SIZE_ENDIAN_NAME <size, big_endian> +#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 @@ -115,13 +115,13 @@ class Select_size { }; template<int size, bool big_endian> class Select_size_endian { }; -#define SELECT_SIZE_NAME +#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 SELECT_SIZE_ENDIAN_NAME +#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) \ diff --git a/gold/object.h b/gold/object.h index 5e57039..9b23de9 100644 --- a/gold/object.h +++ b/gold/object.h @@ -392,8 +392,9 @@ class Sized_object : public Object Sized_target<size, big_endian>* sized_target() { - return this->Object::sized_target SELECT_SIZE_ENDIAN_NAME ( - SELECT_SIZE_ENDIAN_ONLY(size, big_endian)); + return this->Object::sized_target + SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( + SELECT_SIZE_ENDIAN_ONLY(size, big_endian)); } private: diff --git a/gold/output.cc b/gold/output.cc index 703a560..220a4f6 100644 --- a/gold/output.cc +++ b/gold/output.cc @@ -144,7 +144,7 @@ Output_section_headers::do_sized_write(Output_file* of) for (Layout::Segment_list::const_iterator p = this->segment_list_.begin(); p != this->segment_list_.end(); ++p) - v = (*p)->write_section_headers SELECT_SIZE_ENDIAN_NAME ( + v = (*p)->write_section_headers SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( this->secnamepool_, v, &shndx SELECT_SIZE_ENDIAN(size, big_endian)); for (Layout::Section_list::const_iterator p = this->section_list_.begin(); @@ -333,7 +333,7 @@ Output_file_header::do_sized_write(Output_file* of) else { Sized_symbol<size>* ssym; - ssym = this->symtab_->get_sized_symbol SELECT_SIZE_NAME ( + ssym = this->symtab_->get_sized_symbol SELECT_SIZE_NAME(size) ( sym SELECT_SIZE(size)); v = ssym->value(); } @@ -971,12 +971,14 @@ Output_segment::write_section_headers(const Stringpool* secnamepool, if (this->type_ != elfcpp::PT_LOAD) return v; - v = this->write_section_headers_list SELECT_SIZE_ENDIAN_NAME ( - secnamepool, &this->output_data_, v, pshndx - SELECT_SIZE_ENDIAN(size, big_endian)); - v = this->write_section_headers_list SELECT_SIZE_ENDIAN_NAME ( - secnamepool, &this->output_bss_, v, pshndx - SELECT_SIZE_ENDIAN(size, big_endian)); + v = this->write_section_headers_list + SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( + 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) ( + secnamepool, &this->output_bss_, v, pshndx + SELECT_SIZE_ENDIAN(size, big_endian)); return v; } diff --git a/gold/resolve.cc b/gold/resolve.cc index 83e616c..86645a4 100644 --- a/gold/resolve.cc +++ b/gold/resolve.cc @@ -55,8 +55,9 @@ 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 ( - SELECT_SIZE_ENDIAN_ONLY(size, big_endian)); + sized_target = object->sized_target + SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( + SELECT_SIZE_ENDIAN_ONLY(size, big_endian)); sized_target->resolve(to, sym, object); return; } diff --git a/gold/symtab.cc b/gold/symtab.cc index 0f43faa..9adb9de 100644 --- a/gold/symtab.cc +++ b/gold/symtab.cc @@ -308,8 +308,8 @@ Symbol_table::add_from_object(Sized_object<size, big_endian>* object, if (!ins.second) { // We already have an entry for NAME/VERSION. - ret = this->get_sized_symbol SELECT_SIZE_NAME (ins.first->second - SELECT_SIZE(size)); + ret = this->get_sized_symbol SELECT_SIZE_NAME(size) (ins.first->second + SELECT_SIZE(size)); assert(ret != NULL); was_undefined = ret->is_undefined(); @@ -330,10 +330,10 @@ Symbol_table::add_from_object(Sized_object<size, big_endian>* object, // This is the unfortunate case where we already have // entries for both NAME/VERSION and NAME/NULL. const Sized_symbol<size>* sym2; - sym2 = this->get_sized_symbol SELECT_SIZE_NAME ( + sym2 = this->get_sized_symbol SELECT_SIZE_NAME(size) ( insdef.first->second SELECT_SIZE(size)); - Symbol_table::resolve SELECT_SIZE_ENDIAN_NAME ( + Symbol_table::resolve SELECT_SIZE_ENDIAN_NAME(size, big_endian) ( ret, sym2 SELECT_SIZE_ENDIAN(size, big_endian)); this->make_forwarder(insdef.first->second, ret); insdef.first->second = ret; @@ -352,8 +352,9 @@ Symbol_table::add_from_object(Sized_object<size, big_endian>* object, { // We already have an entry for NAME/NULL. Make // NAME/VERSION point to it. - ret = this->get_sized_symbol SELECT_SIZE_NAME (insdef.first->second - SELECT_SIZE(size)); + ret = this->get_sized_symbol SELECT_SIZE_NAME(size) ( + insdef.first->second + SELECT_SIZE(size)); Symbol_table::resolve(ret, sym, object); ins.first->second = ret; } @@ -500,7 +501,8 @@ Symbol_table::add_from_object( template<int size, bool big_endian> Sized_symbol<size>* Symbol_table::define_special_symbol(Target* target, const char* name, - bool only_if_ref) + bool only_if_ref + ACCEPT_SIZE_ENDIAN) { assert(this->size_ == size); @@ -562,8 +564,8 @@ Symbol_table::define_special_symbol(Target* target, const char* name, { assert(sym == NULL); - sym = this->get_sized_symbol SELECT_SIZE_NAME (oldsym - SELECT_SIZE(size)); + sym = this->get_sized_symbol SELECT_SIZE_NAME(size) (oldsym + SELECT_SIZE(size)); assert(sym->source() == Symbol::FROM_OBJECT); const int old_shnum = sym->shnum(); if (old_shnum != elfcpp::SHN_UNDEF @@ -628,9 +630,13 @@ Symbol_table::do_define_in_output_data( Sized_symbol<size>* sym; if (target->is_big_endian()) - sym = this->define_special_symbol<size, true>(target, name, only_if_ref); + sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) ( + target, name, only_if_ref + SELECT_SIZE_ENDIAN(size, true)); else - sym = this->define_special_symbol<size, false>(target, name, only_if_ref); + sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) ( + target, name, only_if_ref + SELECT_SIZE_ENDIAN(size, false)); if (sym == NULL) return; @@ -684,9 +690,13 @@ Symbol_table::do_define_in_output_segment( Sized_symbol<size>* sym; if (target->is_big_endian()) - sym = this->define_special_symbol<size, true>(target, name, only_if_ref); + sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) ( + target, name, only_if_ref + SELECT_SIZE_ENDIAN(size, true)); else - sym = this->define_special_symbol<size, false>(target, name, only_if_ref); + sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) ( + target, name, only_if_ref + SELECT_SIZE_ENDIAN(size, false)); if (sym == NULL) return; @@ -736,9 +746,13 @@ Symbol_table::do_define_as_constant( Sized_symbol<size>* sym; if (target->is_big_endian()) - sym = this->define_special_symbol<size, true>(target, name, only_if_ref); + sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, true) ( + target, name, only_if_ref + SELECT_SIZE_ENDIAN(size, true)); else - sym = this->define_special_symbol<size, false>(target, name, only_if_ref); + sym = this->define_special_symbol SELECT_SIZE_ENDIAN_NAME(size, false) ( + target, name, only_if_ref + SELECT_SIZE_ENDIAN(size, false)); if (sym == NULL) return; diff --git a/gold/symtab.h b/gold/symtab.h index 40a9e57..2fa3396 100644 --- a/gold/symtab.h +++ b/gold/symtab.h @@ -507,7 +507,8 @@ class Symbol_table // Define a special symbol. template<int size, bool big_endian> Sized_symbol<size>* - define_special_symbol(Target* target, const char* name, bool only_if_ref); + define_special_symbol(Target* target, const char* name, bool only_if_ref + ACCEPT_SIZE_ENDIAN); // Define a special symbol based on an Output_data. It is a // multiple definition error if this symbol is already defined. |