+ // Write the target-specific symbols.
+ for (std::vector<Symbol*>::const_iterator p = this->target_symbols_.begin();
+ p != this->target_symbols_.end();
+ ++p)
+ {
+ Sized_symbol<size>* sym = static_cast<Sized_symbol<size>*>(*p);
+
+ unsigned int sym_index = sym->symtab_index();
+ unsigned int dynsym_index;
+ if (dynamic_view == NULL)
+ dynsym_index = -1U;
+ else
+ dynsym_index = sym->dynsym_index();
+
+ unsigned int shndx;
+ switch (sym->source())
+ {
+ case Symbol::IS_CONSTANT:
+ shndx = elfcpp::SHN_ABS;
+ break;
+ case Symbol::IS_UNDEFINED:
+ shndx = elfcpp::SHN_UNDEF;
+ break;
+ default:
+ gold_unreachable();
+ }
+
+ if (sym_index != -1U)
+ {
+ sym_index -= first_global_index;
+ gold_assert(sym_index < output_count);
+ unsigned char* ps = psyms + (sym_index * sym_size);
+ this->sized_write_symbol<size, big_endian>(sym, sym->value(), shndx,
+ sym->binding(), sympool,
+ ps);
+ }
+
+ if (dynsym_index != -1U)
+ {
+ 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<size, big_endian>(sym, sym->value(), shndx,
+ sym->binding(), dynpool,
+ pd);
+ }
+ }
+