This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ld -r and section groups.


A lot of mucking around for a small functional change.  This tweaks the
behaviour of unique_section_p to make sections is a group unique.

bfd/
	* 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.

ld/
	* ldlang.c (unique_section_p): Pass section parm, return true on
	group sections.
	(output_section_callback): Adjust.
	* ldlang.h (unique_section_p): Update prototype.
	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Adjust.

Index: bfd/aout-adobe.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-adobe.c,v
retrieving revision 1.17
diff -u -p -r1.17 aout-adobe.c
--- bfd/aout-adobe.c	4 Nov 2003 10:41:50 -0000	1.17
+++ bfd/aout-adobe.c	30 Apr 2004 13:12:37 -0000
@@ -517,6 +517,7 @@ aout_adobe_sizeof_headers (ignore_abfd, 
 #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
Index: bfd/aout-target.h
===================================================================
RCS file: /cvs/src/src/bfd/aout-target.h,v
retrieving revision 1.22
diff -u -p -r1.22 aout-target.h
--- bfd/aout-target.h	22 Apr 2004 14:45:31 -0000	1.22
+++ bfd/aout-target.h	30 Apr 2004 13:12:38 -0000
@@ -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
Index: bfd/aout-tic30.c
===================================================================
RCS file: /cvs/src/src/bfd/aout-tic30.c,v
retrieving revision 1.21
diff -u -p -r1.21 aout-tic30.c
--- bfd/aout-tic30.c	22 Apr 2004 14:45:31 -0000	1.21
+++ bfd/aout-tic30.c	30 Apr 2004 13:12:41 -0000
@@ -969,6 +969,9 @@ tic30_aout_set_arch_mach (abfd, arch, ma
 #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
Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.60
diff -u -p -r1.60 bfd.c
--- bfd/bfd.c	29 Apr 2004 16:40:19 -0000	1.60
+++ bfd/bfd.c	30 Apr 2004 13:12:42 -0000
@@ -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))
 .
Index: bfd/binary.c
===================================================================
RCS file: /cvs/src/src/bfd/binary.c,v
retrieving revision 1.20
diff -u -p -r1.20 binary.c
--- bfd/binary.c	4 Nov 2003 10:41:50 -0000	1.20
+++ bfd/binary.c	30 Apr 2004 13:12:42 -0000
@@ -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
Index: bfd/bout.c
===================================================================
RCS file: /cvs/src/src/bfd/bout.c,v
retrieving revision 1.18
diff -u -p -r1.18 bout.c
--- bfd/bout.c	4 Nov 2003 10:41:50 -0000	1.18
+++ bfd/bout.c	30 Apr 2004 13:12:43 -0000
@@ -1487,6 +1487,7 @@ b_out_bfd_get_relocated_section_contents
 #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 \
Index: bfd/coff-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-alpha.c,v
retrieving revision 1.19
diff -u -p -r1.19 coff-alpha.c
--- bfd/coff-alpha.c	25 Jun 2003 06:40:18 -0000	1.19
+++ bfd/coff-alpha.c	30 Apr 2004 13:12:44 -0000
@@ -2359,6 +2359,7 @@ static const struct ecoff_backend_data a
 #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 =
Index: bfd/coff-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-mips.c,v
retrieving revision 1.23
diff -u -p -r1.23 coff-mips.c
--- bfd/coff-mips.c	24 Apr 2004 06:12:24 -0000	1.23
+++ bfd/coff-mips.c	30 Apr 2004 13:12:45 -0000
@@ -1393,6 +1393,7 @@ static const struct ecoff_backend_data m
 /* 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;
Index: bfd/coff-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff-rs6000.c,v
retrieving revision 1.58
diff -u -p -r1.58 coff-rs6000.c
--- bfd/coff-rs6000.c	22 Apr 2004 14:45:31 -0000	1.58
+++ bfd/coff-rs6000.c	30 Apr 2004 13:12:47 -0000
@@ -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 */
Index: bfd/coff64-rs6000.c
===================================================================
RCS file: /cvs/src/src/bfd/coff64-rs6000.c,v
retrieving revision 1.49
diff -u -p -r1.49 coff64-rs6000.c
--- bfd/coff64-rs6000.c	22 Apr 2004 14:45:31 -0000	1.49
+++ bfd/coff64-rs6000.c	30 Apr 2004 13:12:48 -0000
@@ -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 */
Index: bfd/coffcode.h
===================================================================
RCS file: /cvs/src/src/bfd/coffcode.h,v
retrieving revision 1.102
diff -u -p -r1.102 coffcode.h
--- bfd/coffcode.h	29 Apr 2004 16:40:19 -0000	1.102
+++ bfd/coffcode.h	30 Apr 2004 13:12:51 -0000
@@ -5564,6 +5564,10 @@ static const bfd_coff_backend_data ticof
 #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
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.138
diff -u -p -r1.138 elf-bfd.h
--- bfd/elf-bfd.h	27 Apr 2004 03:13:14 -0000	1.138
+++ bfd/elf-bfd.h	30 Apr 2004 13:12:56 -0000
@@ -1368,6 +1368,8 @@ extern bfd_boolean _bfd_elf_slurp_versio
   (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
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.222
diff -u -p -r1.222 elf.c
--- bfd/elf.c	27 Apr 2004 03:13:14 -0000	1.222
+++ bfd/elf.c	30 Apr 2004 13:13:00 -0000
@@ -613,6 +613,12 @@ setup_group (bfd *abfd, Elf_Internal_Shd
 }
 
 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)
 {
   asection *first = elf_next_in_group (group);
Index: bfd/elfxx-target.h
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-target.h,v
retrieving revision 1.63
diff -u -p -r1.63 elfxx-target.h
--- bfd/elfxx-target.h	22 Apr 2004 14:45:32 -0000	1.63
+++ bfd/elfxx-target.h	30 Apr 2004 13:13:00 -0000
@@ -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
Index: bfd/i386msdos.c
===================================================================
RCS file: /cvs/src/src/bfd/i386msdos.c,v
retrieving revision 1.13
diff -u -p -r1.13 i386msdos.c
--- bfd/i386msdos.c	4 Nov 2003 10:41:51 -0000	1.13
+++ bfd/i386msdos.c	30 Apr 2004 13:13:01 -0000
@@ -176,6 +176,7 @@ msdos_set_section_contents (abfd, sectio
 #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
Index: bfd/i386os9k.c
===================================================================
RCS file: /cvs/src/src/bfd/i386os9k.c,v
retrieving revision 1.12
diff -u -p -r1.12 i386os9k.c
--- bfd/i386os9k.c	30 Nov 2002 08:39:39 -0000	1.12
+++ bfd/i386os9k.c	30 Apr 2004 13:13:01 -0000
@@ -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
Index: bfd/ieee.c
===================================================================
RCS file: /cvs/src/src/bfd/ieee.c,v
retrieving revision 1.36
diff -u -p -r1.36 ieee.c
--- bfd/ieee.c	30 Nov 2003 18:40:41 -0000	1.36
+++ bfd/ieee.c	30 Apr 2004 13:13:03 -0000
@@ -4037,6 +4037,7 @@ ieee_bfd_debug_info_accumulate (abfd, se
 #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
Index: bfd/ihex.c
===================================================================
RCS file: /cvs/src/src/bfd/ihex.c,v
retrieving revision 1.21
diff -u -p -r1.21 ihex.c
--- bfd/ihex.c	1 Dec 2003 06:33:01 -0000	1.21
+++ bfd/ihex.c	30 Apr 2004 13:13:03 -0000
@@ -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
Index: bfd/libbfd-in.h
===================================================================
RCS file: /cvs/src/src/bfd/libbfd-in.h,v
retrieving revision 1.32
diff -u -p -r1.32 libbfd-in.h
--- bfd/libbfd-in.h	22 Apr 2004 14:45:31 -0000	1.32
+++ bfd/libbfd-in.h	30 Apr 2004 13:13:04 -0000
@@ -355,6 +355,9 @@ extern bfd_boolean _bfd_generic_set_sect
 #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)
Index: bfd/mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.7
diff -u -p -r1.7 mach-o.c
--- bfd/mach-o.c	15 Mar 2004 12:23:10 -0000	1.7
+++ bfd/mach-o.c	30 Apr 2004 13:13:05 -0000
@@ -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
Index: bfd/mmo.c
===================================================================
RCS file: /cvs/src/src/bfd/mmo.c,v
retrieving revision 1.16
diff -u -p -r1.16 mmo.c
--- bfd/mmo.c	4 Nov 2003 10:41:51 -0000	1.16
+++ bfd/mmo.c	30 Apr 2004 13:13:07 -0000
@@ -3286,6 +3286,7 @@ mmo_canonicalize_reloc (abfd, section, r
 #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
Index: bfd/nlm-target.h
===================================================================
RCS file: /cvs/src/src/bfd/nlm-target.h,v
retrieving revision 1.10
diff -u -p -r1.10 nlm-target.h
--- bfd/nlm-target.h	4 Nov 2003 11:30:54 -0000	1.10
+++ bfd/nlm-target.h	30 Apr 2004 13:13:07 -0000
@@ -44,6 +44,7 @@ Foundation, Inc., 59 Temple Place - Suit
 #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
Index: bfd/oasys.c
===================================================================
RCS file: /cvs/src/src/bfd/oasys.c,v
retrieving revision 1.22
diff -u -p -r1.22 oasys.c
--- bfd/oasys.c	30 Nov 2003 18:40:41 -0000	1.22
+++ bfd/oasys.c	30 Apr 2004 13:13:08 -0000
@@ -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
Index: bfd/pef.c
===================================================================
RCS file: /cvs/src/src/bfd/pef.c,v
retrieving revision 1.6
diff -u -p -r1.6 pef.c
--- bfd/pef.c	16 Oct 2003 04:11:07 -0000	1.6
+++ bfd/pef.c	30 Apr 2004 13:13:08 -0000
@@ -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
Index: bfd/ppcboot.c
===================================================================
RCS file: /cvs/src/src/bfd/ppcboot.c,v
retrieving revision 1.16
diff -u -p -r1.16 ppcboot.c
--- bfd/ppcboot.c	4 Nov 2003 10:41:52 -0000	1.16
+++ bfd/ppcboot.c	30 Apr 2004 13:13:09 -0000
@@ -469,6 +469,7 @@ ppcboot_bfd_print_private_bfd_data (abfd
 #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
Index: bfd/section.c
===================================================================
RCS file: /cvs/src/src/bfd/section.c,v
retrieving revision 1.67
diff -u -p -r1.67 section.c
--- bfd/section.c	1 Dec 2003 06:33:01 -0000	1.67
+++ bfd/section.c	30 Apr 2004 13:13:10 -0000
@@ -945,13 +945,19 @@ bfd_make_section_anyway (bfd *abfd, cons
   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;
@@ -1347,6 +1353,24 @@ _bfd_strip_section_from_output (struct b
   /* If the output section is empty, flag it for removal too.
      See ldlang.c:strip_excluded_output_sections for the action.  */
   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;
 }
 
 /*
Index: bfd/srec.c
===================================================================
RCS file: /cvs/src/src/bfd/srec.c,v
retrieving revision 1.27
diff -u -p -r1.27 srec.c
--- bfd/srec.c	30 Nov 2003 18:40:41 -0000	1.27
+++ bfd/srec.c	30 Apr 2004 13:13:11 -0000
@@ -1284,6 +1284,7 @@ srec_print_symbol (abfd, afile, symbol, 
 #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
Index: bfd/targets.c
===================================================================
RCS file: /cvs/src/src/bfd/targets.c,v
retrieving revision 1.107
diff -u -p -r1.107 targets.c
--- bfd/targets.c	22 Apr 2004 14:45:31 -0000	1.107
+++ bfd/targets.c	30 Apr 2004 13:13:11 -0000
@@ -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);
@@ -442,6 +443,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 *);
Index: bfd/tekhex.c
===================================================================
RCS file: /cvs/src/src/bfd/tekhex.c,v
retrieving revision 1.18
diff -u -p -r1.18 tekhex.c
--- bfd/tekhex.c	30 Nov 2003 18:40:41 -0000	1.18
+++ bfd/tekhex.c	30 Apr 2004 13:13:12 -0000
@@ -1001,6 +1001,7 @@ tekhex_print_symbol (abfd, filep, symbol
 #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
Index: bfd/versados.c
===================================================================
RCS file: /cvs/src/src/bfd/versados.c,v
retrieving revision 1.20
diff -u -p -r1.20 versados.c
--- bfd/versados.c	30 Nov 2003 18:40:41 -0000	1.20
+++ bfd/versados.c	30 Apr 2004 13:13:12 -0000
@@ -872,6 +872,7 @@ versados_canonicalize_reloc (abfd, secti
 #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
Index: bfd/vms.c
===================================================================
RCS file: /cvs/src/src/bfd/vms.c,v
retrieving revision 1.27
diff -u -p -r1.27 vms.c
--- bfd/vms.c	22 Apr 2004 14:45:31 -0000	1.27
+++ bfd/vms.c	30 Apr 2004 13:13:13 -0000
@@ -166,6 +166,7 @@ static bfd_boolean vms_bfd_set_private_f
 
 #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
 
 /*===========================================================================*/
Index: bfd/xsym.c
===================================================================
RCS file: /cvs/src/src/bfd/xsym.c,v
retrieving revision 1.5
diff -u -p -r1.5 xsym.c
--- bfd/xsym.c	16 Oct 2003 04:11:09 -0000	1.5
+++ bfd/xsym.c	30 Apr 2004 13:13:14 -0000
@@ -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
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.142
diff -u -p -r1.142 ldlang.c
--- ld/ldlang.c	19 Apr 2004 07:35:12 -0000	1.142
+++ ld/ldlang.c	30 Apr 2004 13:13:34 -0000
@@ -121,10 +121,17 @@ stat_alloc (size_t size)
 }
 
 bfd_boolean
-unique_section_p (const char *secnam)
+unique_section_p (const asection *sec)
 {
   struct unique_sections *unam;
+  const char *secnam;
 
+  if (link_info.relocatable
+      && sec->owner != NULL
+      && bfd_is_group_section (sec->owner, sec))
+    return TRUE;
+
+  secnam = sec->name;
   for (unam = unique_section_list; unam; unam = unam->next)
     if (wildcardp (unam->name)
 	? fnmatch (unam->name, secnam, 0) == 0
@@ -1262,7 +1269,7 @@ output_section_callback (lang_wild_state
   lang_statement_union_type *before;
 
   /* Exclude sections that match UNIQUE_SECTION_LIST.  */
-  if (unique_section_p (bfd_get_section_name (file->the_bfd, section)))
+  if (unique_section_p (section))
     return;
 
   /* If the wild pattern was marked KEEP, the member sections
Index: ld/ldlang.h
===================================================================
RCS file: /cvs/src/src/ld/ldlang.h,v
retrieving revision 1.36
diff -u -p -r1.36 ldlang.h
--- ld/ldlang.h	18 Mar 2004 12:50:20 -0000	1.36
+++ ld/ldlang.h	30 Apr 2004 13:13:34 -0000
@@ -556,7 +556,7 @@ extern struct bfd_elf_version_deps *lang
 extern void lang_register_vers_node
   (const char *, struct bfd_elf_version_tree *, struct bfd_elf_version_deps *);
 bfd_boolean unique_section_p
-  (const char *);
+  (const asection *);
 extern void lang_add_unique
   (const char *);
 extern const char *lang_get_output_target
Index: ld/emultempl/elf32.em
===================================================================
RCS file: /cvs/src/src/ld/emultempl/elf32.em,v
retrieving revision 1.111
diff -u -p -r1.111 elf32.em
--- ld/emultempl/elf32.em	27 Mar 2004 10:58:35 -0000	1.111
+++ ld/emultempl/elf32.em	30 Apr 2004 13:13:36 -0000
@@ -1142,7 +1142,7 @@ gld${EMULATION_NAME}_place_orphan (lang_
       isdyn = 1;
     }
 
-  if (isdyn || (!config.unique_orphan_sections && !unique_section_p (secname)))
+  if (isdyn || (!config.unique_orphan_sections && !unique_section_p (s)))
     {
       /* Look through the script to see where to place this section.  */
       os = lang_output_section_find (secname);

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]