This is the mail archive of the binutils@sourceware.org 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]

Tidy ld/ldmisc.c


The idea here is to not use elf-bfd.h and coff-bfd.h in generic linker
code.

bfd/
	* targets.c (struct bfd_target): Add _bfd_group_name.
	(BFD_JUMP_TABLE): Likewise.
	* coffgen.c (bfd_coff_group_name): New function.
	* elf.c (bfd_elf_group_name): New function.
	* linker.c (_bfd_nolink_bfd_group_name): New function.
	* section.c (bfd_generic_group_name): New function.
	* elf-bfd.h (bfd_elf_group_name): Declare.
	* libbfd-in.h (_bfd_nolink_bfd_group_name): Declare.
	* libcoff-in.h (bfd_coff_group_name): Declare.
	* aout-target.h (MY_bfd_group_name): Define.
	* aout-tic30.c (MY_bfd_group_name): Define.
	* bfd.c (bfd_group_name): Define.
	* binary.c (binary_bfd_group_name): Define.
	* coff-alpha.c (_bfd_ecoff_bfd_group_name): Define.
	* coff-mips.c (_bfd_ecoff_bfd_group_name): Define.
	* coff-rs6000.c (_bfd_xcoff_bfd_group_name): Define.
	* coffcode.h (coff_bfd_group_name): Define.
	* elfxx-target.h (bfd_elfNN_bfd_group_name): Define.
	* i386msdos.c (msdos_bfd_group_name): Define.
	* ihex.c (ihex_bfd_group_name): Define.
	* mach-o-target.c (bfd_mach_o_bfd_group_name): Define.
	* mmo.c (mmo_bfd_group_name): Define.
	* pef.c (bfd_pef_bfd_group_name): Define.
	* plugin.c (bfd_plugin_bfd_group_name): Define.
	* ppcboot.c (ppcboot_bfd_group_name): Define.
	* som.c (som_bfd_group_name): Define.
	* srec.c (srec_bfd_group_name): Define.
	* tekhex.c (tekhex_bfd_group_name): Define.
	* verilog.c (verilog_bfd_group_name): Define.
	* vms-alpha.c (vms_bfd_group_name, alpha_vms_bfd_group_name): Define.
	* xsym.c (bfd_sym_bfd_group_name): Define.
	* coff64-rs6000.c (rs6000_xcoff64_vec): Init new field.
	(rs6000_xcoff64_aix_vec): Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* libcoff.h: Regenerate.
ld/
	* ldmisc.c: Don't #include elf-bfd.h or coff-bfd.h.
	(vfinfo): Use bfd_group_name.

diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 99a82bb57a..58de28faba 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -502,6 +502,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
 #ifndef MY_bfd_is_group_section
 #define MY_bfd_is_group_section bfd_generic_is_group_section
 #endif
+#ifndef MY_bfd_group_name
+#define MY_bfd_group_name bfd_generic_group_name
+#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 49463181f0..7cc6ba5f6c 100644
--- a/bfd/aout-tic30.c
+++ b/bfd/aout-tic30.c
@@ -991,6 +991,9 @@ tic30_aout_set_arch_mach (bfd *abfd,
 #ifndef MY_bfd_is_group_section
 #define MY_bfd_is_group_section bfd_generic_is_group_section
 #endif
+#ifndef MY_bfd_group_name
+#define MY_bfd_group_name bfd_generic_group_name
+#endif
 #ifndef MY_bfd_discard_group
 #define MY_bfd_discard_group bfd_generic_discard_group
 #endif
diff --git a/bfd/bfd.c b/bfd/bfd.c
index f56a8d342f..f14ec253fb 100644
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -1862,6 +1862,9 @@ DESCRIPTION
 .#define bfd_is_group_section(abfd, sec) \
 .	BFD_SEND (abfd, _bfd_is_group_section, (abfd, sec))
 .
+.#define bfd_group_name(abfd, sec) \
+.	BFD_SEND (abfd, _bfd_group_name, (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 37f5f9f736..eb87d11b6e 100644
--- a/bfd/binary.c
+++ b/bfd/binary.c
@@ -307,6 +307,7 @@ binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define binary_bfd_lookup_section_flags		   bfd_generic_lookup_section_flags
 #define binary_bfd_merge_sections		   bfd_generic_merge_sections
 #define binary_bfd_is_group_section		   bfd_generic_is_group_section
+#define binary_bfd_group_name			   bfd_generic_group_name
 #define binary_bfd_discard_group		   bfd_generic_discard_group
 #define binary_section_already_linked		  _bfd_generic_section_already_linked
 #define binary_bfd_define_common_symbol		   bfd_generic_define_common_symbol
diff --git a/bfd/coff-alpha.c b/bfd/coff-alpha.c
index 726d20bfbb..ee4a3eeded 100644
--- a/bfd/coff-alpha.c
+++ b/bfd/coff-alpha.c
@@ -2390,6 +2390,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
 #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_group_name bfd_generic_group_name
 #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
 #define _bfd_ecoff_section_already_linked \
   _bfd_coff_section_already_linked
diff --git a/bfd/coff-mips.c b/bfd/coff-mips.c
index 3ada9ceb0f..a2dd9e1c4f 100644
--- a/bfd/coff-mips.c
+++ b/bfd/coff-mips.c
@@ -1416,6 +1416,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
 #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_group_name bfd_generic_group_name
 #define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
 #define _bfd_ecoff_section_already_linked \
   _bfd_coff_section_already_linked
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 85e90a0254..4620254aae 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4057,6 +4057,7 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = {
 #define _bfd_xcoff_bfd_lookup_section_flags bfd_generic_lookup_section_flags
 #define _bfd_xcoff_bfd_merge_sections bfd_generic_merge_sections
 #define _bfd_xcoff_bfd_is_group_section bfd_generic_is_group_section
+#define _bfd_xcoff_bfd_group_name bfd_generic_group_name
 #define _bfd_xcoff_bfd_discard_group bfd_generic_discard_group
 #define _bfd_xcoff_section_already_linked _bfd_generic_section_already_linked
 #define _bfd_xcoff_bfd_define_common_symbol _bfd_xcoff_define_common_symbol
diff --git a/bfd/coff64-rs6000.c b/bfd/coff64-rs6000.c
index 6f0e358f4a..b6b189fd2d 100644
--- a/bfd/coff64-rs6000.c
+++ b/bfd/coff64-rs6000.c
@@ -2778,6 +2778,7 @@ const bfd_target rs6000_xcoff64_vec =
     bfd_generic_lookup_section_flags,
     bfd_generic_merge_sections,
     bfd_generic_is_group_section,
+    bfd_generic_group_name,
     bfd_generic_discard_group,
     _bfd_generic_section_already_linked,
     _bfd_xcoff_define_common_symbol,
@@ -3040,6 +3041,7 @@ const bfd_target rs6000_xcoff64_aix_vec =
     bfd_generic_lookup_section_flags,
     bfd_generic_merge_sections,
     bfd_generic_is_group_section,
+    bfd_generic_group_name,
     bfd_generic_discard_group,
     _bfd_generic_section_already_linked,
     _bfd_xcoff_define_common_symbol,
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index c3f13300a4..054e45c960 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5751,6 +5751,10 @@ static bfd_coff_backend_data bigobj_swap_table =
 #define coff_bfd_is_group_section	    bfd_generic_is_group_section
 #endif
 
+#ifndef coff_bfd_group_name
+#define coff_bfd_group_name		    bfd_coff_group_name
+#endif
+
 #ifndef coff_bfd_discard_group
 #define coff_bfd_discard_group		    bfd_generic_discard_group
 #endif
diff --git a/bfd/coffgen.c b/bfd/coffgen.c
index 5d61f39c8c..209b01d5d0 100644
--- a/bfd/coffgen.c
+++ b/bfd/coffgen.c
@@ -3155,3 +3155,14 @@ bfd_coff_gc_sections (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
   /* ... and mark SEC_EXCLUDE for those that go.  */
   return coff_gc_sweep (abfd, info);
 }
+
+/* Return name used to identify a comdat group.  */
+
+const char *
+bfd_coff_group_name (bfd *abfd, const asection *sec)
+{
+  struct coff_comdat_info *ci = bfd_coff_get_comdat_section (abfd, sec);
+  if (ci != NULL)
+    return ci->name;
+  return NULL;
+}
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 521d35debb..4458ff7b2a 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2111,6 +2111,8 @@ extern bfd_boolean _bfd_elf_match_sections_by_type
   (bfd *, const asection *, bfd *, const asection *);
 extern bfd_boolean bfd_elf_is_group_section
   (bfd *, const struct bfd_section *);
+extern const char *bfd_elf_group_name
+  (bfd *, const struct bfd_section *);
 extern bfd_boolean _bfd_elf_section_already_linked
   (bfd *, asection *, struct bfd_link_info *);
 extern void bfd_elf_set_group_contents
diff --git a/bfd/elf.c b/bfd/elf.c
index 5a061c9110..ec4c643d59 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -974,6 +974,14 @@ bfd_elf_is_group_section (bfd *abfd ATTRIBUTE_UNUSED, const asection *sec)
   return elf_next_in_group (sec) != NULL;
 }
 
+const char *
+bfd_elf_group_name (bfd *abfd ATTRIBUTE_UNUSED, const asection *sec)
+{
+  if (elf_sec_group (sec) != NULL)
+    return elf_group_name (sec);
+  return NULL;
+}
+
 static char *
 convert_debug_to_zdebug (bfd *abfd, const char *name)
 {
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index 0b737a4ffa..78a1f6314d 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -192,6 +192,10 @@
 #define bfd_elfNN_bfd_is_group_section bfd_elf_is_group_section
 #endif
 
+#ifndef bfd_elfNN_bfd_group_name
+#define bfd_elfNN_bfd_group_name bfd_elf_group_name
+#endif
+
 #ifndef bfd_elfNN_bfd_discard_group
 #define bfd_elfNN_bfd_discard_group bfd_generic_discard_group
 #endif
diff --git a/bfd/i386msdos.c b/bfd/i386msdos.c
index f70a6f364d..9c4ab4cece 100644
--- a/bfd/i386msdos.c
+++ b/bfd/i386msdos.c
@@ -226,6 +226,7 @@ msdos_set_section_contents (bfd *abfd,
 #define msdos_bfd_lookup_section_flags bfd_generic_lookup_section_flags
 #define msdos_bfd_merge_sections bfd_generic_merge_sections
 #define msdos_bfd_is_group_section bfd_generic_is_group_section
+#define msdos_bfd_group_name bfd_generic_group_name
 #define msdos_bfd_discard_group bfd_generic_discard_group
 #define msdos_section_already_linked \
   _bfd_generic_section_already_linked
diff --git a/bfd/ihex.c b/bfd/ihex.c
index 101e0a7615..09149089be 100644
--- a/bfd/ihex.c
+++ b/bfd/ihex.c
@@ -962,6 +962,7 @@ ihex_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
 #define ihex_bfd_lookup_section_flags		  bfd_generic_lookup_section_flags
 #define ihex_bfd_merge_sections			  bfd_generic_merge_sections
 #define ihex_bfd_is_group_section		  bfd_generic_is_group_section
+#define ihex_bfd_group_name			  bfd_generic_group_name
 #define ihex_bfd_discard_group			  bfd_generic_discard_group
 #define ihex_section_already_linked		  _bfd_generic_section_already_linked
 #define ihex_bfd_define_common_symbol		  bfd_generic_define_common_symbol
diff --git a/bfd/libbfd-in.h b/bfd/libbfd-in.h
index cac4d3b022..f498ffd5e7 100644
--- a/bfd/libbfd-in.h
+++ b/bfd/libbfd-in.h
@@ -523,6 +523,8 @@ extern bfd_boolean _bfd_nolink_bfd_lookup_section_flags
 #define _bfd_nolink_bfd_merge_sections _bfd_bool_bfd_link_false_error
 extern bfd_boolean _bfd_nolink_bfd_is_group_section
   (bfd *, const asection *) ATTRIBUTE_HIDDEN;
+extern const char *_bfd_nolink_bfd_group_name
+  (bfd *, const asection *) ATTRIBUTE_HIDDEN;
 extern bfd_boolean _bfd_nolink_bfd_discard_group
   (bfd *, asection *) ATTRIBUTE_HIDDEN;
 extern struct bfd_link_hash_table *_bfd_nolink_bfd_link_hash_table_create
diff --git a/bfd/libcoff-in.h b/bfd/libcoff-in.h
index c75c9ac595..783d54a88a 100644
--- a/bfd/libcoff-in.h
+++ b/bfd/libcoff-in.h
@@ -577,7 +577,8 @@ extern bfd_boolean _bfd_coff_reloc_link_order
    struct bfd_link_order *);
 extern bfd_boolean bfd_coff_gc_sections
   (bfd *, struct bfd_link_info *);
-
+extern const char *bfd_coff_group_name
+  (bfd *, const asection *);
 
 #define coff_get_section_contents_in_window \
   _bfd_generic_get_section_contents_in_window
diff --git a/bfd/linker.c b/bfd/linker.c
index 1b71fcf8f0..f6eef93259 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -3461,6 +3461,13 @@ _bfd_nolink_bfd_is_group_section (bfd *abfd,
   return _bfd_bool_bfd_false_error (abfd);
 }
 
+const char *
+_bfd_nolink_bfd_group_name (bfd *abfd,
+			    const asection *sec ATTRIBUTE_UNUSED)
+{
+  return _bfd_ptr_bfd_null_error (abfd);
+}
+
 bfd_boolean
 _bfd_nolink_bfd_discard_group (bfd *abfd, asection *sec ATTRIBUTE_UNUSED)
 {
diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c
index e02dd79018..e15e88f353 100644
--- a/bfd/mach-o-target.c
+++ b/bfd/mach-o-target.c
@@ -52,6 +52,7 @@
 #define bfd_mach_o_bfd_lookup_section_flags	      bfd_generic_lookup_section_flags
 #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_group_name		      bfd_generic_group_name
 #define bfd_mach_o_bfd_discard_group		      bfd_generic_discard_group
 #define bfd_mach_o_section_already_linked	      _bfd_generic_section_already_linked
 #define bfd_mach_o_bfd_define_common_symbol	      bfd_generic_define_common_symbol
diff --git a/bfd/mmo.c b/bfd/mmo.c
index bd4303c531..f48f9868fe 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3311,6 +3311,7 @@ mmo_write_object_contents (bfd *abfd)
 #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_group_name bfd_generic_group_name
 #define mmo_bfd_discard_group bfd_generic_discard_group
 #define mmo_section_already_linked \
   _bfd_generic_section_already_linked
diff --git a/bfd/pef.c b/bfd/pef.c
index 8c66ca477d..effa076405 100644
--- a/bfd/pef.c
+++ b/bfd/pef.c
@@ -56,6 +56,7 @@
 #define bfd_pef_bfd_lookup_section_flags	    bfd_generic_lookup_section_flags
 #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_group_name			    bfd_generic_group_name
 #define bfd_pef_bfd_discard_group		    bfd_generic_discard_group
 #define bfd_pef_section_already_linked		    _bfd_generic_section_already_linked
 #define bfd_pef_bfd_define_common_symbol	    bfd_generic_define_common_symbol
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 5f760e9c42..ca26005055 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -102,6 +102,7 @@ dlerror (void)
 #define bfd_plugin_bfd_lookup_section_flags	      bfd_generic_lookup_section_flags
 #define bfd_plugin_bfd_merge_sections		      bfd_generic_merge_sections
 #define bfd_plugin_bfd_is_group_section		      bfd_generic_is_group_section
+#define bfd_plugin_bfd_group_name		      bfd_generic_group_name
 #define bfd_plugin_bfd_discard_group		      bfd_generic_discard_group
 #define bfd_plugin_section_already_linked	      _bfd_generic_section_already_linked
 #define bfd_plugin_bfd_define_common_symbol	      bfd_generic_define_common_symbol
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index 99db8234d1..02132e7801 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -456,6 +456,7 @@ ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg)
 #define ppcboot_bfd_lookup_section_flags bfd_generic_lookup_section_flags
 #define ppcboot_bfd_merge_sections bfd_generic_merge_sections
 #define ppcboot_bfd_is_group_section bfd_generic_is_group_section
+#define ppcboot_bfd_group_name bfd_generic_group_name
 #define ppcboot_bfd_discard_group bfd_generic_discard_group
 #define ppcboot_section_already_linked \
   _bfd_generic_section_already_linked
diff --git a/bfd/section.c b/bfd/section.c
index 64636334ac..74feb73be9 100644
--- a/bfd/section.c
+++ b/bfd/section.c
@@ -1662,6 +1662,24 @@ bfd_generic_is_group_section (bfd *abfd ATTRIBUTE_UNUSED,
   return FALSE;
 }
 
+/*
+FUNCTION
+	bfd_generic_group_name
+
+SYNOPSIS
+	const char *bfd_generic_group_name (bfd *, const asection *sec);
+
+DESCRIPTION
+	Returns group name if @var{sec} is a member of a group.
+*/
+
+const char *
+bfd_generic_group_name (bfd *abfd ATTRIBUTE_UNUSED,
+			const asection *sec ATTRIBUTE_UNUSED)
+{
+  return NULL;
+}
+
 /*
 FUNCTION
 	bfd_generic_discard_group
diff --git a/bfd/som.c b/bfd/som.c
index 0d17b3278a..02a99a3360 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6756,6 +6756,7 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
 #define som_bfd_lookup_section_flags		bfd_generic_lookup_section_flags
 #define som_bfd_merge_sections			bfd_generic_merge_sections
 #define som_bfd_is_group_section		bfd_generic_is_group_section
+#define som_bfd_group_name			bfd_generic_group_name
 #define som_bfd_discard_group			bfd_generic_discard_group
 #define som_section_already_linked		_bfd_generic_section_already_linked
 #define som_bfd_define_common_symbol		bfd_generic_define_common_symbol
diff --git a/bfd/srec.c b/bfd/srec.c
index 77eaecd111..218276837c 100644
--- a/bfd/srec.c
+++ b/bfd/srec.c
@@ -1275,6 +1275,7 @@ srec_print_symbol (bfd *abfd,
 #define srec_bfd_lookup_section_flags		  bfd_generic_lookup_section_flags
 #define srec_bfd_merge_sections			  bfd_generic_merge_sections
 #define srec_bfd_is_group_section		  bfd_generic_is_group_section
+#define srec_bfd_group_name			  bfd_generic_group_name
 #define srec_bfd_discard_group			  bfd_generic_discard_group
 #define srec_section_already_linked		  _bfd_generic_section_already_linked
 #define srec_bfd_define_common_symbol		  bfd_generic_define_common_symbol
diff --git a/bfd/targets.c b/bfd/targets.c
index 6b85c62798..09956994ec 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -462,6 +462,7 @@ BFD_JUMP_TABLE macros.
 .  NAME##_bfd_lookup_section_flags, \
 .  NAME##_bfd_merge_sections, \
 .  NAME##_bfd_is_group_section, \
+.  NAME##_bfd_group_name, \
 .  NAME##_bfd_discard_group, \
 .  NAME##_section_already_linked, \
 .  NAME##_bfd_define_common_symbol, \
@@ -520,6 +521,9 @@ BFD_JUMP_TABLE macros.
 .  {* Is this section a member of a group?  *}
 .  bfd_boolean (*_bfd_is_group_section) (bfd *, const struct bfd_section *);
 .
+.  {* The group name, if section is a member of a group.  *}
+.  const char *(*_bfd_group_name) (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 386e33b24e..fb03629182 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -978,6 +978,7 @@ tekhex_print_symbol (bfd *abfd,
 #define tekhex_bfd_lookup_section_flags		    bfd_generic_lookup_section_flags
 #define tekhex_bfd_merge_sections		    bfd_generic_merge_sections
 #define tekhex_bfd_is_group_section		    bfd_generic_is_group_section
+#define tekhex_bfd_group_name			    bfd_generic_group_name
 #define tekhex_bfd_discard_group		    bfd_generic_discard_group
 #define tekhex_section_already_linked		    _bfd_generic_section_already_linked
 #define tekhex_bfd_define_common_symbol		    bfd_generic_define_common_symbol
diff --git a/bfd/verilog.c b/bfd/verilog.c
index 252e240277..a785e50a00 100644
--- a/bfd/verilog.c
+++ b/bfd/verilog.c
@@ -368,6 +368,7 @@ verilog_mkobject (bfd *abfd)
 #define verilog_bfd_gc_sections			     bfd_generic_gc_sections
 #define verilog_bfd_merge_sections		     bfd_generic_merge_sections
 #define verilog_bfd_is_group_section		     bfd_generic_is_group_section
+#define verilog_bfd_group_name			     bfd_generic_group_name
 #define verilog_bfd_discard_group		     bfd_generic_discard_group
 #define verilog_section_already_linked		     _bfd_generic_section_already_linked
 #define verilog_bfd_link_hash_table_create	     _bfd_generic_link_hash_table_create
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 4e6f9c1c42..69822a2ce6 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -9504,6 +9504,7 @@ bfd_vms_get_data (bfd *abfd)
 #define vms_bfd_copy_link_hash_symbol_type \
   _bfd_generic_copy_link_hash_symbol_type
 #define vms_bfd_is_group_section	  bfd_generic_is_group_section
+#define vms_bfd_group_name		  bfd_generic_group_name
 #define vms_bfd_discard_group		  bfd_generic_discard_group
 #define vms_section_already_linked	  _bfd_generic_section_already_linked
 #define vms_bfd_define_common_symbol	  bfd_generic_define_common_symbol
@@ -9550,6 +9551,7 @@ bfd_vms_get_data (bfd *abfd)
 #define alpha_vms_bfd_lookup_section_flags bfd_generic_lookup_section_flags
 #define alpha_vms_bfd_merge_sections bfd_generic_merge_sections
 #define alpha_vms_bfd_is_group_section bfd_generic_is_group_section
+#define alpha_vms_bfd_group_name bfd_generic_group_name
 #define alpha_vms_bfd_discard_group bfd_generic_discard_group
 #define alpha_vms_section_already_linked \
   _bfd_generic_section_already_linked
diff --git a/bfd/xsym.c b/bfd/xsym.c
index 67d91cb077..cf4a67167a 100644
--- a/bfd/xsym.c
+++ b/bfd/xsym.c
@@ -48,6 +48,7 @@
 #define bfd_sym_bfd_lookup_section_flags	    bfd_generic_lookup_section_flags
 #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_group_name			    bfd_generic_group_name
 #define bfd_sym_bfd_discard_group		    bfd_generic_discard_group
 #define bfd_sym_section_already_linked		    _bfd_generic_section_already_linked
 #define bfd_sym_bfd_define_common_symbol	    bfd_generic_define_common_symbol
diff --git a/ld/ldmisc.c b/ld/ldmisc.c
index f7ab7b5d99..319f247e3b 100644
--- a/ld/ldmisc.c
+++ b/ld/ldmisc.c
@@ -35,8 +35,6 @@
 #include "ldlex.h"
 #include "ldmain.h"
 #include "ldfile.h"
-#include "elf-bfd.h"
-#include "coff-bfd.h"
 
 /*
  %% literal %
@@ -431,26 +429,18 @@ vfinfo (FILE *fp, const char *fmt, va_list ap, bfd_boolean is_warning)
 		  /* section name from a section */
 		  asection *sec;
 		  bfd *abfd;
-		  const char *group = NULL;
-		  struct coff_comdat_info *ci;
 
 		  fmt++;
 		  sec = (asection *) args[arg_no].p;
 		  ++arg_count;
-		  abfd = sec->owner;
 		  fprintf (fp, "%s", sec->name);
-		  if (abfd != NULL
-		      && bfd_get_flavour (abfd) == bfd_target_elf_flavour
-		      && elf_next_in_group (sec) != NULL
-		      && (sec->flags & SEC_GROUP) == 0)
-		    group = elf_group_name (sec);
-		  else if (abfd != NULL
-			   && bfd_get_flavour (abfd) == bfd_target_coff_flavour
-			   && (ci = bfd_coff_get_comdat_section (sec->owner,
-								 sec)) != NULL)
-		    group = ci->name;
-		  if (group != NULL)
-		    fprintf (fp, "[%s]", group);
+		  abfd = sec->owner;
+		  if (abfd != NULL)
+		    {
+		      const char *group = bfd_group_name (abfd, sec);
+		      if (group != NULL)
+			fprintf (fp, "[%s]", group);
+		    }
 		}
 	      else if (*fmt == 'B')
 		{

-- 
Alan Modra
Australia Development Lab, IBM


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