* elf32-i386 (elf_i386_copy_indirect_symbol): New function.

(elf_backend_copy_indirect_symbol): Define.
	(struct elf_i386_link_hash_entry): Rename "root" to "elf".
	(struct elf_i386_link_hash_table): Likewise.
	(link_hash_newfunc): Get rid of unnecessary casts.
	(elf_i386_link_hash_table_create): Likewise.
	(elf_i386_check_relocs): Initialise local_got_refcounts to 0.
	Don't test input section SEC_READONLY here to try to avoid copy
	relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
	(elf_i386_adjust_dynamic_symbol): Check output section SEC_READONLY
	here to properly test whether we need copy relocs.  Do so for weak
	syms too.

	* elf32-hppa (elf32_hppa_copy_indirect_symbol): New function.
	(elf_backend_copy_indirect_symbol): Define.
	(struct elf32_hppa_link_hash_table): Rename "root" to "elf".
	(stub_hash_newfunc): Get rid of unnecessary casts.
	(hppa_link_hash_newfunc): Likewise.
	(elf32_hppa_check_relocs): Initialise local_got_refcounts to 0.
	Don't test input section SEC_READONLY here to try to avoid copy
	relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
	(elf32_hppa_adjust_dynamic_symbol): Check output section SEC_READONLY
	here to properly test whether we need copy relocs.  Do so for weak
	syms too.
This commit is contained in:
Alan Modra
2001-09-26 09:25:04 +00:00
parent e5e2b9ff10
commit ebe50baeda
3 changed files with 235 additions and 144 deletions

View File

@ -1,3 +1,30 @@
2001-09-26 Alan Modra <amodra@bigpond.net.au>
* elf32-i386 (elf_i386_copy_indirect_symbol): New function.
(elf_backend_copy_indirect_symbol): Define.
(struct elf_i386_link_hash_entry): Rename "root" to "elf".
(struct elf_i386_link_hash_table): Likewise.
(link_hash_newfunc): Get rid of unnecessary casts.
(elf_i386_link_hash_table_create): Likewise.
(elf_i386_check_relocs): Initialise local_got_refcounts to 0.
Don't test input section SEC_READONLY here to try to avoid copy
relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
(elf_i386_adjust_dynamic_symbol): Check output section SEC_READONLY
here to properly test whether we need copy relocs. Do so for weak
syms too.
* elf32-hppa (elf32_hppa_copy_indirect_symbol): New function.
(elf_backend_copy_indirect_symbol): Define.
(struct elf32_hppa_link_hash_table): Rename "root" to "elf".
(stub_hash_newfunc): Get rid of unnecessary casts.
(hppa_link_hash_newfunc): Likewise.
(elf32_hppa_check_relocs): Initialise local_got_refcounts to 0.
Don't test input section SEC_READONLY here to try to avoid copy
relocs, and keep dyn_relocs regardleas of ELF_LINK_NON_GOT_REF.
(elf32_hppa_adjust_dynamic_symbol): Check output section SEC_READONLY
here to properly test whether we need copy relocs. Do so for weak
syms too.
2001-09-26 Alan Modra <amodra@bigpond.net.au> 2001-09-26 Alan Modra <amodra@bigpond.net.au>
* bfd.c (_bfd_default_error_handlerl): Define using VPARAMS, * bfd.c (_bfd_default_error_handlerl): Define using VPARAMS,

View File

@ -222,7 +222,7 @@ struct elf32_hppa_link_hash_entry {
struct elf32_hppa_link_hash_table { struct elf32_hppa_link_hash_table {
/* The main hash table. */ /* The main hash table. */
struct elf_link_hash_table root; struct elf_link_hash_table elf;
/* The stub hash table. */ /* The stub hash table. */
struct bfd_hash_table stub_hash_table; struct bfd_hash_table stub_hash_table;
@ -321,6 +321,9 @@ static boolean elf32_hppa_add_symbol_hook
static boolean elf32_hppa_create_dynamic_sections static boolean elf32_hppa_create_dynamic_sections
PARAMS ((bfd *, struct bfd_link_info *)); PARAMS ((bfd *, struct bfd_link_info *));
static void elf32_hppa_copy_indirect_symbol
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
static boolean elf32_hppa_check_relocs static boolean elf32_hppa_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, PARAMS ((bfd *, struct bfd_link_info *,
asection *, const Elf_Internal_Rela *)); asection *, const Elf_Internal_Rela *));
@ -398,38 +401,34 @@ stub_hash_newfunc (entry, table, string)
struct bfd_hash_table *table; struct bfd_hash_table *table;
const char *string; const char *string;
{ {
struct elf32_hppa_stub_hash_entry *ret;
ret = (struct elf32_hppa_stub_hash_entry *) entry;
/* 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. */
if (ret == NULL) if (entry == NULL)
{ {
ret = ((struct elf32_hppa_stub_hash_entry *) entry = bfd_hash_allocate (table,
bfd_hash_allocate (table, sizeof (struct elf32_hppa_stub_hash_entry));
sizeof (struct elf32_hppa_stub_hash_entry))); if (entry == NULL)
if (ret == NULL) return entry;
return NULL;
} }
/* Call the allocation method of the superclass. */ /* Call the allocation method of the superclass. */
ret = ((struct elf32_hppa_stub_hash_entry *) entry = bfd_hash_newfunc (entry, table, string);
bfd_hash_newfunc ((struct bfd_hash_entry *) ret, table, string)); if (entry != NULL)
if (ret)
{ {
struct elf32_hppa_stub_hash_entry *eh;
/* Initialize the local fields. */ /* Initialize the local fields. */
ret->stub_sec = NULL; eh = (struct elf32_hppa_stub_hash_entry *) entry;
ret->stub_offset = 0; eh->stub_sec = NULL;
ret->target_value = 0; eh->stub_offset = 0;
ret->target_section = NULL; eh->target_value = 0;
ret->stub_type = hppa_stub_long_branch; eh->target_section = NULL;
ret->h = NULL; eh->stub_type = hppa_stub_long_branch;
ret->id_sec = NULL; eh->h = NULL;
eh->id_sec = NULL;
} }
return (struct bfd_hash_entry *) ret; return entry;
} }
/* Initialize an entry in the link hash table. */ /* Initialize an entry in the link hash table. */
@ -440,38 +439,33 @@ hppa_link_hash_newfunc (entry, table, string)
struct bfd_hash_table *table; struct bfd_hash_table *table;
const char *string; const char *string;
{ {
struct elf32_hppa_link_hash_entry *ret;
ret = (struct elf32_hppa_link_hash_entry *) entry;
/* 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. */
if (ret == NULL) if (entry == NULL)
{ {
ret = ((struct elf32_hppa_link_hash_entry *) entry = bfd_hash_allocate (table,
bfd_hash_allocate (table, sizeof (struct elf32_hppa_link_hash_entry));
sizeof (struct elf32_hppa_link_hash_entry))); if (entry == NULL)
if (ret == NULL) return entry;
return NULL;
} }
/* Call the allocation method of the superclass. */ /* Call the allocation method of the superclass. */
ret = ((struct elf32_hppa_link_hash_entry *) entry = _bfd_elf_link_hash_newfunc (entry, table, string);
_bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, if (entry != NULL)
table, string));
if (ret)
{ {
struct elf32_hppa_link_hash_entry *eh;
/* Initialize the local fields. */ /* Initialize the local fields. */
ret->stub_cache = NULL; eh = (struct elf32_hppa_link_hash_entry *) entry;
ret->dyn_relocs = NULL; eh->stub_cache = NULL;
ret->maybe_pic_call = 0; eh->dyn_relocs = NULL;
ret->pic_call = 0; eh->maybe_pic_call = 0;
ret->plabel = 0; eh->pic_call = 0;
ret->plt_abs = 0; eh->plabel = 0;
eh->plt_abs = 0;
} }
return (struct bfd_hash_entry *) ret; return entry;
} }
/* Create the derived linker hash table. The PA ELF port uses the derived /* Create the derived linker hash table. The PA ELF port uses the derived
@ -489,7 +483,7 @@ elf32_hppa_link_hash_table_create (abfd)
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
if (!_bfd_elf_link_hash_table_init (&ret->root, abfd, hppa_link_hash_newfunc)) if (!_bfd_elf_link_hash_table_init (&ret->elf, abfd, hppa_link_hash_newfunc))
{ {
bfd_release (abfd, ret); bfd_release (abfd, ret);
return NULL; return NULL;
@ -516,7 +510,7 @@ elf32_hppa_link_hash_table_create (abfd)
ret->has_17bit_branch = 0; ret->has_17bit_branch = 0;
ret->need_plt_stub = 0; ret->need_plt_stub = 0;
return &ret->root.root; return &ret->elf.root;
} }
/* Build a name for an entry in the stub hash table. */ /* Build a name for an entry in the stub hash table. */
@ -912,7 +906,7 @@ hppa_build_one_stub (gen_entry, in_arg)
struct elf32_hppa_link_hash_entry *eh; struct elf32_hppa_link_hash_entry *eh;
bfd_vma value; bfd_vma value;
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
eh = (struct elf32_hppa_link_hash_entry *) stub_entry->h; eh = (struct elf32_hppa_link_hash_entry *) stub_entry->h;
if (eh->elf.root.type != bfd_link_hash_defined if (eh->elf.root.type != bfd_link_hash_defined
@ -1137,6 +1131,28 @@ elf32_hppa_create_dynamic_sections (abfd, info)
return true; return true;
} }
/* Copy the extra info we tack onto an elf_link_hash_entry. */
void
elf32_hppa_copy_indirect_symbol (dir, ind)
struct elf_link_hash_entry *dir, *ind;
{
struct elf32_hppa_link_hash_entry *edir, *eind;
edir = (struct elf32_hppa_link_hash_entry *) dir;
eind = (struct elf32_hppa_link_hash_entry *) ind;
if (edir->dyn_relocs == NULL)
{
edir->dyn_relocs = eind->dyn_relocs;
eind->dyn_relocs = NULL;
}
else if (eind->dyn_relocs != NULL)
abort ();
_bfd_elf_link_hash_copy_indirect (dir, ind);
}
/* Look through the relocs for a section during the first phase, and /* Look through the relocs for a section during the first phase, and
allocate space in the global offset table or procedure linkage allocate space in the global offset table or procedure linkage
table. At this point we haven't necessarily read all the input table. At this point we haven't necessarily read all the input
@ -1163,7 +1179,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
return true; return true;
htab = hppa_link_hash_table (info); htab = hppa_link_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr; symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd); sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd); local_got_refcounts = elf_local_got_refcounts (abfd);
@ -1338,7 +1354,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
/* Allocate space for a GOT entry, as well as a dynamic /* Allocate space for a GOT entry, as well as a dynamic
relocation for this entry. */ relocation for this entry. */
if (dynobj == NULL) if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd; htab->elf.dynobj = dynobj = abfd;
if (htab->sgot == NULL) if (htab->sgot == NULL)
{ {
@ -1367,16 +1383,12 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
size = symtab_hdr->sh_info; size = symtab_hdr->sh_info;
size *= 2 * sizeof (bfd_signed_vma); size *= 2 * sizeof (bfd_signed_vma);
local_got_refcounts = ((bfd_signed_vma *) local_got_refcounts = ((bfd_signed_vma *)
bfd_alloc (abfd, size)); bfd_zalloc (abfd, size));
if (local_got_refcounts == NULL) if (local_got_refcounts == NULL)
return false; return false;
elf_local_got_refcounts (abfd) = local_got_refcounts; elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, (size_t) size);
} }
if (local_got_refcounts[r_symndx] == -1) local_got_refcounts[r_symndx] += 1;
local_got_refcounts[r_symndx] = 1;
else
local_got_refcounts[r_symndx] += 1;
} }
} }
@ -1421,18 +1433,14 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
size = symtab_hdr->sh_info; size = symtab_hdr->sh_info;
size *= 2 * sizeof (bfd_signed_vma); size *= 2 * sizeof (bfd_signed_vma);
local_got_refcounts = ((bfd_signed_vma *) local_got_refcounts = ((bfd_signed_vma *)
bfd_alloc (abfd, size)); bfd_zalloc (abfd, size));
if (local_got_refcounts == NULL) if (local_got_refcounts == NULL)
return false; return false;
elf_local_got_refcounts (abfd) = local_got_refcounts; elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, (size_t) size);
} }
local_plt_refcounts = (local_got_refcounts local_plt_refcounts = (local_got_refcounts
+ symtab_hdr->sh_info); + symtab_hdr->sh_info);
if (local_plt_refcounts[r_symndx] == -1) local_plt_refcounts[r_symndx] += 1;
local_plt_refcounts[r_symndx] = 1;
else
local_plt_refcounts[r_symndx] += 1;
} }
} }
} }
@ -1442,10 +1450,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
/* Flag this symbol as having a non-got, non-plt reference /* Flag this symbol as having a non-got, non-plt reference
so that we generate copy relocs if it turns out to be so that we generate copy relocs if it turns out to be
dynamic. */ dynamic. */
if (need_entry == NEED_DYNREL if (h != NULL && !info->shared)
&& h != NULL
&& !info->shared
&& (sec->flags & SEC_READONLY) != 0)
h->elf.elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; h->elf.elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
/* If we are creating a shared library then we need to copy /* If we are creating a shared library then we need to copy
@ -1487,7 +1492,6 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
|| (!info->shared || (!info->shared
&& (sec->flags & SEC_ALLOC) != 0 && (sec->flags & SEC_ALLOC) != 0
&& h != NULL && h != NULL
&& (h->elf.elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
&& (h->elf.root.type == bfd_link_hash_defweak && (h->elf.root.type == bfd_link_hash_defweak
|| (h->elf.elf_link_hash_flags || (h->elf.elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))) & ELF_LINK_HASH_DEF_REGULAR) == 0)))
@ -1499,7 +1503,7 @@ elf32_hppa_check_relocs (abfd, info, sec, relocs)
char *name; char *name;
if (dynobj == NULL) if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd; htab->elf.dynobj = dynobj = abfd;
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(abfd, (abfd,
@ -1650,7 +1654,7 @@ elf32_hppa_gc_sweep_hook (abfd, info, sec, relocs)
if (local_plt_refcounts != NULL) if (local_plt_refcounts != NULL)
local_plt_refcounts += symtab_hdr->sh_info; local_plt_refcounts += symtab_hdr->sh_info;
htab = hppa_link_hash_table (info); htab = hppa_link_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
if (dynobj == NULL) if (dynobj == NULL)
return true; return true;
@ -1800,10 +1804,12 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
{ {
bfd *dynobj; bfd *dynobj;
struct elf32_hppa_link_hash_table *htab; struct elf32_hppa_link_hash_table *htab;
struct elf32_hppa_link_hash_entry *eh;
struct elf32_hppa_dyn_reloc_entry *p;
asection *s; asection *s;
htab = hppa_link_hash_table (info); htab = hppa_link_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
/* If this is a function, put it in the procedure linkage table. We /* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later, will fill in the contents of the procedure linkage table later,
@ -1857,7 +1863,6 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
abort (); abort ();
h->root.u.def.section = h->weakdef->root.u.def.section; h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value; h->root.u.def.value = h->weakdef->root.u.def.value;
return true;
} }
/* This is a reference to a symbol defined by a dynamic object which /* This is a reference to a symbol defined by a dynamic object which
@ -1875,6 +1880,22 @@ elf32_hppa_adjust_dynamic_symbol (info, h)
if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
return true; return true;
eh = (struct elf32_hppa_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
{
s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
break;
}
/* 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 (p == NULL)
{
h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
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
@ -1974,7 +1995,7 @@ allocate_dynrelocs (h, inf)
info = (struct bfd_link_info *) inf; info = (struct bfd_link_info *) inf;
htab = hppa_link_hash_table (info); htab = hppa_link_hash_table (info);
if ((htab->root.dynamic_sections_created if ((htab->elf.dynamic_sections_created
&& h->plt.refcount > 0) && h->plt.refcount > 0)
|| ((struct elf32_hppa_link_hash_entry *) h)->pic_call) || ((struct elf32_hppa_link_hash_entry *) h)->pic_call)
{ {
@ -2033,7 +2054,7 @@ allocate_dynrelocs (h, inf)
s = htab->sgot; s = htab->sgot;
h->got.offset = s->_raw_size; h->got.offset = s->_raw_size;
s->_raw_size += GOT_ENTRY_SIZE; s->_raw_size += GOT_ENTRY_SIZE;
dyn = htab->root.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, h))
htab->srelgot->_raw_size += sizeof (Elf32_External_Rela); htab->srelgot->_raw_size += sizeof (Elf32_External_Rela);
} }
@ -2078,7 +2099,7 @@ allocate_dynrelocs (h, inf)
if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
&& (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
|| (htab->root.dynamic_sections_created || (htab->elf.dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak && (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))) || h->root.type == bfd_link_hash_undefined))))
{ {
@ -2181,11 +2202,11 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
boolean relocs; boolean relocs;
htab = hppa_link_hash_table (info); htab = hppa_link_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
if (dynobj == NULL) if (dynobj == NULL)
abort (); abort ();
if (htab->root.dynamic_sections_created) if (htab->elf.dynamic_sections_created)
{ {
/* Set the contents of the .interp section to the interpreter. */ /* Set the contents of the .interp section to the interpreter. */
if (! info->shared) if (! info->shared)
@ -2198,7 +2219,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
} }
/* Force millicode symbols local. */ /* Force millicode symbols local. */
elf_link_hash_traverse (&htab->root, elf_link_hash_traverse (&htab->elf,
clobber_millicode_symbols, clobber_millicode_symbols,
info); info);
} }
@ -2208,7 +2229,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
PIC, and allocate space for the necessary .plt entries so PIC, and allocate space for the necessary .plt entries so
that %r19 will be set up. */ that %r19 will be set up. */
if (! info->shared) if (! info->shared)
elf_link_hash_traverse (&htab->root, elf_link_hash_traverse (&htab->elf,
hppa_handle_PIC_calls, hppa_handle_PIC_calls,
info); info);
} }
@ -2263,7 +2284,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
local_plt = end_local_got; local_plt = end_local_got;
end_local_plt = local_plt + locsymcount; end_local_plt = local_plt + locsymcount;
if (! htab->root.dynamic_sections_created) if (! htab->elf.dynamic_sections_created)
{ {
/* Won't be used, but be safe. */ /* Won't be used, but be safe. */
for (; local_plt < end_local_plt; ++local_plt) for (; local_plt < end_local_plt; ++local_plt)
@ -2290,7 +2311,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
/* Allocate global sym .plt and .got entries, and space for global /* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */ sym dynamic relocs. */
elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info); elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
/* The check_relocs and adjust_dynamic_symbol entry points have /* The check_relocs and adjust_dynamic_symbol entry points have
determined the sizes of the various dynamic sections. Allocate determined the sizes of the various dynamic sections. Allocate
@ -2362,7 +2383,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
return false; return false;
} }
if (htab->root.dynamic_sections_created) if (htab->elf.dynamic_sections_created)
{ {
/* Like IA-64 and HPPA64, always create a DT_PLTGOT. It /* Like IA-64 and HPPA64, always create a DT_PLTGOT. It
actually has nothing to do with the PLT, it is how we actually has nothing to do with the PLT, it is how we
@ -2402,7 +2423,7 @@ elf32_hppa_size_dynamic_sections (output_bfd, info)
/* If any dynamic relocs apply to a read-only section, /* If any dynamic relocs apply to a read-only section,
then we need a DT_TEXTREL entry. */ then we need a DT_TEXTREL entry. */
elf_link_hash_traverse (&htab->root, readonly_dynrelocs, (PTR) info); elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info);
if ((info->flags & DF_TEXTREL) != 0) if ((info->flags & DF_TEXTREL) != 0)
{ {
@ -3018,7 +3039,7 @@ elf32_hppa_set_gp (abfd, info)
bfd_vma gp_val; bfd_vma gp_val;
htab = hppa_link_hash_table (info); htab = hppa_link_hash_table (info);
h = elf_link_hash_lookup (&htab->root, "$global$", false, false, false); h = elf_link_hash_lookup (&htab->elf, "$global$", false, false, false);
if (h != NULL if (h != NULL
&& (h->root.type == bfd_link_hash_defined && (h->root.type == bfd_link_hash_defined
@ -3477,7 +3498,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
htab = hppa_link_hash_table (info); htab = hppa_link_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
local_got_offsets = elf_local_got_offsets (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd);
rel = relocs; rel = relocs;
@ -3601,7 +3622,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
boolean dyn; boolean dyn;
off = h->elf.got.offset; off = h->elf.got.offset;
dyn = htab->root.dynamic_sections_created; dyn = htab->elf.dynamic_sections_created;
if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, &h->elf)) if (! WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, info, &h->elf))
{ {
/* This is actually a static link, or it is a /* This is actually a static link, or it is a
@ -3688,7 +3709,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
case R_PARISC_PLABEL14R: case R_PARISC_PLABEL14R:
case R_PARISC_PLABEL21L: case R_PARISC_PLABEL21L:
case R_PARISC_PLABEL32: case R_PARISC_PLABEL32:
if (htab->root.dynamic_sections_created) if (htab->elf.dynamic_sections_created)
{ {
/* If we have a global symbol with a PLT slot, then /* If we have a global symbol with a PLT slot, then
redirect this relocation to it. */ redirect this relocation to it. */
@ -3839,7 +3860,7 @@ elf32_hppa_relocate_section (output_bfd, info, input_bfd, input_section,
if (elf_section_data (input_section)->stab_info != NULL) if (elf_section_data (input_section)->stab_info != NULL)
{ {
off = (_bfd_stab_section_offset off = (_bfd_stab_section_offset
(output_bfd, &htab->root.stab_info, (output_bfd, &htab->elf.stab_info,
input_section, input_section,
&elf_section_data (input_section)->stab_info, &elf_section_data (input_section)->stab_info,
rel->r_offset)); rel->r_offset));
@ -4001,7 +4022,7 @@ elf32_hppa_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd *dynobj; bfd *dynobj;
htab = hppa_link_hash_table (info); htab = hppa_link_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
if (h->plt.offset != (bfd_vma) -1) if (h->plt.offset != (bfd_vma) -1)
{ {
@ -4199,11 +4220,11 @@ elf32_hppa_finish_dynamic_sections (output_bfd, info)
asection *sdyn; asection *sdyn;
htab = hppa_link_hash_table (info); htab = hppa_link_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
if (htab->root.dynamic_sections_created) if (htab->elf.dynamic_sections_created)
{ {
Elf32_External_Dyn *dyncon, *dynconend; Elf32_External_Dyn *dyncon, *dynconend;
@ -4340,6 +4361,7 @@ elf32_hppa_elf_get_symbol_type (elf_sym, type)
#define bfd_elf32_bfd_link_hash_table_create elf32_hppa_link_hash_table_create #define bfd_elf32_bfd_link_hash_table_create elf32_hppa_link_hash_table_create
#define elf_backend_add_symbol_hook elf32_hppa_add_symbol_hook #define elf_backend_add_symbol_hook elf32_hppa_add_symbol_hook
#define elf_backend_adjust_dynamic_symbol elf32_hppa_adjust_dynamic_symbol #define elf_backend_adjust_dynamic_symbol elf32_hppa_adjust_dynamic_symbol
#define elf_backend_copy_indirect_symbol elf32_hppa_copy_indirect_symbol
#define elf_backend_check_relocs elf32_hppa_check_relocs #define elf_backend_check_relocs elf32_hppa_check_relocs
#define elf_backend_create_dynamic_sections elf32_hppa_create_dynamic_sections #define elf_backend_create_dynamic_sections elf32_hppa_create_dynamic_sections
#define elf_backend_fake_sections elf_hppa_fake_sections #define elf_backend_fake_sections elf_hppa_fake_sections

View File

@ -30,7 +30,8 @@ static void elf_i386_info_to_howto
PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *)); PARAMS ((bfd *, arelent *, Elf32_Internal_Rela *));
static void elf_i386_info_to_howto_rel static void elf_i386_info_to_howto_rel
PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *)); PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
static boolean elf_i386_is_local_label_name PARAMS ((bfd *, const char *)); static boolean elf_i386_is_local_label_name
PARAMS ((bfd *, const char *));
static boolean elf_i386_grok_prstatus static boolean elf_i386_grok_prstatus
PARAMS ((bfd *abfd, Elf_Internal_Note *note)); PARAMS ((bfd *abfd, Elf_Internal_Note *note));
static boolean elf_i386_grok_psinfo static boolean elf_i386_grok_psinfo
@ -39,9 +40,13 @@ static struct bfd_hash_entry *link_hash_newfunc
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
static struct bfd_link_hash_table *elf_i386_link_hash_table_create static struct bfd_link_hash_table *elf_i386_link_hash_table_create
PARAMS ((bfd *)); PARAMS ((bfd *));
static boolean create_got_section PARAMS((bfd *, struct bfd_link_info *)); static boolean create_got_section
PARAMS((bfd *, struct bfd_link_info *));
static boolean elf_i386_create_dynamic_sections static boolean elf_i386_create_dynamic_sections
PARAMS((bfd *, struct bfd_link_info *)); PARAMS((bfd *, struct bfd_link_info *));
static void
elf_i386_copy_indirect_symbol
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
static boolean elf_i386_check_relocs static boolean elf_i386_check_relocs
PARAMS ((bfd *, struct bfd_link_info *, asection *, PARAMS ((bfd *, struct bfd_link_info *, asection *,
const Elf_Internal_Rela *)); const Elf_Internal_Rela *));
@ -473,7 +478,7 @@ struct elf_i386_dyn_relocs
struct elf_i386_link_hash_entry struct elf_i386_link_hash_entry
{ {
struct elf_link_hash_entry root; struct elf_link_hash_entry elf;
/* Track dynamic relocs copied for this symbol. */ /* Track dynamic relocs copied for this symbol. */
struct elf_i386_dyn_relocs *dyn_relocs; struct elf_i386_dyn_relocs *dyn_relocs;
@ -483,7 +488,7 @@ struct elf_i386_link_hash_entry
struct elf_i386_link_hash_table struct elf_i386_link_hash_table
{ {
struct elf_link_hash_table root; struct elf_link_hash_table elf;
/* Short-cuts to get to dynamic linker sections. */ /* Short-cuts to get to dynamic linker sections. */
asection *sgot; asection *sgot;
@ -508,28 +513,27 @@ link_hash_newfunc (entry, table, string)
struct bfd_hash_table *table; struct bfd_hash_table *table;
const char *string; const char *string;
{ {
struct elf_i386_link_hash_entry *ret =
(struct elf_i386_link_hash_entry *) entry;
/* 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. */
if (ret == (struct elf_i386_link_hash_entry *) NULL) if (entry == NULL)
ret = ((struct elf_i386_link_hash_entry *)
bfd_hash_allocate (table,
sizeof (struct elf_i386_link_hash_entry)));
if (ret == (struct elf_i386_link_hash_entry *) NULL)
return (struct bfd_hash_entry *) ret;
/* Call the allocation method of the superclass. */
ret = ((struct elf_i386_link_hash_entry *)
_bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret,
table, string));
if (ret != (struct elf_i386_link_hash_entry *) NULL)
{ {
ret->dyn_relocs = NULL; entry = bfd_hash_allocate (table,
sizeof (struct elf_i386_link_hash_entry));
if (entry == NULL)
return entry;
} }
return (struct bfd_hash_entry *) ret; /* Call the allocation method of the superclass. */
entry = _bfd_elf_link_hash_newfunc (entry, table, string);
if (entry != NULL)
{
struct elf_i386_link_hash_entry *eh;
eh = (struct elf_i386_link_hash_entry *) entry;
eh->dyn_relocs = NULL;
}
return entry;
} }
/* Create an i386 ELF linker hash table. */ /* Create an i386 ELF linker hash table. */
@ -542,10 +546,10 @@ elf_i386_link_hash_table_create (abfd)
bfd_size_type amt = sizeof (struct elf_i386_link_hash_table); bfd_size_type amt = sizeof (struct elf_i386_link_hash_table);
ret = (struct elf_i386_link_hash_table *) bfd_alloc (abfd, amt); ret = (struct elf_i386_link_hash_table *) bfd_alloc (abfd, amt);
if (ret == (struct elf_i386_link_hash_table *) NULL) if (ret == NULL)
return NULL; return NULL;
if (! _bfd_elf_link_hash_table_init (&ret->root, abfd, link_hash_newfunc)) if (! _bfd_elf_link_hash_table_init (&ret->elf, abfd, link_hash_newfunc))
{ {
bfd_release (abfd, ret); bfd_release (abfd, ret);
return NULL; return NULL;
@ -559,7 +563,7 @@ elf_i386_link_hash_table_create (abfd)
ret->sdynbss = NULL; ret->sdynbss = NULL;
ret->srelbss = NULL; ret->srelbss = NULL;
return &ret->root.root; return &ret->elf.root;
} }
/* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up /* Create .got, .gotplt, and .rel.got sections in DYNOBJ, and set up
@ -623,6 +627,28 @@ elf_i386_create_dynamic_sections (dynobj, info)
return true; return true;
} }
/* Copy the extra info we tack onto an elf_link_hash_entry. */
void
elf_i386_copy_indirect_symbol (dir, ind)
struct elf_link_hash_entry *dir, *ind;
{
struct elf_i386_link_hash_entry *edir, *eind;
edir = (struct elf_i386_link_hash_entry *) dir;
eind = (struct elf_i386_link_hash_entry *) ind;
if (edir->dyn_relocs == NULL)
{
edir->dyn_relocs = eind->dyn_relocs;
eind->dyn_relocs = NULL;
}
else if (eind->dyn_relocs != NULL)
abort ();
_bfd_elf_link_hash_copy_indirect (dir, ind);
}
/* Look through the relocs for a section during the first phase, and /* Look through the relocs for a section during the first phase, and
allocate space in the global offset table or procedure linkage allocate space in the global offset table or procedure linkage
table. */ table. */
@ -647,7 +673,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
return true; return true;
htab = elf_i386_hash_table (info); htab = elf_i386_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
symtab_hdr = &elf_tdata (abfd)->symtab_hdr; symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (abfd); sym_hashes = elf_sym_hashes (abfd);
local_got_refcounts = elf_local_got_refcounts (abfd); local_got_refcounts = elf_local_got_refcounts (abfd);
@ -684,7 +710,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
case R_386_GOTOFF: case R_386_GOTOFF:
case R_386_GOTPC: case R_386_GOTPC:
if (dynobj == NULL) if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd; htab->elf.dynobj = dynobj = abfd;
if (!create_got_section (dynobj, info)) if (!create_got_section (dynobj, info))
return false; return false;
break; break;
@ -715,16 +741,12 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
size = symtab_hdr->sh_info; size = symtab_hdr->sh_info;
size *= sizeof (bfd_signed_vma); size *= sizeof (bfd_signed_vma);
local_got_refcounts = ((bfd_signed_vma *) local_got_refcounts = ((bfd_signed_vma *)
bfd_alloc (abfd, size)); bfd_zalloc (abfd, size));
if (local_got_refcounts == NULL) if (local_got_refcounts == NULL)
return false; return false;
elf_local_got_refcounts (abfd) = local_got_refcounts; elf_local_got_refcounts (abfd) = local_got_refcounts;
memset (local_got_refcounts, -1, (size_t) size);
} }
if (local_got_refcounts[r_symndx] == -1) local_got_refcounts[r_symndx] += 1;
local_got_refcounts[r_symndx] = 1;
else
local_got_refcounts[r_symndx] += 1;
} }
break; break;
@ -755,9 +777,12 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
if (h != NULL && !info->shared) if (h != NULL && !info->shared)
{ {
/* If this reloc is in a read-only section, we might /* If this reloc is in a read-only section, we might
need a copy reloc. */ need a copy reloc. We can't check reliably at this
if ((sec->flags & SEC_READONLY) != 0) stage whether the section is read-only, as input
h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF; sections have not yet been mapped to output sections.
Tentatively set the flag for now, and correct in
adjust_dynamic_symbol. */
h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
/* We may need a .plt entry if the function this reloc /* We may need a .plt entry if the function this reloc
refers to is in a shared lib. */ refers to is in a shared lib. */
@ -778,7 +803,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
possible that DEF_REGULAR is not set now but will be set possible that DEF_REGULAR is not set now but will be set
later (it is never cleared). In case of a weak definition, later (it is never cleared). In case of a weak definition,
DEF_REGULAR may be cleared later by a strong definition in DEF_REGULAR may be cleared later by a strong definition in
a shared library. We account for that possibility below by a shared library. We account for that possibility below by
storing information in the relocs_copied field of the hash storing information in the relocs_copied field of the hash
table entry. A similar situation occurs when creating table entry. A similar situation occurs when creating
shared libraries and symbol visibility changes render the shared libraries and symbol visibility changes render the
@ -799,7 +824,6 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
|| (!info->shared || (!info->shared
&& (sec->flags & SEC_ALLOC) != 0 && (sec->flags & SEC_ALLOC) != 0
&& h != NULL && h != NULL
&& (h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
&& (h->root.type == bfd_link_hash_defweak && (h->root.type == bfd_link_hash_defweak
|| (h->elf_link_hash_flags || (h->elf_link_hash_flags
& ELF_LINK_HASH_DEF_REGULAR) == 0))) & ELF_LINK_HASH_DEF_REGULAR) == 0)))
@ -808,7 +832,7 @@ elf_i386_check_relocs (abfd, info, sec, relocs)
Create a reloc section in dynobj and make room for Create a reloc section in dynobj and make room for
this reloc. */ this reloc. */
if (dynobj == NULL) if (dynobj == NULL)
htab->root.dynobj = dynobj = abfd; htab->elf.dynobj = dynobj = abfd;
if (sreloc == NULL) if (sreloc == NULL)
{ {
@ -1061,11 +1085,13 @@ elf_i386_adjust_dynamic_symbol (info, h)
{ {
struct elf_i386_link_hash_table *htab; struct elf_i386_link_hash_table *htab;
bfd *dynobj; bfd *dynobj;
struct elf_i386_link_hash_entry * eh;
struct elf_i386_dyn_relocs *p;
asection *s; asection *s;
unsigned int power_of_two; unsigned int power_of_two;
htab = elf_i386_hash_table (info); htab = elf_i386_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
/* If this is a function, put it in the procedure linkage table. We /* If this is a function, put it in the procedure linkage table. We
will fill in the contents of the procedure linkage table later, will fill in the contents of the procedure linkage table later,
@ -1106,7 +1132,6 @@ elf_i386_adjust_dynamic_symbol (info, h)
|| h->weakdef->root.type == bfd_link_hash_defweak); || h->weakdef->root.type == bfd_link_hash_defweak);
h->root.u.def.section = h->weakdef->root.u.def.section; h->root.u.def.section = h->weakdef->root.u.def.section;
h->root.u.def.value = h->weakdef->root.u.def.value; h->root.u.def.value = h->weakdef->root.u.def.value;
return true;
} }
/* This is a reference to a symbol defined by a dynamic object which /* This is a reference to a symbol defined by a dynamic object which
@ -1124,6 +1149,22 @@ elf_i386_adjust_dynamic_symbol (info, h)
if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0) if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
return true; return true;
eh = (struct elf_i386_link_hash_entry *) h;
for (p = eh->dyn_relocs; p != NULL; p = p->next)
{
s = p->sec->output_section;
if (s != NULL && (s->flags & SEC_READONLY) != 0)
break;
}
/* 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 (p == NULL)
{
h->elf_link_hash_flags &= ~ELF_LINK_NON_GOT_REF;
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
@ -1210,7 +1251,7 @@ allocate_dynrelocs (h, inf)
info = (struct bfd_link_info *) inf; info = (struct bfd_link_info *) inf;
htab = elf_i386_hash_table (info); htab = elf_i386_hash_table (info);
if (htab->root.dynamic_sections_created if (htab->elf.dynamic_sections_created
&& h->plt.refcount > 0) && h->plt.refcount > 0)
{ {
/* Make sure this symbol is output as a dynamic symbol. /* Make sure this symbol is output as a dynamic symbol.
@ -1286,7 +1327,7 @@ allocate_dynrelocs (h, inf)
s = htab->sgot; s = htab->sgot;
h->got.offset = s->_raw_size; h->got.offset = s->_raw_size;
s->_raw_size += 4; s->_raw_size += 4;
dyn = htab->root.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, h))
htab->srelgot->_raw_size += sizeof (Elf32_External_Rel); htab->srelgot->_raw_size += sizeof (Elf32_External_Rel);
} }
@ -1331,7 +1372,7 @@ allocate_dynrelocs (h, inf)
if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0 if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0
&& (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0 && (((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_DYNAMIC) != 0
&& (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0) && (h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
|| (htab->root.dynamic_sections_created || (htab->elf.dynamic_sections_created
&& (h->root.type == bfd_link_hash_undefweak && (h->root.type == bfd_link_hash_undefweak
|| h->root.type == bfd_link_hash_undefined)))) || h->root.type == bfd_link_hash_undefined))))
{ {
@ -1407,11 +1448,11 @@ elf_i386_size_dynamic_sections (output_bfd, info)
bfd *ibfd; bfd *ibfd;
htab = elf_i386_hash_table (info); htab = elf_i386_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
if (dynobj == NULL) if (dynobj == NULL)
abort (); abort ();
if (htab->root.dynamic_sections_created) if (htab->elf.dynamic_sections_created)
{ {
/* Set the contents of the .interp section to the interpreter. */ /* Set the contents of the .interp section to the interpreter. */
if (! info->shared) if (! info->shared)
@ -1473,7 +1514,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
/* Allocate global sym .plt and .got entries, and space for global /* Allocate global sym .plt and .got entries, and space for global
sym dynamic relocs. */ sym dynamic relocs. */
elf_link_hash_traverse (&htab->root, allocate_dynrelocs, (PTR) info); elf_link_hash_traverse (&htab->elf, allocate_dynrelocs, (PTR) info);
/* We now have determined the sizes of the various dynamic sections. /* We now have determined the sizes of the various dynamic sections.
Allocate memory for them. */ Allocate memory for them. */
@ -1536,7 +1577,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
return false; return false;
} }
if (htab->root.dynamic_sections_created) if (htab->elf.dynamic_sections_created)
{ {
/* Add some entries to the .dynamic section. We fill in the /* Add some entries to the .dynamic section. We fill in the
values later, in elf_i386_finish_dynamic_sections, but we values later, in elf_i386_finish_dynamic_sections, but we
@ -1570,7 +1611,7 @@ elf_i386_size_dynamic_sections (output_bfd, info)
/* If any dynamic relocs apply to a read-only section, /* If any dynamic relocs apply to a read-only section,
then we need a DT_TEXTREL entry. */ then we need a DT_TEXTREL entry. */
elf_link_hash_traverse (&htab->root, readonly_dynrelocs, (PTR) info); elf_link_hash_traverse (&htab->elf, readonly_dynrelocs, (PTR) info);
if ((info->flags & DF_TEXTREL) != 0) if ((info->flags & DF_TEXTREL) != 0)
{ {
@ -1642,7 +1683,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
Elf_Internal_Rela *relend; Elf_Internal_Rela *relend;
htab = elf_i386_hash_table (info); htab = elf_i386_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr;
sym_hashes = elf_sym_hashes (input_bfd); sym_hashes = elf_sym_hashes (input_bfd);
local_got_offsets = elf_local_got_offsets (input_bfd); local_got_offsets = elf_local_got_offsets (input_bfd);
@ -1769,7 +1810,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
boolean dyn; boolean dyn;
off = h->got.offset; off = h->got.offset;
dyn = htab->root.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, h)
|| (info->shared || (info->shared
&& (info->symbolic && (info->symbolic
@ -1928,7 +1969,7 @@ elf_i386_relocate_section (output_bfd, info, input_bfd, input_section,
else else
{ {
off = (_bfd_stab_section_offset off = (_bfd_stab_section_offset
(output_bfd, htab->root.stab_info, input_section, (output_bfd, htab->elf.stab_info, input_section,
&elf_section_data (input_section)->stab_info, &elf_section_data (input_section)->stab_info,
rel->r_offset)); rel->r_offset));
if (off == (bfd_vma) -1) if (off == (bfd_vma) -1)
@ -2058,7 +2099,7 @@ elf_i386_finish_dynamic_symbol (output_bfd, info, h, sym)
bfd *dynobj; bfd *dynobj;
htab = elf_i386_hash_table (info); htab = elf_i386_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
if (h->plt.offset != (bfd_vma) -1) if (h->plt.offset != (bfd_vma) -1)
{ {
@ -2239,10 +2280,10 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
asection *sdyn; asection *sdyn;
htab = elf_i386_hash_table (info); htab = elf_i386_hash_table (info);
dynobj = htab->root.dynobj; dynobj = htab->elf.dynobj;
sdyn = bfd_get_section_by_name (dynobj, ".dynamic"); sdyn = bfd_get_section_by_name (dynobj, ".dynamic");
if (htab->root.dynamic_sections_created) if (htab->elf.dynamic_sections_created)
{ {
Elf32_External_Dyn *dyncon, *dynconend; Elf32_External_Dyn *dyncon, *dynconend;
@ -2370,6 +2411,7 @@ elf_i386_finish_dynamic_sections (output_bfd, info)
#define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup #define bfd_elf32_bfd_reloc_type_lookup elf_i386_reloc_type_lookup
#define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol #define elf_backend_adjust_dynamic_symbol elf_i386_adjust_dynamic_symbol
#define elf_backend_copy_indirect_symbol elf_i386_copy_indirect_symbol
#define elf_backend_check_relocs elf_i386_check_relocs #define elf_backend_check_relocs elf_i386_check_relocs
#define elf_backend_create_dynamic_sections elf_i386_create_dynamic_sections #define elf_backend_create_dynamic_sections elf_i386_create_dynamic_sections
#define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections #define elf_backend_finish_dynamic_sections elf_i386_finish_dynamic_sections