mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 03:29:47 +08:00
Use dynamic text relocs for protected vars
Rather than reporting a link error on attempting to use dynbss for protected vars, use dynamic text relocs. * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Heed -z nocopyreloc. Use text relocs rather than giving an error on trying to use .dynbss for protected shared lib vars. * elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2015-02-26 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Heed -z nocopyreloc.
|
||||||
|
Use text relocs rather than giving an error on trying to use
|
||||||
|
.dynbss for protected shared lib vars.
|
||||||
|
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
|
||||||
|
|
||||||
2015-02-25 Andrew Burgess <andrew.burgess@embecosm.com>
|
2015-02-25 Andrew Burgess <andrew.burgess@embecosm.com>
|
||||||
|
|
||||||
* elf32-avr.c (struct elf_avr_section_data): New structure.
|
* elf32-avr.c (struct elf_avr_section_data): New structure.
|
||||||
|
@ -5582,6 +5582,13 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
|||||||
if (!h->non_got_ref)
|
if (!h->non_got_ref)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* If -z nocopyreloc was given, we won't generate them either. */
|
||||||
|
if (info->nocopyreloc)
|
||||||
|
{
|
||||||
|
h->non_got_ref = 0;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* If we didn't find any dynamic relocs in read-only sections, then
|
/* If we didn't find any dynamic relocs in read-only sections, then
|
||||||
we'll be keeping the dynamic relocs and avoiding the copy reloc.
|
we'll be keeping the dynamic relocs and avoiding the copy reloc.
|
||||||
We can't do this if there are any small data relocations. This
|
We can't do this if there are any small data relocations. This
|
||||||
@ -5598,6 +5605,16 @@ ppc_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Protected variables do not work with .dynbss. The copy in
|
||||||
|
.dynbss won't be used by the shared library with the protected
|
||||||
|
definition for the variable. Text relocations are preferable
|
||||||
|
to an incorrect program. */
|
||||||
|
if (h->protected_def)
|
||||||
|
{
|
||||||
|
h->non_got_ref = 0;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* We must allocate the symbol in our .dynbss section, which will
|
/* We must allocate the symbol in our .dynbss section, which will
|
||||||
become part of the .bss section of the executable. There will be
|
become part of the .bss section of the executable. There will be
|
||||||
an entry for this symbol in the .dynsym section. The dynamic
|
an entry for this symbol in the .dynsym section. The dynamic
|
||||||
|
@ -7089,6 +7089,13 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
|||||||
if (!h->def_dynamic || !h->ref_regular || h->def_regular)
|
if (!h->def_dynamic || !h->ref_regular || h->def_regular)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
/* If -z nocopyreloc was given, don't generate them either. */
|
||||||
|
if (info->nocopyreloc)
|
||||||
|
{
|
||||||
|
h->non_got_ref = 0;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* If we didn't find any dynamic relocs in read-only sections, then
|
/* If we didn't find any dynamic relocs in read-only sections, then
|
||||||
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
|
we'll be keeping the dynamic relocs and avoiding the copy reloc. */
|
||||||
if (ELIMINATE_COPY_RELOCS && !readonly_dynrelocs (h))
|
if (ELIMINATE_COPY_RELOCS && !readonly_dynrelocs (h))
|
||||||
@ -7097,6 +7104,16 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Protected variables do not work with .dynbss. The copy in
|
||||||
|
.dynbss won't be used by the shared library with the protected
|
||||||
|
definition for the variable. Text relocations are preferable
|
||||||
|
to an incorrect program. */
|
||||||
|
if (h->protected_def)
|
||||||
|
{
|
||||||
|
h->non_got_ref = 0;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (h->plt.plist != NULL)
|
if (h->plt.plist != NULL)
|
||||||
{
|
{
|
||||||
/* We should never get here, but unfortunately there are versions
|
/* We should never get here, but unfortunately there are versions
|
||||||
|
Reference in New Issue
Block a user