Mercurial > hg > CbC > CbC_llvm
comparison include/llvm/BinaryFormat/MachO.h @ 148:63bd29f05246
merged
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 14 Aug 2019 19:46:37 +0900 |
parents | c2174574ed3a |
children |
comparison
equal
deleted
inserted
replaced
146:3fc4d5c3e21e | 148:63bd29f05246 |
---|---|
1 //===-- llvm/BinaryFormat/MachO.h - The MachO file format -------*- C++/-*-===// | 1 //===-- llvm/BinaryFormat/MachO.h - The MachO file format -------*- C++/-*-===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 // | 4 // See https://llvm.org/LICENSE.txt for license information. |
5 // This file is distributed under the University of Illinois Open Source | 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 // License. See LICENSE.TXT for details. | |
7 // | 6 // |
8 //===----------------------------------------------------------------------===// | 7 //===----------------------------------------------------------------------===// |
9 // | 8 // |
10 // This file defines manifest constants for the MachO object file format. | 9 // This file defines manifest constants for the MachO object file format. |
11 // | 10 // |
333 N_NO_DEAD_STRIP = 0x0020u, | 332 N_NO_DEAD_STRIP = 0x0020u, |
334 N_WEAK_REF = 0x0040u, | 333 N_WEAK_REF = 0x0040u, |
335 N_WEAK_DEF = 0x0080u, | 334 N_WEAK_DEF = 0x0080u, |
336 N_SYMBOL_RESOLVER = 0x0100u, | 335 N_SYMBOL_RESOLVER = 0x0100u, |
337 N_ALT_ENTRY = 0x0200u, | 336 N_ALT_ENTRY = 0x0200u, |
337 N_COLD_FUNC = 0x0400u, | |
338 // For undefined symbols coming from libraries, see GET_LIBRARY_ORDINAL() | 338 // For undefined symbols coming from libraries, see GET_LIBRARY_ORDINAL() |
339 // as these are in the top 8 bits. | 339 // as these are in the top 8 bits. |
340 SELF_LIBRARY_ORDINAL = 0x0, | 340 SELF_LIBRARY_ORDINAL = 0x0, |
341 MAX_LIBRARY_ORDINAL = 0xfd, | 341 MAX_LIBRARY_ORDINAL = 0xfd, |
342 DYNAMIC_LOOKUP_ORDINAL = 0xfe, | 342 DYNAMIC_LOOKUP_ORDINAL = 0xfe, |
484 enum PlatformType { | 484 enum PlatformType { |
485 PLATFORM_MACOS = 1, | 485 PLATFORM_MACOS = 1, |
486 PLATFORM_IOS = 2, | 486 PLATFORM_IOS = 2, |
487 PLATFORM_TVOS = 3, | 487 PLATFORM_TVOS = 3, |
488 PLATFORM_WATCHOS = 4, | 488 PLATFORM_WATCHOS = 4, |
489 PLATFORM_BRIDGEOS = 5 | 489 PLATFORM_BRIDGEOS = 5, |
490 PLATFORM_MACCATALYST = 6, | |
491 PLATFORM_IOSSIMULATOR = 7, | |
492 PLATFORM_TVOSSIMULATOR = 8, | |
493 PLATFORM_WATCHOSSIMULATOR = 9 | |
490 }; | 494 }; |
491 | 495 |
492 // Values for tools enum in build_tool_version. | 496 // Values for tools enum in build_tool_version. |
493 enum { TOOL_CLANG = 1, TOOL_SWIFT = 2, TOOL_LD = 3 }; | 497 enum { TOOL_CLANG = 1, TOOL_SWIFT = 2, TOOL_LD = 3 }; |
494 | 498 |
937 }; | 941 }; |
938 | 942 |
939 // Structs from <mach-o/reloc.h> | 943 // Structs from <mach-o/reloc.h> |
940 struct relocation_info { | 944 struct relocation_info { |
941 int32_t r_address; | 945 int32_t r_address; |
946 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN) | |
947 uint32_t r_type : 4, r_extern : 1, r_length : 2, r_pcrel : 1, | |
948 r_symbolnum : 24; | |
949 #else | |
942 uint32_t r_symbolnum : 24, r_pcrel : 1, r_length : 2, r_extern : 1, | 950 uint32_t r_symbolnum : 24, r_pcrel : 1, r_length : 2, r_extern : 1, |
943 r_type : 4; | 951 r_type : 4; |
952 #endif | |
944 }; | 953 }; |
945 | 954 |
946 struct scattered_relocation_info { | 955 struct scattered_relocation_info { |
947 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN) | 956 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN) |
948 uint32_t r_scattered : 1, r_pcrel : 1, r_length : 2, r_type : 4, | 957 uint32_t r_scattered : 1, r_pcrel : 1, r_length : 2, r_type : 4, |
1391 | 1400 |
1392 // Enums from <mach/machine.h> | 1401 // Enums from <mach/machine.h> |
1393 enum : uint32_t { | 1402 enum : uint32_t { |
1394 // Capability bits used in the definition of cpu_type. | 1403 // Capability bits used in the definition of cpu_type. |
1395 CPU_ARCH_MASK = 0xff000000, // Mask for architecture bits | 1404 CPU_ARCH_MASK = 0xff000000, // Mask for architecture bits |
1396 CPU_ARCH_ABI64 = 0x01000000 // 64 bit ABI | 1405 CPU_ARCH_ABI64 = 0x01000000, // 64 bit ABI |
1406 CPU_ARCH_ABI64_32 = 0x02000000, // ILP32 ABI on 64-bit hardware | |
1397 }; | 1407 }; |
1398 | 1408 |
1399 // Constants for the cputype field. | 1409 // Constants for the cputype field. |
1400 enum CPUType { | 1410 enum CPUType { |
1401 CPU_TYPE_ANY = -1, | 1411 CPU_TYPE_ANY = -1, |
1404 CPU_TYPE_X86_64 = CPU_TYPE_X86 | CPU_ARCH_ABI64, | 1414 CPU_TYPE_X86_64 = CPU_TYPE_X86 | CPU_ARCH_ABI64, |
1405 /* CPU_TYPE_MIPS = 8, */ | 1415 /* CPU_TYPE_MIPS = 8, */ |
1406 CPU_TYPE_MC98000 = 10, // Old Motorola PowerPC | 1416 CPU_TYPE_MC98000 = 10, // Old Motorola PowerPC |
1407 CPU_TYPE_ARM = 12, | 1417 CPU_TYPE_ARM = 12, |
1408 CPU_TYPE_ARM64 = CPU_TYPE_ARM | CPU_ARCH_ABI64, | 1418 CPU_TYPE_ARM64 = CPU_TYPE_ARM | CPU_ARCH_ABI64, |
1419 CPU_TYPE_ARM64_32 = CPU_TYPE_ARM | CPU_ARCH_ABI64_32, | |
1409 CPU_TYPE_SPARC = 14, | 1420 CPU_TYPE_SPARC = 14, |
1410 CPU_TYPE_POWERPC = 18, | 1421 CPU_TYPE_POWERPC = 18, |
1411 CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC | CPU_ARCH_ABI64 | 1422 CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC | CPU_ARCH_ABI64 |
1412 }; | 1423 }; |
1413 | 1424 |
1472 CPU_SUBTYPE_ARM_V6M = 14, | 1483 CPU_SUBTYPE_ARM_V6M = 14, |
1473 CPU_SUBTYPE_ARM_V7M = 15, | 1484 CPU_SUBTYPE_ARM_V7M = 15, |
1474 CPU_SUBTYPE_ARM_V7EM = 16 | 1485 CPU_SUBTYPE_ARM_V7EM = 16 |
1475 }; | 1486 }; |
1476 | 1487 |
1477 enum CPUSubTypeARM64 { CPU_SUBTYPE_ARM64_ALL = 0 }; | 1488 enum CPUSubTypeARM64 { |
1489 CPU_SUBTYPE_ARM64_ALL = 0, | |
1490 CPU_SUBTYPE_ARM64E = 2, | |
1491 }; | |
1492 | |
1493 enum CPUSubTypeARM64_32 { CPU_SUBTYPE_ARM64_32_V8 = 1 }; | |
1478 | 1494 |
1479 enum CPUSubTypeSPARC { CPU_SUBTYPE_SPARC_ALL = 0 }; | 1495 enum CPUSubTypeSPARC { CPU_SUBTYPE_SPARC_ALL = 0 }; |
1480 | 1496 |
1481 enum CPUSubTypePowerPC { | 1497 enum CPUSubTypePowerPC { |
1482 CPU_SUBTYPE_POWERPC_ALL = 0, | 1498 CPU_SUBTYPE_POWERPC_ALL = 0, |
1971 sizeof(ppc_thread_state32_t) / sizeof(uint32_t); | 1987 sizeof(ppc_thread_state32_t) / sizeof(uint32_t); |
1972 | 1988 |
1973 // Define a union of all load command structs | 1989 // Define a union of all load command structs |
1974 #define LOAD_COMMAND_STRUCT(LCStruct) LCStruct LCStruct##_data; | 1990 #define LOAD_COMMAND_STRUCT(LCStruct) LCStruct LCStruct##_data; |
1975 | 1991 |
1976 union macho_load_command { | 1992 LLVM_PACKED_START |
1993 union alignas(4) macho_load_command { | |
1977 #include "llvm/BinaryFormat/MachO.def" | 1994 #include "llvm/BinaryFormat/MachO.def" |
1978 }; | 1995 }; |
1996 LLVM_PACKED_END | |
1979 | 1997 |
1980 } // end namespace MachO | 1998 } // end namespace MachO |
1981 } // end namespace llvm | 1999 } // end namespace llvm |
1982 | 2000 |
1983 #endif | 2001 #endif |