summaryrefslogtreecommitdiff
path: root/bfd/mach-o-i386.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2011-12-14 10:30:06 +0000
committerTristan Gingold <gingold@adacore.com>2011-12-14 10:30:06 +0000
commit426a42def94d4edf831e4aeaca4e01c26c6400cf (patch)
tree6c4a2a594f3e06a1a20b0d3d1c537f1d411baff2 /bfd/mach-o-i386.c
parentb816b3f502945e4fca98b889cfd0923cf1c11cf0 (diff)
downloadbinutils-redhat-426a42def94d4edf831e4aeaca4e01c26c6400cf.tar.gz
bfd/
2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o-i386.c (text_section_names_xlat): New table. (data_section_names_xlat): Likewise. (import_section_names_xlat): Likewise. (mach_o_i386_segsec_names_xlat): Likewise. (bfd_mach_o_tgt_seg_table): Use new tables. * mach-o-x86-64.c (bfd_mach_o_tgt_seg_table): Set NULL. * mach-o.c (mach_o_section_name_xlat, mach_o_segment_name_xlat): Move to mach-o.h as typedefs. (text_section_names_xlat): Update for current GCC usage. (data_section_names_xlat): Likewise. (dwarf_section_names_xlat): Likewise. (objc_section_names_xlat): New table. (segsec_names_xlat): Add objc table. (bfd_mach_o_normalize_section_name): Replace with... (bfd_mach_o_section_data_for_mach_sect): New. (bfd_mach_o_section_data_for_bfd_name): New. (bfd_mach_o_section_data_for_bfd_name): Update to use additional data. (bfd_mach_o_convert_section_name_to_mach_o): Likewise. (bfd_mach_o_bfd_copy_private_section_data): Implement. (bfd_mach_o_write_symtab): Write a zero-length string as the first entry for compatibility with system tools. (bfd_mach_o_build_commands): Update section alignment info. (bfd_mach_o_new_section_hook): Use translation table data to define default section flags, type, attributes and alignment, when available. (bfd_mach_o_init_section_from_mach_o): Add TODO comment. (bfd_mach_o_section_type_name): Add 'symbol_stubs'. (bfd_mach_o_section_attribute_name): Add 'self_modifying_code'. (bfd_mach_o_get_section_type_from_name): Change "not-found" return value. (bfd_mach_o_tgt_seg_table): Set default NULL. * mach-o.h (bfd_mach_o_segment_command): Use define for name length. (bfd_mach_o_backend_data): Move until after contents are defined. (bfd_mach_o_normalize_section_name): Remove. (bfd_mach_o_convert_section_name_to_bfd): Declare. (mach_o_section_name_xlat): Declare. (mach_o_segment_name_xlat): Declare. (bfd_mach_o_section_data_for_mach_sect): Declare. (bfd_mach_o_section_data_for_bfd_name): Declare. include/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * mach-o/loader.h (bfd_mach_o_section_type): define BFD_MACH_O_S_ATTR_NONE to 0. gas/ 2011-12-14 Iain Sandoe <iains@gcc.gnu.org> * config/obj-macho.c: Add some more top-level comments. (collect_16char_name): New. (obj_mach_o_section): Amend to allow syntax compatible with existing system tools. Use section translation data when available. (obj_mach_o_segT_from_bfd_name): New. (known_sections): Update. (obj_mach_o_known_section): Use obj_mach_o_segT_from_bfd_name. (objc_sections): New. (obj_mach_o_objc_section): New. (debug_sections): New. (obj_mach_o_debug_section): New. (tgt_sections): New. (obj_mach_o_opt_tgt_section): New. (obj_mach_o_base_section): New. (obj_mach_o_common_parse): Update to create BSS on demand and to handle lcomm optional alignment param. (obj_mach_o_comm): Update parameter name. (obj_mach_o_placeholder): New. (mach_o_pseudo_table): Update for GCC section directives. * config/obj-macho.h (_OBJ_MACH_O_H): New. (USE_ALIGN_PTWO): Define. (S_SET_ALIGN) Define.
Diffstat (limited to 'bfd/mach-o-i386.c')
-rw-r--r--bfd/mach-o-i386.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/bfd/mach-o-i386.c b/bfd/mach-o-i386.c
index 11915604b3..c5e38843d3 100644
--- a/bfd/mach-o-i386.c
+++ b/bfd/mach-o-i386.c
@@ -280,10 +280,65 @@ bfd_mach_o_i386_print_thread (bfd *abfd, bfd_mach_o_thread_flavour *thread,
return FALSE;
}
+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,
+ BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS,
+ 0},
+ { ".picsymbol_stub", "__picsymbol_stub",
+ SEC_DATA | SEC_LOAD, BFD_MACH_O_S_SYMBOL_STUBS,
+ BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS,
+ 0},
+ { NULL, NULL, 0, 0, 0, 0}
+ };
+
+static const mach_o_section_name_xlat data_section_names_xlat[] =
+ {
+ /* The first two are recognized by i386, but not emitted for x86 by
+ modern GCC. */
+ { ".non_lazy_symbol_pointer", "__nl_symbol_ptr",
+ SEC_DATA | SEC_LOAD, BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS,
+ BFD_MACH_O_S_ATTR_NONE, 2},
+ { ".lazy_symbol_pointer", "__la_symbol_ptr",
+ SEC_DATA | SEC_LOAD, BFD_MACH_O_S_LAZY_SYMBOL_POINTERS,
+ BFD_MACH_O_S_ATTR_NONE, 2},
+ { ".lazy_symbol_pointer2", "__la_sym_ptr2",
+ SEC_DATA | SEC_LOAD, BFD_MACH_O_S_LAZY_SYMBOL_POINTERS,
+ BFD_MACH_O_S_ATTR_NONE, 2},
+ { ".lazy_symbol_pointer3", "__la_sym_ptr3",
+ SEC_DATA | SEC_LOAD, BFD_MACH_O_S_LAZY_SYMBOL_POINTERS,
+ BFD_MACH_O_S_ATTR_NONE, 2},
+ { NULL, NULL, 0, 0, 0, 0}
+ };
+
+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,
+ BFD_MACH_O_S_ATTR_PURE_INSTRUCTIONS
+ | BFD_MACH_O_S_SELF_MODIFYING_CODE,
+ 6},
+ { ".non_lazy_symbol_pointer_x86", "__pointers",
+ SEC_DATA | SEC_LOAD, BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS,
+ BFD_MACH_O_S_ATTR_NONE, 2},
+ { NULL, NULL, 0, 0, 0, 0}
+ };
+
+const mach_o_segment_name_xlat mach_o_i386_segsec_names_xlat[] =
+ {
+ { "__TEXT", text_section_names_xlat },
+ { "__DATA", data_section_names_xlat },
+ { "__IMPORT", import_section_names_xlat },
+ { NULL, NULL }
+ };
+
#define bfd_mach_o_swap_reloc_in bfd_mach_o_i386_swap_reloc_in
#define bfd_mach_o_swap_reloc_out bfd_mach_o_i386_swap_reloc_out
#define bfd_mach_o_print_thread bfd_mach_o_i386_print_thread
+#define bfd_mach_o_tgt_seg_table mach_o_i386_segsec_names_xlat
+
#define bfd_mach_o_bfd_reloc_type_lookup bfd_mach_o_i386_bfd_reloc_type_lookup
#define bfd_mach_o_bfd_reloc_name_lookup bfd_mach_o_i386_bfd_reloc_name_lookup