// Finalize the sections.
void
- do_finalize_sections(Layout*, const Input_objects*);
+ do_finalize_sections(Layout*, const Input_objects*, Symbol_table*);
// Return the value to use for a dynamic which requires special
// treatment.
elfcpp::SHN_UNDEF, // small_common_shndx
elfcpp::SHN_X86_64_LCOMMON, // large_common_shndx
0, // small_common_section_flags
- elfcpp::SHF_X86_64_LARGE // large_common_section_flags
+ elfcpp::SHF_X86_64_LARGE, // large_common_section_flags
+ NULL, // attributes_section
+ NULL // attributes_vendor
};
// This is called when a new output section is created. This is where
os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
(elfcpp::SHF_ALLOC
| elfcpp::SHF_WRITE),
- this->got_, false);
- os->set_is_relro();
+ this->got_, false, true, true,
+ false);
- // The old GNU linker creates a .got.plt section. We just
- // create another set of data in the .got section. Note that we
- // always create a PLT if we create a GOT, although the PLT
- // might be empty.
this->got_plt_ = new Output_data_space(8, "** GOT PLT");
- os = layout->add_output_section_data(".got", elfcpp::SHT_PROGBITS,
+ os = layout->add_output_section_data(".got.plt", elfcpp::SHT_PROGBITS,
(elfcpp::SHF_ALLOC
| elfcpp::SHF_WRITE),
- this->got_plt_, false);
- os->set_is_relro();
+ this->got_plt_, false, false,
+ false, true);
// The first three entries are reserved.
this->got_plt_->set_current_data_size(3 * 8);
+ // Those bytes can go into the relro segment.
+ layout->increase_relro(3 * 8);
+
// Define _GLOBAL_OFFSET_TABLE_ at the start of the PLT.
symtab->define_in_output_data("_GLOBAL_OFFSET_TABLE_", NULL,
+ Symbol_table::PREDEFINED,
this->got_plt_,
0, 0, elfcpp::STT_OBJECT,
elfcpp::STB_LOCAL,
gold_assert(layout != NULL);
this->rela_dyn_ = new Reloc_section(parameters->options().combreloc());
layout->add_output_section_data(".rela.dyn", elfcpp::SHT_RELA,
- elfcpp::SHF_ALLOC, this->rela_dyn_, true);
+ elfcpp::SHF_ALLOC, this->rela_dyn_, true,
+ false, false, false);
}
return this->rela_dyn_;
}
{
this->rel_ = new Reloc_section(false);
layout->add_output_section_data(".rela.plt", elfcpp::SHT_RELA,
- elfcpp::SHF_ALLOC, this->rel_, true);
+ elfcpp::SHF_ALLOC, this->rel_, true,
+ false, false, false);
}
void
layout->add_output_section_data(".plt", elfcpp::SHT_PROGBITS,
(elfcpp::SHF_ALLOC
| elfcpp::SHF_EXECINSTR),
- this->plt_, false);
+ this->plt_, false, false, false, false);
}
}
{
bool is_exec = parameters->options().output_is_executable();
symtab->define_in_output_segment("_TLS_MODULE_BASE_", NULL,
+ Symbol_table::PREDEFINED,
tls_segment, 0, 0,
elfcpp::STT_TLS,
elfcpp::STB_LOCAL,
target->make_plt_entry(symtab, layout, gsym);
// Make a dynamic relocation if necessary.
int flags = Symbol::NON_PIC_REF;
- if (gsym->type() == elfcpp::STT_FUNC)
+ if (gsym->is_func())
flags |= Symbol::FUNCTION_CALL;
if (gsym->needs_dynamic_reloc(flags))
{
// Finalize the sections.
void
-Target_x86_64::do_finalize_sections(Layout* layout, const Input_objects*)
+Target_x86_64::do_finalize_sections(
+ Layout* layout,
+ const Input_objects*,
+ Symbol_table*)
{
// Fill in some more dynamic tags.
Output_data_dynamic* const odyn = layout->dynamic_data();
this->set_view_to_nop(view, view_size, fnoffset + 1, 8);
}
// lea NN(%rsp),%r10
- else if (this->match_view(view, view_size, fnoffset, "\x4c\x8d\x94\x24", 4)
+ // lea NN(%rsp),%r11
+ else if ((this->match_view(view, view_size, fnoffset,
+ "\x4c\x8d\x94\x24", 4)
+ || this->match_view(view, view_size, fnoffset,
+ "\x4c\x8d\x9c\x24", 4))
&& fnsize > 8)
{
// This is loading an offset from the stack pointer for a
if (!object->has_no_split_stack())
object->error(_("failed to match split-stack sequence at "
"section %u offset %0zx"),
- shndx, fnoffset);
+ shndx, static_cast<size_t>(fnoffset));
return;
}