* elf-bfd.h (struct elf_size_info): Add swap_symbol_in field.

(bfd_elf32_swap_symbol_in): Update prototype.
	(bfd_elf64_swap_symbol_in): Likewise.
	* elfcode.h (elf_swap_symbol_in): Change input args to const PTR *.
	(elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
	* elflink.h (elf_link_is_defined_archive_symbol): Likewise.
	(elf_link_add_object_symbols): Likewise.
	(elf_link_record_local_dynamic_symbol): Likewise.
	(elf_link_input_bfd): Likewise.
	(elf_gc_mark): Likewise.
	(elf_reloc_symbol_deleted_p): Likewise.
	* elf-m10200.c (mn10200_elf_relax_section): Likewise.
	(mn10200_elf_relax_delete_bytes): Likewise.
	(mn10200_elf_symbol_address_p): Likewise.
	(mn10200_elf_get_relocated_section_contents): Likewise.
	* elf-m10300.c (mn10300_elf_relax_section): Likewise.
	(mn10300_elf_relax_section): Likewise.
	(mn10300_elf_relax_delete_bytes): Likewise.
	(mn10300_elf_symbol_address_p): Likewise.
	(mn10300_elf_get_relocated_section_contents): Likewise.
	* elf32-h8300.c (elf32_h8_relax_section): Likewise.
	(elf32_h8_relax_delete_bytes): Likewise.
	(elf32_h8_symbol_address_p): Likewise.
	(elf32_h8_get_relocated_section_contents): Likewise.
	* elf32-hppa.c (get_local_syms): Likewise.
	* elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
	* elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
	* elf32-sh.c (sh_elf_relax_section): Likewise.
	(sh_elf_relax_delete_bytes): Likewise.
	(sh_elf_get_relocated_section_contents): Likewise.
	* elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
	* elf64-alpha.c (elf64_alpha_relax_section): Likewise.
	* elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
	* elf64-mmix.c (mmix_elf_relax_section): Likewise.
	* elf64-ppc.c (get_local_syms): Likewise.
	* elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
	* elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
	* elfcode.h (NAME(_bfd_elf,size_info)): Update initialiser.
	* elf64-alpha.c (alpha_elf_size_info): Likewise.
	* elf64-hppa.c (hppa64_elf_size_info): Likewise.
	* elf64-mips.c (mips_elf64_size_info): Likewise.
	* elf64-s390.c (s390_elf64_size_info): Likewise.
	* elf64-sparc.c (sparc64_elf_size_info): Likewise.
This commit is contained in:
Alan Modra 2002-06-05 13:32:02 +00:00
parent 53bfd6b45b
commit 73ff0d563c
21 changed files with 146 additions and 51 deletions

View file

@ -1,3 +1,49 @@
2002-06-05 Alan Modra <amodra@bigpond.net.au>
* elf-bfd.h (struct elf_size_info): Add swap_symbol_in field.
(bfd_elf32_swap_symbol_in): Update prototype.
(bfd_elf64_swap_symbol_in): Likewise.
* elfcode.h (elf_swap_symbol_in): Change input args to const PTR *.
(elf_slurp_symbol_table): Adjust call to elf_swap_symbol_in.
* elflink.h (elf_link_is_defined_archive_symbol): Likewise.
(elf_link_add_object_symbols): Likewise.
(elf_link_record_local_dynamic_symbol): Likewise.
(elf_link_input_bfd): Likewise.
(elf_gc_mark): Likewise.
(elf_reloc_symbol_deleted_p): Likewise.
* elf-m10200.c (mn10200_elf_relax_section): Likewise.
(mn10200_elf_relax_delete_bytes): Likewise.
(mn10200_elf_symbol_address_p): Likewise.
(mn10200_elf_get_relocated_section_contents): Likewise.
* elf-m10300.c (mn10300_elf_relax_section): Likewise.
(mn10300_elf_relax_section): Likewise.
(mn10300_elf_relax_delete_bytes): Likewise.
(mn10300_elf_symbol_address_p): Likewise.
(mn10300_elf_get_relocated_section_contents): Likewise.
* elf32-h8300.c (elf32_h8_relax_section): Likewise.
(elf32_h8_relax_delete_bytes): Likewise.
(elf32_h8_symbol_address_p): Likewise.
(elf32_h8_get_relocated_section_contents): Likewise.
* elf32-hppa.c (get_local_syms): Likewise.
* elf32-m68k.c (bfd_m68k_elf32_create_embedded_relocs): Likewise.
* elf32-mips.c (bfd_mips_elf32_create_embedded_relocs): Likewise.
* elf32-sh.c (sh_elf_relax_section): Likewise.
(sh_elf_relax_delete_bytes): Likewise.
(sh_elf_get_relocated_section_contents): Likewise.
* elf32-xstormy16.c (xstormy16_elf_relax_section): Likewise.
* elf64-alpha.c (elf64_alpha_relax_section): Likewise.
* elf64-hppa.c (elf64_hppa_check_relocs): Likewise.
* elf64-mmix.c (mmix_elf_relax_section): Likewise.
* elf64-ppc.c (get_local_syms): Likewise.
* elf64-sh64.c (sh_elf64_get_relocated_section_contents): Likewise.
* elfxx-ia64.c (elfNN_ia64_relax_section): Likewise.
* elfcode.h (NAME(_bfd_elf,size_info)): Update initialiser.
* elf64-alpha.c (alpha_elf_size_info): Likewise.
* elf64-hppa.c (hppa64_elf_size_info): Likewise.
* elf64-mips.c (mips_elf64_size_info): Likewise.
* elf64-s390.c (s390_elf64_size_info): Likewise.
* elf64-sparc.c (sparc64_elf_size_info): Likewise.
2002-06-05 Maciej W. Rozycki <macro@ds2.pg.gda.pl> 2002-06-05 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* elf32-mips.c (elf32_mips_ignore_discarded_relocs): Move to... * elf32-mips.c (elf32_mips_ignore_discarded_relocs): Move to...

View file

@ -353,6 +353,8 @@ struct elf_size_info {
PARAMS ((bfd *)); PARAMS ((bfd *));
void (*write_relocs) void (*write_relocs)
PARAMS ((bfd *, asection *, PTR)); PARAMS ((bfd *, asection *, PTR));
void (*swap_symbol_in)
PARAMS ((bfd *, const PTR *, const PTR *, Elf_Internal_Sym *));
void (*swap_symbol_out) void (*swap_symbol_out)
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
boolean (*slurp_reloc_table) boolean (*slurp_reloc_table)
@ -1441,8 +1443,7 @@ extern boolean bfd_elf32_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *)); PARAMS ((bfd *, struct bfd_link_info *));
extern void bfd_elf32_swap_symbol_in extern void bfd_elf32_swap_symbol_in
PARAMS ((bfd *, const Elf32_External_Sym *, const Elf_External_Sym_Shndx *, PARAMS ((bfd *, const PTR *, const PTR *, Elf_Internal_Sym *));
Elf_Internal_Sym *));
extern void bfd_elf32_swap_symbol_out extern void bfd_elf32_swap_symbol_out
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf32_swap_reloc_in extern void bfd_elf32_swap_reloc_in
@ -1494,8 +1495,7 @@ extern boolean bfd_elf64_bfd_final_link
PARAMS ((bfd *, struct bfd_link_info *)); PARAMS ((bfd *, struct bfd_link_info *));
extern void bfd_elf64_swap_symbol_in extern void bfd_elf64_swap_symbol_in
PARAMS ((bfd *, const Elf64_External_Sym *, const Elf_External_Sym_Shndx *, PARAMS ((bfd *, const PTR *, const PTR *, Elf_Internal_Sym *));
Elf_Internal_Sym *));
extern void bfd_elf64_swap_symbol_out extern void bfd_elf64_swap_symbol_out
PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR));
extern void bfd_elf64_swap_reloc_in extern void bfd_elf64_swap_reloc_in

View file

@ -630,7 +630,8 @@ mn10200_elf_relax_section (abfd, sec, link_info, again)
esym = extsyms + ELF32_R_SYM (irel->r_info); esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
if (isym.st_shndx == SHN_UNDEF) if (isym.st_shndx == SHN_UNDEF)
sym_sec = bfd_und_section_ptr; sym_sec = bfd_und_section_ptr;
@ -1317,7 +1318,8 @@ mn10200_elf_relax_delete_bytes (abfd, sec, addr, count)
Elf_Internal_Sym isym; Elf_Internal_Sym isym;
Elf_External_Sym_Shndx dummy; Elf_External_Sym_Shndx dummy;
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym, (const PTR *) shndx,
&isym);
if (isym.st_shndx == sec_shndx if (isym.st_shndx == sec_shndx
&& isym.st_value > addr && isym.st_value > addr
@ -1378,7 +1380,8 @@ mn10200_elf_symbol_address_p (abfd, sec, addr)
{ {
Elf_Internal_Sym isym; Elf_Internal_Sym isym;
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym, (const PTR *) shndx,
&isym);
if (isym.st_shndx == sec_shndx if (isym.st_shndx == sec_shndx
&& isym.st_value == addr) && isym.st_value == addr)
@ -1500,7 +1503,8 @@ mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
{ {
asection *isec; asection *isec;
bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp); bfd_elf32_swap_symbol_in (input_bfd, (const PTR *) esym,
(const PTR *) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF) if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr; isec = bfd_und_section_ptr;

View file

@ -937,7 +937,9 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
esym = extsyms + r_index; esym = extsyms + r_index;
shndx = shndx_buf + (shndx_buf ? r_index : 0); shndx = shndx_buf + (shndx_buf ? r_index : 0);
bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, bfd_elf32_swap_symbol_in (input_bfd,
(const PTR *) esym,
(const PTR *) shndx,
&isym); &isym);
if (isym.st_shndx == SHN_UNDEF) if (isym.st_shndx == SHN_UNDEF)
@ -1028,7 +1030,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
{ {
Elf_Internal_Sym isym; Elf_Internal_Sym isym;
bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (input_bfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
if (isym.st_shndx == sec_shndx if (isym.st_shndx == sec_shndx
&& ELF_ST_TYPE (isym.st_info) == STT_FUNC) && ELF_ST_TYPE (isym.st_info) == STT_FUNC)
{ {
@ -1254,7 +1257,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
struct elf_link_hash_table *elftab; struct elf_link_hash_table *elftab;
bfd_size_type amt; bfd_size_type amt;
bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (input_bfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
if (isym.st_shndx != sec_shndx) if (isym.st_shndx != sec_shndx)
continue; continue;
@ -1551,7 +1555,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again)
/* A local symbol. */ /* A local symbol. */
esym = extsyms + ELF32_R_SYM (irel->r_info); esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
if (isym.st_shndx == SHN_UNDEF) if (isym.st_shndx == SHN_UNDEF)
sym_sec = bfd_und_section_ptr; sym_sec = bfd_und_section_ptr;
@ -2674,7 +2679,8 @@ mn10300_elf_relax_delete_bytes (abfd, sec, addr, count)
Elf_Internal_Sym isym; Elf_Internal_Sym isym;
Elf_External_Sym_Shndx dummy; Elf_External_Sym_Shndx dummy;
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym, (const PTR *) shndx,
&isym);
if (isym.st_shndx == sec_shndx if (isym.st_shndx == sec_shndx
&& isym.st_value > addr && isym.st_value > addr
@ -2735,7 +2741,8 @@ mn10300_elf_symbol_address_p (abfd, sec, addr)
{ {
Elf_Internal_Sym isym; Elf_Internal_Sym isym;
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym, (const PTR *) shndx,
&isym);
if (isym.st_shndx == sec_shndx if (isym.st_shndx == sec_shndx
&& isym.st_value == addr) && isym.st_value == addr)
@ -2857,7 +2864,8 @@ mn10300_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
{ {
asection *isec; asection *isec;
bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp); bfd_elf32_swap_symbol_in (input_bfd, (const PTR *) esym,
(const PTR *) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF) if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr; isec = bfd_und_section_ptr;

View file

@ -1,5 +1,6 @@
/* Generic support for 32-bit ELF /* Generic support for 32-bit ELF
Copyright 1993, 1995, 1998, 1999, 2001 Free Software Foundation, Inc. Copyright 1993, 1995, 1998, 1999, 2001, 2002
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
@ -815,7 +816,8 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
/* A local symbol. */ /* A local symbol. */
esym = extsyms + ELF32_R_SYM (irel->r_info); esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx); sym_sec = bfd_section_from_elf_index (abfd, isym.st_shndx);
symval = (isym.st_value symval = (isym.st_value
@ -911,7 +913,9 @@ elf32_h8_relax_section (abfd, sec, link_info, again)
shndx = shndx_buf; shndx = shndx_buf;
if (shndx != NULL) if (shndx != NULL)
shndx += ELF32_R_SYM (last_reloc->r_info); shndx += ELF32_R_SYM (last_reloc->r_info);
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &last_symbol); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx,
&last_symbol);
last_sym_sec last_sym_sec
= bfd_section_from_elf_index (abfd, last_symbol.st_shndx); = bfd_section_from_elf_index (abfd, last_symbol.st_shndx);
@ -1338,7 +1342,8 @@ elf32_h8_relax_delete_bytes (abfd, sec, addr, count)
Elf_Internal_Sym isym; Elf_Internal_Sym isym;
Elf_External_Sym_Shndx dummy; Elf_External_Sym_Shndx dummy;
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym, (const PTR *) shndx,
&isym);
if (isym.st_shndx == sec_shndx if (isym.st_shndx == sec_shndx
&& isym.st_value > addr && isym.st_value > addr
@ -1399,7 +1404,8 @@ elf32_h8_symbol_address_p (abfd, sec, addr)
{ {
Elf_Internal_Sym isym; Elf_Internal_Sym isym;
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym, (const PTR *) shndx,
&isym);
if (isym.st_shndx == sec_shndx if (isym.st_shndx == sec_shndx
&& isym.st_value == addr) && isym.st_value == addr)
@ -1521,7 +1527,8 @@ elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order,
{ {
asection *isec; asection *isec;
bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp); bfd_elf32_swap_symbol_in (input_bfd, (const PTR *) esym,
(const PTR *) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF) if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr; isec = bfd_und_section_ptr;

View file

@ -2827,7 +2827,8 @@ get_local_syms (output_bfd, input_bfd, info)
isym = local_syms, shndx = shndx_buf; isym = local_syms, shndx = shndx_buf;
esym < end_sy; esym < end_sy;
esym++, isym++, shndx = (shndx ? shndx + 1 : NULL)) esym++, isym++, shndx = (shndx ? shndx + 1 : NULL))
bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isym); bfd_elf32_swap_symbol_in (input_bfd, (const PTR *) esym,
(const PTR *) shndx, isym);
/* Now we can free the external symbols. */ /* Now we can free the external symbols. */
free (shndx_buf); free (shndx_buf);

View file

@ -2211,7 +2211,8 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
/* A local symbol. */ /* A local symbol. */
esym = extsyms + ELF32_R_SYM (irel->r_info); esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx); targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
} }

View file

@ -1886,7 +1886,8 @@ bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
/* A local symbol. */ /* A local symbol. */
esym = extsyms + ELF32_R_SYM (irel->r_info); esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx); targetsec = bfd_section_from_elf_index (abfd, isym.st_shndx);
} }

View file

@ -2067,7 +2067,8 @@ sh_elf_relax_section (abfd, sec, link_info, again)
esym = extsyms + ELF32_R_SYM (irelfn->r_info); esym = extsyms + ELF32_R_SYM (irelfn->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelfn->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelfn->r_info) : 0);
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
if (isym.st_shndx if (isym.st_shndx
!= (unsigned int) _bfd_elf_section_from_bfd_section (abfd, sec)) != (unsigned int) _bfd_elf_section_from_bfd_section (abfd, sec))
@ -2447,7 +2448,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
{ {
esym = extsyms + ELF32_R_SYM (irel->r_info); esym = extsyms + ELF32_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irel->r_info) : 0);
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &sym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &sym);
if (sym.st_shndx == sec_shndx if (sym.st_shndx == sec_shndx
&& (sym.st_value <= addr && (sym.st_value <= addr
@ -2710,7 +2712,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
esym = extsyms + ELF32_R_SYM (irelscan->r_info); esym = extsyms + ELF32_R_SYM (irelscan->r_info);
shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelscan->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELF32_R_SYM (irelscan->r_info) : 0);
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &sym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &sym);
if (sym.st_shndx == sec_shndx if (sym.st_shndx == sec_shndx
&& (sym.st_value <= addr && (sym.st_value <= addr
@ -2757,7 +2760,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count)
Elf_Internal_Sym isym; Elf_Internal_Sym isym;
Elf_External_Sym_Shndx dummy; Elf_External_Sym_Shndx dummy;
bfd_elf32_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf32_swap_symbol_in (abfd, (const PTR *) esym, (const PTR *) shndx,
&isym);
if (isym.st_shndx == sec_shndx if (isym.st_shndx == sec_shndx
&& isym.st_value > addr && isym.st_value > addr
@ -4924,7 +4928,8 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order,
{ {
asection *isec; asection *isec;
bfd_elf32_swap_symbol_in (input_bfd, esym, shndx, isymp); bfd_elf32_swap_symbol_in (input_bfd, (const PTR *) esym,
(const PTR *) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF) if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr; isec = bfd_und_section_ptr;

View file

@ -654,7 +654,8 @@ xstormy16_elf_relax_section (dynobj, splt, info, again)
shndx = shndx_buf; shndx = shndx_buf;
if (shndx != NULL) if (shndx != NULL)
shndx += idx; shndx += idx;
bfd_elf32_swap_symbol_in (ibfd, extsyms + idx, shndx, &isym); bfd_elf32_swap_symbol_in (ibfd, (const PTR *) (extsyms + idx),
(const PTR *) shndx, &isym);
if (isym.st_shndx == SHN_UNDEF) if (isym.st_shndx == SHN_UNDEF)
continue; continue;
else if (isym.st_shndx == SHN_ABS) else if (isym.st_shndx == SHN_ABS)

View file

@ -2172,7 +2172,8 @@ elf64_alpha_relax_section (abfd, sec, link_info, again)
esym = extsyms + ELF64_R_SYM (irel->r_info); esym = extsyms + ELF64_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELF64_R_SYM (irel->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELF64_R_SYM (irel->r_info) : 0);
bfd_elf64_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf64_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
if (isym.st_shndx == SHN_UNDEF) if (isym.st_shndx == SHN_UNDEF)
continue; continue;
else if (isym.st_shndx == SHN_ABS) else if (isym.st_shndx == SHN_ABS)
@ -5528,6 +5529,7 @@ const struct elf_size_info alpha_elf_size_info =
bfd_elf64_write_out_phdrs, bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr, bfd_elf64_write_shdrs_and_ehdr,
bfd_elf64_write_relocs, bfd_elf64_write_relocs,
bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out, bfd_elf64_swap_symbol_out,
bfd_elf64_slurp_reloc_table, bfd_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table, bfd_elf64_slurp_symbol_table,

View file

@ -682,7 +682,8 @@ elf64_hppa_check_relocs (abfd, info, sec, relocs)
i < symtab_hdr->sh_info; i < symtab_hdr->sh_info;
i++, esym++, isym++, shndx = (shndx != NULL ? shndx + 1 : NULL)) i++, esym++, isym++, shndx = (shndx != NULL ? shndx + 1 : NULL))
{ {
bfd_elf64_swap_symbol_in (abfd, esym, shndx, isym); bfd_elf64_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, isym);
if (isym->st_shndx > highest_shndx) if (isym->st_shndx > highest_shndx)
highest_shndx = isym->st_shndx; highest_shndx = isym->st_shndx;
} }
@ -2673,6 +2674,7 @@ const struct elf_size_info hppa64_elf_size_info =
bfd_elf64_write_out_phdrs, bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr, bfd_elf64_write_shdrs_and_ehdr,
bfd_elf64_write_relocs, bfd_elf64_write_relocs,
bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out, bfd_elf64_swap_symbol_out,
bfd_elf64_slurp_reloc_table, bfd_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table, bfd_elf64_slurp_symbol_table,

View file

@ -2666,6 +2666,7 @@ const struct elf_size_info mips_elf64_size_info =
bfd_elf64_write_out_phdrs, bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr, bfd_elf64_write_shdrs_and_ehdr,
mips_elf64_write_relocs, mips_elf64_write_relocs,
bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out, bfd_elf64_swap_symbol_out,
mips_elf64_slurp_reloc_table, mips_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table, bfd_elf64_slurp_symbol_table,

View file

@ -2419,7 +2419,8 @@ mmix_elf_relax_section (abfd, sec, link_info, again)
esym = extsyms + ELF64_R_SYM (irel->r_info); esym = extsyms + ELF64_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf shndx = shndx_buf + (shndx_buf
? ELF64_R_SYM (irel->r_info) : 0); ? ELF64_R_SYM (irel->r_info) : 0);
bfd_elf64_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elf64_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
if (isym.st_shndx == SHN_UNDEF) if (isym.st_shndx == SHN_UNDEF)
sym_sec = bfd_und_section_ptr; sym_sec = bfd_und_section_ptr;

View file

@ -4594,7 +4594,8 @@ get_local_syms (input_bfd, htab)
isym = local_syms, shndx = shndx_buf; isym = local_syms, shndx = shndx_buf;
esym < end_sy; esym < end_sy;
esym++, isym++, shndx = (shndx ? shndx + 1 : NULL)) esym++, isym++, shndx = (shndx ? shndx + 1 : NULL))
bfd_elf64_swap_symbol_in (input_bfd, esym, shndx, isym); bfd_elf64_swap_symbol_in (input_bfd, (const PTR *) esym,
(const PTR *) shndx, isym);
/* Now we can free the external symbols. */ /* Now we can free the external symbols. */
free (shndx_buf); free (shndx_buf);

View file

@ -2339,6 +2339,7 @@ const struct elf_size_info s390_elf64_size_info =
bfd_elf64_write_out_phdrs, bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr, bfd_elf64_write_shdrs_and_ehdr,
bfd_elf64_write_relocs, bfd_elf64_write_relocs,
bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out, bfd_elf64_swap_symbol_out,
bfd_elf64_slurp_reloc_table, bfd_elf64_slurp_reloc_table,
bfd_elf64_slurp_symbol_table, bfd_elf64_slurp_symbol_table,

View file

@ -2234,7 +2234,8 @@ sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order,
{ {
asection *isec; asection *isec;
bfd_elf64_swap_symbol_in (input_bfd, esym, shndx, isymp); bfd_elf64_swap_symbol_in (input_bfd, (const PTR *) esym,
(const PTR *) shndx, isymp);
if (isymp->st_shndx == SHN_UNDEF) if (isymp->st_shndx == SHN_UNDEF)
isec = bfd_und_section_ptr; isec = bfd_und_section_ptr;

View file

@ -3067,6 +3067,7 @@ const struct elf_size_info sparc64_elf_size_info =
bfd_elf64_write_out_phdrs, bfd_elf64_write_out_phdrs,
bfd_elf64_write_shdrs_and_ehdr, bfd_elf64_write_shdrs_and_ehdr,
sparc64_elf_write_relocs, sparc64_elf_write_relocs,
bfd_elf64_swap_symbol_in,
bfd_elf64_swap_symbol_out, bfd_elf64_swap_symbol_out,
sparc64_elf_slurp_reloc_table, sparc64_elf_slurp_reloc_table,
bfd_elf64_slurp_symbol_table, bfd_elf64_slurp_symbol_table,

View file

@ -1,6 +1,6 @@
/* ELF executable support for BFD. /* ELF executable support for BFD.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001 Free Software Foundation, Inc. 2001, 2002 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support, from information published Written by Fred Fish @ Cygnus Support, from information published
in "UNIX System V Release 4, Programmers Guide: ANSI C and in "UNIX System V Release 4, Programmers Guide: ANSI C and
@ -203,12 +203,14 @@ static char *elf_symbol_flags PARAMS ((flagword));
format. */ format. */
void void
elf_swap_symbol_in (abfd, src, shndx, dst) elf_swap_symbol_in (abfd, psrc, pshn, dst)
bfd *abfd; bfd *abfd;
const Elf_External_Sym *src; const PTR *psrc;
const Elf_External_Sym_Shndx *shndx; const PTR *pshn;
Elf_Internal_Sym *dst; Elf_Internal_Sym *dst;
{ {
const Elf_External_Sym *src = (const Elf_External_Sym *) psrc;
const Elf_External_Sym_Shndx *shndx = (const Elf_External_Sym_Shndx *) pshn;
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma; int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
dst->st_name = H_GET_32 (abfd, src->st_name); dst->st_name = H_GET_32 (abfd, src->st_name);
@ -1242,8 +1244,9 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
/* Skip first symbol, which is a null dummy. */ /* Skip first symbol, which is a null dummy. */
for (i = 1; i < symcount; i++) for (i = 1; i < symcount; i++)
{ {
elf_swap_symbol_in (abfd, x_symp + i, elf_swap_symbol_in (abfd, (const PTR *) (x_symp + i),
x_shndx + (x_shndx != NULL ? i : 0), &i_sym); (const PTR *) (x_shndx + (x_shndx ? i : 0)),
&i_sym);
memcpy (&sym->internal_elf_sym, &i_sym, sizeof (Elf_Internal_Sym)); memcpy (&sym->internal_elf_sym, &i_sym, sizeof (Elf_Internal_Sym));
#ifdef ELF_KEEP_EXTSYM #ifdef ELF_KEEP_EXTSYM
memcpy (&sym->native_elf_sym, x_symp + i, sizeof (Elf_External_Sym)); memcpy (&sym->native_elf_sym, x_symp + i, sizeof (Elf_External_Sym));
@ -1695,6 +1698,7 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = {
elf_write_out_phdrs, elf_write_out_phdrs,
elf_write_shdrs_and_ehdr, elf_write_shdrs_and_ehdr,
elf_write_relocs, elf_write_relocs,
elf_swap_symbol_in,
elf_swap_symbol_out, elf_swap_symbol_out,
elf_slurp_reloc_table, elf_slurp_reloc_table,
elf_slurp_symbol_table, elf_slurp_symbol_table,

View file

@ -237,7 +237,7 @@ elf_link_is_defined_archive_symbol (abfd, symdef)
Elf_Internal_Sym sym; Elf_Internal_Sym sym;
const char * name; const char * name;
elf_swap_symbol_in (abfd, esym, shndx, &sym); elf_swap_symbol_in (abfd, (const PTR *) esym, (const PTR *) shndx, &sym);
name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, sym.st_name); name = bfd_elf_string_from_elf_section (abfd, hdr->sh_link, sym.st_name);
if (name == (const char *) NULL) if (name == (const char *) NULL)
@ -1666,7 +1666,7 @@ elf_link_add_object_symbols (abfd, info)
override = false; override = false;
elf_swap_symbol_in (abfd, esym, shndx, &sym); elf_swap_symbol_in (abfd, (const PTR *) esym, (const PTR *) shndx, &sym);
flags = BSF_NO_FLAGS; flags = BSF_NO_FLAGS;
sec = NULL; sec = NULL;
@ -2556,7 +2556,8 @@ elf_link_record_local_dynamic_symbol (info, input_bfd, input_indx)
|| bfd_bread ((PTR) shndx, amt, input_bfd) != amt) || bfd_bread ((PTR) shndx, amt, input_bfd) != amt)
return false; return false;
} }
elf_swap_symbol_in (input_bfd, &esym, shndx, &entry->isym); elf_swap_symbol_in (input_bfd, (const PTR *) &esym, (const PTR *) shndx,
&entry->isym);
name = (bfd_elf_string_from_elf_section name = (bfd_elf_string_from_elf_section
(input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link, (input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link,
@ -6521,7 +6522,8 @@ elf_link_input_bfd (finfo, input_bfd)
const char *name; const char *name;
Elf_Internal_Sym osym; Elf_Internal_Sym osym;
elf_swap_symbol_in (input_bfd, esym, shndx, isym); elf_swap_symbol_in (input_bfd, (const PTR *) esym, (const PTR *) shndx,
isym);
*pindex = -1; *pindex = -1;
if (elf_bad_symtab (input_bfd)) if (elf_bad_symtab (input_bfd))
@ -7660,6 +7662,7 @@ elf_gc_mark (info, sec, gc_mark_hook)
asection *rsec; asection *rsec;
struct elf_link_hash_entry *h; struct elf_link_hash_entry *h;
Elf_Internal_Sym s; Elf_Internal_Sym s;
Elf_External_Sym_Shndx *locshndx;
r_symndx = ELF_R_SYM (rel->r_info); r_symndx = ELF_R_SYM (rel->r_info);
if (r_symndx == 0) if (r_symndx == 0)
@ -7667,9 +7670,10 @@ elf_gc_mark (info, sec, gc_mark_hook)
if (elf_bad_symtab (sec->owner)) if (elf_bad_symtab (sec->owner))
{ {
locshndx = locsym_shndx + (locsym_shndx ? r_symndx : 0);
elf_swap_symbol_in (input_bfd, elf_swap_symbol_in (input_bfd,
locsyms + r_symndx, (const PTR *) (locsyms + r_symndx),
locsym_shndx + (locsym_shndx ? r_symndx : 0), (const PTR *) locshndx,
&s); &s);
if (ELF_ST_BIND (s.st_info) == STB_LOCAL) if (ELF_ST_BIND (s.st_info) == STB_LOCAL)
rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s);
@ -7686,9 +7690,10 @@ elf_gc_mark (info, sec, gc_mark_hook)
} }
else else
{ {
locshndx = locsym_shndx + (locsym_shndx ? r_symndx : 0);
elf_swap_symbol_in (input_bfd, elf_swap_symbol_in (input_bfd,
locsyms + r_symndx, (const PTR *) (locsyms + r_symndx),
locsym_shndx + (locsym_shndx ? r_symndx : 0), (const PTR *) locshndx,
&s); &s);
rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s);
} }
@ -8282,7 +8287,8 @@ elf_reloc_symbol_deleted_p (offset, cookie)
lshndx = (Elf_External_Sym_Shndx *) rcookie->locsym_shndx; lshndx = (Elf_External_Sym_Shndx *) rcookie->locsym_shndx;
if (lshndx != NULL) if (lshndx != NULL)
lshndx += r_symndx; lshndx += r_symndx;
elf_swap_symbol_in (rcookie->abfd, lsym, lshndx, &isym); elf_swap_symbol_in (rcookie->abfd, (const PTR *) lsym,
(const PTR *) lshndx, &isym);
} }
if (r_symndx >= rcookie->locsymcount if (r_symndx >= rcookie->locsymcount

View file

@ -812,7 +812,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again)
/* A local symbol. */ /* A local symbol. */
esym = extsyms + ELFNN_R_SYM (irel->r_info); esym = extsyms + ELFNN_R_SYM (irel->r_info);
shndx = shndx_buf + (shndx_buf ? ELFNN_R_SYM (irel->r_info) : 0); shndx = shndx_buf + (shndx_buf ? ELFNN_R_SYM (irel->r_info) : 0);
bfd_elfNN_swap_symbol_in (abfd, esym, shndx, &isym); bfd_elfNN_swap_symbol_in (abfd, (const PTR *) esym,
(const PTR *) shndx, &isym);
if (isym.st_shndx == SHN_UNDEF) if (isym.st_shndx == SHN_UNDEF)
continue; /* We can't do anthing with undefined symbols. */ continue; /* We can't do anthing with undefined symbols. */
else if (isym.st_shndx == SHN_ABS) else if (isym.st_shndx == SHN_ABS)