From 72adc230457cc2885fe394ab4647dceab2d9d0aa Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 30 Apr 2004 14:23:40 +0000 Subject: [PATCH] * section.c (bfd_make_section_anyway): Add all sections to hash tab. * elf-bfd.h (bfd_elf_is_group_section): Declare. * elf.c (bfd_elf_is_group_section): New function. * elfxx-target.h (bfd_elfNN_bfd_is_group_section * section.c (bfd_generic_is_group_section): New function. * targets.c (struct bfd_target): Add _bfd_is_group_section field. (BFD_JUMP_TABLE_LINK): Adjust. * aout-adobe.c (aout_32_bfd_is_group_section): Define. * aout-target.h (MY_bfd_is_group_section): Define. * aout-tic30.c (MY_bfd_is_group_section): Define. * bfd.c (bfd_is_group_section): Define. * binary.c (binary_bfd_is_group_section): Define. * bout.c (b_out_bfd_is_group_section): Define. * coff-alpha.c (_bfd_ecoff_bfd_is_group_section): Define. * coff-mips.c (_bfd_ecoff_bfd_is_group_section): Define. * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Adjust. * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Adjust. * coffcode.h (coff_bfd_is_group_section): Define. * i386msdos.c (msdos_bfd_is_group_section): Define. * i386os9k.c (os9k_bfd_is_group_section): Define. * ieee.c (ieee_bfd_is_group_section): Define. * ihex.c (ihex_bfd_is_group_section): Define. * libbfd-in.h (_bfd_nolink_bfd_is_group_section): Define. * mach-o.c (bfd_mach_o_bfd_is_group_section): Define. * mmo.c (mmo_bfd_is_group_section): Define. * nlm-target.h (nlm_bfd_is_group_section): Define. * oasys.c (oasys_bfd_is_group_section): Define. * pef.c (bfd_pef_bfd_is_group_section): Define. * ppcboot.c (ppcboot_bfd_is_group_section): Define. * srec.c (srec_bfd_is_group_section): Define. * tekhex.c (tekhex_bfd_is_group_section): Define. * versados.c (versados_bfd_is_group_section): Define. * vms.c (vms_bfd_is_group_section): Define. * xsym.c (bfd_sym_bfd_is_group_section): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. --- bfd/ChangeLog | 40 ++++++++++++++++++++++++++++++++++++++++ bfd/aout-adobe.c | 3 ++- bfd/aout-target.h | 5 ++++- bfd/aout-tic30.c | 6 +++++- bfd/bfd-in2.h | 9 +++++++++ bfd/bfd.c | 3 +++ bfd/binary.c | 5 +++-- bfd/bout.c | 3 ++- bfd/coff-alpha.c | 5 +++-- bfd/coff-mips.c | 3 ++- bfd/coff-rs6000.c | 4 +++- bfd/coff64-rs6000.c | 4 +++- bfd/coffcode.h | 4 ++++ bfd/elf-bfd.h | 2 ++ bfd/elf.c | 6 ++++++ bfd/elfxx-target.h | 6 +++++- bfd/i386msdos.c | 3 ++- bfd/i386os9k.c | 5 +++-- bfd/ieee.c | 3 ++- bfd/ihex.c | 3 ++- bfd/libbfd-in.h | 3 +++ bfd/libbfd.h | 3 +++ bfd/mach-o.c | 3 ++- bfd/mmo.c | 3 ++- bfd/nlm-target.h | 3 ++- bfd/oasys.c | 3 ++- bfd/pef.c | 3 ++- bfd/ppcboot.c | 3 ++- bfd/section.c | 38 +++++++++++++++++++++++++++++++------- bfd/srec.c | 3 ++- bfd/targets.c | 4 ++++ bfd/tekhex.c | 5 +++-- bfd/versados.c | 3 ++- bfd/vms.c | 3 ++- bfd/xsym.c | 3 ++- 35 files changed, 169 insertions(+), 36 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1221ebd41ed..74bc2cca7a2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,43 @@ +2004-04-30 Alan Modra + + * section.c (bfd_make_section_anyway): Add all sections to hash tab. + + * elf-bfd.h (bfd_elf_is_group_section): Declare. + * elf.c (bfd_elf_is_group_section): New function. + * elfxx-target.h (bfd_elfNN_bfd_is_group_section + * section.c (bfd_generic_is_group_section): New function. + * targets.c (struct bfd_target): Add _bfd_is_group_section field. + (BFD_JUMP_TABLE_LINK): Adjust. + * aout-adobe.c (aout_32_bfd_is_group_section): Define. + * aout-target.h (MY_bfd_is_group_section): Define. + * aout-tic30.c (MY_bfd_is_group_section): Define. + * bfd.c (bfd_is_group_section): Define. + * binary.c (binary_bfd_is_group_section): Define. + * bout.c (b_out_bfd_is_group_section): Define. + * coff-alpha.c (_bfd_ecoff_bfd_is_group_section): Define. + * coff-mips.c (_bfd_ecoff_bfd_is_group_section): Define. + * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Adjust. + * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Adjust. + * coffcode.h (coff_bfd_is_group_section): Define. + * i386msdos.c (msdos_bfd_is_group_section): Define. + * i386os9k.c (os9k_bfd_is_group_section): Define. + * ieee.c (ieee_bfd_is_group_section): Define. + * ihex.c (ihex_bfd_is_group_section): Define. + * libbfd-in.h (_bfd_nolink_bfd_is_group_section): Define. + * mach-o.c (bfd_mach_o_bfd_is_group_section): Define. + * mmo.c (mmo_bfd_is_group_section): Define. + * nlm-target.h (nlm_bfd_is_group_section): Define. + * oasys.c (oasys_bfd_is_group_section): Define. + * pef.c (bfd_pef_bfd_is_group_section): Define. + * ppcboot.c (ppcboot_bfd_is_group_section): Define. + * srec.c (srec_bfd_is_group_section): Define. + * tekhex.c (tekhex_bfd_is_group_section): Define. + * versados.c (versados_bfd_is_group_section): Define. + * vms.c (vms_bfd_is_group_section): Define. + * xsym.c (bfd_sym_bfd_is_group_section): Define. + * bfd-in2.h: Regenerate. + * libbfd.h: Regenerate. + 2004-04-30 Alan Modra * elflink.c (elf_gc_mark): Follow indirect and warning syms. diff --git a/bfd/aout-adobe.c b/bfd/aout-adobe.c index 052e93829e0..c13f80fc24f 100644 --- a/bfd/aout-adobe.c +++ b/bfd/aout-adobe.c @@ -1,6 +1,6 @@ /* BFD back-end for a.out.adobe binaries. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, - 2002, 2003 + 2002, 2003, 2004 Free Software Foundation, Inc. Written by Cygnus Support. Based on bout.c. @@ -517,6 +517,7 @@ aout_adobe_sizeof_headers (ignore_abfd, ignore) #define aout_32_bfd_relax_section bfd_generic_relax_section #define aout_32_bfd_gc_sections bfd_generic_gc_sections #define aout_32_bfd_merge_sections bfd_generic_merge_sections +#define aout_32_bfd_is_group_section bfd_generic_is_group_section #define aout_32_bfd_discard_group bfd_generic_discard_group #define aout_32_bfd_link_hash_table_create \ _bfd_generic_link_hash_table_create diff --git a/bfd/aout-target.h b/bfd/aout-target.h index dece83cf263..80513c7c739 100644 --- a/bfd/aout-target.h +++ b/bfd/aout-target.h @@ -1,6 +1,6 @@ /* Define a target vector and some small routines for a variant of a.out. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -513,6 +513,9 @@ MY_bfd_final_link (abfd, info) #ifndef MY_bfd_merge_sections #define MY_bfd_merge_sections bfd_generic_merge_sections #endif +#ifndef MY_bfd_is_group_section +#define MY_bfd_is_group_section bfd_generic_is_group_section +#endif #ifndef MY_bfd_discard_group #define MY_bfd_discard_group bfd_generic_discard_group #endif diff --git a/bfd/aout-tic30.c b/bfd/aout-tic30.c index 96f35dce9e4..1ae0ebfdab9 100644 --- a/bfd/aout-tic30.c +++ b/bfd/aout-tic30.c @@ -1,5 +1,6 @@ /* BFD back-end for TMS320C30 a.out binaries. - Copyright 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 + Free Software Foundation, Inc. Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) This file is part of BFD, the Binary File Descriptor library. @@ -969,6 +970,9 @@ tic30_aout_set_arch_mach (abfd, arch, machine) #ifndef MY_bfd_merge_sections #define MY_bfd_merge_sections bfd_generic_merge_sections #endif +#ifndef MY_bfd_is_group_section +#define MY_bfd_is_group_section bfd_generic_is_group_section +#endif #ifndef MY_bfd_discard_group #define MY_bfd_discard_group bfd_generic_discard_group #endif diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index d0e5cbe37ef..ed45cac8c92 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1470,6 +1470,8 @@ bfd_boolean bfd_copy_private_section_data void _bfd_strip_section_from_output (struct bfd_link_info *info, asection *section); +bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec); + bfd_boolean bfd_generic_discard_group (bfd *abfd, asection *group); /* Extracted from archures.c. */ @@ -3976,6 +3978,9 @@ bfd_boolean bfd_set_private_flags (bfd *abfd, flagword flags); #define bfd_merge_sections(abfd, link_info) \ BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) +#define bfd_is_group_section(abfd, sec) \ + BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) + #define bfd_discard_group(abfd, sec) \ BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) @@ -4346,6 +4351,7 @@ typedef struct bfd_target NAME##_bfd_link_split_section, \ NAME##_bfd_gc_sections, \ NAME##_bfd_merge_sections, \ + NAME##_bfd_is_group_section, \ NAME##_bfd_discard_group int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); @@ -4383,6 +4389,9 @@ typedef struct bfd_target /* Attempt to merge SEC_MERGE sections. */ bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); + /* Is this section a member of a group? */ + bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); + /* Discard members of a group. */ bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); diff --git a/bfd/bfd.c b/bfd/bfd.c index 199ed1af7aa..e184781f5fd 100644 --- a/bfd/bfd.c +++ b/bfd/bfd.c @@ -1083,6 +1083,9 @@ DESCRIPTION .#define bfd_merge_sections(abfd, link_info) \ . BFD_SEND (abfd, _bfd_merge_sections, (abfd, link_info)) . +.#define bfd_is_group_section(abfd, sec) \ +. BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec)) +. .#define bfd_discard_group(abfd, sec) \ . BFD_SEND (abfd, _bfd_discard_group, (abfd, sec)) . diff --git a/bfd/binary.c b/bfd/binary.c index 65f46afa39c..c8d8941ec55 100644 --- a/bfd/binary.c +++ b/bfd/binary.c @@ -1,6 +1,6 @@ /* BFD back-end for binary objects. - Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support, This file is part of BFD, the Binary File Descriptor library. @@ -339,6 +339,7 @@ binary_sizeof_headers (abfd, exec) #define binary_bfd_relax_section bfd_generic_relax_section #define binary_bfd_gc_sections bfd_generic_gc_sections #define binary_bfd_merge_sections bfd_generic_merge_sections +#define binary_bfd_is_group_section bfd_generic_is_group_section #define binary_bfd_discard_group bfd_generic_discard_group #define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define binary_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/bout.c b/bfd/bout.c index a39a9a36a94..0c6c808de79 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 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Cygnus Support. @@ -1487,6 +1487,7 @@ b_out_bfd_get_relocated_section_contents (output_bfd, link_info, link_order, #define b_out_bfd_link_split_section _bfd_generic_link_split_section #define b_out_bfd_gc_sections bfd_generic_gc_sections #define b_out_bfd_merge_sections bfd_generic_merge_sections +#define b_out_bfd_is_group_section bfd_generic_is_group_section #define b_out_bfd_discard_group bfd_generic_discard_group #define aout_32_get_section_contents_in_window \ diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c index e9dd4169b22..262af474594 100644 --- a/bfd/coff-alpha.c +++ b/bfd/coff-alpha.c @@ -1,6 +1,6 @@ /* BFD back-end for ALPHA Extended-Coff files. - Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, + 2003, 2004 Free Software Foundation, Inc. Modified from coff-mips.c by Steve Chamberlain and Ian Lance Taylor . @@ -2359,6 +2359,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data = #define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section #define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections +#define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group const bfd_target ecoffalpha_little_vec = diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c index cafc289aa91..9ef19852df7 100644 --- a/bfd/coff-mips.c +++ b/bfd/coff-mips.c @@ -1,6 +1,6 @@ /* BFD back-end for MIPS Extended-Coff files. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Original version by Per Bothner. Full support added by Ian Lance Taylor, ian@cygnus.com. @@ -1393,6 +1393,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data = /* Merging of sections is not done. */ #define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections +#define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group extern const bfd_target ecoff_big_vec; diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c index bcd89dd2f03..22d47c561bf 100644 --- a/bfd/coff-rs6000.c +++ b/bfd/coff-rs6000.c @@ -1,5 +1,5 @@ /* BFD back-end for IBM RS/6000 "XCOFF" files. - Copyright 1990-1999, 2000, 2001, 2002, 2003 + Copyright 1990-1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced @@ -4196,6 +4196,7 @@ const bfd_target rs6000coff_vec = _bfd_generic_link_split_section, bfd_generic_gc_sections, bfd_generic_merge_sections, + bfd_generic_is_group_section, bfd_generic_discard_group, /* Dynamic */ @@ -4439,6 +4440,7 @@ const bfd_target pmac_xcoff_vec = _bfd_generic_link_split_section, bfd_generic_gc_sections, bfd_generic_merge_sections, + bfd_generic_is_group_section, bfd_generic_discard_group, /* Dynamic */ diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c index 14e4c2782bc..857a4b45c36 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 + Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written Clinton Popetz. Contributed by Cygnus Support. @@ -2737,6 +2737,7 @@ const bfd_target rs6000coff64_vec = _bfd_generic_link_split_section, bfd_generic_gc_sections, bfd_generic_merge_sections, + bfd_generic_is_group_section, bfd_generic_discard_group, /* Dynamic */ @@ -2981,6 +2982,7 @@ const bfd_target aix5coff64_vec = _bfd_generic_link_split_section, bfd_generic_gc_sections, bfd_generic_merge_sections, + bfd_generic_is_group_section, bfd_generic_discard_group, /* Dynamic */ diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 80b5526a4fd..d495b531d6d 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -5564,6 +5564,10 @@ static const bfd_coff_backend_data ticoff1_swap_table = #define coff_bfd_merge_sections bfd_generic_merge_sections #endif +#ifndef coff_bfd_is_group_section +#define coff_bfd_is_group_section bfd_generic_is_group_section +#endif + #ifndef coff_bfd_discard_group #define coff_bfd_discard_group bfd_generic_discard_group #endif diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index 4877a0a4686..9d0ec364b74 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -1368,6 +1368,8 @@ extern bfd_boolean _bfd_elf_slurp_version_tables (bfd *); extern bfd_boolean _bfd_elf_merge_sections (bfd *, struct bfd_link_info *); +extern bfd_boolean bfd_elf_is_group_section + (bfd *, const struct bfd_section *); extern bfd_boolean bfd_elf_discard_group (bfd *, struct bfd_section *); extern void bfd_elf_set_group_contents diff --git a/bfd/elf.c b/bfd/elf.c index d383813e939..159e040b45d 100644 --- a/bfd/elf.c +++ b/bfd/elf.c @@ -612,6 +612,12 @@ setup_group (bfd *abfd, Elf_Internal_Shdr *hdr, asection *newsect) return TRUE; } +bfd_boolean +bfd_elf_is_group_section (bfd *abfd ATTRIBUTE_UNUSED, const asection *sec) +{ + return elf_next_in_group (sec) != NULL; +} + bfd_boolean bfd_elf_discard_group (bfd *abfd ATTRIBUTE_UNUSED, asection *group) { diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h index 5d8af449f07..61ed19788f8 100644 --- a/bfd/elfxx-target.h +++ b/bfd/elfxx-target.h @@ -1,6 +1,6 @@ /* Target definitions for NN-bit ELF Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003 Free Software Foundation, Inc. + 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -136,6 +136,10 @@ _bfd_elf_merge_sections #endif +#ifndef bfd_elfNN_bfd_is_group_section +#define bfd_elfNN_bfd_is_group_section bfd_elf_is_group_section +#endif + #ifndef bfd_elfNN_bfd_discard_group #define bfd_elfNN_bfd_discard_group bfd_elf_discard_group #endif diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c index 059466b4c95..2dbd8df4db8 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 Free Software Foundation, Inc. + 2003, 2004 Free Software Foundation, Inc. Written by Bryan Ford of the University of Utah. Contributed by the Center for Software Science at the @@ -176,6 +176,7 @@ msdos_set_section_contents (abfd, section, location, offset, count) #define msdos_bfd_relax_section bfd_generic_relax_section #define msdos_bfd_gc_sections bfd_generic_gc_sections #define msdos_bfd_merge_sections bfd_generic_merge_sections +#define msdos_bfd_is_group_section bfd_generic_is_group_section #define msdos_bfd_discard_group bfd_generic_discard_group #define msdos_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define msdos_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/i386os9k.c b/bfd/i386os9k.c index d9a34e34131..3be6bdd92b0 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 - Free Software Foundation, Inc. + Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2001, 2002, + 2004 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -333,6 +333,7 @@ os9k_sizeof_headers (ignore_abfd, ignore) #define os9k_bfd_relax_section bfd_generic_relax_section #define os9k_bfd_gc_sections bfd_generic_gc_sections #define os9k_bfd_merge_sections bfd_generic_merge_sections +#define os9k_bfd_is_group_section bfd_generic_is_group_section #define os9k_bfd_discard_group bfd_generic_discard_group #define os9k_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define os9k_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/ieee.c b/bfd/ieee.c index 8a0802840d4..fcabf750a0d 100644 --- a/bfd/ieee.c +++ b/bfd/ieee.c @@ -1,6 +1,6 @@ /* BFD back-end for ieee-695 objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support. @@ -4037,6 +4037,7 @@ ieee_bfd_debug_info_accumulate (abfd, section) #define ieee_bfd_relax_section bfd_generic_relax_section #define ieee_bfd_gc_sections bfd_generic_gc_sections #define ieee_bfd_merge_sections bfd_generic_merge_sections +#define ieee_bfd_is_group_section bfd_generic_is_group_section #define ieee_bfd_discard_group bfd_generic_discard_group #define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define ieee_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/ihex.c b/bfd/ihex.c index 5d2d47fbcb7..5c4c438e1a8 100644 --- a/bfd/ihex.c +++ b/bfd/ihex.c @@ -1,5 +1,5 @@ /* BFD back-end for Intel Hex objects. - Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Ian Lance Taylor of Cygnus Support . @@ -988,6 +988,7 @@ ihex_sizeof_headers (abfd, exec) #define ihex_bfd_relax_section bfd_generic_relax_section #define ihex_bfd_gc_sections bfd_generic_gc_sections #define ihex_bfd_merge_sections bfd_generic_merge_sections +#define ihex_bfd_is_group_section bfd_generic_is_group_section #define ihex_bfd_discard_group bfd_generic_discard_group #define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define ihex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h index 5dd9a717626..fb021d3b034 100644 --- a/bfd/libbfd-in.h +++ b/bfd/libbfd-in.h @@ -355,6 +355,9 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_merge_sections \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) +#define _bfd_nolink_bfd_is_group_section \ + ((bfd_boolean (*) (bfd *, const struct bfd_section *)) \ + bfd_false) #define _bfd_nolink_bfd_discard_group \ ((bfd_boolean (*) (bfd *, struct bfd_section *)) \ bfd_false) diff --git a/bfd/libbfd.h b/bfd/libbfd.h index 2573de7bfbc..6841e29b8e0 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -360,6 +360,9 @@ extern bfd_boolean _bfd_generic_set_section_contents #define _bfd_nolink_bfd_merge_sections \ ((bfd_boolean (*) (bfd *, struct bfd_link_info *)) \ bfd_false) +#define _bfd_nolink_bfd_is_group_section \ + ((bfd_boolean (*) (bfd *, const struct bfd_section *)) \ + bfd_false) #define _bfd_nolink_bfd_discard_group \ ((bfd_boolean (*) (bfd *, struct bfd_section *)) \ bfd_false) diff --git a/bfd/mach-o.c b/bfd/mach-o.c index b5d6a728d08..eaa7aba88a4 100644 --- a/bfd/mach-o.c +++ b/bfd/mach-o.c @@ -1,5 +1,5 @@ /* Mach-O support for BFD. - Copyright 1999, 2000, 2001, 2002, 2003 + Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -68,6 +68,7 @@ #define bfd_mach_o_set_section_contents _bfd_generic_set_section_contents #define bfd_mach_o_bfd_gc_sections bfd_generic_gc_sections #define bfd_mach_o_bfd_merge_sections bfd_generic_merge_sections +#define bfd_mach_o_bfd_is_group_section bfd_generic_is_group_section #define bfd_mach_o_bfd_discard_group bfd_generic_discard_group static bfd_boolean bfd_mach_o_bfd_copy_private_symbol_data diff --git a/bfd/mmo.c b/bfd/mmo.c index 74b4c9dd1d0..d791062ecc3 100644 --- a/bfd/mmo.c +++ b/bfd/mmo.c @@ -1,5 +1,5 @@ /* BFD back-end for mmo objects (MMIX-specific object-format). - Copyright 2001, 2002, 2003 + Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Hans-Peter Nilsson (hp@bitrange.com). Infrastructure and other bits originally copied from srec.c and @@ -3286,6 +3286,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols) #define mmo_set_arch_mach bfd_default_set_arch_mach #define mmo_bfd_relax_section bfd_generic_relax_section #define mmo_bfd_merge_sections bfd_generic_merge_sections +#define mmo_bfd_is_group_section bfd_generic_is_group_section #define mmo_bfd_discard_group bfd_generic_discard_group /* objcopy will be upset if we return -1 from bfd_get_reloc_upper_bound by diff --git a/bfd/nlm-target.h b/bfd/nlm-target.h index 70ae4f4d6a7..cf84000ff64 100644 --- a/bfd/nlm-target.h +++ b/bfd/nlm-target.h @@ -1,5 +1,5 @@ /* Target definitions for 32/64-bit NLM (NetWare Loadable Module) - Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -44,6 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define nlm_bfd_relax_section bfd_generic_relax_section #define nlm_bfd_gc_sections bfd_generic_gc_sections #define nlm_bfd_merge_sections bfd_generic_merge_sections +#define nlm_bfd_is_group_section bfd_generic_is_group_section #define nlm_bfd_discard_group bfd_generic_discard_group #define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define nlm_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/oasys.c b/bfd/oasys.c index be6a8d90d86..2108bda25db 100644 --- a/bfd/oasys.c +++ b/bfd/oasys.c @@ -1,6 +1,6 @@ /* BFD back-end for oasys objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2001, - 2002, 2003 Free Software Foundation, Inc. + 2002, 2003, 2004 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support, . This file is part of BFD, the Binary File Descriptor library. @@ -1506,6 +1506,7 @@ oasys_sizeof_headers (abfd, exec) #define oasys_bfd_relax_section bfd_generic_relax_section #define oasys_bfd_gc_sections bfd_generic_gc_sections #define oasys_bfd_merge_sections bfd_generic_merge_sections +#define oasys_bfd_is_group_section bfd_generic_is_group_section #define oasys_bfd_discard_group bfd_generic_discard_group #define oasys_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define oasys_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/pef.c b/bfd/pef.c index 7d758cf57d2..e1bb5a76db5 100644 --- a/bfd/pef.c +++ b/bfd/pef.c @@ -1,5 +1,5 @@ /* PEF support for BFD. - Copyright 1999, 2000, 2001, 2002, 2003 + Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -52,6 +52,7 @@ #define bfd_pef_bfd_relax_section bfd_generic_relax_section #define bfd_pef_bfd_gc_sections bfd_generic_gc_sections #define bfd_pef_bfd_merge_sections bfd_generic_merge_sections +#define bfd_pef_bfd_is_group_section bfd_generic_is_group_section #define bfd_pef_bfd_discard_group bfd_generic_discard_group #define bfd_pef_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define bfd_pef_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c index 05fb7de7429..d34f1a2777e 100644 --- a/bfd/ppcboot.c +++ b/bfd/ppcboot.c @@ -1,5 +1,5 @@ /* BFD back-end for PPCbug boot records. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Michael Meissner, Cygnus Support, @@ -469,6 +469,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg) #define ppcboot_bfd_relax_section bfd_generic_relax_section #define ppcboot_bfd_gc_sections bfd_generic_gc_sections #define ppcboot_bfd_merge_sections bfd_generic_merge_sections +#define ppcboot_bfd_is_group_section bfd_generic_is_group_section #define ppcboot_bfd_discard_group bfd_generic_discard_group #define ppcboot_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define ppcboot_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/section.c b/bfd/section.c index fce8e1eab3d..5ecb4a63481 100644 --- a/bfd/section.c +++ b/bfd/section.c @@ -1,6 +1,6 @@ /* Object file "section" support for the BFD library. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Cygnus Support. @@ -945,13 +945,19 @@ bfd_make_section_anyway (bfd *abfd, const char *name) newsect = &sh->section; if (newsect->name != NULL) { - /* We are making a section of the same name. It can't go in - section_htab without generating a unique section name and - that would be pointless; We don't need to traverse the - hash table. */ - newsect = bfd_zalloc (abfd, sizeof (asection)); - if (newsect == NULL) + /* We are making a section of the same name. Put it in the + section hash table. Even though we can't find it directly by a + hash lookup, we'll be able to find the section by traversing + sh->root.next quicker than looking at all the bfd sections. */ + struct section_hash_entry *new_sh; + new_sh = (struct section_hash_entry *) + bfd_section_hash_newfunc (NULL, &abfd->section_htab, name); + if (new_sh == NULL) return NULL; + + new_sh->root.next = sh->root.next; + sh->root.next = &new_sh->root; + newsect = &new_sh->section; } newsect->name = name; @@ -1349,6 +1355,24 @@ _bfd_strip_section_from_output (struct bfd_link_info *info, asection *s) os->flags |= SEC_EXCLUDE; } +/* +FUNCTION + bfd_generic_is_group_section + +SYNOPSIS + bfd_boolean bfd_generic_is_group_section (bfd *, const asection *sec); + +DESCRIPTION + Returns TRUE if @var{sec} is a member of a group. +*/ + +bfd_boolean +bfd_generic_is_group_section (bfd *abfd ATTRIBUTE_UNUSED, + const asection *sec ATTRIBUTE_UNUSED) +{ + return FALSE; +} + /* FUNCTION bfd_generic_discard_group diff --git a/bfd/srec.c b/bfd/srec.c index c0a3d585b43..2eba70d588a 100644 --- a/bfd/srec.c +++ b/bfd/srec.c @@ -1,6 +1,6 @@ /* BFD back-end for s-record objects. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2002, 2003 + 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . @@ -1284,6 +1284,7 @@ srec_print_symbol (abfd, afile, symbol, how) #define srec_bfd_relax_section bfd_generic_relax_section #define srec_bfd_gc_sections bfd_generic_gc_sections #define srec_bfd_merge_sections bfd_generic_merge_sections +#define srec_bfd_is_group_section bfd_generic_is_group_section #define srec_bfd_discard_group bfd_generic_discard_group #define srec_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define srec_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/targets.c b/bfd/targets.c index 353e8c2214d..29e3f626ac2 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -406,6 +406,7 @@ BFD_JUMP_TABLE macros. . NAME##_bfd_link_split_section, \ . NAME##_bfd_gc_sections, \ . NAME##_bfd_merge_sections, \ +. NAME##_bfd_is_group_section, \ . NAME##_bfd_discard_group . . int (*_bfd_sizeof_headers) (bfd *, bfd_boolean); @@ -443,6 +444,9 @@ BFD_JUMP_TABLE macros. . {* Attempt to merge SEC_MERGE sections. *} . bfd_boolean (*_bfd_merge_sections) (bfd *, struct bfd_link_info *); . +. {* Is this section a member of a group? *} +. bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *); +. . {* Discard members of a group. *} . bfd_boolean (*_bfd_discard_group) (bfd *, struct bfd_section *); . diff --git a/bfd/tekhex.c b/bfd/tekhex.c index f828fe7393c..278e30358e8 100644 --- a/bfd/tekhex.c +++ b/bfd/tekhex.c @@ -1,6 +1,6 @@ /* BFD backend for Extended Tektronix Hex Format objects. - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, + 2003, 2004 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . This file is part of BFD, the Binary File Descriptor library. @@ -1001,6 +1001,7 @@ tekhex_print_symbol (abfd, filep, symbol, how) #define tekhex_bfd_relax_section bfd_generic_relax_section #define tekhex_bfd_gc_sections bfd_generic_gc_sections #define tekhex_bfd_merge_sections bfd_generic_merge_sections +#define tekhex_bfd_is_group_section bfd_generic_is_group_section #define tekhex_bfd_discard_group bfd_generic_discard_group #define tekhex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define tekhex_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/versados.c b/bfd/versados.c index 19df300b5dd..cd5926ebfed 100644 --- a/bfd/versados.c +++ b/bfd/versados.c @@ -1,5 +1,5 @@ /* BFD back-end for VERSAdos-E objects. - Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Steve Chamberlain of Cygnus Support . @@ -872,6 +872,7 @@ versados_canonicalize_reloc (abfd, section, relptr, symbols) #define versados_bfd_relax_section bfd_generic_relax_section #define versados_bfd_gc_sections bfd_generic_gc_sections #define versados_bfd_merge_sections bfd_generic_merge_sections +#define versados_bfd_is_group_section bfd_generic_is_group_section #define versados_bfd_discard_group bfd_generic_discard_group #define versados_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define versados_bfd_link_hash_table_free _bfd_generic_link_hash_table_free diff --git a/bfd/vms.c b/bfd/vms.c index 62972b680fe..329b0564ad8 100644 --- a/bfd/vms.c +++ b/bfd/vms.c @@ -1,6 +1,6 @@ /* vms.c -- BFD back-end for VAX (openVMS/VAX) and EVAX (openVMS/Alpha) files. - Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Written by Klaus K"ampf (kkaempf@rmi.de) @@ -166,6 +166,7 @@ static bfd_boolean vms_bfd_set_private_flags #define vms_make_empty_symbol _bfd_generic_make_empty_symbol #define vms_bfd_link_just_syms _bfd_generic_link_just_syms +#define vms_bfd_is_group_section bfd_generic_is_group_section #define vms_bfd_discard_group bfd_generic_discard_group /*===========================================================================*/ diff --git a/bfd/xsym.c b/bfd/xsym.c index a4058dd3954..e5889d474f3 100644 --- a/bfd/xsym.c +++ b/bfd/xsym.c @@ -1,5 +1,5 @@ /* xSYM symbol-file support for BFD. - Copyright 1999, 2000, 2001, 2002, 2003 + Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -42,6 +42,7 @@ #define bfd_sym_bfd_relax_section bfd_generic_relax_section #define bfd_sym_bfd_gc_sections bfd_generic_gc_sections #define bfd_sym_bfd_merge_sections bfd_generic_merge_sections +#define bfd_sym_bfd_is_group_section bfd_generic_is_group_section #define bfd_sym_bfd_discard_group bfd_generic_discard_group #define bfd_sym_bfd_link_hash_table_create _bfd_generic_link_hash_table_create #define bfd_sym_bfd_link_hash_table_free _bfd_generic_link_hash_table_free -- 2.30.2