From 46d1c23bceb2b8923af0d00a7f536a88524d6a74 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Mon, 8 Aug 2011 08:59:33 +0000 Subject: bfd/ 2011-08-08 Tristan Gingold * mach-o.h: Move size macros to external.h Move reloc macros to reloc.h and x86-64.h. * mach-o-i386.c: Includes mach-o/reloc.h * mach-o-x86-64.c: Ditto and includes mach-o/x86-64.h * mach-o.c: Add includes. (bfd_mach_o_write_header): Use structure from external.h to convert. (bfd_mach_o_write_thread): Ditto. (bfd_mach_o_write_relocs): Ditto. (bfd_mach_o_write_section_32): Ditto. (bfd_mach_o_write_section_64): Ditto. (bfd_mach_o_write_segment_32): Ditto. (bfd_mach_o_write_segment_64): Ditto. (bfd_mach_o_write_symtab): Ditto. (bfd_mach_o_write_contents): Ditto. (bfd_mach_o_read_header): Ditto. (bfd_mach_o_read_section_32): Ditto. (bfd_mach_o_read_section_64): Ditto. (bfd_mach_o_read_symtab_symbol): Ditto. (bfd_mach_o_read_dylinker): Ditto. (bfd_mach_o_read_dylib): Ditto. (bfd_mach_o_read_dysymtab): Ditto. (bfd_mach_o_read_symtab): Ditto. (bfd_mach_o_read_linkedit): Ditto. (bfd_mach_o_read_str): Ditto. (bfd_mach_o_read_dyld_info): Ditto. (bfd_mach_o_read_segment): Ditto. (bfd_mach_o_read_command): Ditto. (bfd_mach_o_archive_p): Ditto. (bfd_mach_o_canonicalize_one_reloc): Ditto. Change the BUF parameter. (bfd_mach_o_canonicalize_relocs): Adjust to call the above function. (bfd_mach_o_read_dysymtab_symbol): Rename BUF variable. (bfd_mach_o_read_uuid): Remove useless cast. Use a macro instead of an hard-coded value. include/mach-o 2011-08-08 Tristan Gingold * loader.h: Reorder declarations. * x86-64.h: New file. * external.h: New file. * reloc.h: New file. --- bfd/mach-o.h | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) (limited to 'bfd/mach-o.h') diff --git a/bfd/mach-o.h b/bfd/mach-o.h index 183076b..de9640a 100644 --- a/bfd/mach-o.h +++ b/bfd/mach-o.h @@ -41,9 +41,6 @@ typedef struct bfd_mach_o_header } bfd_mach_o_header; -#define BFD_MACH_O_HEADER_SIZE 28 -#define BFD_MACH_O_HEADER_64_SIZE 32 - typedef struct bfd_mach_o_section { /* Fields present in the file. */ @@ -64,8 +61,6 @@ typedef struct bfd_mach_o_section asection *bfdsection; } bfd_mach_o_section; -#define BFD_MACH_O_SECTION_SIZE 68 -#define BFD_MACH_O_SECTION_64_SIZE 80 typedef struct bfd_mach_o_segment_command { @@ -81,55 +76,12 @@ typedef struct bfd_mach_o_segment_command bfd_mach_o_section *sections; } bfd_mach_o_segment_command; -#define BFD_MACH_O_LC_SEGMENT_SIZE 56 -#define BFD_MACH_O_LC_SEGMENT_64_SIZE 72 /* Protection flags. */ #define BFD_MACH_O_PROT_READ 0x01 #define BFD_MACH_O_PROT_WRITE 0x02 #define BFD_MACH_O_PROT_EXECUTE 0x04 -/* Generic relocation types (used by i386). */ -#define BFD_MACH_O_GENERIC_RELOC_VANILLA 0 -#define BFD_MACH_O_GENERIC_RELOC_PAIR 1 -#define BFD_MACH_O_GENERIC_RELOC_SECTDIFF 2 -#define BFD_MACH_O_GENERIC_RELOC_PB_LA_PTR 3 -#define BFD_MACH_O_GENERIC_RELOC_LOCAL_SECTDIFF 4 - -/* X86-64 relocations. */ -#define BFD_MACH_O_X86_64_RELOC_UNSIGNED 0 /* Absolute addresses. */ -#define BFD_MACH_O_X86_64_RELOC_SIGNED 1 /* 32-bit disp. */ -#define BFD_MACH_O_X86_64_RELOC_BRANCH 2 /* 32-bit pcrel disp. */ -#define BFD_MACH_O_X86_64_RELOC_GOT_LOAD 3 /* Movq load of a GOT entry. */ -#define BFD_MACH_O_X86_64_RELOC_GOT 4 /* GOT reference. */ -#define BFD_MACH_O_X86_64_RELOC_SUBTRACTOR 5 /* Symbol difference. */ -#define BFD_MACH_O_X86_64_RELOC_SIGNED_1 6 /* 32-bit signed disp -1. */ -#define BFD_MACH_O_X86_64_RELOC_SIGNED_2 7 /* 32-bit signed disp -2. */ -#define BFD_MACH_O_X86_64_RELOC_SIGNED_4 8 /* 32-bit signed disp -4. */ - -/* Size of a relocation entry. */ -#define BFD_MACH_O_RELENT_SIZE 8 - -/* Fields for a normal (non-scattered) entry. */ -#define BFD_MACH_O_R_PCREL 0x01000000 -#define BFD_MACH_O_GET_R_LENGTH(s) (((s) >> 25) & 0x3) -#define BFD_MACH_O_R_EXTERN 0x08000000 -#define BFD_MACH_O_GET_R_TYPE(s) (((s) >> 28) & 0x0f) -#define BFD_MACH_O_GET_R_SYMBOLNUM(s) ((s) & 0x00ffffff) -#define BFD_MACH_O_SET_R_LENGTH(l) (((l) & 0x3) << 25) -#define BFD_MACH_O_SET_R_TYPE(t) (((t) & 0xf) << 28) -#define BFD_MACH_O_SET_R_SYMBOLNUM(s) ((s) & 0x00ffffff) - -/* Fields for a scattered entry. */ -#define BFD_MACH_O_SR_SCATTERED 0x80000000 -#define BFD_MACH_O_SR_PCREL 0x40000000 -#define BFD_MACH_O_GET_SR_LENGTH(s) (((s) >> 28) & 0x3) -#define BFD_MACH_O_GET_SR_TYPE(s) (((s) >> 24) & 0x0f) -#define BFD_MACH_O_GET_SR_ADDRESS(s) ((s) & 0x00ffffff) -#define BFD_MACH_O_SET_SR_LENGTH(l) (((l) & 0x3) << 28) -#define BFD_MACH_O_SET_SR_TYPE(t) (((t) & 0xf) << 24) -#define BFD_MACH_O_SET_SR_ADDRESS(s) ((s) & 0x00ffffff) - /* Expanded internal representation of a relocation entry. */ typedef struct bfd_mach_o_reloc_info { @@ -154,8 +106,6 @@ typedef struct bfd_mach_o_asymbol unsigned short n_desc; } bfd_mach_o_asymbol; -#define BFD_MACH_O_NLIST_SIZE 12 -#define BFD_MACH_O_NLIST_64_SIZE 16 typedef struct bfd_mach_o_symtab_command { @@ -262,8 +212,6 @@ typedef struct bfd_mach_o_dylib_module bfd_vma objc_module_info_addr; } bfd_mach_o_dylib_module; -#define BFD_MACH_O_DYLIB_MODULE_SIZE 52 -#define BFD_MACH_O_DYLIB_MODULE_64_SIZE 56 typedef struct bfd_mach_o_dylib_table_of_content { @@ -274,7 +222,6 @@ typedef struct bfd_mach_o_dylib_table_of_content unsigned long module_index; } bfd_mach_o_dylib_table_of_content; -#define BFD_MACH_O_TABLE_OF_CONTENT_SIZE 8 typedef struct bfd_mach_o_dylib_reference { -- cgit v1.1