* layout.cc (Layout::add_target_dynamic_tags): If

dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
	plt_rel.
This commit is contained in:
Ian Lance Taylor
2012-08-07 13:24:47 +00:00
parent e2de53900e
commit 82435b3b3d
2 changed files with 22 additions and 9 deletions

View File

@ -1,3 +1,9 @@
2012-08-07 Ian Lance Taylor <iant@google.com>
* layout.cc (Layout::add_target_dynamic_tags): If
dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
plt_rel.
2012-07-30 Nick Clifton <nickc@redhat.com> 2012-07-30 Nick Clifton <nickc@redhat.com>
* po/gold.pot: Updated template. * po/gold.pot: Updated template.

View File

@ -4341,19 +4341,26 @@ Layout::add_target_dynamic_tags(bool use_rel, const Output_data* plt_got,
use_rel ? elfcpp::DT_REL : elfcpp::DT_RELA); use_rel ? elfcpp::DT_REL : elfcpp::DT_RELA);
} }
if (dyn_rel != NULL && dyn_rel->output_section() != NULL) if ((dyn_rel != NULL && dyn_rel->output_section() != NULL)
|| (dynrel_includes_plt
&& plt_rel != NULL
&& plt_rel->output_section() != NULL))
{ {
bool have_dyn_rel = dyn_rel != NULL && dyn_rel->output_section() != NULL;
bool have_plt_rel = plt_rel != NULL && plt_rel->output_section() != NULL;
odyn->add_section_address(use_rel ? elfcpp::DT_REL : elfcpp::DT_RELA, odyn->add_section_address(use_rel ? elfcpp::DT_REL : elfcpp::DT_RELA,
dyn_rel->output_section()); (have_dyn_rel
if (plt_rel != NULL ? dyn_rel->output_section()
&& plt_rel->output_section() != NULL : plt_rel->output_section()));
&& dynrel_includes_plt) elfcpp::DT size_tag = use_rel ? elfcpp::DT_RELSZ : elfcpp::DT_RELASZ;
odyn->add_section_size(use_rel ? elfcpp::DT_RELSZ : elfcpp::DT_RELASZ, if (have_dyn_rel && have_plt_rel && dynrel_includes_plt)
odyn->add_section_size(size_tag,
dyn_rel->output_section(), dyn_rel->output_section(),
plt_rel->output_section()); plt_rel->output_section());
else if (have_dyn_rel)
odyn->add_section_size(size_tag, dyn_rel->output_section());
else else
odyn->add_section_size(use_rel ? elfcpp::DT_RELSZ : elfcpp::DT_RELASZ, odyn->add_section_size(size_tag, plt_rel->output_section());
dyn_rel->output_section());
const int size = parameters->target().get_size(); const int size = parameters->target().get_size();
elfcpp::DT rel_tag; elfcpp::DT rel_tag;
int rel_size; int rel_size;
@ -4379,7 +4386,7 @@ Layout::add_target_dynamic_tags(bool use_rel, const Output_data* plt_got,
} }
odyn->add_constant(rel_tag, rel_size); odyn->add_constant(rel_tag, rel_size);
if (parameters->options().combreloc()) if (parameters->options().combreloc() && have_dyn_rel)
{ {
size_t c = dyn_rel->relative_reloc_count(); size_t c = dyn_rel->relative_reloc_count();
if (c > 0) if (c > 0)