mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-23 19:50:13 +08:00
* elf-bfd.h (struct elf_backend_data): Remove "bfd *" and add
"elflink_hash_entry *" param to elf_backend_link_output_symbol_hook. Add "elflink_hash_entry *" param to elf_backend_output_arch_syms. * elflink.h (elf_link_output_sym): Add "elflink_hash_entry *" param, and pass to output_symbol_hook. (elf_bfd_final_link): Adjust elf_link_output_sym calls. (elf_link_output_extsym): Likewise. (elf_link_input_bfd): Likewise. * elf32-sh64.c (sh64_elf_link_output_symbol_hook): Adjust. * elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise. * elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise. * elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise. * elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise. * elf64-sparc.c (sparc64_elf_output_arch_syms): Likewise. * elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise. Validate dynh->h against h. * elf64-ppc.c (struct ppc_link_hash_entry): Add adjust_done bitfield. (link_hash_newfunc): Init it. (adjust_opd_syms): New function. (ppc64_elf_edit_opd): Set adjust_done when global .opd sym adjusted. Set opd.adjust for all .opd relocs. Call adjust_opd_syms. (ppc64_elf_tls_optimize): Adjust possible .opd sym values here. (ppc64_elf_relocate_section): Also adjust syms not a multiple of 24. (ppc64_elf_output_symbol_hook): New function. (elf_backend_link_output_symbol_hook): Define.
This commit is contained in:
@ -1,3 +1,32 @@
|
|||||||
|
2003-12-08 Alan Modra <amodra@bigpond.net.au>
|
||||||
|
|
||||||
|
* elf-bfd.h (struct elf_backend_data): Remove "bfd *" and add
|
||||||
|
"elflink_hash_entry *" param to elf_backend_link_output_symbol_hook.
|
||||||
|
Add "elflink_hash_entry *" param to elf_backend_output_arch_syms.
|
||||||
|
* elflink.h (elf_link_output_sym): Add "elflink_hash_entry *" param,
|
||||||
|
and pass to output_symbol_hook.
|
||||||
|
(elf_bfd_final_link): Adjust elf_link_output_sym calls.
|
||||||
|
(elf_link_output_extsym): Likewise.
|
||||||
|
(elf_link_input_bfd): Likewise.
|
||||||
|
* elf32-sh64.c (sh64_elf_link_output_symbol_hook): Adjust.
|
||||||
|
* elf32-v850.c (v850_elf_link_output_symbol_hook): Likewise.
|
||||||
|
* elf64-mmix.c (mmix_elf_link_output_symbol_hook): Likewise.
|
||||||
|
* elf64-sh64.c (sh64_elf64_link_output_symbol_hook): Likewise.
|
||||||
|
* elfxx-mips.c (_bfd_mips_elf_link_output_symbol_hook): Likewise.
|
||||||
|
* elfxx-mips.h (_bfd_mips_elf_link_output_symbol_hook): Likewise.
|
||||||
|
* elf64-sparc.c (sparc64_elf_output_arch_syms): Likewise.
|
||||||
|
* elf64-hppa.c (elf64_hppa_link_output_symbol_hook): Likewise.
|
||||||
|
Validate dynh->h against h.
|
||||||
|
* elf64-ppc.c (struct ppc_link_hash_entry): Add adjust_done bitfield.
|
||||||
|
(link_hash_newfunc): Init it.
|
||||||
|
(adjust_opd_syms): New function.
|
||||||
|
(ppc64_elf_edit_opd): Set adjust_done when global .opd sym adjusted.
|
||||||
|
Set opd.adjust for all .opd relocs. Call adjust_opd_syms.
|
||||||
|
(ppc64_elf_tls_optimize): Adjust possible .opd sym values here.
|
||||||
|
(ppc64_elf_relocate_section): Also adjust syms not a multiple of 24.
|
||||||
|
(ppc64_elf_output_symbol_hook): New function.
|
||||||
|
(elf_backend_link_output_symbol_hook): Define.
|
||||||
|
|
||||||
2003-12-07 Richard Sandiford <rsandifo@redhat.com>
|
2003-12-07 Richard Sandiford <rsandifo@redhat.com>
|
||||||
|
|
||||||
* elf32-mips.c, elfn32-mips.c, elf64-mips.c: Convert prototypes.
|
* elf32-mips.c, elfn32-mips.c, elf64-mips.c: Convert prototypes.
|
||||||
|
@ -626,8 +626,8 @@ struct elf_backend_data
|
|||||||
/* If this field is not NULL, it is called by the elf_link_output_sym
|
/* If this field is not NULL, it is called by the elf_link_output_sym
|
||||||
phase of a link for each symbol which will appear in the object file. */
|
phase of a link for each symbol which will appear in the object file. */
|
||||||
bfd_boolean (*elf_backend_link_output_symbol_hook)
|
bfd_boolean (*elf_backend_link_output_symbol_hook)
|
||||||
(bfd *, struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
|
(struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
|
||||||
asection *);
|
asection *, struct elf_link_hash_entry *);
|
||||||
|
|
||||||
/* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
|
/* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
|
||||||
linker the first time it encounters a dynamic object in the link.
|
linker the first time it encounters a dynamic object in the link.
|
||||||
@ -793,7 +793,8 @@ struct elf_backend_data
|
|||||||
not handled in the hash table. */
|
not handled in the hash table. */
|
||||||
bfd_boolean (*elf_backend_output_arch_syms)
|
bfd_boolean (*elf_backend_output_arch_syms)
|
||||||
(bfd *, struct bfd_link_info *, void *,
|
(bfd *, struct bfd_link_info *, void *,
|
||||||
bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *));
|
bfd_boolean (*) (void *, const char *, Elf_Internal_Sym *, asection *,
|
||||||
|
struct elf_link_hash_entry *));
|
||||||
|
|
||||||
/* Copy any information related to dynamic linking from a pre-existing
|
/* Copy any information related to dynamic linking from a pre-existing
|
||||||
symbol to a newly created symbol. Also called to copy flags and
|
symbol to a newly created symbol. Also called to copy flags and
|
||||||
|
@ -59,8 +59,8 @@ static bfd_boolean sh64_elf_add_symbol_hook
|
|||||||
(bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **,
|
(bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **,
|
||||||
flagword *, asection **, bfd_vma *);
|
flagword *, asection **, bfd_vma *);
|
||||||
static bfd_boolean sh64_elf_link_output_symbol_hook
|
static bfd_boolean sh64_elf_link_output_symbol_hook
|
||||||
(bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
|
(struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
|
||||||
asection *);
|
struct elf_link_hash_entry *);
|
||||||
static bfd_boolean sh64_backend_section_from_shdr
|
static bfd_boolean sh64_backend_section_from_shdr
|
||||||
(bfd *, Elf_Internal_Shdr *, const char *);
|
(bfd *, Elf_Internal_Shdr *, const char *);
|
||||||
static void sh64_elf_final_write_processing
|
static void sh64_elf_final_write_processing
|
||||||
@ -470,11 +470,11 @@ sh64_elf_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
|||||||
DataLabel symbol. */
|
DataLabel symbol. */
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
sh64_elf_link_output_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED,
|
sh64_elf_link_output_symbol_hook (struct bfd_link_info *info,
|
||||||
struct bfd_link_info *info,
|
|
||||||
const char *cname,
|
const char *cname,
|
||||||
Elf_Internal_Sym *sym,
|
Elf_Internal_Sym *sym,
|
||||||
asection *input_sec ATTRIBUTE_UNUSED)
|
asection *input_sec ATTRIBUTE_UNUSED,
|
||||||
|
struct elf_link_hash_entry *h ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
char *name = (char *) cname;
|
char *name = (char *) cname;
|
||||||
|
|
||||||
|
@ -76,8 +76,8 @@ static bfd_boolean v850_elf_add_symbol_hook
|
|||||||
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
|
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
|
||||||
const char **, flagword *, asection **, bfd_vma *));
|
const char **, flagword *, asection **, bfd_vma *));
|
||||||
static bfd_boolean v850_elf_link_output_symbol_hook
|
static bfd_boolean v850_elf_link_output_symbol_hook
|
||||||
PARAMS ((bfd *, struct bfd_link_info *, const char *,
|
PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *,
|
||||||
Elf_Internal_Sym *, asection *));
|
asection *, struct elf_link_hash_entry *));
|
||||||
static bfd_boolean v850_elf_section_from_shdr
|
static bfd_boolean v850_elf_section_from_shdr
|
||||||
PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
|
PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
|
||||||
static bfd_boolean v850_elf_gc_sweep_hook
|
static bfd_boolean v850_elf_gc_sweep_hook
|
||||||
@ -2213,12 +2213,12 @@ v850_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
v850_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
|
v850_elf_link_output_symbol_hook (info, name, sym, input_sec, h)
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
|
||||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||||
const char *name ATTRIBUTE_UNUSED;
|
const char *name ATTRIBUTE_UNUSED;
|
||||||
Elf_Internal_Sym *sym;
|
Elf_Internal_Sym *sym;
|
||||||
asection *input_sec;
|
asection *input_sec;
|
||||||
|
struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
|
||||||
{
|
{
|
||||||
/* If we see a common symbol, which implies a relocatable link, then
|
/* If we see a common symbol, which implies a relocatable link, then
|
||||||
if a symbol was in a special common section in an input file, mark
|
if a symbol was in a special common section in an input file, mark
|
||||||
|
@ -202,8 +202,8 @@ static bfd_boolean elf64_hppa_size_dynamic_sections
|
|||||||
PARAMS ((bfd *, struct bfd_link_info *));
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
|
|
||||||
static bfd_boolean elf64_hppa_link_output_symbol_hook
|
static bfd_boolean elf64_hppa_link_output_symbol_hook
|
||||||
PARAMS ((bfd *abfd, struct bfd_link_info *, const char *,
|
PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *,
|
||||||
Elf_Internal_Sym *, asection *input_sec));
|
asection *, struct elf_link_hash_entry *));
|
||||||
|
|
||||||
static bfd_boolean elf64_hppa_finish_dynamic_symbol
|
static bfd_boolean elf64_hppa_finish_dynamic_symbol
|
||||||
PARAMS ((bfd *, struct bfd_link_info *,
|
PARAMS ((bfd *, struct bfd_link_info *,
|
||||||
@ -1893,12 +1893,12 @@ elf64_hppa_size_dynamic_sections (output_bfd, info)
|
|||||||
table. Ick. */
|
table. Ick. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec)
|
elf64_hppa_link_output_symbol_hook (info, name, sym, input_sec, h)
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
|
||||||
struct bfd_link_info *info;
|
struct bfd_link_info *info;
|
||||||
const char *name;
|
const char *name;
|
||||||
Elf_Internal_Sym *sym;
|
Elf_Internal_Sym *sym;
|
||||||
asection *input_sec ATTRIBUTE_UNUSED;
|
asection *input_sec ATTRIBUTE_UNUSED;
|
||||||
|
struct elf_link_hash_entry *h;
|
||||||
{
|
{
|
||||||
struct elf64_hppa_link_hash_table *hppa_info;
|
struct elf64_hppa_link_hash_table *hppa_info;
|
||||||
struct elf64_hppa_dyn_hash_entry *dyn_h;
|
struct elf64_hppa_dyn_hash_entry *dyn_h;
|
||||||
@ -1912,6 +1912,8 @@ elf64_hppa_link_output_symbol_hook (abfd, info, name, sym, input_sec)
|
|||||||
hppa_info = elf64_hppa_hash_table (info);
|
hppa_info = elf64_hppa_hash_table (info);
|
||||||
dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
|
dyn_h = elf64_hppa_dyn_hash_lookup (&hppa_info->dyn_hash_table,
|
||||||
name, FALSE, FALSE);
|
name, FALSE, FALSE);
|
||||||
|
if (dyn_h->h != h)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
/* Function symbols for which we created .opd entries *may* have been
|
/* Function symbols for which we created .opd entries *may* have been
|
||||||
munged by finish_dynamic_symbol and have to be un-munged here.
|
munged by finish_dynamic_symbol and have to be un-munged here.
|
||||||
|
@ -157,8 +157,8 @@ struct bpo_greg_section_info
|
|||||||
};
|
};
|
||||||
|
|
||||||
static bfd_boolean mmix_elf_link_output_symbol_hook
|
static bfd_boolean mmix_elf_link_output_symbol_hook
|
||||||
PARAMS ((bfd *, struct bfd_link_info *, const char *,
|
PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *,
|
||||||
Elf_Internal_Sym *, asection *));
|
asection *, struct elf_link_hash_entry *));
|
||||||
|
|
||||||
static bfd_reloc_status_type mmix_elf_reloc
|
static bfd_reloc_status_type mmix_elf_reloc
|
||||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||||
@ -2113,12 +2113,12 @@ _bfd_mmix_check_all_relocs (abfd, info)
|
|||||||
number. */
|
number. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
mmix_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
|
mmix_elf_link_output_symbol_hook (info, name, sym, input_sec, h)
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
|
||||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||||
const char *name ATTRIBUTE_UNUSED;
|
const char *name ATTRIBUTE_UNUSED;
|
||||||
Elf_Internal_Sym *sym;
|
Elf_Internal_Sym *sym;
|
||||||
asection *input_sec;
|
asection *input_sec;
|
||||||
|
struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
|
||||||
{
|
{
|
||||||
if (input_sec != NULL
|
if (input_sec != NULL
|
||||||
&& input_sec->name != NULL
|
&& input_sec->name != NULL
|
||||||
|
106
bfd/elf64-ppc.c
106
bfd/elf64-ppc.c
@ -92,6 +92,7 @@ static bfd_reloc_status_type ppc64_elf_unhandled_reloc
|
|||||||
#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol
|
#define elf_backend_finish_dynamic_symbol ppc64_elf_finish_dynamic_symbol
|
||||||
#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class
|
#define elf_backend_reloc_type_class ppc64_elf_reloc_type_class
|
||||||
#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections
|
#define elf_backend_finish_dynamic_sections ppc64_elf_finish_dynamic_sections
|
||||||
|
#define elf_backend_link_output_symbol_hook ppc64_elf_output_symbol_hook
|
||||||
#define elf_backend_special_sections ppc64_elf_special_sections
|
#define elf_backend_special_sections ppc64_elf_special_sections
|
||||||
|
|
||||||
/* The name of the dynamic interpreter. This is put in the .interp
|
/* The name of the dynamic interpreter. This is put in the .interp
|
||||||
@ -2762,6 +2763,9 @@ struct ppc_link_hash_entry
|
|||||||
unsigned int is_func_descriptor:1;
|
unsigned int is_func_descriptor:1;
|
||||||
unsigned int is_entry:1;
|
unsigned int is_entry:1;
|
||||||
|
|
||||||
|
/* Whether global opd sym has been adjusted or not. */
|
||||||
|
unsigned int adjust_done:1;
|
||||||
|
|
||||||
/* Contexts in which symbol is used in the GOT (or TOC).
|
/* Contexts in which symbol is used in the GOT (or TOC).
|
||||||
TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the
|
TLS_GD .. TLS_EXPLICIT bits are or'd into the mask as the
|
||||||
corresponding relocs are encountered during check_relocs.
|
corresponding relocs are encountered during check_relocs.
|
||||||
@ -2971,6 +2975,7 @@ link_hash_newfunc (struct bfd_hash_entry *entry,
|
|||||||
eh->is_func = 0;
|
eh->is_func = 0;
|
||||||
eh->is_func_descriptor = 0;
|
eh->is_func_descriptor = 0;
|
||||||
eh->is_entry = 0;
|
eh->is_entry = 0;
|
||||||
|
eh->adjust_done = 0;
|
||||||
eh->tls_mask = 0;
|
eh->tls_mask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4875,10 +4880,53 @@ get_tls_mask (char **tls_maskp, unsigned long *toc_symndx,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Adjust all global syms defined in opd sections. In gcc generated
|
||||||
|
code these will already have been done, but I suppose we have to
|
||||||
|
cater for all sorts of hand written assembly. */
|
||||||
|
|
||||||
|
static bfd_boolean
|
||||||
|
adjust_opd_syms (struct elf_link_hash_entry *h, void *inf ATTRIBUTE_UNUSED)
|
||||||
|
{
|
||||||
|
struct ppc_link_hash_entry *eh;
|
||||||
|
asection *sym_sec;
|
||||||
|
long *opd_adjust;
|
||||||
|
|
||||||
|
if (h->root.type == bfd_link_hash_indirect)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
if (h->root.type == bfd_link_hash_warning)
|
||||||
|
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||||
|
|
||||||
|
if (h->root.type != bfd_link_hash_defined
|
||||||
|
&& h->root.type != bfd_link_hash_defweak)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
eh = (struct ppc_link_hash_entry *) h;
|
||||||
|
if (eh->adjust_done)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
sym_sec = eh->elf.root.u.def.section;
|
||||||
|
if (sym_sec != NULL
|
||||||
|
&& elf_section_data (sym_sec) != NULL
|
||||||
|
&& (opd_adjust = ppc64_elf_section_data (sym_sec)->opd.adjust) != NULL)
|
||||||
|
{
|
||||||
|
eh->elf.root.u.def.value += opd_adjust[eh->elf.root.u.def.value / 24];
|
||||||
|
eh->adjust_done = 1;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove unused Official Procedure Descriptor entries. Currently we
|
||||||
|
only remove those associated with functions in discarded link-once
|
||||||
|
sections, or weakly defined functions that have been overridden. It
|
||||||
|
would be possible to remove many more entries for statically linked
|
||||||
|
applications. */
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
|
ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
|
||||||
{
|
{
|
||||||
bfd *ibfd;
|
bfd *ibfd;
|
||||||
|
bfd_boolean some_edited = FALSE;
|
||||||
|
|
||||||
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
|
for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link_next)
|
||||||
{
|
{
|
||||||
@ -5079,14 +5127,17 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
|
|||||||
|
|
||||||
if (h != NULL)
|
if (h != NULL)
|
||||||
{
|
{
|
||||||
/* Redefine the function descriptor symbol
|
/* Redefine the function descriptor symbol to
|
||||||
to this location in the opd section.
|
this location in the opd section. It is
|
||||||
We've checked above that opd relocs are
|
necessary to update the value here rather
|
||||||
ordered. */
|
than using an array of adjustments as we do
|
||||||
|
for local symbols, because various places
|
||||||
|
in the generic ELF code use the value
|
||||||
|
stored in u.def.value. */
|
||||||
fdh->elf.root.u.def.value = wptr - sec->contents;
|
fdh->elf.root.u.def.value = wptr - sec->contents;
|
||||||
|
fdh->adjust_done = 1;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Local syms are a bit tricky. We could
|
/* Local syms are a bit tricky. We could
|
||||||
tweak them as they can be cached, but
|
tweak them as they can be cached, but
|
||||||
we'd need to look through the local syms
|
we'd need to look through the local syms
|
||||||
@ -5094,7 +5145,6 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
|
|||||||
don't have at the moment. So keep an
|
don't have at the moment. So keep an
|
||||||
array of adjustments. */
|
array of adjustments. */
|
||||||
adjust[rel->r_offset / 24] = wptr - rptr;
|
adjust[rel->r_offset / 24] = wptr - rptr;
|
||||||
}
|
|
||||||
|
|
||||||
if (wptr != rptr)
|
if (wptr != rptr)
|
||||||
memcpy (wptr, rptr, 24);
|
memcpy (wptr, rptr, 24);
|
||||||
@ -5153,6 +5203,7 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
|
|||||||
elf_section_data (sec)->rel_hdr.sh_size
|
elf_section_data (sec)->rel_hdr.sh_size
|
||||||
= sec->reloc_count * elf_section_data (sec)->rel_hdr.sh_entsize;
|
= sec->reloc_count * elf_section_data (sec)->rel_hdr.sh_entsize;
|
||||||
BFD_ASSERT (elf_section_data (sec)->rel_hdr2 == NULL);
|
BFD_ASSERT (elf_section_data (sec)->rel_hdr2 == NULL);
|
||||||
|
some_edited = TRUE;
|
||||||
}
|
}
|
||||||
else if (elf_section_data (sec)->relocs != relstart)
|
else if (elf_section_data (sec)->relocs != relstart)
|
||||||
free (relstart);
|
free (relstart);
|
||||||
@ -5167,6 +5218,9 @@ ppc64_elf_edit_opd (bfd *obfd, struct bfd_link_info *info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (some_edited)
|
||||||
|
elf_link_hash_traverse (elf_hash_table (info), adjust_opd_syms, NULL);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5262,8 +5316,18 @@ ppc64_elf_tls_optimize (bfd *obfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
|
|||||||
value = h->root.u.def.value;
|
value = h->root.u.def.value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
value = sym->st_value;
|
value = sym->st_value;
|
||||||
|
|
||||||
|
if (elf_section_data (sym_sec) != NULL)
|
||||||
|
{
|
||||||
|
long *adjust;
|
||||||
|
adjust = ppc64_elf_section_data (sym_sec)->opd.adjust;
|
||||||
|
if (adjust != NULL)
|
||||||
|
value += adjust[value / 24];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ok_tprel = FALSE;
|
ok_tprel = FALSE;
|
||||||
is_local = FALSE;
|
is_local = FALSE;
|
||||||
if (h == NULL
|
if (h == NULL
|
||||||
@ -7402,7 +7466,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|
|||||||
long *opd_sym_adjust;
|
long *opd_sym_adjust;
|
||||||
|
|
||||||
opd_sym_adjust = ppc64_elf_section_data (sec)->opd.adjust;
|
opd_sym_adjust = ppc64_elf_section_data (sec)->opd.adjust;
|
||||||
if (opd_sym_adjust != NULL && sym->st_value % 24 == 0)
|
if (opd_sym_adjust != NULL)
|
||||||
relocation += opd_sym_adjust[sym->st_value / 24];
|
relocation += opd_sym_adjust[sym->st_value / 24];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8673,6 +8737,32 @@ ppc64_elf_relocate_section (bfd *output_bfd,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Adjust the value of any local symbols in opd sections. */
|
||||||
|
|
||||||
|
static bfd_boolean
|
||||||
|
ppc64_elf_output_symbol_hook (struct bfd_link_info *info,
|
||||||
|
const char *name ATTRIBUTE_UNUSED,
|
||||||
|
Elf_Internal_Sym *elfsym,
|
||||||
|
asection *input_sec,
|
||||||
|
struct elf_link_hash_entry *h)
|
||||||
|
{
|
||||||
|
long *adjust;
|
||||||
|
bfd_vma value;
|
||||||
|
|
||||||
|
if (h != NULL
|
||||||
|
|| input_sec == NULL
|
||||||
|
|| ppc64_elf_section_data (input_sec) == NULL
|
||||||
|
|| (adjust = ppc64_elf_section_data (input_sec)->opd.adjust) == NULL)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
value = elfsym->st_value - input_sec->output_offset;
|
||||||
|
if (!info->relocatable)
|
||||||
|
value -= input_sec->output_section->vma;
|
||||||
|
|
||||||
|
elfsym->st_value += adjust[value / 24];
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Finish up dynamic symbol handling. We set the contents of various
|
/* Finish up dynamic symbol handling. We set the contents of various
|
||||||
dynamic sections here. */
|
dynamic sections here. */
|
||||||
|
|
||||||
|
@ -144,8 +144,8 @@ static bfd_boolean sh64_elf64_add_symbol_hook
|
|||||||
(bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **,
|
(bfd *, struct bfd_link_info *, const Elf_Internal_Sym *, const char **,
|
||||||
flagword *, asection **, bfd_vma *);
|
flagword *, asection **, bfd_vma *);
|
||||||
static bfd_boolean sh64_elf64_link_output_symbol_hook
|
static bfd_boolean sh64_elf64_link_output_symbol_hook
|
||||||
(bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
|
(struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
|
||||||
asection *);
|
struct elf_link_hash_entry *);
|
||||||
static bfd_boolean sh64_elf64_fake_sections
|
static bfd_boolean sh64_elf64_fake_sections
|
||||||
(bfd *, Elf_Internal_Shdr *, asection *);
|
(bfd *, Elf_Internal_Shdr *, asection *);
|
||||||
static void sh64_elf64_final_write_processing
|
static void sh64_elf64_final_write_processing
|
||||||
@ -2982,11 +2982,11 @@ sh64_elf64_add_symbol_hook (bfd *abfd, struct bfd_link_info *info,
|
|||||||
DataLabel symbol. */
|
DataLabel symbol. */
|
||||||
|
|
||||||
static bfd_boolean
|
static bfd_boolean
|
||||||
sh64_elf64_link_output_symbol_hook (bfd *abfd ATTRIBUTE_UNUSED,
|
sh64_elf64_link_output_symbol_hook (struct bfd_link_info *info,
|
||||||
struct bfd_link_info *info,
|
|
||||||
const char *cname,
|
const char *cname,
|
||||||
Elf_Internal_Sym *sym,
|
Elf_Internal_Sym *sym,
|
||||||
asection *input_sec ATTRIBUTE_UNUSED)
|
asection *input_sec ATTRIBUTE_UNUSED,
|
||||||
|
struct elf_link_hash_entry *h ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
char *name = (char *) cname;
|
char *name = (char *) cname;
|
||||||
|
|
||||||
|
@ -65,7 +65,8 @@ static bfd_boolean sparc64_elf_add_symbol_hook
|
|||||||
const char **, flagword *, asection **, bfd_vma *));
|
const char **, flagword *, asection **, bfd_vma *));
|
||||||
static bfd_boolean sparc64_elf_output_arch_syms
|
static bfd_boolean sparc64_elf_output_arch_syms
|
||||||
PARAMS ((bfd *, struct bfd_link_info *, PTR,
|
PARAMS ((bfd *, struct bfd_link_info *, PTR,
|
||||||
bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *, asection *)));
|
bfd_boolean (*) (PTR, const char *, Elf_Internal_Sym *,
|
||||||
|
asection *, struct elf_link_hash_entry *)));
|
||||||
static void sparc64_elf_symbol_processing
|
static void sparc64_elf_symbol_processing
|
||||||
PARAMS ((bfd *, asymbol *));
|
PARAMS ((bfd *, asymbol *));
|
||||||
|
|
||||||
@ -1511,7 +1512,8 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func)
|
|||||||
struct bfd_link_info *info;
|
struct bfd_link_info *info;
|
||||||
PTR finfo;
|
PTR finfo;
|
||||||
bfd_boolean (*func)
|
bfd_boolean (*func)
|
||||||
PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *));
|
PARAMS ((PTR, const char *, Elf_Internal_Sym *, asection *,
|
||||||
|
struct elf_link_hash_entry *));
|
||||||
{
|
{
|
||||||
int reg;
|
int reg;
|
||||||
struct sparc64_elf_app_reg *app_regs =
|
struct sparc64_elf_app_reg *app_regs =
|
||||||
@ -1557,7 +1559,8 @@ sparc64_elf_output_arch_syms (output_bfd, info, finfo, func)
|
|||||||
sym.st_shndx = app_regs [reg].shndx;
|
sym.st_shndx = app_regs [reg].shndx;
|
||||||
if (! (*func) (finfo, app_regs [reg].name, &sym,
|
if (! (*func) (finfo, app_regs [reg].name, &sym,
|
||||||
sym.st_shndx == SHN_ABS
|
sym.st_shndx == SHN_ABS
|
||||||
? bfd_abs_section_ptr : bfd_und_section_ptr))
|
? bfd_abs_section_ptr : bfd_und_section_ptr,
|
||||||
|
NULL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2833,7 +2833,8 @@ struct elf_final_link_info
|
|||||||
};
|
};
|
||||||
|
|
||||||
static bfd_boolean elf_link_output_sym
|
static bfd_boolean elf_link_output_sym
|
||||||
(struct elf_final_link_info *, const char *, Elf_Internal_Sym *, asection *);
|
(struct elf_final_link_info *, const char *, Elf_Internal_Sym *, asection *,
|
||||||
|
struct elf_link_hash_entry *);
|
||||||
static bfd_boolean elf_link_flush_output_syms
|
static bfd_boolean elf_link_flush_output_syms
|
||||||
(struct elf_final_link_info *);
|
(struct elf_final_link_info *);
|
||||||
static bfd_boolean elf_link_output_extsym
|
static bfd_boolean elf_link_output_extsym
|
||||||
@ -3407,7 +3408,8 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||||||
elfsym.st_info = 0;
|
elfsym.st_info = 0;
|
||||||
elfsym.st_other = 0;
|
elfsym.st_other = 0;
|
||||||
elfsym.st_shndx = SHN_UNDEF;
|
elfsym.st_shndx = SHN_UNDEF;
|
||||||
if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr))
|
if (! elf_link_output_sym (&finfo, NULL, &elfsym, bfd_und_section_ptr,
|
||||||
|
NULL))
|
||||||
goto error_return;
|
goto error_return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3423,7 +3425,7 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||||||
elfsym.st_other = 0;
|
elfsym.st_other = 0;
|
||||||
elfsym.st_shndx = SHN_ABS;
|
elfsym.st_shndx = SHN_ABS;
|
||||||
if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd),
|
if (! elf_link_output_sym (&finfo, bfd_get_filename (abfd),
|
||||||
&elfsym, bfd_abs_section_ptr))
|
&elfsym, bfd_abs_section_ptr, NULL))
|
||||||
goto error_return;
|
goto error_return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3448,7 +3450,7 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||||||
elfsym.st_value = 0;
|
elfsym.st_value = 0;
|
||||||
else
|
else
|
||||||
elfsym.st_value = o->vma;
|
elfsym.st_value = o->vma;
|
||||||
if (! elf_link_output_sym (&finfo, NULL, &elfsym, o))
|
if (! elf_link_output_sym (&finfo, NULL, &elfsym, o, NULL))
|
||||||
goto error_return;
|
goto error_return;
|
||||||
if (i == SHN_LORESERVE - 1)
|
if (i == SHN_LORESERVE - 1)
|
||||||
i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
|
i += SHN_HIRESERVE + 1 - SHN_LORESERVE;
|
||||||
@ -3702,7 +3704,8 @@ elf_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
|
|||||||
if (bed->elf_backend_output_arch_syms)
|
if (bed->elf_backend_output_arch_syms)
|
||||||
{
|
{
|
||||||
typedef bfd_boolean (*out_sym_func)
|
typedef bfd_boolean (*out_sym_func)
|
||||||
(void *, const char *, Elf_Internal_Sym *, asection *);
|
(void *, const char *, Elf_Internal_Sym *, asection *,
|
||||||
|
struct elf_link_hash_entry *);
|
||||||
|
|
||||||
if (! ((*bed->elf_backend_output_arch_syms)
|
if (! ((*bed->elf_backend_output_arch_syms)
|
||||||
(abfd, info, &finfo, (out_sym_func) elf_link_output_sym)))
|
(abfd, info, &finfo, (out_sym_func) elf_link_output_sym)))
|
||||||
@ -4086,20 +4089,20 @@ static bfd_boolean
|
|||||||
elf_link_output_sym (struct elf_final_link_info *finfo,
|
elf_link_output_sym (struct elf_final_link_info *finfo,
|
||||||
const char *name,
|
const char *name,
|
||||||
Elf_Internal_Sym *elfsym,
|
Elf_Internal_Sym *elfsym,
|
||||||
asection *input_sec)
|
asection *input_sec,
|
||||||
|
struct elf_link_hash_entry *h)
|
||||||
{
|
{
|
||||||
Elf_External_Sym *dest;
|
Elf_External_Sym *dest;
|
||||||
Elf_External_Sym_Shndx *destshndx;
|
Elf_External_Sym_Shndx *destshndx;
|
||||||
bfd_boolean (*output_symbol_hook)
|
bfd_boolean (*output_symbol_hook)
|
||||||
(bfd *, struct bfd_link_info *info, const char *,
|
(struct bfd_link_info *, const char *, Elf_Internal_Sym *, asection *,
|
||||||
Elf_Internal_Sym *, asection *);
|
struct elf_link_hash_entry *);
|
||||||
|
|
||||||
output_symbol_hook = get_elf_backend_data (finfo->output_bfd)->
|
output_symbol_hook = get_elf_backend_data (finfo->output_bfd)->
|
||||||
elf_backend_link_output_symbol_hook;
|
elf_backend_link_output_symbol_hook;
|
||||||
if (output_symbol_hook != NULL)
|
if (output_symbol_hook != NULL)
|
||||||
{
|
{
|
||||||
if (! ((*output_symbol_hook)
|
if (! (*output_symbol_hook) (finfo->info, name, elfsym, input_sec, h))
|
||||||
(finfo->output_bfd, finfo->info, name, elfsym, input_sec)))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4640,7 +4643,7 @@ elf_link_output_extsym (struct elf_link_hash_entry *h, void *data)
|
|||||||
|
|
||||||
h->indx = bfd_get_symcount (finfo->output_bfd);
|
h->indx = bfd_get_symcount (finfo->output_bfd);
|
||||||
|
|
||||||
if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec))
|
if (! elf_link_output_sym (finfo, h->root.root.string, &sym, input_sec, h))
|
||||||
{
|
{
|
||||||
eoinfo->failed = TRUE;
|
eoinfo->failed = TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -4845,7 +4848,7 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! elf_link_output_sym (finfo, name, &osym, isec))
|
if (! elf_link_output_sym (finfo, name, &osym, isec, NULL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5207,7 +5210,8 @@ elf_link_input_bfd (struct elf_final_link_info *finfo, bfd *input_bfd)
|
|||||||
finfo->indices[r_symndx]
|
finfo->indices[r_symndx]
|
||||||
= bfd_get_symcount (output_bfd);
|
= bfd_get_symcount (output_bfd);
|
||||||
|
|
||||||
if (! elf_link_output_sym (finfo, name, &sym, sec))
|
if (! elf_link_output_sym (finfo, name, &sym, sec,
|
||||||
|
NULL))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4818,12 +4818,12 @@ _bfd_mips_elf_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp)
|
|||||||
also where we undo the increment of the value for a mips16 symbol. */
|
also where we undo the increment of the value for a mips16 symbol. */
|
||||||
|
|
||||||
bfd_boolean
|
bfd_boolean
|
||||||
_bfd_mips_elf_link_output_symbol_hook (abfd, info, name, sym, input_sec)
|
_bfd_mips_elf_link_output_symbol_hook (info, name, sym, input_sec, h)
|
||||||
bfd *abfd ATTRIBUTE_UNUSED;
|
|
||||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||||
const char *name ATTRIBUTE_UNUSED;
|
const char *name ATTRIBUTE_UNUSED;
|
||||||
Elf_Internal_Sym *sym;
|
Elf_Internal_Sym *sym;
|
||||||
asection *input_sec;
|
asection *input_sec;
|
||||||
|
struct elf_link_hash_entry *h ATTRIBUTE_UNUSED;
|
||||||
{
|
{
|
||||||
/* If we see a common symbol, which implies a relocatable link, then
|
/* If we see a common symbol, which implies a relocatable link, then
|
||||||
if a symbol was small common in an input file, mark it as small
|
if a symbol was small common in an input file, mark it as small
|
||||||
|
@ -36,8 +36,8 @@ extern bfd_boolean _bfd_mips_elf_add_symbol_hook
|
|||||||
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
|
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
|
||||||
const char **, flagword *, asection **, bfd_vma *));
|
const char **, flagword *, asection **, bfd_vma *));
|
||||||
extern bfd_boolean _bfd_mips_elf_link_output_symbol_hook
|
extern bfd_boolean _bfd_mips_elf_link_output_symbol_hook
|
||||||
PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
|
PARAMS ((struct bfd_link_info *, const char *, Elf_Internal_Sym *,
|
||||||
asection *));
|
asection *, struct elf_link_hash_entry *));
|
||||||
extern bfd_boolean _bfd_mips_elf_create_dynamic_sections
|
extern bfd_boolean _bfd_mips_elf_create_dynamic_sections
|
||||||
PARAMS ((bfd *, struct bfd_link_info *));
|
PARAMS ((bfd *, struct bfd_link_info *));
|
||||||
extern bfd_boolean _bfd_mips_elf_check_relocs
|
extern bfd_boolean _bfd_mips_elf_check_relocs
|
||||||
|
Reference in New Issue
Block a user