diff options
46 files changed, 190 insertions, 152 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 93528e6a093..5b1082245ef 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,58 @@ +2006-06-19 Alan Modra <amodra@bigpond.net.au> + + * elf-bfd.h (struct elf_backend_data): Add bfd_link_info pointer + parameter. + (_bfd_elf_sizeof_headers): Replace bfd_boolean param with + bfd_link_info pointer. + * targets.c (struct bfd_target <_bfd_sizeof_headers>): Likewise. + * bfd.c (bfd_sizeof_headers): Tweak param name. + * aout-adobe.c (aout_adobe_sizeof_headers): Adjust. + * aoutx.h (NAME (aout, sizeof_headers)): Adjust. + * binary.c (binary_sizeof_headers): Adjust. + * bout.c (b_out_sizeof_headers): Adjust. + * coff-rs6000.c (_bfd_xcoff_sizeof_headers): Adjust. + * coff64-rs6000.c (xcoff64_sizeof_headers): Adjust. + * coffgen.c (coff_sizeof_headers): Adjust. + * ecoff.c (_bfd_ecoff_sizeof_headers): Adjust. + (ecoff_compute_section_file_positions): Adjust. + (_bfd_ecoff_write_object_contents): Adjust. + * elf.c (get_program_header_size, _bfd_elf_sizeof_headers): Adjust. + * elf32-arm.c (elf32_arm_additional_program_headers): Adjust. + * elf32-i370.c (elf_backend_additional_program_headers): Adjust. + * elf32-ppc.c (ppc_elf_additional_program_headers): Adjust. + * elf64-hppa.c (elf64_hppa_additional_program_headers): Adjust. + * elf64-x86-64.c (elf64_x86_64_additional_program_headers): Adjust. + * elfxx-ia64.c (elfNN_ia64_additional_program_headers): Adjust. + * elfxx-mips.c (_bfd_mips_elf_additional_program_headers): Adjust. + * elfxx-mips.h (_bfd_mips_elf_additional_program_headers): Adjust. + * i386msdos.c: Convert to ISO C. + (msdos_sizeof_headers): Adjust. + * i386os9k.c: Convert to ISO C. + (os9k_sizeof_headers): Adjust. + * ieee.c (ieee_sizeof_headers): Adjust. + * ihex.c (ihex_sizeof_headers): Adjust. + * libaout.h (NAME (aout, sizeof_headers)): Adjust. + * libbfd-in.h (_bfd_nolink_sizeof_headers): Adjust. + * libcoff-in.h (coff_sizeof_headers): Adjust. + * libecoff.h (_bfd_ecoff_sizeof_headers): Adjust. + * mach-o.c (bfd_mach_o_sizeof_headers): Adjust. + * mmo.c (mmo_sizeof_headers): Adjust. + * oasys.c (oasys_sizeof_headers): Adjust. + * pdp11.c (NAME (aout, sizeof_headers)): Adjust. + * pef.c (bfd_pef_sizeof_headers): Adjust. + * ppcboot.c (ppcboot_sizeof_headers): Adjust. + * som.c (som_sizeof_headers): Adjust. + * srec.c (srec_sizeof_headers): Adjust. + * tekhex.c (tekhex_sizeof_headers): Adjust. + * versados.c (versados_sizeof_headers): Adjust. + * vms.c (vms_sizeof_headers): Adjust. + * xcoff-target.h (_bfd_xcoff_sizeof_headers): Adjust. + * xsym.c (bfd_sym_sizeof_headers): Adjust. + * xsym.h (bfd_sym_sizeof_headers): Adjust. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + * libcoff.h: Regenerate. + 2006-06-15 Mark Shinwell <shinwell@codesourcery.com> * bfd-in2.h: Regenerate. diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index 85e31fdc70e..b9f4a89e9f1 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -441,7 +441,7 @@ aout_adobe_set_arch_mach (bfd *abfd, static int aout_adobe_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, - bfd_boolean ignore ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return sizeof (struct internal_exec); } diff --git a/bfd/aoutx.h b/bfd/aoutx.h index 663d49de13b..066f23ffd4c 100644 --- a/bfd/aoutx.h +++ b/bfd/aoutx.h @@ -2780,7 +2780,8 @@ NAME (aout, find_nearest_line) (bfd *abfd, } int -NAME (aout, sizeof_headers) (bfd *abfd, bfd_boolean execable ATTRIBUTE_UNUSED) +NAME (aout, sizeof_headers) (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return adata (abfd).exec_bytes_size; } diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 3387dfabd3c..df3bae8945c 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -4630,8 +4630,8 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); #define bfd_set_private_flags(abfd, flags) \ BFD_SEND (abfd, _bfd_set_private_flags, (abfd, flags)) -#define bfd_sizeof_headers(abfd, reloc) \ - BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) +#define bfd_sizeof_headers(abfd, info) \ + BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info)) #define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ BFD_SEND (abfd, _bfd_find_nearest_line, \ @@ -5081,7 +5081,7 @@ typedef struct bfd_target NAME##_bfd_discard_group, \ NAME##_section_already_linked \ - int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); + int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *); bfd_byte * (*_bfd_get_relocated_section_contents) (bfd *, struct bfd_link_info *, struct bfd_link_order *, bfd_byte *, bfd_boolean, struct bfd_symbol **); diff --git a/bfd/bfd.c b/bfd/bfd.c index 238bbd67e1a..406efffbbc3 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -1183,8 +1183,8 @@ FUNCTION DESCRIPTION The following functions exist but have not yet been documented. -.#define bfd_sizeof_headers(abfd, reloc) \ -. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, reloc)) +.#define bfd_sizeof_headers(abfd, info) \ +. BFD_SEND (abfd, _bfd_sizeof_headers, (abfd, info)) . .#define bfd_find_nearest_line(abfd, sec, syms, off, file, func, line) \ . BFD_SEND (abfd, _bfd_find_nearest_line, \ diff --git a/bfd/binary.c b/bfd/binary.c index 92a47adda2f..89fc55f3262 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -306,7 +306,7 @@ binary_set_section_contents (bfd *abfd, static int binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean exec ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/bout.c b/bfd/bout.c index 5102ba77622..15baadfe50c 100644 --- a/bfd/bout.c +++ b/bfd/bout.c @@ -1,6 +1,6 @@ /* BFD back-end for Intel 960 b.out binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. @@ -990,7 +990,8 @@ b_out_set_arch_mach (bfd *abfd, } static int -b_out_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, bfd_boolean ignore ATTRIBUTE_UNUSED) +b_out_sizeof_headers (bfd *ignore_abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return sizeof (struct external_exec); } diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index 951587f99b1..1f0458e8ec8 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -59,7 +59,7 @@ extern bfd_boolean _bfd_xcoff_write_armap extern bfd_boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); extern int _bfd_xcoff_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); + PARAMS ((bfd *, struct bfd_link_info *)); extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); extern unsigned int _bfd_xcoff_swap_sym_out @@ -2573,9 +2573,8 @@ _bfd_xcoff_write_archive_contents (abfd) always uses an a.out header. */ int -_bfd_xcoff_sizeof_headers (abfd, reloc) - bfd *abfd; - bfd_boolean reloc ATTRIBUTE_UNUSED; +_bfd_xcoff_sizeof_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { int size; diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index e0aa87ef677..0ac7d70e383 100644 --- a/bfd/coff64-rs6000.c +++ b/bfd/coff64-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written Clinton Popetz. Contributed by Cygnus Support. @@ -127,7 +127,7 @@ extern bfd_boolean _bfd_xcoff_write_armap extern bfd_boolean _bfd_xcoff_write_archive_contents PARAMS ((bfd *)); extern int _bfd_xcoff_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); + PARAMS ((bfd *, struct bfd_link_info *)); extern void _bfd_xcoff_swap_sym_in PARAMS ((bfd *, PTR, PTR)); extern unsigned int _bfd_xcoff_swap_sym_out @@ -161,7 +161,7 @@ static const bfd_target *xcoff64_archive_p static bfd *xcoff64_openr_next_archived_file PARAMS ((bfd *, bfd *)); static int xcoff64_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); + PARAMS ((bfd *, struct bfd_link_info *)); static asection *xcoff64_create_csect_from_smclas PARAMS ((bfd *, union internal_auxent *, const char *)); static bfd_boolean xcoff64_is_lineno_count_overflow @@ -2056,9 +2056,8 @@ xcoff64_openr_next_archived_file (archive, last_file) always uses an a.out header. */ static int -xcoff64_sizeof_headers (abfd, reloc) - bfd *abfd; - bfd_boolean reloc ATTRIBUTE_UNUSED; +xcoff64_sizeof_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { int size; diff --git a/bfd/coffgen.c b/bfd/coffgen.c index c541e6a590e..bef7d7a384c 100644 --- a/bfd/coffgen.c +++ b/bfd/coffgen.c @@ -2238,11 +2238,11 @@ coff_find_inliner_info (bfd *abfd, } int -coff_sizeof_headers (bfd *abfd, bfd_boolean reloc) +coff_sizeof_headers (bfd *abfd, struct bfd_link_info *info) { size_t size; - if (! reloc) + if (!info->relocatable) size = bfd_coff_filhsz (abfd) + bfd_coff_aoutsz (abfd); else size = bfd_coff_filhsz (abfd); diff --git a/bfd/ecoff.c b/bfd/ecoff.c index 0416c236868..386227b1ccf 100644 --- a/bfd/ecoff.c +++ b/bfd/ecoff.c @@ -1862,7 +1862,8 @@ _bfd_ecoff_set_arch_mach (bfd *abfd, /* Get the size of the section headers. */ int -_bfd_ecoff_sizeof_headers (bfd *abfd, bfd_boolean reloc ATTRIBUTE_UNUSED) +_bfd_ecoff_sizeof_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *current; int c; @@ -1936,7 +1937,7 @@ ecoff_compute_section_file_positions (bfd *abfd) const bfd_vma round = ecoff_backend (abfd)->round; bfd_size_type amt; - sofar = _bfd_ecoff_sizeof_headers (abfd, FALSE); + sofar = _bfd_ecoff_sizeof_headers (abfd, NULL); file_sofar = sofar; /* Sort the sections by VMA. */ @@ -2357,7 +2358,7 @@ _bfd_ecoff_write_object_contents (bfd *abfd) } if ((abfd->flags & D_PAGED) != 0) - text_size = _bfd_ecoff_sizeof_headers (abfd, FALSE); + text_size = _bfd_ecoff_sizeof_headers (abfd, NULL); else text_size = 0; text_start = 0; diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 89baa9c463e..d5c7d1bc548 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -829,7 +829,7 @@ struct elf_backend_data return the number of additional program segments which this BFD will need. It should return -1 on error. */ int (*elf_backend_additional_program_headers) - (bfd *); + (bfd *, struct bfd_link_info *); /* This function is called to modify an existing segment map in a backend specific fashion. */ @@ -1576,7 +1576,7 @@ extern bfd_boolean _bfd_elf_find_inliner_info #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol extern int _bfd_elf_sizeof_headers - (bfd *, bfd_boolean); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_elf_new_section_hook (bfd *, asection *); extern bfd_boolean _bfd_elf_init_reloc_shdr diff --git a/bfd/elf.c b/bfd/elf.c index 08ef5371dbd..05fa1877682 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -4721,7 +4721,7 @@ assign_file_positions_for_non_load_sections (bfd *abfd, will be two segments. */ static bfd_size_type -get_program_header_size (bfd *abfd) +get_program_header_size (bfd *abfd, struct bfd_link_info *info) { size_t segs; asection *s; @@ -4805,7 +4805,7 @@ get_program_header_size (bfd *abfd) { int a; - a = (*bed->elf_backend_additional_program_headers) (abfd); + a = (*bed->elf_backend_additional_program_headers) (abfd, info); if (a == -1) abort (); segs += a; @@ -7116,13 +7116,13 @@ _bfd_elf_find_inliner_info (bfd *abfd, } int -_bfd_elf_sizeof_headers (bfd *abfd, bfd_boolean reloc) +_bfd_elf_sizeof_headers (bfd *abfd, struct bfd_link_info *info) { int ret; ret = get_elf_backend_data (abfd)->s->sizeof_ehdr; - if (! reloc) - ret += get_program_header_size (abfd); + if (!info->relocatable) + ret += get_program_header_size (abfd, info); return ret; } diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 639a6105ab9..b360c934c28 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -9217,7 +9217,8 @@ elf32_arm_modify_segment_map (bfd *abfd, /* We may add a PT_ARM_EXIDX program header. */ static int -elf32_arm_additional_program_headers (bfd *abfd) +elf32_arm_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *sec; diff --git a/bfd/elf32-i370.c b/bfd/elf32-i370.c index 218aa23a68f..2119dcc03df 100644 --- a/bfd/elf32-i370.c +++ b/bfd/elf32-i370.c @@ -1451,7 +1451,7 @@ i370_noop (void) (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, \ Elf_Internal_Sym *)) i370_noop #define elf_backend_additional_program_headers \ - (int (*) (bfd *)) i370_noop + (int (*) (bfd *, struct bfd_link_info *)) i370_noop #define elf_backend_modify_segment_map \ (bfd_boolean (*) (bfd *, struct bfd_link_info *)) i370_noop diff --git a/bfd/elf32-ppc.c b/bfd/elf32-ppc.c index b1d18e7c236..5d1386eb07f 100644 --- a/bfd/elf32-ppc.c +++ b/bfd/elf32-ppc.c @@ -1869,7 +1869,8 @@ ppc_elf_fake_sections (bfd *abfd ATTRIBUTE_UNUSED, need to bump up the number of section headers. */ static int -ppc_elf_additional_program_headers (bfd *abfd) +ppc_elf_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; int ret = 0; diff --git a/bfd/elf64-hppa.c b/bfd/elf64-hppa.c index 58798ae3794..143c84a927d 100644 --- a/bfd/elf64-hppa.c +++ b/bfd/elf64-hppa.c @@ -204,9 +204,6 @@ static bfd_boolean elf64_hppa_finish_dynamic_symbol PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, Elf_Internal_Sym *)); -static int elf64_hppa_additional_program_headers - PARAMS ((bfd *)); - static bfd_boolean elf64_hppa_modify_segment_map PARAMS ((bfd *, struct bfd_link_info *)); @@ -2617,8 +2614,8 @@ elf64_hppa_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) existence of a .interp section. */ static int -elf64_hppa_additional_program_headers (abfd) - bfd *abfd; +elf64_hppa_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 42569b78aa6..5a3f36b64a5 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3594,7 +3594,8 @@ elf64_x86_64_merge_symbol (struct bfd_link_info *info ATTRIBUTE_UNUSED, } static int -elf64_x86_64_additional_program_headers (bfd *abfd) +elf64_x86_64_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; int count = 0; diff --git a/bfd/elfxx-ia64.c b/bfd/elfxx-ia64.c index 817ccb14390..e515997aa10 100644 --- a/bfd/elfxx-ia64.c +++ b/bfd/elfxx-ia64.c @@ -215,8 +215,6 @@ static bfd_boolean elfNN_ia64_add_symbol_hook PARAMS ((bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *sym, const char **namep, flagword *flagsp, asection **secp, bfd_vma *valp)); -static int elfNN_ia64_additional_program_headers - PARAMS ((bfd *abfd)); static bfd_boolean elfNN_ia64_modify_segment_map PARAMS ((bfd *, struct bfd_link_info *)); static bfd_boolean elfNN_ia64_is_local_label_name @@ -1637,8 +1635,8 @@ elfNN_ia64_add_symbol_hook (abfd, info, sym, namep, flagsp, secp, valp) /* Return the number of additional phdrs we will need. */ static int -elfNN_ia64_additional_program_headers (abfd) - bfd *abfd; +elfNN_ia64_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; int ret = 0; diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 466a471675b..a1a7d1ecd45 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -9138,7 +9138,8 @@ _bfd_mips_elf_final_write_processing (bfd *abfd, segments. */ int -_bfd_mips_elf_additional_program_headers (bfd *abfd) +_bfd_mips_elf_additional_program_headers (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { asection *s; int ret = 0; diff --git a/bfd/elfxx-mips.h b/bfd/elfxx-mips.h index 6c3c9a30f6e..6e9a191fa71 100644 --- a/bfd/elfxx-mips.h +++ b/bfd/elfxx-mips.h @@ -1,5 +1,6 @@ /* MIPS ELF specific backend routines. - Copyright 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -68,7 +69,7 @@ extern bfd_boolean _bfd_mips_elf_finish_dynamic_sections extern void _bfd_mips_elf_final_write_processing (bfd *, bfd_boolean); extern int _bfd_mips_elf_additional_program_headers - (bfd *); + (bfd *, struct bfd_link_info *); extern bfd_boolean _bfd_mips_elf_modify_segment_map (bfd *, struct bfd_link_info *); extern asection * _bfd_mips_elf_gc_mark_hook diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index bb25acd7324..3e1a69edc7e 100644 --- a/bfd/i386msdos.c +++ b/bfd/i386msdos.c @@ -1,6 +1,6 @@ /* BFD back-end for MS-DOS executables. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, - 2003, 2004, 2005 Free Software Foundation, Inc. + 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Bryan Ford of the University of Utah. Contributed by the Center for Software Science at the @@ -33,24 +33,15 @@ #define EXE_LOAD_LOW 0xffff #define EXE_PAGE_SIZE 512 -static int msdos_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); -static bfd_boolean msdos_write_object_contents - PARAMS ((bfd *)); -static bfd_boolean msdos_set_section_contents - PARAMS ((bfd *, sec_ptr, const PTR, file_ptr, bfd_size_type)); - static int -msdos_sizeof_headers (abfd, exec) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_boolean exec ATTRIBUTE_UNUSED; +msdos_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } static bfd_boolean -msdos_write_object_contents (abfd) - bfd *abfd; +msdos_write_object_contents (bfd *abfd) { static char hdr[EXE_PAGE_SIZE]; file_ptr outfile_size = sizeof(hdr); @@ -112,12 +103,11 @@ msdos_write_object_contents (abfd) } static bfd_boolean -msdos_set_section_contents (abfd, section, location, offset, count) - bfd *abfd; - sec_ptr section; - const PTR location; - file_ptr offset; - bfd_size_type count; +msdos_set_section_contents (bfd *abfd, + sec_ptr section, + const void *location, + file_ptr offset, + bfd_size_type count) { if (count == 0) diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index f825bc62073..062f39b278d 100644 --- a/bfd/i386os9k.c +++ b/bfd/i386os9k.c @@ -1,6 +1,6 @@ /* BFD back-end for os9000 i386 binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002, - 2004, 2005 Free Software Foundation, Inc. + 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -27,22 +27,12 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. #include "libaout.h" /* BFD a.out internal data structures */ #include "os9k.h" -static const bfd_target * os9k_callback - PARAMS ((bfd *)); -static const bfd_target * os9k_object_p - PARAMS ((bfd *)); -static int os9k_sizeof_headers - PARAMS ((bfd *, bfd_boolean)); -bfd_boolean os9k_swap_exec_header_in - PARAMS ((bfd *, mh_com *, struct internal_exec *)); - /* Swaps the information in an executable header taken from a raw byte stream memory image, into the internal exec_header structure. */ -bfd_boolean -os9k_swap_exec_header_in (abfd, raw_bytes, execp) - bfd *abfd; - mh_com *raw_bytes; - struct internal_exec *execp; +static bfd_boolean +os9k_swap_exec_header_in (bfd *abfd, + mh_com *raw_bytes, + struct internal_exec *execp) { mh_com *bytes = (mh_com *) raw_bytes; unsigned int dload, dmemsize, dmemstart; @@ -77,44 +67,12 @@ os9k_swap_exec_header_in (abfd, raw_bytes, execp) return TRUE; } -static const bfd_target * -os9k_object_p (abfd) - bfd *abfd; -{ - struct internal_exec anexec; - mh_com exec_bytes; - - if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd) - != MHCOM_BYTES_SIZE) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync); - if (N_BADMAG (anexec)) - { - bfd_set_error (bfd_error_wrong_format); - return 0; - } - - if (! os9k_swap_exec_header_in (abfd, &exec_bytes, &anexec)) - { - if (bfd_get_error () != bfd_error_system_call) - bfd_set_error (bfd_error_wrong_format); - return NULL; - } - return aout_32_some_aout_object_p (abfd, &anexec, os9k_callback); -} - /* Finish up the opening of a b.out file for reading. Fill in all the fields that are not handled by common code. */ static const bfd_target * -os9k_callback (abfd) - bfd *abfd; +os9k_callback (bfd *abfd) { struct internal_exec *execp = exec_hdr (abfd); unsigned long bss_start; @@ -156,10 +114,39 @@ os9k_callback (abfd) return abfd->xvec; } +static const bfd_target * +os9k_object_p (bfd *abfd) +{ + struct internal_exec anexec; + mh_com exec_bytes; + + if (bfd_bread ((PTR) &exec_bytes, (bfd_size_type) MHCOM_BYTES_SIZE, abfd) + != MHCOM_BYTES_SIZE) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + anexec.a_info = H_GET_16 (abfd, exec_bytes.m_sync); + if (N_BADMAG (anexec)) + { + bfd_set_error (bfd_error_wrong_format); + return 0; + } + + if (! os9k_swap_exec_header_in (abfd, &exec_bytes, &anexec)) + { + if (bfd_get_error () != bfd_error_system_call) + bfd_set_error (bfd_error_wrong_format); + return NULL; + } + return aout_32_some_aout_object_p (abfd, &anexec, os9k_callback); +} + static int -os9k_sizeof_headers (ignore_abfd, ignore) - bfd *ignore_abfd ATTRIBUTE_UNUSED; - bfd_boolean ignore ATTRIBUTE_UNUSED; +os9k_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return sizeof (struct internal_exec); } diff --git a/bfd/ieee.c b/bfd/ieee.c index 910f24e045d..f8d4e800235 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -3715,7 +3715,7 @@ ieee_generic_stat_arch_elt (bfd *abfd, struct stat *buf) static int ieee_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean x ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/ihex.c b/bfd/ihex.c index ae28959aed3..d2875dce8b8 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -899,7 +899,8 @@ ihex_set_arch_mach (bfd *abfd, /* Get the size of the headers, for the linker. */ static int -ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED) +ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/libaout.h b/bfd/libaout.h index bb3ee808267..1a6ff98941b 100644 --- a/bfd/libaout.h +++ b/bfd/libaout.h @@ -557,7 +557,7 @@ extern asymbol * NAME (aout, minisymbol_to_symbol) (bfd *, bfd_boolean, const void *, asymbol *); extern int NAME (aout, sizeof_headers) - (bfd *, bfd_boolean); + (bfd *, struct bfd_link_info *); extern bfd_boolean NAME (aout, adjust_sizes_and_vmas) (bfd *, bfd_size_type *, file_ptr *); diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index ab11d2ffb21..52172c1680f 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -375,7 +375,8 @@ extern bfd_boolean _bfd_generic_set_section_contents /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ -#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0) +#define _bfd_nolink_sizeof_headers \ + ((int (*) (bfd *, struct bfd_link_info *)) bfd_0) #define _bfd_nolink_bfd_get_relocated_section_contents \ ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \ bfd_byte *, bfd_boolean, asymbol **)) \ diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 5debdf37198..0f41f5f2d1b 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -380,7 +380,8 @@ extern bfd_boolean _bfd_generic_set_section_contents /* Routines to use for BFD_JUMP_TABLE_LINK for targets which do not support linking. Use BFD_JUMP_TABLE_LINK (_bfd_nolink). */ -#define _bfd_nolink_sizeof_headers ((int (*) (bfd *, bfd_boolean)) bfd_0) +#define _bfd_nolink_sizeof_headers \ + ((int (*) (bfd *, struct bfd_link_info *)) bfd_0) #define _bfd_nolink_bfd_get_relocated_section_contents \ ((bfd_byte *(*) (bfd *, struct bfd_link_info *, struct bfd_link_order *, \ bfd_byte *, bfd_boolean, asymbol **)) \ diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h index f2bc264b3b9..fdb1a59b814 100644 --- a/bfd/libcoff-in.h +++ b/bfd/libcoff-in.h @@ -348,7 +348,7 @@ extern bfd_boolean coff_find_nearest_line extern bfd_boolean coff_find_inliner_info (bfd *, const char **, const char **, unsigned int *); extern int coff_sizeof_headers - (bfd *, bfd_boolean); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_coff_reloc16_relax_section (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents diff --git a/bfd/libcoff.h b/bfd/libcoff.h index f756f30b1bf..e26fce06415 100644 --- a/bfd/libcoff.h +++ b/bfd/libcoff.h @@ -352,7 +352,7 @@ extern bfd_boolean coff_find_nearest_line extern bfd_boolean coff_find_inliner_info (bfd *, const char **, const char **, unsigned int *); extern int coff_sizeof_headers - (bfd *, bfd_boolean); + (bfd *, struct bfd_link_info *); extern bfd_boolean bfd_coff_reloc16_relax_section (bfd *, asection *, struct bfd_link_info *, bfd_boolean *); extern bfd_byte *bfd_coff_reloc16_get_relocated_section_contents diff --git a/bfd/libecoff.h b/bfd/libecoff.h index 8c5e218ee58..165e75585a3 100644 --- a/bfd/libecoff.h +++ b/bfd/libecoff.h @@ -1,6 +1,6 @@ /* BFD ECOFF object file private structure. Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004, - 2005 Free Software Foundation, Inc. + 2005, 2006 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -301,7 +301,7 @@ extern bfd_boolean _bfd_ecoff_set_arch_mach extern bfd_boolean _bfd_ecoff_set_section_contents (bfd *, asection *, const void * location, file_ptr, bfd_size_type); -extern int _bfd_ecoff_sizeof_headers (bfd *, bfd_boolean); +extern int _bfd_ecoff_sizeof_headers (bfd *, struct bfd_link_info *); /* ecoff_bfd_get_relocated_section_contents defined by backend. */ /* ecoff_bfd_relax_section defined by backend. */ extern struct bfd_link_hash_table *_bfd_ecoff_bfd_link_hash_table_create diff --git a/bfd/mach-o.c b/bfd/mach-o.c index 666cf650999..7baf87ba75d 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -568,7 +568,7 @@ bfd_mach_o_write_contents (bfd *abfd) static int bfd_mach_o_sizeof_headers (bfd *a ATTRIBUTE_UNUSED, - bfd_boolean b ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/mmo.c b/bfd/mmo.c index 20ac40668a4..9ee539baece 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -387,7 +387,7 @@ static void mmo_print_symbol (bfd *, void *, asymbol *, bfd_print_symbol_type); static bfd_boolean mmo_set_section_contents (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type); -static int mmo_sizeof_headers (bfd *, bfd_boolean); +static int mmo_sizeof_headers (bfd *, struct bfd_link_info *); static long mmo_get_reloc_upper_bound (bfd *, asection *); static bfd_boolean mmo_internal_write_header (bfd *); static bfd_boolean mmo_internal_write_post (bfd *, int, asection *); @@ -2231,7 +2231,7 @@ mmo_print_symbol (bfd *abfd, void *afile, asymbol *symbol, static int mmo_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean exec ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/oasys.c b/bfd/oasys.c index e51cde6c4d0..ec08555afd0 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1164,7 +1164,8 @@ oasys_generic_stat_arch_elt (bfd *abfd, struct stat *buf) } static int -oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED) +oasys_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/pdp11.c b/bfd/pdp11.c index b3b4f07347b..a3950793822 100644 --- a/bfd/pdp11.c +++ b/bfd/pdp11.c @@ -2371,7 +2371,8 @@ NAME (aout, find_nearest_line) (bfd *abfd, } int -NAME (aout, sizeof_headers) (bfd *abfd, bfd_boolean execable ATTRIBUTE_UNUSED) +NAME (aout, sizeof_headers) (bfd *abfd, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return adata (abfd).exec_bytes_size; } diff --git a/bfd/pef.c b/bfd/pef.c index 2aca6a445b7..63e557acaa5 100644 --- a/bfd/pef.c +++ b/bfd/pef.c @@ -1,5 +1,5 @@ /* PEF support for BFD. - Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -1002,7 +1002,8 @@ bfd_pef_get_symbol_info (bfd *abfd ATTRIBUTE_UNUSED, } static int -bfd_pef_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED) +bfd_pef_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index 9cd7c26e2fb..f7bb6aaf656 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -99,7 +99,6 @@ static long ppcboot_canonicalize_symtab PARAMS ((bfd *, asymbol **)); static void ppcboot_get_symbol_info PARAMS ((bfd *, asymbol *, symbol_info *)); static bfd_boolean ppcboot_set_section_contents PARAMS ((bfd *, asection *, const PTR, file_ptr, bfd_size_type)); -static int ppcboot_sizeof_headers PARAMS ((bfd *, bfd_boolean)); static bfd_boolean ppcboot_bfd_print_private_bfd_data PARAMS ((bfd *, PTR)); #define ppcboot_set_tdata(abfd, ptr) ((abfd)->tdata.any = (PTR) (ptr)) @@ -396,9 +395,8 @@ ppcboot_set_section_contents (abfd, sec, data, offset, size) static int -ppcboot_sizeof_headers (abfd, exec) - bfd *abfd ATTRIBUTE_UNUSED; - bfd_boolean exec ATTRIBUTE_UNUSED; +ppcboot_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return sizeof (ppcboot_hdr_t); } diff --git a/bfd/som.c b/bfd/som.c index c3e88dcda25..ead05f94746 100644 --- a/bfd/som.c +++ b/bfd/som.c @@ -5328,7 +5328,7 @@ som_find_nearest_line (bfd *abfd ATTRIBUTE_UNUSED, static int som_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean reloc ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { (*_bfd_error_handler) (_("som_sizeof_headers unimplemented")); fflush (stderr); diff --git a/bfd/srec.c b/bfd/srec.c index 836b81eb9a9..2863191437e 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1100,7 +1100,7 @@ symbolsrec_write_object_contents (bfd *abfd) static int srec_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean exec ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/targets.c b/bfd/targets.c index 09e4bc0b398..180ecd2bf57 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -1,6 +1,6 @@ /* Generic target-file-type support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003, 2004, 2005 + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Written by Cygnus Support. @@ -438,7 +438,7 @@ BFD_JUMP_TABLE macros. . NAME##_bfd_discard_group, \ . NAME##_section_already_linked \ . -. int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); +. int (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *); . bfd_byte * (*_bfd_get_relocated_section_contents) . (bfd *, struct bfd_link_info *, struct bfd_link_order *, . bfd_byte *, bfd_boolean, struct bfd_symbol **); diff --git a/bfd/tekhex.c b/bfd/tekhex.c index e40c86648e2..fffedad958b 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -865,7 +865,7 @@ tekhex_write_object_contents (bfd *abfd) static int tekhex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean exec ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/versados.c b/bfd/versados.c index fb6cfbd22ac..c29483e4c68 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -1,6 +1,6 @@ /* BFD back-end for VERSAdos-E objects. - Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 - Free Software Foundation, Inc. + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support <sac@cygnus.com>. Versados is a Motorola trademark. @@ -675,7 +675,7 @@ versados_set_section_contents (bfd *abfd ATTRIBUTE_UNUSED, static int versados_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, - bfd_boolean exec ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/vms.c b/bfd/vms.c index 0e178eb6eac..d2d98310ca3 100644 --- a/bfd/vms.c +++ b/bfd/vms.c @@ -1402,7 +1402,7 @@ vms_set_section_contents (bfd * abfd, static int vms_sizeof_headers (bfd * abfd ATTRIBUTE_UNUSED, - bfd_boolean reloc ATTRIBUTE_UNUSED) + struct bfd_link_info *info ATTRIBUTE_UNUSED) { #if VMS_DEBUG vms_debug (1, "vms_sizeof_headers (%p, %s)\n", abfd, (reloc)?"True":"False"); diff --git a/bfd/xcoff-target.h b/bfd/xcoff-target.h index 7e73cf26a59..b912fdf35e6 100644 --- a/bfd/xcoff-target.h +++ b/bfd/xcoff-target.h @@ -1,5 +1,5 @@ /* Common definitions for backends based on IBM RS/6000 "XCOFF64" files. - Copyright 2000, 2001, 2002, 2004, 2005 + Copyright 2000, 2001, 2002, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -125,7 +125,7 @@ extern bfd * _bfd_xcoff_openr_next_archived_file (bfd *, bfd *); extern int _bfd_xcoff_generic_stat_arch_elt (bfd *, struct stat *); extern bfd_boolean _bfd_xcoff_write_armap (bfd *, unsigned int, struct orl *, unsigned int, int); extern bfd_boolean _bfd_xcoff_write_archive_contents (bfd *); -extern int _bfd_xcoff_sizeof_headers (bfd *, bfd_boolean); +extern int _bfd_xcoff_sizeof_headers (bfd *, struct bfd_link_info *); extern void _bfd_xcoff_swap_sym_in (bfd *, void *, void *); extern unsigned int _bfd_xcoff_swap_sym_out (bfd *, void *, void *); extern void _bfd_xcoff_swap_aux_in (bfd *, void *, int, int, int, int, void *); diff --git a/bfd/xsym.c b/bfd/xsym.c index dfd75056518..b102bef34be 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -2300,7 +2300,8 @@ bfd_sym_canonicalize_symtab (bfd *abfd ATTRIBUTE_UNUSED, asymbol **sym ATTRIBUTE } int -bfd_sym_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, bfd_boolean exec ATTRIBUTE_UNUSED) +bfd_sym_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED) { return 0; } diff --git a/bfd/xsym.h b/bfd/xsym.h index 386a1635746..bbeadc22c96 100644 --- a/bfd/xsym.h +++ b/bfd/xsym.h @@ -1,5 +1,5 @@ /* xSYM symbol-file support for BFD. - Copyright 1999, 2000, 2001, 2002, 2003, 2005 + Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2006 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -696,6 +696,6 @@ extern long bfd_sym_get_symtab_upper_bound extern long bfd_sym_canonicalize_symtab (bfd *, asymbol **); extern int bfd_sym_sizeof_headers - (bfd *, bfd_boolean); + (bfd *, struct bfd_link_info *); #endif /* __xSYM_H__ */ |