mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 12:23:31 +08:00
microblaze: Check UNDEFWEAK_NO_DYNAMIC_RELOC
Don't generate dynamic relocation against weak undefined symbol if it is resolved to zero. FIXME: UNDEFWEAK_NO_DYNAMIC_RELOC may need to be checked in more places. PR ld/22269 * elf32-microblaze.c (microblaze_elf_relocate_section): Don't generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is true. (allocate_dynrelocs): Discard dynamic relocations if UNDEFWEAK_NO_DYNAMIC_RELOC is true.
This commit is contained in:
@ -1,3 +1,12 @@
|
|||||||
|
2017-10-14 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR ld/22269
|
||||||
|
* elf32-microblaze.c (microblaze_elf_relocate_section): Don't
|
||||||
|
generate dynamic relocation if UNDEFWEAK_NO_DYNAMIC_RELOC is
|
||||||
|
true.
|
||||||
|
(allocate_dynrelocs): Discard dynamic relocations if
|
||||||
|
UNDEFWEAK_NO_DYNAMIC_RELOC is true.
|
||||||
|
|
||||||
2017-10-14 H.J. Lu <hongjiu.lu@intel.com>
|
2017-10-14 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
PR ld/22269
|
PR ld/22269
|
||||||
|
@ -1002,6 +1002,7 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
bfd_vma relocation;
|
bfd_vma relocation;
|
||||||
|
bfd_boolean resolved_to_zero;
|
||||||
|
|
||||||
/* This is a final link. */
|
/* This is a final link. */
|
||||||
sym = NULL;
|
sym = NULL;
|
||||||
@ -1041,6 +1042,9 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
|||||||
goto check_reloc;
|
goto check_reloc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resolved_to_zero = (h != NULL
|
||||||
|
&& UNDEFWEAK_NO_DYNAMIC_RELOC (info, h));
|
||||||
|
|
||||||
switch ((int) r_type)
|
switch ((int) r_type)
|
||||||
{
|
{
|
||||||
case (int) R_MICROBLAZE_SRO32 :
|
case (int) R_MICROBLAZE_SRO32 :
|
||||||
@ -1257,7 +1261,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
|||||||
/* Need to generate relocs ? */
|
/* Need to generate relocs ? */
|
||||||
if ((bfd_link_pic (info) || indx != 0)
|
if ((bfd_link_pic (info) || indx != 0)
|
||||||
&& (h == NULL
|
&& (h == NULL
|
||||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
|| (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||||
|
&& !resolved_to_zero)
|
||||||
|| h->root.type != bfd_link_hash_undefweak))
|
|| h->root.type != bfd_link_hash_undefweak))
|
||||||
need_relocs = TRUE;
|
need_relocs = TRUE;
|
||||||
|
|
||||||
@ -1432,7 +1437,8 @@ microblaze_elf_relocate_section (bfd *output_bfd,
|
|||||||
|
|
||||||
if ((bfd_link_pic (info)
|
if ((bfd_link_pic (info)
|
||||||
&& (h == NULL
|
&& (h == NULL
|
||||||
|| ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
|| (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|
||||||
|
&& !resolved_to_zero)
|
||||||
|| h->root.type != bfd_link_hash_undefweak)
|
|| h->root.type != bfd_link_hash_undefweak)
|
||||||
&& (!howto->pc_relative
|
&& (!howto->pc_relative
|
||||||
|| (h != NULL
|
|| (h != NULL
|
||||||
@ -2861,6 +2867,8 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void * dat)
|
|||||||
pp = &p->next;
|
pp = &p->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (UNDEFWEAK_NO_DYNAMIC_RELOC (info, h))
|
||||||
|
eh->dyn_relocs = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user