summaryrefslogtreecommitdiff
path: root/bfd/mach-o.h
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2011-08-08 10:56:31 +0000
committerTristan Gingold <gingold@adacore.com>2011-08-08 10:56:31 +0000
commit383524a31bed54fa899b9cf10dd253485f1a784d (patch)
tree6583c48e89736b078148b20a3c1861c88dfd61b7 /bfd/mach-o.h
parent1f1fd62acc6e89cd8253cd24cedc92d1dbe36c2e (diff)
downloadgdb-383524a31bed54fa899b9cf10dd253485f1a784d.tar.gz
2011-08-08 Tristan Gingold <gingold@adacore.com>
* mach-o.h (BFD_MACH_O_SEGNAME_SIZE): New macro. (BFD_MACH_O_SECTNAME_SIZE): Ditto. (bfd_mach_o_section): Use them. Add next field. (bfd_mach_o_segment_command): Replace sections array by sect_head and sect_tail. (bfd_mach_o_get_mach_o_section): New macro. (bfd_mach_o_lookup_section): Remove. (bfd_mach_o_new_section_hook): New function. * mach-o.c (bfd_mach_o_normalize_section_name): Use strncmp instead of strcmp. (bfd_mach_o_convert_section_name_to_bfd): Replaces section parameter with segname and sectname parameters. Adjust. (bfd_mach_o_append_section_to_segment): New function. Use a linked list for Mach-O sections. (bfd_mach_o_write_segment_32): Adjust. (bfd_mach_o_write_segment_64): Ditto. (bfd_mach_o_build_commands): Fix comment. Adjust. (bfd_mach_o_flatten_sections): Adjust. (bfd_mach_o_print_section_map): Adjust. (bfd_mach_o_set_section_flags_from_bfd): Ditto. (bfd_mach_o_new_section_hook): New function. (bfd_mach_o_init_section_from_mach_o): Ditto. (bfd_mach_o_read_section_32): Remove section parameter. Return a section instead. (bfd_mach_o_read_section_64): Ditto. (bfd_mach_o_read_section): Ditto. (bfd_mach_o_make_bfd_section): Adjust. (bfd_mach_o_read_segment): Adjust for new profile of bfd_mach_o_read_section. (bfd_mach_o_lookup_section): Remove. * mach-o-target.c (bfd_mach_o_new_section_hook): Remove.
Diffstat (limited to 'bfd/mach-o.h')
-rw-r--r--bfd/mach-o.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/bfd/mach-o.h b/bfd/mach-o.h
index 1da79ffaff1..53d97dab3a6 100644
--- a/bfd/mach-o.h
+++ b/bfd/mach-o.h
@@ -41,11 +41,14 @@ typedef struct bfd_mach_o_header
}
bfd_mach_o_header;
+#define BFD_MACH_O_SEGNAME_SIZE 16
+#define BFD_MACH_O_SECTNAME_SIZE 16
+
typedef struct bfd_mach_o_section
{
/* Fields present in the file. */
- char sectname[16 + 1];
- char segname[16 + 1];
+ char sectname[BFD_MACH_O_SECTNAME_SIZE + 1]; /* Always NUL padded. */
+ char segname[BFD_MACH_O_SEGNAME_SIZE + 1];
bfd_vma addr;
bfd_vma size;
bfd_vma offset;
@@ -59,6 +62,9 @@ typedef struct bfd_mach_o_section
/* Corresponding bfd section. */
asection *bfdsection;
+
+ /* Simply linked list. */
+ struct bfd_mach_o_section *next;
}
bfd_mach_o_section;
@@ -73,7 +79,10 @@ typedef struct bfd_mach_o_segment_command
unsigned long initprot; /* Initial protection. */
unsigned long nsects;
unsigned long flags;
- bfd_mach_o_section *sections;
+
+ /* Linked list of sections. */
+ bfd_mach_o_section *sect_head;
+ bfd_mach_o_section *sect_tail;
}
bfd_mach_o_segment_command;
@@ -525,6 +534,10 @@ bfd_mach_o_backend_data;
#define bfd_mach_o_get_backend_data(abfd) \
((bfd_mach_o_backend_data*)(abfd)->xvec->backend_data)
+/* Get the Mach-O header for section SEC. */
+#define bfd_mach_o_get_mach_o_section(sec) \
+ ((bfd_mach_o_section *)(sec)->used_by_bfd)
+
bfd_boolean bfd_mach_o_valid (bfd *);
int bfd_mach_o_read_dysymtab_symbol (bfd *, bfd_mach_o_dysymtab_command *, bfd_mach_o_symtab_command *, bfd_mach_o_asymbol *, unsigned long);
int bfd_mach_o_scan_start_address (bfd *);
@@ -536,8 +549,8 @@ const bfd_target *bfd_mach_o_archive_p (bfd *);
bfd *bfd_mach_o_openr_next_archived_file (bfd *, bfd *);
bfd_boolean bfd_mach_o_set_arch_mach (bfd *, enum bfd_architecture,
unsigned long);
-int bfd_mach_o_lookup_section (bfd *, asection *, bfd_mach_o_load_command **, bfd_mach_o_section **);
int bfd_mach_o_lookup_command (bfd *, bfd_mach_o_load_command_type, bfd_mach_o_load_command **);
+bfd_boolean bfd_mach_o_new_section_hook (bfd *, asection *);
bfd_boolean bfd_mach_o_write_contents (bfd *);
bfd_boolean bfd_mach_o_bfd_copy_private_symbol_data (bfd *, asymbol *,
bfd *, asymbol *);