+// Compute final local symbol value. R_SYM is the index of a local
+// symbol in symbol table. LV points to a symbol value, which is
+// expected to hold the input value and to be over-written by the
+// final value. SYMTAB points to a symbol table. Some targets may want
+// to know would-be-finalized local symbol values in relaxation.
+// Hence we provide this method. Since this method updates *LV, a
+// callee should make a copy of the original local symbol value and
+// use the copy instead of modifying an object's local symbols before
+// everything is finalized. The caller should also free up any allocated
+// memory in the return value in *LV.
+template<int size, bool big_endian>
+typename Sized_relobj_file<size, big_endian>::Compute_final_local_value_status
+Sized_relobj_file<size, big_endian>::compute_final_local_value(
+ unsigned int r_sym,
+ const Symbol_value<size>* lv_in,
+ Symbol_value<size>* lv_out,
+ const Symbol_table* symtab)
+{
+ // This is just a wrapper of compute_final_local_value_internal.
+ const bool relocatable = parameters->options().relocatable();
+ const Output_sections& out_sections(this->output_sections());
+ const std::vector<Address>& out_offsets(this->section_offsets());
+ return this->compute_final_local_value_internal(r_sym, lv_in, lv_out,
+ relocatable, out_sections,
+ out_offsets, symtab);
+}
+
+// Finalize the local symbols. Here we set the final value in
+// THIS->LOCAL_VALUES_ and set their output symbol table indexes.
+// This function is always called from a singleton thread. The actual
+// output of the local symbols will occur in a separate task.
+
+template<int size, bool big_endian>
+unsigned int
+Sized_relobj_file<size, big_endian>::do_finalize_local_symbols(
+ unsigned int index,
+ off_t off,
+ Symbol_table* symtab)
+{
+ gold_assert(off == static_cast<off_t>(align_address(off, size >> 3)));
+
+ const unsigned int loccount = this->local_symbol_count_;
+ this->local_symbol_offset_ = off;
+
+ const bool relocatable = parameters->options().relocatable();
+ const Output_sections& out_sections(this->output_sections());
+ const std::vector<Address>& out_offsets(this->section_offsets());
+
+ for (unsigned int i = 1; i < loccount; ++i)
+ {
+ Symbol_value<size>* lv = &this->local_values_[i];
+
+ Compute_final_local_value_status cflv_status =
+ this->compute_final_local_value_internal(i, lv, lv, relocatable,
+ out_sections, out_offsets,
+ symtab);
+ switch (cflv_status)
+ {
+ case CFLV_OK:
+ if (!lv->is_output_symtab_index_set())
+ {
+ lv->set_output_symtab_index(index);
+ ++index;
+ }
+ break;
+ case CFLV_DISCARDED:
+ case CFLV_ERROR:
+ // Do nothing.
+ break;
+ default:
+ gold_unreachable();
+ }