return this->output_local_dynsym_count_;
}
-// Return the value of the local symbol symndx.
-template<int size, bool big_endian>
-typename elfcpp::Elf_types<size>::Elf_Addr
-Sized_relobj<size, big_endian>::local_symbol_value(unsigned int symndx) const
-{
- gold_assert(symndx < this->local_symbol_count_);
- gold_assert(symndx < this->local_values_.size());
- const Symbol_value<size>& lv(this->local_values_[symndx]);
- return lv.value(this, 0);
-}
-
// Write out the local symbols.
template<int size, bool big_endian>
const unsigned int lsi = this->local_sym_index_;
section_offset_type offset;
Output_section* os = this->u1_.relobj->output_section(lsi, &offset);
- gold_assert(os != NULL);
+ gold_assert(os != NULL && offset != -1);
return offset;
}
template<bool dynamic, int size, bool big_endian>
typename elfcpp::Elf_types<size>::Elf_Addr
-Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::symbol_value() const
+Output_reloc<elfcpp::SHT_REL, dynamic, size, big_endian>::symbol_value(
+ Address addend) const
{
if (this->local_sym_index_ == GSYM_CODE)
{
const Sized_symbol<size>* sym;
sym = static_cast<const Sized_symbol<size>*>(this->u1_.gsym);
- return sym->value();
+ return sym->value() + addend;
}
gold_assert(this->local_sym_index_ != SECTION_CODE
- && this->local_sym_index_ != INVALID_CODE);
- const Sized_relobj<size, big_endian>* relobj = this->u1_.relobj;
- return relobj->local_symbol_value(this->local_sym_index_);
+ && this->local_sym_index_ != INVALID_CODE
+ && !this->is_section_symbol_);
+ const unsigned int lsi = this->local_sym_index_;
+ const Symbol_value<size>* symval = this->u1_.relobj->local_symbol(lsi);
+ return symval->value(this->u1_.relobj, addend);
}
// Write out a Rela relocation.
this->rel_.write_rel(&orel);
Addend addend = this->addend_;
if (this->rel_.is_relative())
- addend += this->rel_.symbol_value();
- if (this->rel_.is_local_section_symbol())
+ addend = this->rel_.symbol_value(addend);
+ else if (this->rel_.is_local_section_symbol())
addend += this->rel_.local_section_offset();
orel.put_r_addend(addend);
}
break;
default:
- val = this->u_.object->local_symbol_value(this->local_sym_index_);
+ {
+ const unsigned int lsi = this->local_sym_index_;
+ const Symbol_value<size>* symval = this->u_.object->local_symbol(lsi);
+ val = symval->value(this->u_.object, 0);
+ }
break;
}
// 14 Compare string constants in file 1 and file 2.
// 15 Compare wide string constants in file 1 and file 2.
// 16 Call a function directly after its address has been taken.
+// 17 File 1 checks array of string constants defined in file 2.
#include "two_file_test.h"
{
return f10() == 135;
}
+
+// 17 File 1 checks array of string constants defined in file 2.
+
+bool
+t17()
+{
+ char c = 'a';
+ for (int i = 0; i < T17_COUNT; ++i)
+ {
+ if (t17data[i][0] != c || t17data[i][1] != '\0')
+ return false;
+ ++c;
+ }
+ return true;
+}