From 73ff0d563cc293d039736e9fc3dc335d88b5c586 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 5 Jun 2002 13:32:02 +0000 Subject: [PATCH] * 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. --- bfd/ChangeLog | 46 ++++++++++++++++++++++++++++++++++++++++++++++ bfd/elf-bfd.h | 8 ++++---- bfd/elf-m10200.c | 12 ++++++++---- bfd/elf-m10300.c | 22 +++++++++++++++------- bfd/elf32-h8300.c | 19 +++++++++++++------ bfd/elf32-hppa.c | 3 ++- bfd/elf32-m68k.c | 3 ++- bfd/elf32-mips.c | 3 ++- bfd/elf32-sh.c | 15 ++++++++++----- bfd/elf32-xstormy16.c | 3 ++- bfd/elf64-alpha.c | 4 +++- bfd/elf64-hppa.c | 4 +++- bfd/elf64-mips.c | 1 + bfd/elf64-mmix.c | 3 ++- bfd/elf64-ppc.c | 3 ++- bfd/elf64-s390.c | 1 + bfd/elf64-sh64.c | 3 ++- bfd/elf64-sparc.c | 1 + bfd/elfcode.h | 16 ++++++++++------ bfd/elflink.h | 24 +++++++++++++++--------- bfd/elfxx-ia64.c | 3 ++- 21 files changed, 146 insertions(+), 51 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0cbc8e7..fce1f9a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,49 @@ +2002-06-05 Alan Modra + + * 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 * elf32-mips.c (elf32_mips_ignore_discarded_relocs): Move to... diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 1dd03b2..9d76706 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -353,6 +353,8 @@ struct elf_size_info { PARAMS ((bfd *)); void (*write_relocs) PARAMS ((bfd *, asection *, PTR)); + void (*swap_symbol_in) + PARAMS ((bfd *, const PTR *, const PTR *, Elf_Internal_Sym *)); void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); boolean (*slurp_reloc_table) @@ -1441,8 +1443,7 @@ extern boolean bfd_elf32_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *)); extern void bfd_elf32_swap_symbol_in - PARAMS ((bfd *, const Elf32_External_Sym *, const Elf_External_Sym_Shndx *, - Elf_Internal_Sym *)); + PARAMS ((bfd *, const PTR *, const PTR *, Elf_Internal_Sym *)); extern void bfd_elf32_swap_symbol_out PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); extern void bfd_elf32_swap_reloc_in @@ -1494,8 +1495,7 @@ extern boolean bfd_elf64_bfd_final_link PARAMS ((bfd *, struct bfd_link_info *)); extern void bfd_elf64_swap_symbol_in - PARAMS ((bfd *, const Elf64_External_Sym *, const Elf_External_Sym_Shndx *, - Elf_Internal_Sym *)); + PARAMS ((bfd *, const PTR *, const PTR *, Elf_Internal_Sym *)); extern void bfd_elf64_swap_symbol_out PARAMS ((bfd *, const Elf_Internal_Sym *, PTR, PTR)); extern void bfd_elf64_swap_reloc_in diff --git a/bfd/elf-m10200.c b/bfd/elf-m10200.c index 4e8de60..fe240fd 100644 --- a/bfd/elf-m10200.c +++ b/bfd/elf-m10200.c @@ -630,7 +630,8 @@ mn10200_elf_relax_section (abfd, sec, link_info, again) esym = extsyms + ELF32_R_SYM (irel->r_info); 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) sym_sec = bfd_und_section_ptr; @@ -1317,7 +1318,8 @@ mn10200_elf_relax_delete_bytes (abfd, sec, addr, count) Elf_Internal_Sym isym; 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 && isym.st_value > addr @@ -1378,7 +1380,8 @@ mn10200_elf_symbol_address_p (abfd, sec, addr) { 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 && isym.st_value == addr) @@ -1500,7 +1503,8 @@ mn10200_elf_get_relocated_section_contents (output_bfd, link_info, link_order, { 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) isec = bfd_und_section_ptr; diff --git a/bfd/elf-m10300.c b/bfd/elf-m10300.c index 40b4ad6..1cc9f4c 100644 --- a/bfd/elf-m10300.c +++ b/bfd/elf-m10300.c @@ -937,7 +937,9 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) esym = extsyms + r_index; 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); if (isym.st_shndx == SHN_UNDEF) @@ -1028,7 +1030,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) { 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 && 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; 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) continue; @@ -1551,7 +1555,8 @@ mn10300_elf_relax_section (abfd, sec, link_info, again) /* A local symbol. */ esym = extsyms + ELF32_R_SYM (irel->r_info); 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) sym_sec = bfd_und_section_ptr; @@ -2674,7 +2679,8 @@ mn10300_elf_relax_delete_bytes (abfd, sec, addr, count) Elf_Internal_Sym isym; 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 && isym.st_value > addr @@ -2735,7 +2741,8 @@ mn10300_elf_symbol_address_p (abfd, sec, addr) { 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 && isym.st_value == addr) @@ -2857,7 +2864,8 @@ mn10300_elf_get_relocated_section_contents (output_bfd, link_info, link_order, { 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) isec = bfd_und_section_ptr; diff --git a/bfd/elf32-h8300.c b/bfd/elf32-h8300.c index 52213ec..4a152e2 100644 --- a/bfd/elf32-h8300.c +++ b/bfd/elf32-h8300.c @@ -1,5 +1,6 @@ /* 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. @@ -815,7 +816,8 @@ elf32_h8_relax_section (abfd, sec, link_info, again) /* A local symbol. */ esym = extsyms + ELF32_R_SYM (irel->r_info); 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); symval = (isym.st_value @@ -911,7 +913,9 @@ elf32_h8_relax_section (abfd, sec, link_info, again) shndx = shndx_buf; if (shndx != NULL) 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 = 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_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 && isym.st_value > addr @@ -1399,7 +1404,8 @@ elf32_h8_symbol_address_p (abfd, sec, addr) { 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 && isym.st_value == addr) @@ -1521,7 +1527,8 @@ elf32_h8_get_relocated_section_contents (output_bfd, link_info, link_order, { 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) isec = bfd_und_section_ptr; diff --git a/bfd/elf32-hppa.c b/bfd/elf32-hppa.c index 6615fca..68d6518 100644 --- a/bfd/elf32-hppa.c +++ b/bfd/elf32-hppa.c @@ -2827,7 +2827,8 @@ get_local_syms (output_bfd, input_bfd, info) isym = local_syms, shndx = shndx_buf; esym < end_sy; 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. */ free (shndx_buf); diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index b507fba..628096a 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -2211,7 +2211,8 @@ bfd_m68k_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) /* A local symbol. */ esym = extsyms + ELF32_R_SYM (irel->r_info); 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); } diff --git a/bfd/elf32-mips.c b/bfd/elf32-mips.c index 11c427a..de9cf2f 100644 --- a/bfd/elf32-mips.c +++ b/bfd/elf32-mips.c @@ -1886,7 +1886,8 @@ bfd_mips_elf32_create_embedded_relocs (abfd, info, datasec, relsec, errmsg) /* A local symbol. */ esym = extsyms + ELF32_R_SYM (irel->r_info); 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); } diff --git a/bfd/elf32-sh.c b/bfd/elf32-sh.c index ef737b5..3e8de13 100644 --- a/bfd/elf32-sh.c +++ b/bfd/elf32-sh.c @@ -2067,7 +2067,8 @@ sh_elf_relax_section (abfd, sec, link_info, again) esym = extsyms + ELF32_R_SYM (irelfn->r_info); 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 != (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); 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 && (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); 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 && (sym.st_value <= addr @@ -2757,7 +2760,8 @@ sh_elf_relax_delete_bytes (abfd, sec, addr, count) Elf_Internal_Sym isym; 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 && isym.st_value > addr @@ -4924,7 +4928,8 @@ sh_elf_get_relocated_section_contents (output_bfd, link_info, link_order, { 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) isec = bfd_und_section_ptr; diff --git a/bfd/elf32-xstormy16.c b/bfd/elf32-xstormy16.c index d1e4fb1..57ee1fe 100644 --- a/bfd/elf32-xstormy16.c +++ b/bfd/elf32-xstormy16.c @@ -654,7 +654,8 @@ xstormy16_elf_relax_section (dynobj, splt, info, again) shndx = shndx_buf; if (shndx != NULL) 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) continue; else if (isym.st_shndx == SHN_ABS) diff --git a/bfd/elf64-alpha.c b/bfd/elf64-alpha.c index c172c4f..026740a 100644 --- a/bfd/elf64-alpha.c +++ b/bfd/elf64-alpha.c @@ -2172,7 +2172,8 @@ elf64_alpha_relax_section (abfd, sec, link_info, again) esym = extsyms + ELF64_R_SYM (irel->r_info); 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) continue; 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_shdrs_and_ehdr, bfd_elf64_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, bfd_elf64_slurp_reloc_table, bfd_elf64_slurp_symbol_table, diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index bc16061..e41e605 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -682,7 +682,8 @@ elf64_hppa_check_relocs (abfd, info, sec, relocs) i < symtab_hdr->sh_info; 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) 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_shdrs_and_ehdr, bfd_elf64_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, bfd_elf64_slurp_reloc_table, bfd_elf64_slurp_symbol_table, diff --git a/bfd/elf64-mips.c b/bfd/elf64-mips.c index 6c1de47..694bca5 100644 --- a/bfd/elf64-mips.c +++ b/bfd/elf64-mips.c @@ -2666,6 +2666,7 @@ const struct elf_size_info mips_elf64_size_info = bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr, mips_elf64_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, mips_elf64_slurp_reloc_table, bfd_elf64_slurp_symbol_table, diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index bfc88d9..729dfb8 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -2419,7 +2419,8 @@ mmix_elf_relax_section (abfd, sec, link_info, again) esym = extsyms + ELF64_R_SYM (irel->r_info); 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) sym_sec = bfd_und_section_ptr; diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 8e1935d..eb0f4d3 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -4594,7 +4594,8 @@ get_local_syms (input_bfd, htab) isym = local_syms, shndx = shndx_buf; esym < end_sy; 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. */ free (shndx_buf); diff --git a/bfd/elf64-s390.c b/bfd/elf64-s390.c index 0d59f46..abbd4cc 100644 --- a/bfd/elf64-s390.c +++ b/bfd/elf64-s390.c @@ -2339,6 +2339,7 @@ const struct elf_size_info s390_elf64_size_info = bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr, bfd_elf64_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, bfd_elf64_slurp_reloc_table, bfd_elf64_slurp_symbol_table, diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c index fb46bce..b06b0ff 100644 --- a/bfd/elf64-sh64.c +++ b/bfd/elf64-sh64.c @@ -2234,7 +2234,8 @@ sh_elf64_get_relocated_section_contents (output_bfd, link_info, link_order, { 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) isec = bfd_und_section_ptr; diff --git a/bfd/elf64-sparc.c b/bfd/elf64-sparc.c index 4933f8d..36ed1e9 100644 --- a/bfd/elf64-sparc.c +++ b/bfd/elf64-sparc.c @@ -3067,6 +3067,7 @@ const struct elf_size_info sparc64_elf_size_info = bfd_elf64_write_out_phdrs, bfd_elf64_write_shdrs_and_ehdr, sparc64_elf_write_relocs, + bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out, sparc64_elf_slurp_reloc_table, bfd_elf64_slurp_symbol_table, diff --git a/bfd/elfcode.h b/bfd/elfcode.h index 203323c..1a362ee 100644 --- a/bfd/elfcode.h +++ b/bfd/elfcode.h @@ -1,6 +1,6 @@ /* ELF executable support for BFD. 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 in "UNIX System V Release 4, Programmers Guide: ANSI C and @@ -203,12 +203,14 @@ static char *elf_symbol_flags PARAMS ((flagword)); format. */ void -elf_swap_symbol_in (abfd, src, shndx, dst) +elf_swap_symbol_in (abfd, psrc, pshn, dst) bfd *abfd; - const Elf_External_Sym *src; - const Elf_External_Sym_Shndx *shndx; + const PTR *psrc; + const PTR *pshn; 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; 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. */ for (i = 1; i < symcount; i++) { - elf_swap_symbol_in (abfd, x_symp + i, - x_shndx + (x_shndx != NULL ? i : 0), &i_sym); + elf_swap_symbol_in (abfd, (const PTR *) (x_symp + i), + (const PTR *) (x_shndx + (x_shndx ? i : 0)), + &i_sym); memcpy (&sym->internal_elf_sym, &i_sym, sizeof (Elf_Internal_Sym)); #ifdef ELF_KEEP_EXTSYM 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_shdrs_and_ehdr, elf_write_relocs, + elf_swap_symbol_in, elf_swap_symbol_out, elf_slurp_reloc_table, elf_slurp_symbol_table, diff --git a/bfd/elflink.h b/bfd/elflink.h index 5046416..8c221f9 100644 --- a/bfd/elflink.h +++ b/bfd/elflink.h @@ -237,7 +237,7 @@ elf_link_is_defined_archive_symbol (abfd, symdef) Elf_Internal_Sym sym; 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); if (name == (const char *) NULL) @@ -1666,7 +1666,7 @@ elf_link_add_object_symbols (abfd, info) 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; 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) 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 (input_bfd, elf_tdata (input_bfd)->symtab_hdr.sh_link, @@ -6521,7 +6522,8 @@ elf_link_input_bfd (finfo, input_bfd) const char *name; 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; if (elf_bad_symtab (input_bfd)) @@ -7660,6 +7662,7 @@ elf_gc_mark (info, sec, gc_mark_hook) asection *rsec; struct elf_link_hash_entry *h; Elf_Internal_Sym s; + Elf_External_Sym_Shndx *locshndx; r_symndx = ELF_R_SYM (rel->r_info); if (r_symndx == 0) @@ -7667,9 +7670,10 @@ elf_gc_mark (info, sec, gc_mark_hook) if (elf_bad_symtab (sec->owner)) { + locshndx = locsym_shndx + (locsym_shndx ? r_symndx : 0); elf_swap_symbol_in (input_bfd, - locsyms + r_symndx, - locsym_shndx + (locsym_shndx ? r_symndx : 0), + (const PTR *) (locsyms + r_symndx), + (const PTR *) locshndx, &s); if (ELF_ST_BIND (s.st_info) == STB_LOCAL) rsec = (*gc_mark_hook) (sec->owner, info, rel, NULL, &s); @@ -7686,9 +7690,10 @@ elf_gc_mark (info, sec, gc_mark_hook) } else { + locshndx = locsym_shndx + (locsym_shndx ? r_symndx : 0); elf_swap_symbol_in (input_bfd, - locsyms + r_symndx, - locsym_shndx + (locsym_shndx ? r_symndx : 0), + (const PTR *) (locsyms + r_symndx), + (const PTR *) locshndx, &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; if (lshndx != NULL) 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 diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index bfa6391..0e3d0db 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -812,7 +812,8 @@ elfNN_ia64_relax_section (abfd, sec, link_info, again) /* A local symbol. */ esym = extsyms + ELFNN_R_SYM (irel->r_info); 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) continue; /* We can't do anthing with undefined symbols. */ else if (isym.st_shndx == SHN_ABS) -- 2.7.4