mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 20:28:28 +08:00
Alpha DT_RELA
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
This commit is contained in:
@ -1,3 +1,8 @@
|
|||||||
|
2017-02-21 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Only emit
|
||||||
|
DT_RELA, DT_RELASZ, and DT_RELAENT when DT_RELASZ is non-zero.
|
||||||
|
|
||||||
2017-02-20 Alan Modra <amodra@gmail.com>
|
2017-02-20 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
PR 21181
|
PR 21181
|
||||||
|
@ -2879,7 +2879,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||||||
{
|
{
|
||||||
bfd *dynobj;
|
bfd *dynobj;
|
||||||
asection *s;
|
asection *s;
|
||||||
bfd_boolean relplt;
|
bfd_boolean relplt, relocs;
|
||||||
struct alpha_elf_link_hash_table * htab;
|
struct alpha_elf_link_hash_table * htab;
|
||||||
|
|
||||||
htab = alpha_elf_hash_table (info);
|
htab = alpha_elf_hash_table (info);
|
||||||
@ -2916,6 +2916,7 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||||||
determined the sizes of the various dynamic sections. Allocate
|
determined the sizes of the various dynamic sections. Allocate
|
||||||
memory for them. */
|
memory for them. */
|
||||||
relplt = FALSE;
|
relplt = FALSE;
|
||||||
|
relocs = FALSE;
|
||||||
for (s = dynobj->sections; s != NULL; s = s->next)
|
for (s = dynobj->sections; s != NULL; s = s->next)
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
@ -2933,6 +2934,8 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||||||
{
|
{
|
||||||
if (strcmp (name, ".rela.plt") == 0)
|
if (strcmp (name, ".rela.plt") == 0)
|
||||||
relplt = TRUE;
|
relplt = TRUE;
|
||||||
|
else
|
||||||
|
relocs = TRUE;
|
||||||
|
|
||||||
/* We use the reloc_count field as a counter if we need
|
/* We use the reloc_count field as a counter if we need
|
||||||
to copy relocs into the output file. */
|
to copy relocs into the output file. */
|
||||||
@ -2997,15 +3000,18 @@ elf64_alpha_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!add_dynamic_entry (DT_RELA, 0)
|
if (relocs)
|
||||||
|| !add_dynamic_entry (DT_RELASZ, 0)
|
|
||||||
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (info->flags & DF_TEXTREL)
|
|
||||||
{
|
{
|
||||||
if (!add_dynamic_entry (DT_TEXTREL, 0))
|
if (!add_dynamic_entry (DT_RELA, 0)
|
||||||
|
|| !add_dynamic_entry (DT_RELASZ, 0)
|
||||||
|
|| !add_dynamic_entry (DT_RELAENT, sizeof (Elf64_External_Rela)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (info->flags & DF_TEXTREL)
|
||||||
|
{
|
||||||
|
if (!add_dynamic_entry (DT_TEXTREL, 0))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#undef add_dynamic_entry
|
#undef add_dynamic_entry
|
||||||
|
Reference in New Issue
Block a user