diff options
48 files changed, 195 insertions, 153 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 93528e6..5b10822 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 85e31fd..b9f4a89 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 663d49d..066f23f 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 3387dfa..df3bae8 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 **); @@ -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 92a47ad..89fc55f 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; } @@ -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 951587f..1f0458e 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 e0aa87e..0ac7d70 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 c541e6a..bef7d7a 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 0416c23..386227b 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 89baa9c..d5c7d1b 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 @@ -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 639a610..b360c93 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 218aa23..2119dcc 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 b1d18e7..5d1386e 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 58798ae..143c84a 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 42569b7..5a3f36b 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 817ccb1..e515997 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 466a471..a1a7d1e 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 6c3c9a3..6e9a191 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 bb25acd..3e1a69e 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 f825bc6..062f39b 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); } @@ -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; } @@ -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 bb3ee80..1a6ff98 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 ab11d2f..52172c1 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 5debdf3..0f41f5f 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 f2bc264..fdb1a59 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 f756f30..e26fce0 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 8c5e218..165e755 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 666cf65..7baf87b 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; } @@ -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 e51cde6..ec08555 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 b3b4f07..a395079 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; } @@ -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 9cd7c26..f7bb6aa 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); } @@ -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); @@ -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 09e4bc0..180ecd2 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 e40c866..fffedad 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 fb6cfbd..c29483e 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; } @@ -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 7e73cf2..b912fdf 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 *); @@ -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; } @@ -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__ */ diff --git a/ld/ChangeLog b/ld/ChangeLog index ef8befb..6347778 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,7 @@ +2006-06-19 Alan Modra <amodra@bigpond.net.au> + + * ldexp.c (fold_name): Adjust bfd_sizeof_headers call. + 2006-06-14 Kevin F. Quinn <kevquinn@gentoo.org> * ld.texinfo: Document new -z lazy option. @@ -481,7 +481,7 @@ fold_name (etree_type *tree) /* Don't find the real header size if only marking sections; The bfd function may cache incorrect data. */ if (expld.phase != lang_mark_phase_enum) - hdr_size = bfd_sizeof_headers (output_bfd, link_info.relocatable); + hdr_size = bfd_sizeof_headers (output_bfd, &link_info); new_abs (hdr_size); } break; |