diff options
author | Tristan Gingold <gingold@adacore.com> | 2015-11-17 14:56:04 +0100 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2015-11-17 15:03:25 +0100 |
commit | c25b1ab690ddeeba239a044c8d0086867de30f93 (patch) | |
tree | e69f1c17eed848e5786068a8fdbdf318dd3a85dc /include | |
parent | 0c801b966379f7826fdd793b26ae879c2edf78d1 (diff) | |
download | gdb-c25b1ab690ddeeba239a044c8d0086867de30f93.zip gdb-c25b1ab690ddeeba239a044c8d0086867de30f93.tar.gz gdb-c25b1ab690ddeeba239a044c8d0086867de30f93.tar.bz2 |
Mach-O: add new defines and struct for darwin 14.5
include/mach-o/
* arm64.h: New file.
* unwind.h: Add arm64 encodings.
* loader.h (bfd_mach_o_cpu_subtype): Add arm64 literals.
(BFD_MACH_O_LC_ENCRYPTION_INFO_64, BFD_MACH_O_LC_LINKER_OPTIONS)
(BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT)
(BFD_MACH_O_LC_VERSION_MIN_WATCHOS): Define.
* external.h (mach_o_encryption_info_64_command_external):
(mach_o_linker_option_command_external)
(mach_o_dyld_cache_header_external)
(mach_o_dyld_cache_mapping_info_external)
(mach_o_dyld_cache_image_info_external): New types.
Diffstat (limited to 'include')
-rw-r--r-- | include/mach-o/ChangeLog | 15 | ||||
-rw-r--r-- | include/mach-o/arm64.h | 50 | ||||
-rw-r--r-- | include/mach-o/external.h | 54 | ||||
-rw-r--r-- | include/mach-o/loader.h | 12 | ||||
-rw-r--r-- | include/mach-o/unwind.h | 29 |
5 files changed, 158 insertions, 2 deletions
diff --git a/include/mach-o/ChangeLog b/include/mach-o/ChangeLog index 8df85c5..b33a069 100644 --- a/include/mach-o/ChangeLog +++ b/include/mach-o/ChangeLog @@ -1,3 +1,18 @@ +2015-11-17 Tristan Gingold <gingold@adacore.com> + + * arm64.h: New file. + * arm.h: New file. + * unwind.h: Add arm64 encodings. + * loader.h (bfd_mach_o_cpu_subtype): Add arm64 literals. + (BFD_MACH_O_LC_ENCRYPTION_INFO_64, BFD_MACH_O_LC_LINKER_OPTIONS) + (BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT) + (BFD_MACH_O_LC_VERSION_MIN_WATCHOS): Define. + * external.h (mach_o_encryption_info_64_command_external): + (mach_o_linker_option_command_external) + (mach_o_dyld_cache_header_external) + (mach_o_dyld_cache_mapping_info_external) + (mach_o_dyld_cache_image_info_external): New types. + 2015-01-01 Alan Modra <amodra@gmail.com> Update year range in copyright notice of all files. diff --git a/include/mach-o/arm64.h b/include/mach-o/arm64.h new file mode 100644 index 0000000..d9ceada --- /dev/null +++ b/include/mach-o/arm64.h @@ -0,0 +1,50 @@ +/* Mach-O arm declarations for BFD. + Copyright (C) 2015 Free Software Foundation, Inc. + + This file is part of BFD, the Binary File Descriptor library. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ + +#ifndef _MACH_O_ARM64_H +#define _MACH_O_ARM64_H + +/* ARM64 relocations. */ + +/* Relocations for addresses in data. */ +#define BFD_MACH_O_ARM64_RELOC_UNSIGNED 0 +#define BFD_MACH_O_ARM64_RELOC_SUBTRACTOR 1 + +/* Relocation for a call. */ +#define BFD_MACH_O_ARM64_RELOC_BRANCH26 2 + +/* Relocations for local data. */ +#define BFD_MACH_O_ARM64_RELOC_PAGE21 3 +#define BFD_MACH_O_ARM64_RELOC_PAGEOFF12 4 + +/* Relocations for global data. */ +#define BFD_MACH_O_ARM64_RELOC_GOT_LOAD_PAGE21 5 +#define BFD_MACH_O_ARM64_RELOC_GOT_LOAD_PAGEOFF12 6 + +/* Relocation for personality routine. */ +#define BFD_MACH_O_ARM64_RELOC_POINTER_TO_GOT 7 + +/* Relocations for thread local data. */ +#define BFD_MACH_O_ARM64_RELOC_TLVP_LOAD_PAGE21 8 +#define BFD_MACH_O_ARM64_RELOC_TLVP_LOAD_PAGEOFF12 9 + +#define BFD_MACH_O_ARM64_RELOC_ADDEND 10 + +#endif /* _MACH_O_ARM64_H */ diff --git a/include/mach-o/external.h b/include/mach-o/external.h index 34393d2..99ca89d 100644 --- a/include/mach-o/external.h +++ b/include/mach-o/external.h @@ -318,6 +318,14 @@ struct mach_o_encryption_info_command_external unsigned char cryptid[4]; /* Encryption method. */ }; +struct mach_o_encryption_info_64_command_external +{ + unsigned char cryptoff[4]; /* File offset of the encrypted area. */ + unsigned char cryptsize[4]; /* Size of the encrypted area. */ + unsigned char cryptid[4]; /* Encryption method. */ + unsigned char pad[4]; /* Pad to make struct size a multiple of 8. */ +}; + struct mach_o_fvmlib_command_external { unsigned char name[4]; /* Offset of the name. */ @@ -347,6 +355,12 @@ struct mach_o_data_in_code_entry_external unsigned char kind[2]; /* Kind. See BFD_MACH_O_DICE_ values. */ }; +struct mach_o_linker_option_command_external +{ + unsigned char count[4]; /* Number of strings. */ + /* COUNT null terminated UTF-8 strings, with 0 at the end for padding. */ +}; + struct mach_o_fat_header_external { unsigned char magic[4]; @@ -362,4 +376,44 @@ struct mach_o_fat_arch_external unsigned char align[4]; /* Power of 2. */ }; +struct mach_o_dyld_cache_header_external +{ + unsigned char magic[16]; + + unsigned char mapping_offset[4]; + unsigned char mapping_count[4]; + unsigned char images_offset[4]; + unsigned char images_count[4]; + + unsigned char dyld_base_address[8]; + + unsigned char code_signature_offset[8]; + unsigned char code_signature_size[8]; + + unsigned char slide_info_offset[8]; + unsigned char slide_info_size[8]; + + unsigned char local_symbols_offset[8]; + unsigned char local_symbols_size[8]; +}; + +struct mach_o_dyld_cache_mapping_info_external +{ + unsigned char address[8]; + unsigned char size[8]; + unsigned char file_offset[8]; + unsigned char max_prot[4]; + unsigned char init_prot[4]; +}; + +struct mach_o_dyld_cache_image_info_external +{ + unsigned char address[8]; + unsigned char mtime[8]; + unsigned char inode[8]; + unsigned char path_file_offset[4]; + unsigned char pad[4]; +}; + + #endif /* _MACH_O_EXTERNAL_H */ diff --git a/include/mach-o/loader.h b/include/mach-o/loader.h index cd25baa..6838c39 100644 --- a/include/mach-o/loader.h +++ b/include/mach-o/loader.h @@ -75,7 +75,11 @@ typedef enum bfd_mach_o_cpu_subtype BFD_MACH_O_CPU_SUBTYPE_ARM_V6 = 6, BFD_MACH_O_CPU_SUBTYPE_ARM_V5TEJ = 7, BFD_MACH_O_CPU_SUBTYPE_ARM_XSCALE = 8, - BFD_MACH_O_CPU_SUBTYPE_ARM_V7 = 9 + BFD_MACH_O_CPU_SUBTYPE_ARM_V7 = 9, + + /* arm64. */ + BFD_MACH_O_CPU_SUBTYPE_ARM64_ALL = 0, + BFD_MACH_O_CPU_SUBTYPE_ARM64_V8 = 1 } bfd_mach_o_cpu_subtype; @@ -176,7 +180,11 @@ typedef enum bfd_mach_o_load_command_type BFD_MACH_O_LC_MAIN = 0x28, /* Entry point. */ BFD_MACH_O_LC_DATA_IN_CODE = 0x29, /* Table of non-instructions. */ BFD_MACH_O_LC_SOURCE_VERSION = 0x2a, /* Source version. */ - BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS = 0x2b /* DRs from dylibs. */ + BFD_MACH_O_LC_DYLIB_CODE_SIGN_DRS = 0x2b, /* DRs from dylibs. */ + BFD_MACH_O_LC_ENCRYPTION_INFO_64 = 0x2c, /* Encrypted 64 bit seg info. */ + BFD_MACH_O_LC_LINKER_OPTIONS = 0x2d, /* Linker options. */ + BFD_MACH_O_LC_LINKER_OPTIMIZATION_HINT = 0x2e, /* Optimization hints. */ + BFD_MACH_O_LC_VERSION_MIN_WATCHOS = 0x30 /* Minimal WatchOS version. */ } bfd_mach_o_load_command_type; diff --git a/include/mach-o/unwind.h b/include/mach-o/unwind.h index 1addb97..32a9389 100644 --- a/include/mach-o/unwind.h +++ b/include/mach-o/unwind.h @@ -103,6 +103,35 @@ #define MACH_O_UNWIND_X86_REG_ESI 5 #define MACH_O_UNWIND_X86_REG_EBP 6 +/* Encodings for arm64. */ + +#define MACH_O_UNWIND_ARM64_MODE_MASK 0x0f000000 + +/* Leaf function: FP/LR are *not* saved, none or some non-volatile registers + are saved, stack is allocated. The size of the frame (register saved and + memory) is encoded in STACK_SIZE in 16 byte units. */ +#define MACH_O_UNWIND_ARM64_MODE_FRAMELESS 0x02000000 + +#define MACH_O_UNWIND_ARM64_MODE_DWARF 0x03000000 + +/* Standard frame: FP/LR are pushed, SP is copied to FP, then non-volatile + registers are saved. */ +#define MACH_O_UNWIND_ARM64_MODE_FRAME 0x04000000 + +/* Registers (for FRAME). */ +#define MACH_O_UNWIND_ARM64_FRAME_X19_X20_PAIR 0x00000001 +#define MACH_O_UNWIND_ARM64_FRAME_X21_X22_PAIR 0x00000002 +#define MACH_O_UNWIND_ARM64_FRAME_X23_X24_PAIR 0x00000004 +#define MACH_O_UNWIND_ARM64_FRAME_X25_X26_PAIR 0x00000008 +#define MACH_O_UNWIND_ARM64_FRAME_X27_X28_PAIR 0x00000010 +#define MACH_O_UNWIND_ARM64_FRAME_D8_D9_PAIR 0x00000100 +#define MACH_O_UNWIND_ARM64_FRAME_D10_D11_PAIR 0x00000200 +#define MACH_O_UNWIND_ARM64_FRAME_D12_D13_PAIR 0x00000400 +#define MACH_O_UNWIND_ARM64_FRAME_D14_D15_PAIR 0x00000800 + +#define MACH_O_UNWIND_ARM64_FRAMELESS_STACK_SIZE_MASK 0x00fff000 +#define MACH_O_UNWIND_ARM64_DWARF_SECTION_OFFSET 0x00ffffff + /* Entry in object file (in __LD,__compact_unwind section). */ struct mach_o_compact_unwind_32 |