summaryrefslogtreecommitdiff
path: root/bfd/elf32-i386.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-09-04 16:26:08 +0000
committerIan Lance Taylor <ian@airs.com>1999-09-04 16:26:08 +0000
commit1003101ff92657906ae1f4ce5102210c4a312541 (patch)
tree007b7d4e4b119fdc86cdd2fedd043ff87584c3c2 /bfd/elf32-i386.c
parent0a952ac3cd0f1dfa38d1add426d3aa265114a1b4 (diff)
downloadgdb-1003101ff92657906ae1f4ce5102210c4a312541.tar.gz
* elf-bfd.h (ELF_LINK_NON_GOT_REF): Define.
* elflink.h (elf_adjust_dynamic_symbol): Copy REF_REGULAR_NONWEAK and NON_GOT_REF from weak defined symbol to real symbol. * elf32-i386.c (elf_i386_check_relocs): Set NON_GOT_REF. (elf_i386_adjust_dynamic_symbol): If NON_GOT_REF is not set, don't create a COPY reloc. * elf32-sparc.c (elf32_sparc_check_relocs): Set NON_GOT_REF. (elf32_sparc_adjust_dynamic_symbol): If NON_GOT_REF is not set, don't create a COPY reloc.
Diffstat (limited to 'bfd/elf32-i386.c')
-rw-r--r--bfd/elf32-i386.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c
index 0790af5eb0b..33514ac9bff 100644
--- a/bfd/elf32-i386.c
+++ b/bfd/elf32-i386.c
@@ -591,6 +591,9 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
case R_386_32:
case R_386_PC32:
+ if (h != NULL)
+ h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
+
/* If we are creating a shared library, and this is a reloc
against a global symbol, or a non PC relative reloc
against a local symbol, then we need to copy the reloc
@@ -889,6 +892,11 @@ elf_i386_adjust_dynamic_symbol (info, h)
if (info->shared)
return true;
+ /* If there are no references to this symbol that do not use the
+ GOT, we don't need to generate a copy reloc. */
+ if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
+ return true;
+
/* We must allocate the symbol in our .dynbss section, which will
become part of the .bss section of the executable. There will be
an entry for this symbol in the .dynsym section. The dynamic