diff options
author | Alan Modra <amodra@gmail.com> | 2015-02-23 16:45:05 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2015-02-26 14:09:50 +1030 |
commit | a127494f2dcad834743e613be4cfea39511ad5ec (patch) | |
tree | 50acf38638babae8ef62de680ed7d6c3c659f2ec /bfd/elf64-ppc.c | |
parent | e26e3344573513d33e99bca5c659bbbe3a9b647c (diff) | |
download | gdb-a127494f2dcad834743e613be4cfea39511ad5ec.zip gdb-a127494f2dcad834743e613be4cfea39511ad5ec.tar.gz gdb-a127494f2dcad834743e613be4cfea39511ad5ec.tar.bz2 |
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.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r-- | bfd/elf64-ppc.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index a2ddb41..1573e30 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -7089,6 +7089,13 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, if (!h->def_dynamic || !h->ref_regular || h->def_regular) 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 we'll be keeping the dynamic relocs and avoiding the copy reloc. */ if (ELIMINATE_COPY_RELOCS && !readonly_dynrelocs (h)) @@ -7097,6 +7104,16 @@ ppc64_elf_adjust_dynamic_symbol (struct bfd_link_info *info, 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) { /* We should never get here, but unfortunately there are versions |