* elf64-x86-64.c: Convert to ISO C90 prototypes, remove

unnecessary prototypes.  Replace PTR with void *.
This commit is contained in:
Andreas Jaeger 2003-06-29 05:57:36 +00:00
parent 43d5792ce1
commit 27482721cf
2 changed files with 72 additions and 175 deletions

View File

@ -1,3 +1,8 @@
2003-06-29 Andreas Jaeger <aj@suse.de>
* elf64-x86-64.c: Convert to ISO C90 prototypes, remove
unnecessary prototypes. Replace PTR with void *.
2003-06-29 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de> 2003-06-29 Thiemo Seufer <seufer@csv.ica.uni-stuttgart.de>
* elfxx-mips.c: Allow lazy binding for R_MIPS_JALR. * elfxx-mips.c: Allow lazy binding for R_MIPS_JALR.

View File

@ -150,72 +150,14 @@ static const struct elf_reloc_map x86_64_reloc_map[] =
{ BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, }, { BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, },
}; };
static reloc_howto_type *elf64_x86_64_reloc_type_lookup
PARAMS ((bfd *, bfd_reloc_code_real_type));
static void elf64_x86_64_info_to_howto
PARAMS ((bfd *, arelent *, Elf_Internal_Rela *));
static bfd_boolean elf64_x86_64_grok_prstatus
PARAMS ((bfd *, Elf_Internal_Note *));
static bfd_boolean elf64_x86_64_grok_psinfo
PARAMS ((bfd *, Elf_Internal_Note *));
static struct bfd_link_hash_table *elf64_x86_64_link_hash_table_create
PARAMS ((bfd *));
static int elf64_x86_64_tls_transition
PARAMS ((struct bfd_link_info *, int, int));
static bfd_boolean elf64_x86_64_mkobject
PARAMS((bfd *));
static bfd_boolean elf64_x86_64_elf_object_p PARAMS ((bfd *abfd));
static bfd_boolean create_got_section
PARAMS((bfd *, struct bfd_link_info *));
static bfd_boolean elf64_x86_64_create_dynamic_sections
PARAMS((bfd *, struct bfd_link_info *));
static void elf64_x86_64_copy_indirect_symbol
PARAMS ((struct elf_backend_data *, struct elf_link_hash_entry *,
struct elf_link_hash_entry *));
static bfd_boolean elf64_x86_64_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *sec,
const Elf_Internal_Rela *));
static asection *elf64_x86_64_gc_mark_hook
PARAMS ((asection *, struct bfd_link_info *, Elf_Internal_Rela *,
struct elf_link_hash_entry *, Elf_Internal_Sym *));
static bfd_boolean elf64_x86_64_gc_sweep_hook
PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *));
static struct bfd_hash_entry *link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static bfd_boolean elf64_x86_64_adjust_dynamic_symbol
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
static bfd_boolean allocate_dynrelocs
PARAMS ((struct elf_link_hash_entry *, PTR));
static bfd_boolean readonly_dynrelocs
PARAMS ((struct elf_link_hash_entry *, PTR));
static bfd_boolean elf64_x86_64_size_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static bfd_vma dtpoff_base
PARAMS ((struct bfd_link_info *));
static bfd_vma tpoff
PARAMS ((struct bfd_link_info *, bfd_vma));
static bfd_boolean elf64_x86_64_relocate_section
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
static bfd_boolean elf64_x86_64_finish_dynamic_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
Elf_Internal_Sym *sym));
static bfd_boolean elf64_x86_64_finish_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *));
static enum elf_reloc_type_class elf64_x86_64_reloc_type_class
PARAMS ((const Elf_Internal_Rela *));
/* Given a BFD reloc type, return a HOWTO structure. */ /* Given a BFD reloc type, return a HOWTO structure. */
static reloc_howto_type * static reloc_howto_type *
elf64_x86_64_reloc_type_lookup (abfd, code) elf64_x86_64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
bfd *abfd ATTRIBUTE_UNUSED; bfd_reloc_code_real_type code)
bfd_reloc_code_real_type code;
{ {
unsigned int i; unsigned int i;
for (i = 0; i < sizeof (x86_64_reloc_map) / sizeof (struct elf_reloc_map); for (i = 0; i < sizeof (x86_64_reloc_map) / sizeof (struct elf_reloc_map);
i++) i++)
{ {
@ -228,10 +170,8 @@ elf64_x86_64_reloc_type_lookup (abfd, code)
/* Given an x86_64 ELF reloc type, fill in an arelent structure. */ /* Given an x86_64 ELF reloc type, fill in an arelent structure. */
static void static void
elf64_x86_64_info_to_howto (abfd, cache_ptr, dst) elf64_x86_64_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *cache_ptr,
bfd *abfd ATTRIBUTE_UNUSED; Elf_Internal_Rela *dst)
arelent *cache_ptr;
Elf_Internal_Rela *dst;
{ {
unsigned r_type, i; unsigned r_type, i;
@ -252,9 +192,7 @@ elf64_x86_64_info_to_howto (abfd, cache_ptr, dst)
/* Support for core dump NOTE sections. */ /* Support for core dump NOTE sections. */
static bfd_boolean static bfd_boolean
elf64_x86_64_grok_prstatus (abfd, note) elf64_x86_64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note)
bfd *abfd;
Elf_Internal_Note *note;
{ {
int offset; int offset;
size_t raw_size; size_t raw_size;
@ -286,9 +224,7 @@ elf64_x86_64_grok_prstatus (abfd, note)
} }
static bfd_boolean static bfd_boolean
elf64_x86_64_grok_psinfo (abfd, note) elf64_x86_64_grok_psinfo (bfd *abfd, Elf_Internal_Note *note)
bfd *abfd;
Elf_Internal_Note *note;
{ {
switch (note->descsz) switch (note->descsz)
{ {
@ -447,10 +383,8 @@ struct elf64_x86_64_link_hash_table
/* Create an entry in an x86-64 ELF linker hash table. */ /* Create an entry in an x86-64 ELF linker hash table. */
static struct bfd_hash_entry * static struct bfd_hash_entry *
link_hash_newfunc (entry, table, string) link_hash_newfunc (struct bfd_hash_entry *entry, struct bfd_hash_table *table,
struct bfd_hash_entry *entry; const char *string)
struct bfd_hash_table *table;
const char *string;
{ {
/* Allocate the structure if it has not already been allocated by a /* Allocate the structure if it has not already been allocated by a
subclass. */ subclass. */
@ -479,8 +413,7 @@ link_hash_newfunc (entry, table, string)
/* Create an X86-64 ELF linker hash table. */ /* Create an X86-64 ELF linker hash table. */
static struct bfd_link_hash_table * static struct bfd_link_hash_table *
elf64_x86_64_link_hash_table_create (abfd) elf64_x86_64_link_hash_table_create (bfd *abfd)
bfd *abfd;
{ {
struct elf64_x86_64_link_hash_table *ret; struct elf64_x86_64_link_hash_table *ret;
bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table); bfd_size_type amt = sizeof (struct elf64_x86_64_link_hash_table);
@ -512,9 +445,7 @@ elf64_x86_64_link_hash_table_create (abfd)
shortcuts to them in our hash table. */ shortcuts to them in our hash table. */
static bfd_boolean static bfd_boolean
create_got_section (dynobj, info) create_got_section (bfd *dynobj, struct bfd_link_info *info)
bfd *dynobj;
struct bfd_link_info *info;
{ {
struct elf64_x86_64_link_hash_table *htab; struct elf64_x86_64_link_hash_table *htab;
@ -543,9 +474,7 @@ create_got_section (dynobj, info)
hash table. */ hash table. */
static bfd_boolean static bfd_boolean
elf64_x86_64_create_dynamic_sections (dynobj, info) elf64_x86_64_create_dynamic_sections (bfd *dynobj, struct bfd_link_info *info)
bfd *dynobj;
struct bfd_link_info *info;
{ {
struct elf64_x86_64_link_hash_table *htab; struct elf64_x86_64_link_hash_table *htab;
@ -572,9 +501,9 @@ elf64_x86_64_create_dynamic_sections (dynobj, info)
/* Copy the extra info we tack onto an elf_link_hash_entry. */ /* Copy the extra info we tack onto an elf_link_hash_entry. */
static void static void
elf64_x86_64_copy_indirect_symbol (bed, dir, ind) elf64_x86_64_copy_indirect_symbol (struct elf_backend_data *bed,
struct elf_backend_data *bed; struct elf_link_hash_entry *dir,
struct elf_link_hash_entry *dir, *ind; struct elf_link_hash_entry *ind)
{ {
struct elf64_x86_64_link_hash_entry *edir, *eind; struct elf64_x86_64_link_hash_entry *edir, *eind;
@ -637,8 +566,7 @@ elf64_x86_64_copy_indirect_symbol (bed, dir, ind)
} }
static bfd_boolean static bfd_boolean
elf64_x86_64_mkobject (abfd) elf64_x86_64_mkobject (bfd *abfd)
bfd *abfd;
{ {
bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata); bfd_size_type amt = sizeof (struct elf64_x86_64_obj_tdata);
abfd->tdata.any = bfd_zalloc (abfd, amt); abfd->tdata.any = bfd_zalloc (abfd, amt);
@ -648,8 +576,7 @@ elf64_x86_64_mkobject (abfd)
} }
static bfd_boolean static bfd_boolean
elf64_x86_64_elf_object_p (abfd) elf64_x86_64_elf_object_p (bfd *abfd)
bfd *abfd;
{ {
/* Allocate our special target data. */ /* Allocate our special target data. */
struct elf64_x86_64_obj_tdata *new_tdata; struct elf64_x86_64_obj_tdata *new_tdata;
@ -665,10 +592,7 @@ elf64_x86_64_elf_object_p (abfd)
} }
static int static int
elf64_x86_64_tls_transition (info, r_type, is_local) elf64_x86_64_tls_transition (struct bfd_link_info *info, int r_type, int is_local)
struct bfd_link_info *info;
int r_type;
int is_local;
{ {
if (info->shared) if (info->shared)
return r_type; return r_type;
@ -692,11 +616,8 @@ elf64_x86_64_tls_transition (info, r_type, is_local)
linkage table, and dynamic reloc sections. */ linkage table, and dynamic reloc sections. */
static bfd_boolean static bfd_boolean
elf64_x86_64_check_relocs (abfd, info, sec, relocs) elf64_x86_64_check_relocs (bfd *abfd, struct bfd_link_info *info, asection *sec,
bfd *abfd; const Elf_Internal_Rela *relocs)
struct bfd_link_info *info;
asection *sec;
const Elf_Internal_Rela *relocs;
{ {
struct elf64_x86_64_link_hash_table *htab; struct elf64_x86_64_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
@ -1060,12 +981,11 @@ elf64_x86_64_check_relocs (abfd, info, sec, relocs)
relocation. */ relocation. */
static asection * static asection *
elf64_x86_64_gc_mark_hook (sec, info, rel, h, sym) elf64_x86_64_gc_mark_hook (asection *sec,
asection *sec; struct bfd_link_info *info ATTRIBUTE_UNUSED,
struct bfd_link_info *info ATTRIBUTE_UNUSED; Elf_Internal_Rela *rel,
Elf_Internal_Rela *rel; struct elf_link_hash_entry *h,
struct elf_link_hash_entry *h; Elf_Internal_Sym *sym)
Elf_Internal_Sym *sym;
{ {
if (h != NULL) if (h != NULL)
{ {
@ -1099,11 +1019,8 @@ elf64_x86_64_gc_mark_hook (sec, info, rel, h, sym)
/* Update the got entry reference counts for the section being removed. */ /* Update the got entry reference counts for the section being removed. */
static bfd_boolean static bfd_boolean
elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs) elf64_x86_64_gc_sweep_hook (bfd *abfd, struct bfd_link_info *info,
bfd *abfd; asection *sec, const Elf_Internal_Rela *relocs)
struct bfd_link_info *info;
asection *sec;
const Elf_Internal_Rela *relocs;
{ {
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
struct elf_link_hash_entry **sym_hashes; struct elf_link_hash_entry **sym_hashes;
@ -1202,9 +1119,8 @@ elf64_x86_64_gc_sweep_hook (abfd, info, sec, relocs)
understand. */ understand. */
static bfd_boolean static bfd_boolean
elf64_x86_64_adjust_dynamic_symbol (info, h) elf64_x86_64_adjust_dynamic_symbol (struct bfd_link_info *info,
struct bfd_link_info *info; struct elf_link_hash_entry *h)
struct elf_link_hash_entry *h;
{ {
struct elf64_x86_64_link_hash_table *htab; struct elf64_x86_64_link_hash_table *htab;
asection *s; asection *s;
@ -1217,11 +1133,9 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
|| (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0) || (h->elf_link_hash_flags & ELF_LINK_HASH_NEEDS_PLT) != 0)
{ {
if (h->plt.refcount <= 0 if (h->plt.refcount <= 0
|| (! info->shared || SYMBOL_CALLS_LOCAL (info, h)
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) == 0 || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
&& (h->elf_link_hash_flags & ELF_LINK_HASH_REF_DYNAMIC) == 0 && h->root.type == bfd_link_hash_undefweak))
&& h->root.type != bfd_link_hash_undefweak
&& h->root.type != bfd_link_hash_undefined))
{ {
/* This case can occur if we saw a PLT32 reloc in an input /* This case can occur if we saw a PLT32 reloc in an input
file, but the symbol was never referred to by a dynamic file, but the symbol was never referred to by a dynamic
@ -1355,9 +1269,9 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
will be called from elflink.h. If elflink.h doesn't call our will be called from elflink.h. If elflink.h doesn't call our
finish_dynamic_symbol routine, we'll need to do something about finish_dynamic_symbol routine, we'll need to do something about
initializing any .plt and .got entries in elf64_x86_64_relocate_section. */ initializing any .plt and .got entries in elf64_x86_64_relocate_section. */
#define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, INFO, H) \ #define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
((DYN) \ ((DYN) \
&& ((INFO)->shared \ && ((SHARED) \
|| ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \ || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) == 0) \
&& ((H)->dynindx != -1 \ && ((H)->dynindx != -1 \
|| ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0)) || ((H)->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0))
@ -1366,9 +1280,7 @@ elf64_x86_64_adjust_dynamic_symbol (info, h)
dynamic relocs. */ dynamic relocs. */
static bfd_boolean static bfd_boolean
allocate_dynrelocs (h, inf) allocate_dynrelocs (struct elf_link_hash_entry *h, void * inf)
struct elf_link_hash_entry *h;
PTR inf;
{ {
struct bfd_link_info *info; struct bfd_link_info *info;
struct elf64_x86_64_link_hash_table *htab; struct elf64_x86_64_link_hash_table *htab;
@ -1385,9 +1297,7 @@ allocate_dynrelocs (h, inf)
htab = elf64_x86_64_hash_table (info); htab = elf64_x86_64_hash_table (info);
if (htab->elf.dynamic_sections_created if (htab->elf.dynamic_sections_created
&& h->plt.refcount > 0 && h->plt.refcount > 0)
&& (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak))
{ {
/* Make sure this symbol is output as a dynamic symbol. /* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */ Undefined weak syms won't yet be marked as dynamic. */
@ -1398,7 +1308,8 @@ allocate_dynrelocs (h, inf)
return FALSE; return FALSE;
} }
if (WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, info, h)) if (info->shared
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h))
{ {
asection *s = htab->splt; asection *s = htab->splt;
@ -1482,7 +1393,8 @@ allocate_dynrelocs (h, inf)
htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela); htab->srelgot->_raw_size += 2 * sizeof (Elf64_External_Rela);
else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT else if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT
|| h->root.type != bfd_link_hash_undefweak) || h->root.type != bfd_link_hash_undefweak)
&& WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h)) && (info->shared
|| WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h)))
htab->srelgot->_raw_size += sizeof (Elf64_External_Rela); htab->srelgot->_raw_size += sizeof (Elf64_External_Rela);
} }
else else
@ -1500,9 +1412,13 @@ allocate_dynrelocs (h, inf)
if (info->shared) if (info->shared)
{ {
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) != 0 /* Relocs that use pc_count are those that appear on a call
&& ((h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL) != 0 insn, or certain REL relocs that can generated via assembly.
|| info->symbolic)) We want calls to protected symbols to resolve directly to the
function rather than going via the plt. If people want
function pointer comparisons to work as expected then they
should avoid writing weird assembly. */
if (SYMBOL_CALLS_LOCAL (info, h))
{ {
struct elf64_x86_64_dyn_relocs **pp; struct elf64_x86_64_dyn_relocs **pp;
@ -1569,9 +1485,7 @@ allocate_dynrelocs (h, inf)
/* Find any dynamic relocs that apply to read-only sections. */ /* Find any dynamic relocs that apply to read-only sections. */
static bfd_boolean static bfd_boolean
readonly_dynrelocs (h, inf) readonly_dynrelocs (struct elf_link_hash_entry *h, void * inf)
struct elf_link_hash_entry *h;
PTR inf;
{ {
struct elf64_x86_64_link_hash_entry *eh; struct elf64_x86_64_link_hash_entry *eh;
struct elf64_x86_64_dyn_relocs *p; struct elf64_x86_64_dyn_relocs *p;
@ -1600,9 +1514,8 @@ readonly_dynrelocs (h, inf)
/* Set the sizes of the dynamic sections. */ /* Set the sizes of the dynamic sections. */
static bfd_boolean static bfd_boolean
elf64_x86_64_size_dynamic_sections (output_bfd, info) elf64_x86_64_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED; struct bfd_link_info *info)
struct bfd_link_info *info;
{ {
struct elf64_x86_64_link_hash_table *htab; struct elf64_x86_64_link_hash_table *htab;
bfd *dynobj; bfd *dynobj;
@ -1824,8 +1737,7 @@ elf64_x86_64_size_dynamic_sections (output_bfd, info)
This is PT_TLS segment p_vaddr. */ This is PT_TLS segment p_vaddr. */
static bfd_vma static bfd_vma
dtpoff_base (info) dtpoff_base (struct bfd_link_info *info)
struct bfd_link_info *info;
{ {
/* If tls_segment is NULL, we should have signalled an error already. */ /* If tls_segment is NULL, we should have signalled an error already. */
if (elf_hash_table (info)->tls_segment == NULL) if (elf_hash_table (info)->tls_segment == NULL)
@ -1837,9 +1749,7 @@ dtpoff_base (info)
if STT_TLS virtual address is ADDRESS. */ if STT_TLS virtual address is ADDRESS. */
static bfd_vma static bfd_vma
tpoff (info, address) tpoff (struct bfd_link_info *info, bfd_vma address)
struct bfd_link_info *info;
bfd_vma address;
{ {
struct elf_link_tls_segment *tls_segment struct elf_link_tls_segment *tls_segment
= elf_hash_table (info)->tls_segment; = elf_hash_table (info)->tls_segment;
@ -1854,16 +1764,11 @@ tpoff (info, address)
/* Relocate an x86_64 ELF section. */ /* Relocate an x86_64 ELF section. */
static bfd_boolean static bfd_boolean
elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section, elf64_x86_64_relocate_section (bfd *output_bfd, struct bfd_link_info *info,
contents, relocs, local_syms, local_sections) bfd *input_bfd, asection *input_section,
bfd *output_bfd; bfd_byte *contents, Elf_Internal_Rela *relocs,
struct bfd_link_info *info; Elf_Internal_Sym *local_syms,
bfd *input_bfd; asection **local_sections)
asection *input_section;
bfd_byte *contents;
Elf_Internal_Rela *relocs;
Elf_Internal_Sym *local_syms;
asection **local_sections;
{ {
struct elf64_x86_64_link_hash_table *htab; struct elf64_x86_64_link_hash_table *htab;
Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Shdr *symtab_hdr;
@ -1981,12 +1886,9 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
off = h->got.offset; off = h->got.offset;
dyn = htab->elf.dynamic_sections_created; dyn = htab->elf.dynamic_sections_created;
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, h) if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info->shared, h)
|| (info->shared || (info->shared
&& (info->symbolic && SYMBOL_REFERENCES_LOCAL (info, h))
|| h->dynindx == -1
|| (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
|| (ELF_ST_VISIBILITY (h->other) || (ELF_ST_VISIBILITY (h->other)
&& h->root.type == bfd_link_hash_undefweak)) && h->root.type == bfd_link_hash_undefweak))
{ {
@ -2114,10 +2016,7 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
&& r_type != R_X86_64_PC16 && r_type != R_X86_64_PC16
&& r_type != R_X86_64_PC32) && r_type != R_X86_64_PC32)
|| (h != NULL || (h != NULL
&& h->dynindx != -1 && !SYMBOL_CALLS_LOCAL (info, h))))
&& (! info->symbolic
|| (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))))
|| (ELIMINATE_COPY_RELOCS || (ELIMINATE_COPY_RELOCS
&& !info->shared && !info->shared
&& h != NULL && h != NULL
@ -2604,11 +2503,10 @@ elf64_x86_64_relocate_section (output_bfd, info, input_bfd, input_section,
dynamic sections here. */ dynamic sections here. */
static bfd_boolean static bfd_boolean
elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym) elf64_x86_64_finish_dynamic_symbol (bfd *output_bfd,
bfd *output_bfd; struct bfd_link_info *info,
struct bfd_link_info *info; struct elf_link_hash_entry *h,
struct elf_link_hash_entry *h; Elf_Internal_Sym *sym)
Elf_Internal_Sym *sym;
{ {
struct elf64_x86_64_link_hash_table *htab; struct elf64_x86_64_link_hash_table *htab;
@ -2714,10 +2612,7 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
The entry in the global offset table will already have been The entry in the global offset table will already have been
initialized in the relocate_section function. */ initialized in the relocate_section function. */
if (info->shared if (info->shared
&& (info->symbolic && SYMBOL_REFERENCES_LOCAL (info, h))
|| h->dynindx == -1
|| (h->elf_link_hash_flags & ELF_LINK_FORCED_LOCAL))
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR))
{ {
BFD_ASSERT((h->got.offset & 1) != 0); BFD_ASSERT((h->got.offset & 1) != 0);
rela.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE); rela.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
@ -2774,8 +2669,7 @@ elf64_x86_64_finish_dynamic_symbol (output_bfd, info, h, sym)
dynamic linker, before writing them out. */ dynamic linker, before writing them out. */
static enum elf_reloc_type_class static enum elf_reloc_type_class
elf64_x86_64_reloc_type_class (rela) elf64_x86_64_reloc_type_class (const Elf_Internal_Rela *rela)
const Elf_Internal_Rela *rela;
{ {
switch ((int) ELF64_R_TYPE (rela->r_info)) switch ((int) ELF64_R_TYPE (rela->r_info))
{ {
@ -2793,9 +2687,7 @@ elf64_x86_64_reloc_type_class (rela)
/* Finish up the dynamic sections. */ /* Finish up the dynamic sections. */
static bfd_boolean static bfd_boolean
elf64_x86_64_finish_dynamic_sections (output_bfd, info) elf64_x86_64_finish_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
bfd *output_bfd;
struct bfd_link_info *info;
{ {
struct elf64_x86_64_link_hash_table *htab; struct elf64_x86_64_link_hash_table *htab;
bfd *dynobj; bfd *dynobj;