public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [mach-o]: Add page_size field to backend data
@ 2014-04-18  8:48 Tristan Gingold
  0 siblings, 0 replies; only message in thread
From: Tristan Gingold @ 2014-04-18  8:48 UTC (permalink / raw)
  To: binutils@sourceware.org Development

Hi,

this is a preliminary work to support laying out of executables: add a pagesize
field to backend data.

Committed on trunk.

Tristan.

bfd/
	* mach-o.h (bfd_mach_o_backend_data): Add page_size field.
	* mach-o-target.c: Check TARGET_PAGESIZE is defined.
	(TARGET_NAME_BACKEND): Add TARGET_PAGESIZE.
	* mach-o.c (TARGET_PAGESIZE): Define and undefined for
	each targets declared.
	* mach-o-x86-64.c (TARGET_PAGESIZE): Define.
	* mach-o-i386.c (TARGET_PAGESIZE): Define.

diff --git a/bfd/mach-o-i386.c b/bfd/mach-o-i386.c
index 8349c66..6b59ed2 100644
--- a/bfd/mach-o-i386.c
+++ b/bfd/mach-o-i386.c
@@ -397,6 +397,7 @@ const mach_o_segment_name_xlat mach_o_i386_segsec_names_xlat[] =
 #define TARGET_NAME 		mach_o_i386_vec
 #define TARGET_STRING 		"mach-o-i386"
 #define TARGET_ARCHITECTURE	bfd_arch_i386
+#define TARGET_PAGESIZE		4096
 #define TARGET_BIG_ENDIAN 	0
 #define TARGET_ARCHIVE 		0
 #define TARGET_PRIORITY		0
diff --git a/bfd/mach-o-target.c b/bfd/mach-o-target.c
index 65d5118..00bd586 100644
--- a/bfd/mach-o-target.c
+++ b/bfd/mach-o-target.c
@@ -85,6 +85,10 @@
 #error TARGET_ARCHIVE must be defined
 #endif /* TARGET_ARCHIVE */
 
+#ifndef TARGET_PAGESIZE
+#error TARGET_PAGESIZE must be defined
+#endif
+
 #if ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN))
 #error Mach-O fat files must always be big-endian.
 #endif /* ((TARGET_ARCHIVE) && (! TARGET_BIG_ENDIAN)) */
@@ -92,6 +96,7 @@
 static const bfd_mach_o_backend_data TARGET_NAME_BACKEND =
 {
   TARGET_ARCHITECTURE,
+  TARGET_PAGESIZE,
   bfd_mach_o_swap_reloc_in,
   bfd_mach_o_swap_reloc_out,
   bfd_mach_o_print_thread,
diff --git a/bfd/mach-o-x86-64.c b/bfd/mach-o-x86-64.c
index 017a6b8..14a7067 100644
--- a/bfd/mach-o-x86-64.c
+++ b/bfd/mach-o-x86-64.c
@@ -356,6 +356,7 @@ const mach_o_segment_name_xlat mach_o_x86_64_segsec_names_xlat[] =
 #define TARGET_NAME 		mach_o_x86_64_vec
 #define TARGET_STRING 		"mach-o-x86-64"
 #define TARGET_ARCHITECTURE	bfd_arch_i386
+#define TARGET_PAGESIZE		4096
 #define TARGET_BIG_ENDIAN 	0
 #define TARGET_ARCHIVE 		0
 #define TARGET_PRIORITY		0
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index a7bafb5..ab2af7c 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -5084,6 +5084,7 @@ bfd_boolean bfd_mach_o_free_cached_info (bfd *abfd)
 #define TARGET_NAME 		mach_o_be_vec
 #define TARGET_STRING     	"mach-o-be"
 #define TARGET_ARCHITECTURE	bfd_arch_unknown
+#define TARGET_PAGESIZE		1
 #define TARGET_BIG_ENDIAN 	1
 #define TARGET_ARCHIVE 		0
 #define TARGET_PRIORITY		1
@@ -5092,6 +5093,7 @@ bfd_boolean bfd_mach_o_free_cached_info (bfd *abfd)
 #undef TARGET_NAME
 #undef TARGET_STRING
 #undef TARGET_ARCHITECTURE
+#undef TARGET_PAGESIZE
 #undef TARGET_BIG_ENDIAN
 #undef TARGET_ARCHIVE
 #undef TARGET_PRIORITY
@@ -5099,6 +5101,7 @@ bfd_boolean bfd_mach_o_free_cached_info (bfd *abfd)
 #define TARGET_NAME 		mach_o_le_vec
 #define TARGET_STRING 		"mach-o-le"
 #define TARGET_ARCHITECTURE	bfd_arch_unknown
+#define TARGET_PAGESIZE		1
 #define TARGET_BIG_ENDIAN 	0
 #define TARGET_ARCHIVE 		0
 #define TARGET_PRIORITY		1
@@ -5108,6 +5111,7 @@ bfd_boolean bfd_mach_o_free_cached_info (bfd *abfd)
 #undef TARGET_NAME
 #undef TARGET_STRING
 #undef TARGET_ARCHITECTURE
+#undef TARGET_PAGESIZE
 #undef TARGET_BIG_ENDIAN
 #undef TARGET_ARCHIVE
 #undef TARGET_PRIORITY
@@ -5130,6 +5134,7 @@ bfd_boolean bfd_mach_o_free_cached_info (bfd *abfd)
 #define TARGET_NAME 		mach_o_fat_vec
 #define TARGET_STRING 		"mach-o-fat"
 #define TARGET_ARCHITECTURE	bfd_arch_unknown
+#define TARGET_PAGESIZE		1
 #define TARGET_BIG_ENDIAN 	1
 #define TARGET_ARCHIVE 		1
 #define TARGET_PRIORITY		0
@@ -5139,6 +5144,7 @@ bfd_boolean bfd_mach_o_free_cached_info (bfd *abfd)
 #undef TARGET_NAME
 #undef TARGET_STRING
 #undef TARGET_ARCHITECTURE
+#undef TARGET_PAGESIZE
 #undef TARGET_BIG_ENDIAN
 #undef TARGET_ARCHIVE
 #undef TARGET_PRIORITY
diff --git a/bfd/mach-o.h b/bfd/mach-o.h
index 629459b..95827e8 100644
--- a/bfd/mach-o.h
+++ b/bfd/mach-o.h
@@ -719,6 +719,7 @@ bfd_mach_o_section_data_for_bfd_name (bfd *, const char *, const char **);
 typedef struct bfd_mach_o_backend_data
 {
   enum bfd_architecture arch;
+  bfd_vma page_size;
   bfd_boolean (*_bfd_mach_o_swap_reloc_in)(arelent *, bfd_mach_o_reloc_info *);
   bfd_boolean (*_bfd_mach_o_swap_reloc_out)(arelent *, bfd_mach_o_reloc_info *);
   bfd_boolean (*_bfd_mach_o_print_thread)(bfd *, bfd_mach_o_thread_flavour *,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-04-18  8:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-18  8:48 [mach-o]: Add page_size field to backend data Tristan Gingold

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).