mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 04:49:54 +08:00
* elf64-ppc.c (ppc64_elf_edit_toc): Clear "repeat" inside
loop. Really mark toc entry referring to another toc entry only if the first is used.
This commit is contained in:
@ -1,3 +1,9 @@
|
||||
2012-11-05 Alan Modra <amodra@gmail.com>
|
||||
|
||||
* elf64-ppc.c (ppc64_elf_edit_toc): Clear "repeat" inside
|
||||
loop. Really mark toc entry referring to another toc entry
|
||||
only if the first is used.
|
||||
|
||||
2012-10-30 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
* configure.in: Also handle --enable-64-bit-bfd when setting
|
||||
|
@ -8372,8 +8372,9 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
|
||||
goto error_ret;
|
||||
|
||||
/* Mark toc entries referenced as used. */
|
||||
repeat = 0;
|
||||
do
|
||||
{
|
||||
repeat = 0;
|
||||
for (rel = relstart; rel < relstart + sec->reloc_count; ++rel)
|
||||
{
|
||||
enum elf_ppc64_reloc_type r_type;
|
||||
@ -8487,8 +8488,10 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
|
||||
break;
|
||||
|
||||
case R_PPC64_TOC16_LO_DS:
|
||||
off = rel->r_offset + (bfd_big_endian (ibfd) ? -2 : 3);
|
||||
if (!bfd_get_section_contents (ibfd, sec, &opc, off, 1))
|
||||
off = rel->r_offset;
|
||||
off += (bfd_big_endian (ibfd) ? -2 : 3);
|
||||
if (!bfd_get_section_contents (ibfd, sec, &opc,
|
||||
off, 1))
|
||||
{
|
||||
free (used);
|
||||
goto error_ret;
|
||||
@ -8504,18 +8507,21 @@ ppc64_elf_edit_toc (struct bfd_link_info *info)
|
||||
}
|
||||
}
|
||||
|
||||
/* For the toc section, we only mark as used if
|
||||
this entry itself isn't unused. */
|
||||
if (sec == toc
|
||||
&& !used[val >> 3]
|
||||
&& (used[rel->r_offset >> 3]
|
||||
|| !(skip[rel->r_offset >> 3] & ref_from_discarded)))
|
||||
if (sec != toc)
|
||||
used[val >> 3] = 1;
|
||||
/* For the toc section, we only mark as used if this
|
||||
entry itself isn't unused. */
|
||||
else if ((used[rel->r_offset >> 3]
|
||||
|| !(skip[rel->r_offset >> 3] & ref_from_discarded))
|
||||
&& !used[val >> 3])
|
||||
{
|
||||
/* Do all the relocs again, to catch reference
|
||||
chains. */
|
||||
repeat = 1;
|
||||
|
||||
used[val >> 3] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
while (repeat);
|
||||
|
||||
if (elf_section_data (sec)->relocs != relstart)
|
||||
|
Reference in New Issue
Block a user