public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: binutils@sourceware.org
Cc: goldstein.w.n@gmail.com, amodra@gmail.com
Subject: [PATCH v4 1/6] bfd: Don't hard-code BFD_JUMP_TABLE_COPY
Date: Wed,  6 Mar 2024 15:23:56 -0800	[thread overview]
Message-ID: <20240306232401.1408530-2-hjl.tools@gmail.com> (raw)
In-Reply-To: <20240306232401.1408530-1-hjl.tools@gmail.com>

In BFD_JUMP_TABLE_COPY, replace _bfd_generic_init_private_section_data
with NAME##_init_private_section_data so that ELF targets can properly
replace it with _bfd_elf_init_private_section_data.

	* aout-target.h (MY_init_private_section_data): New.
	* coff-rs6000.c (_bfd_xcoff_init_private_section_data): New.
	* coffcode.h (coff_init_private_section_data): New.
	* elfxx-target.h (bfd_elfNN_init_private_section_data): New.
	* libecoff.h (_bfd_ecoff_init_private_section_data): New.
	* mach-o-target.c (bfd_mach_o_init_private_section_data): New.
	* mmo.c (mmo_init_private_section_data): New.
	* plugin.c (bfd_plugin_init_private_section_data): New.
	* ppcboot.c (ppcboot_init_private_section_data): New.
	* som.c (som_init_private_section_data): New.
	* targets.c (BFD_JUMP_TABLE_COPY): Replace
	_bfd_generic_init_private_section_data with
	NAME##_init_private_section_data.
	* vms-alpha.c (vms_init_private_section_data): New.
	* elf-bfd.h (_bfd_generic_init_private_section_data): Removed.
	* bfd-in2.h: Regenerated.
---
 bfd/aout-target.h   | 3 +++
 bfd/bfd-in2.h       | 2 +-
 bfd/coff-rs6000.c   | 2 ++
 bfd/coffcode.h      | 2 ++
 bfd/elf-bfd.h       | 2 --
 bfd/elfxx-target.h  | 2 ++
 bfd/libecoff.h      | 3 +++
 bfd/mach-o-target.c | 1 +
 bfd/mmo.c           | 1 +
 bfd/plugin.c        | 1 +
 bfd/ppcboot.c       | 1 +
 bfd/som.c           | 1 +
 bfd/targets.c       | 2 +-
 bfd/vms-alpha.c     | 1 +
 14 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/bfd/aout-target.h b/bfd/aout-target.h
index 4a05c602435..47fe49fe04a 100644
--- a/bfd/aout-target.h
+++ b/bfd/aout-target.h
@@ -569,6 +569,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
 #define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
 #endif
 
+#define MY_init_private_section_data \
+  _bfd_generic_init_private_section_data
+
 #ifndef MY_bfd_copy_private_symbol_data
 #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
 #endif
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index a335df522d2..79b24a7f6e9 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -7685,7 +7685,7 @@ typedef struct bfd_target
 #define BFD_JUMP_TABLE_COPY(NAME) \
   NAME##_bfd_copy_private_bfd_data, \
   NAME##_bfd_merge_private_bfd_data, \
-  _bfd_generic_init_private_section_data, \
+  NAME##_init_private_section_data, \
   NAME##_bfd_copy_private_section_data, \
   NAME##_bfd_copy_private_symbol_data, \
   NAME##_bfd_copy_private_header_data, \
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 87feb672bf1..7d04739c8a9 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -4471,6 +4471,8 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = {
   _bfd_generic_get_section_contents_in_window
 
 /* For copy private data entry points.  */
+#define _bfd_xcoff_init_private_section_data \
+  _bfd_generic_init_private_section_data
 #define _bfd_xcoff_bfd_copy_private_bfd_data \
   _bfd_xcoff_copy_private_bfd_data
 #define _bfd_xcoff_bfd_merge_private_bfd_data \
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 4170b630b4d..ebf4f513fde 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -5968,6 +5968,8 @@ static const bfd_coff_backend_data bigobj_swap_table =
 #define coff_bfd_copy_private_header_data   _bfd_generic_bfd_copy_private_header_data
 #endif
 
+#define coff_init_private_section_data	    _bfd_generic_init_private_section_data
+
 #ifndef coff_bfd_copy_private_section_data
 #define coff_bfd_copy_private_section_data  _bfd_generic_bfd_copy_private_section_data
 #endif
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 3ed22fa6c52..c5d325435b6 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -2359,8 +2359,6 @@ extern bool _bfd_elf_copy_private_header_data
   (bfd *, bfd *);
 extern bool _bfd_elf_copy_private_symbol_data
   (bfd *, asymbol *, bfd *, asymbol *);
-#define _bfd_generic_init_private_section_data \
-  _bfd_elf_init_private_section_data
 extern bool _bfd_elf_init_private_section_data
   (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
 extern bool _bfd_elf_copy_private_section_data
diff --git a/bfd/elfxx-target.h b/bfd/elfxx-target.h
index a7f2fc6e320..1e6992b5793 100644
--- a/bfd/elfxx-target.h
+++ b/bfd/elfxx-target.h
@@ -230,6 +230,8 @@
   _bfd_elf_copy_private_symbol_data
 #endif
 
+#define bfd_elfNN_init_private_section_data \
+  _bfd_elf_init_private_section_data
 #ifndef bfd_elfNN_bfd_copy_private_section_data
 #define bfd_elfNN_bfd_copy_private_section_data \
   _bfd_elf_copy_private_section_data
diff --git a/bfd/libecoff.h b/bfd/libecoff.h
index 5e6de3ccebf..50a0af7c7a2 100644
--- a/bfd/libecoff.h
+++ b/bfd/libecoff.h
@@ -250,6 +250,9 @@ extern bool _bfd_ecoff_get_section_contents
 #define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section
 #define _bfd_ecoff_bfd_link_check_relocs  _bfd_generic_link_check_relocs
 
+#define _bfd_ecoff_init_private_section_data \
+  _bfd_generic_init_private_section_data
+
 extern bool _bfd_ecoff_bfd_copy_private_bfd_data
   (bfd *, bfd *);
 #define _bfd_ecoff_bfd_copy_private_section_data \
diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c
index 01666d3aa5c..6edb09f4347 100644
--- a/bfd/mach-o-target.c
+++ b/bfd/mach-o-target.c
@@ -75,6 +75,7 @@
 #define bfd_mach_o_write_armap			  _bfd_noarchive_write_armap
 #define bfd_mach_o_get_elt_at_index		  _bfd_noarchive_get_elt_at_index
 #define bfd_mach_o_update_armap_timestamp	  _bfd_noarchive_update_armap_timestamp
+#define bfd_mach_o_init_private_section_data	  _bfd_generic_init_private_section_data
 
 #define TARGET_NAME_BACKEND XCONCAT2(TARGET_NAME,_backend)
 
diff --git a/bfd/mmo.c b/bfd/mmo.c
index 485a1c3ca33..528de1d10e0 100644
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3360,6 +3360,7 @@ mmo_write_object_contents (bfd *abfd)
 #define mmo_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
 #define mmo_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
 #define mmo_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
+#define mmo_init_private_section_data _bfd_generic_init_private_section_data
 
 const bfd_target mmix_mmo_vec =
 {
diff --git a/bfd/plugin.c b/bfd/plugin.c
index 784a3c1fd9d..8226c264733 100644
--- a/bfd/plugin.c
+++ b/bfd/plugin.c
@@ -74,6 +74,7 @@ dlerror (void)
 #define bfd_plugin_new_section_hook		      _bfd_generic_new_section_hook
 #define bfd_plugin_get_section_contents		      _bfd_generic_get_section_contents
 #define bfd_plugin_get_section_contents_in_window     _bfd_generic_get_section_contents_in_window
+#define bfd_plugin_init_private_section_data	      _bfd_generic_init_private_section_data
 #define bfd_plugin_bfd_copy_private_header_data	      _bfd_generic_bfd_copy_private_header_data
 #define bfd_plugin_bfd_merge_private_bfd_data	      _bfd_generic_bfd_merge_private_bfd_data
 #define bfd_plugin_bfd_copy_private_header_data	      _bfd_generic_bfd_copy_private_header_data
diff --git a/bfd/ppcboot.c b/bfd/ppcboot.c
index 461050c668b..2e947779885 100644
--- a/bfd/ppcboot.c
+++ b/bfd/ppcboot.c
@@ -476,6 +476,7 @@ ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg)
 
 #define ppcboot_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
 #define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
+#define ppcboot_init_private_section_data _bfd_generic_init_private_section_data
 #define ppcboot_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
 #define ppcboot_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
 #define ppcboot_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
diff --git a/bfd/som.c b/bfd/som.c
index 17c9d713585..dc641e7857b 100644
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -6782,6 +6782,7 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
 #define som_bfd_link_hide_symbol		_bfd_generic_link_hide_symbol
 #define som_bfd_define_start_stop		bfd_generic_define_start_stop
 #define som_bfd_merge_private_bfd_data		_bfd_generic_bfd_merge_private_bfd_data
+#define som_init_private_section_data		_bfd_generic_init_private_section_data
 #define som_bfd_copy_private_header_data	_bfd_generic_bfd_copy_private_header_data
 #define som_bfd_set_private_flags		_bfd_generic_bfd_set_private_flags
 #define som_find_inliner_info			_bfd_nosymbols_find_inliner_info
diff --git a/bfd/targets.c b/bfd/targets.c
index 3addf2fe373..f94992d031d 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -285,7 +285,7 @@ BFD_JUMP_TABLE macros.
 .#define BFD_JUMP_TABLE_COPY(NAME) \
 .  NAME##_bfd_copy_private_bfd_data, \
 .  NAME##_bfd_merge_private_bfd_data, \
-.  _bfd_generic_init_private_section_data, \
+.  NAME##_init_private_section_data, \
 .  NAME##_bfd_copy_private_section_data, \
 .  NAME##_bfd_copy_private_symbol_data, \
 .  NAME##_bfd_copy_private_header_data, \
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index f5ecdcb3e0c..ace5a24c631 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -10129,6 +10129,7 @@ bfd_vms_get_data (bfd *abfd)
 
 #define vms_bfd_copy_private_bfd_data	  _bfd_generic_bfd_copy_private_bfd_data
 #define vms_bfd_merge_private_bfd_data	  _bfd_generic_bfd_merge_private_bfd_data
+#define vms_init_private_section_data	  _bfd_generic_init_private_section_data
 #define vms_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
 #define vms_bfd_copy_private_symbol_data  _bfd_generic_bfd_copy_private_symbol_data
 #define vms_bfd_copy_private_header_data  _bfd_generic_bfd_copy_private_header_data
-- 
2.44.0


  reply	other threads:[~2024-03-06 23:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 23:23 [PATCH v4 0/6] elf: Use mmap to map in section contents H.J. Lu
2024-03-06 23:23 ` H.J. Lu [this message]
2024-03-07 22:46   ` [PATCH v4 1/6] bfd: Don't hard-code BFD_JUMP_TABLE_COPY Alan Modra
2024-03-06 23:23 ` [PATCH v4 2/6] bfd: Change the --with-mmap default to true H.J. Lu
2024-03-07 22:46   ` Alan Modra
2024-03-06 23:23 ` [PATCH v4 3/6] elf: Use mmap to map in read-only sections H.J. Lu
2024-03-08  0:40   ` Alan Modra
2024-03-08 15:25     ` H.J. Lu
2024-03-06 23:23 ` [PATCH v4 4/6] elf: Add _bfd_elf_mmap_section and _bfd_elf_munmap_section_contents H.J. Lu
2024-03-08  0:41   ` Alan Modra
2024-03-08 15:28     ` H.J. Lu
2024-03-08 17:03       ` H.J. Lu
2024-03-08  0:50   ` Sam James
2024-03-08  3:33     ` Alan Modra
2024-03-06 23:24 ` [PATCH v4 5/6] elf: Use mmap to map in symbol and relocation tables H.J. Lu
2024-03-08  0:42   ` Alan Modra
2024-03-08 15:36     ` H.J. Lu
2024-03-09 16:34       ` H.J. Lu
2024-03-06 23:24 ` [PATCH v4 6/6] elf: Don't cache symbol nor relocation tables with mmap H.J. Lu
2024-03-08  0:43   ` Alan Modra
2024-03-08  0:48   ` Sam James
2024-03-08 15:31     ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240306232401.1408530-2-hjl.tools@gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=goldstein.w.n@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).