summaryrefslogtreecommitdiff
path: root/bfd/mach-o.h
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
commite3cfd1c952860576081c344fdcfdedb081ae0b53 (patch)
tree03505ba6100943ee98e15f3cd964392d062bc7b1 /bfd/mach-o.h
parentbffec3c19b8b26fa3f0468c72857961131e4c677 (diff)
downloadgdb-e3cfd1c952860576081c344fdcfdedb081ae0b53.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.h')
-rw-r--r--bfd/mach-o.h52
1 files changed, 39 insertions, 13 deletions
diff --git a/bfd/mach-o.h b/bfd/mach-o.h
index 686bb90dece..0c6f4fd01cb 100644
--- a/bfd/mach-o.h
+++ b/bfd/mach-o.h
@@ -1,5 +1,5 @@
/* Mach-O support for BFD.
- Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009
+ Copyright 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2009, 2011
Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -70,7 +70,7 @@ bfd_mach_o_section;
typedef struct bfd_mach_o_segment_command
{
- char segname[16 + 1];
+ char segname[BFD_MACH_O_SEGNAME_SIZE + 1];
bfd_vma vmaddr;
bfd_vma vmsize;
bfd_vma fileoff;
@@ -530,15 +530,6 @@ typedef struct bfd_mach_o_xlat_name
bfd_mach_o_xlat_name;
/* Target specific routines. */
-typedef struct bfd_mach_o_backend_data
-{
- enum bfd_architecture arch;
- 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 *,
- void *, char *);
-}
-bfd_mach_o_backend_data;
#define bfd_mach_o_get_data(abfd) ((abfd)->tdata.mach_o_data)
#define bfd_mach_o_get_backend_data(abfd) \
@@ -591,8 +582,9 @@ unsigned int bfd_mach_o_version (bfd *);
unsigned int bfd_mach_o_get_section_type_from_name (const char *);
unsigned int bfd_mach_o_get_section_attribute_from_name (const char *);
-void bfd_mach_o_normalize_section_name (const char *, const char *,
- const char **, flagword *);
+
+void bfd_mach_o_convert_section_name_to_bfd (bfd *, const char *, const char *,
+ const char **, flagword *);
bfd_boolean bfd_mach_o_find_nearest_line (bfd *, asection *, asymbol **,
bfd_vma, const char **,
const char **, unsigned int *);
@@ -608,4 +600,38 @@ extern const bfd_mach_o_xlat_name bfd_mach_o_section_type_name[];
extern const bfd_target mach_o_fat_vec;
+/* Interfaces between BFD names and Mach-O names. */
+
+typedef struct mach_o_section_name_xlat
+{
+ const char *bfd_name;
+ const char *mach_o_name;
+ flagword bfd_flags;
+ unsigned int macho_sectype;
+ unsigned int macho_secattr;
+ unsigned int sectalign;
+} mach_o_section_name_xlat;
+
+typedef struct mach_o_segment_name_xlat
+{
+ const char *segname;
+ const mach_o_section_name_xlat *sections;
+} mach_o_segment_name_xlat;
+
+const mach_o_section_name_xlat *
+bfd_mach_o_section_data_for_mach_sect (bfd *, const char *, const char *);
+const mach_o_section_name_xlat *
+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_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 *,
+ void *, char *);
+ const mach_o_segment_name_xlat *segsec_names_xlat;
+}
+bfd_mach_o_backend_data;
+
#endif /* _BFD_MACH_O_H_ */