[Patch mach-o] correct some section specification nits.

Iain Sandoe developer@sandoe-acoustics.co.uk
Thu Feb 9 14:44:00 GMT 2012


A few nits (although the wrong alignment value for eh-frame does break  
cfi_directives...)

OK?

bfd:

	* mach-o.c (mach_o_section_name_xlat): Correct eh-frame section
	parmaters.
	* mach-o-x86-64.c (text_section_names_xlat): New.
	(mach_o_x86_64_segsec_names_xlat): New.
	(bfd_mach_o_tgt_seg_table): Define to mach_o_x86_64_segsec_names_xlat.
	* mach-o-i386.c (text_section_names_xlat): Correct section parameters.

Index: bfd/mach-o-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o-i386.c,v
retrieving revision 1.10
diff -u -p -r1.10 mach-o-i386.c
--- bfd/mach-o-i386.c	19 Dec 2011 15:42:36 -0000	1.10
+++ bfd/mach-o-i386.c	9 Feb 2012 14:38:58 -0000
@@ -283,11 +283,11 @@ bfd_mach_o_i386_print_thread (bfd *abfd,
  static const mach_o_section_name_xlat text_section_names_xlat[] =
    {
      {	".symbol_stub",			"__symbol_stub",
-	SEC_DATA | SEC_LOAD,		BFD_MACH_O_S_SYMBOL_STUBS,
+	SEC_CODE | SEC_LOAD,		BFD_MACH_O_S_SYMBOL_STUBS,
  	BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS,
  					0},
      {	".picsymbol_stub",		"__picsymbol_stub",
-	SEC_DATA | SEC_LOAD,		BFD_MACH_O_S_SYMBOL_STUBS,
+	SEC_CODE | SEC_LOAD,		BFD_MACH_O_S_SYMBOL_STUBS,
  	BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS,
  					0},
      { NULL, NULL, 0, 0, 0, 0}
@@ -315,7 +315,7 @@ static const mach_o_section_name_xlat da
  static const mach_o_section_name_xlat import_section_names_xlat[] =
    {
      {	".picsymbol_stub3",		"__jump_table",
-	SEC_DATA | SEC_LOAD,		BFD_MACH_O_S_SYMBOL_STUBS,
+	SEC_CODE | SEC_LOAD,		BFD_MACH_O_S_SYMBOL_STUBS,
  	BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS
  	| BFD_MACH_O_S_SELF_MODIFYING_CODE,
  					6},
Index: bfd/mach-o-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o-x86-64.c,v
retrieving revision 1.7
diff -u -p -r1.7 mach-o-x86-64.c
--- bfd/mach-o-x86-64.c	4 Jan 2012 12:59:23 -0000	1.7
+++ bfd/mach-o-x86-64.c	9 Feb 2012 14:38:59 -0000
@@ -326,13 +326,30 @@ bfd_mach_o_section_type_valid_for_x86_64
    return TRUE;
  }

+/* We want to bump the alignment of some sections.  */
+static const mach_o_section_name_xlat text_section_names_xlat[] =
+  {
+    {	".eh_frame",				"__eh_frame",
+	SEC_READONLY | SEC_DATA | SEC_LOAD,	BFD_MACH_O_S_COALESCED,
+	BFD_MACH_O_S_ATTR_LIVE_SUPPORT
+	| BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS
+	| BFD_MACH_O_S_ATTR_NO_TOC,		3},
+    { NULL, NULL, 0, 0, 0, 0}
+  };
+
+const mach_o_segment_name_xlat mach_o_x86_64_segsec_names_xlat[] =
+  {
+    { "__TEXT", text_section_names_xlat },
+    { NULL, NULL }
+  };
+
  #define bfd_mach_o_swap_reloc_in bfd_mach_o_x86_64_swap_reloc_in
  #define bfd_mach_o_swap_reloc_out bfd_mach_o_x86_64_swap_reloc_out

  #define bfd_mach_o_bfd_reloc_type_lookup  
bfd_mach_o_x86_64_bfd_reloc_type_lookup
  #define bfd_mach_o_bfd_reloc_name_lookup  
bfd_mach_o_x86_64_bfd_reloc_name_lookup
  #define bfd_mach_o_print_thread NULL
-#define bfd_mach_o_tgt_seg_table NULL
+#define bfd_mach_o_tgt_seg_table mach_o_x86_64_segsec_names_xlat
  #define bfd_mach_o_section_type_valid_for_tgt  
bfd_mach_o_section_type_valid_for_x86_64

  #define TARGET_NAME 		mach_o_x86_64_vec
Index: bfd/mach-o.c
===================================================================
RCS file: /cvs/src/src/bfd/mach-o.c,v
retrieving revision 1.99
diff -u -p -r1.99 mach-o.c
--- bfd/mach-o.c	2 Feb 2012 11:55:42 -0000	1.99
+++ bfd/mach-o.c	9 Feb 2012 14:39:00 -0000
@@ -121,10 +121,10 @@ static const mach_o_section_name_xlat te
  	SEC_CODE | SEC_LOAD,			BFD_MACH_O_S_REGULAR,
  	BFD_MACH_O_S_ATTR_NONE,			0},
      {	".eh_frame",				"__eh_frame",
-	SEC_READONLY | SEC_LOAD,		BFD_MACH_O_S_COALESCED,
+	SEC_READONLY | SEC_DATA | SEC_LOAD,	BFD_MACH_O_S_COALESCED,
  	BFD_MACH_O_S_ATTR_LIVE_SUPPORT
  	| BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS
-	| BFD_MACH_O_S_ATTR_NO_TOC,		3},
+	| BFD_MACH_O_S_ATTR_NO_TOC,		2},
      { NULL, NULL, 0, 0, 0, 0}
    };




More information about the Binutils mailing list