[llvm] r304864 - Move Object format code to lib/BinaryFormat.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 6 20:49:04 PDT 2017
Author: zturner
Date: Tue Jun 6 22:48:56 2017
New Revision: 304864
URL: http://llvm.org/viewvc/llvm-project?rev=304864&view=rev
Log:
Move Object format code to lib/BinaryFormat.
This creates a new library called BinaryFormat that has all of
the headers from llvm/Support containing structure and layout
definitions for various types of binary formats like dwarf, coff,
elf, etc as well as the code for identifying a file from its
magic.
Differential Revision: https://reviews.llvm.org/D33843
Added:
llvm/trunk/include/llvm/BinaryFormat/
llvm/trunk/include/llvm/BinaryFormat/COFF.h
llvm/trunk/include/llvm/BinaryFormat/Dwarf.def
llvm/trunk/include/llvm/BinaryFormat/Dwarf.h
llvm/trunk/include/llvm/BinaryFormat/ELF.h
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARM.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AVR.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/BPF.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Hexagon.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Lanai.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Mips.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/RISCV.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Sparc.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/SystemZ.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/WebAssembly.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/i386.def
llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/x86_64.def
llvm/trunk/include/llvm/BinaryFormat/MachO.def
llvm/trunk/include/llvm/BinaryFormat/MachO.h
llvm/trunk/include/llvm/BinaryFormat/Magic.h
llvm/trunk/include/llvm/BinaryFormat/Wasm.h
llvm/trunk/include/llvm/BinaryFormat/WasmRelocs/
llvm/trunk/include/llvm/BinaryFormat/WasmRelocs/WebAssembly.def
llvm/trunk/lib/BinaryFormat/
llvm/trunk/lib/BinaryFormat/CMakeLists.txt
llvm/trunk/lib/BinaryFormat/Dwarf.cpp
llvm/trunk/lib/BinaryFormat/LLVMBuild.txt
llvm/trunk/lib/BinaryFormat/Magic.cpp
llvm/trunk/unittests/BinaryFormat/
llvm/trunk/unittests/BinaryFormat/CMakeLists.txt
llvm/trunk/unittests/BinaryFormat/DwarfTest.cpp
llvm/trunk/unittests/BinaryFormat/TestFileMagic.cpp
Removed:
llvm/trunk/include/llvm/Support/COFF.h
llvm/trunk/include/llvm/Support/Dwarf.def
llvm/trunk/include/llvm/Support/Dwarf.h
llvm/trunk/include/llvm/Support/ELF.h
llvm/trunk/include/llvm/Support/ELFRelocs/
llvm/trunk/include/llvm/Support/MachO.def
llvm/trunk/include/llvm/Support/MachO.h
llvm/trunk/include/llvm/Support/Wasm.h
llvm/trunk/include/llvm/Support/WasmRelocs/
llvm/trunk/lib/Support/Dwarf.cpp
llvm/trunk/unittests/Support/DwarfTest.cpp
Modified:
llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp
llvm/trunk/include/llvm/CodeGen/DIE.h
llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h
llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h
llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
llvm/trunk/include/llvm/LinkAllIR.h
llvm/trunk/include/llvm/MC/MCContext.h
llvm/trunk/include/llvm/MC/MCELFObjectWriter.h
llvm/trunk/include/llvm/MC/MCMachObjectWriter.h
llvm/trunk/include/llvm/MC/MCSectionMachO.h
llvm/trunk/include/llvm/MC/MCSymbolWasm.h
llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h
llvm/trunk/include/llvm/Object/COFF.h
llvm/trunk/include/llvm/Object/ELF.h
llvm/trunk/include/llvm/Object/ELFObjectFile.h
llvm/trunk/include/llvm/Object/ELFTypes.h
llvm/trunk/include/llvm/Object/MachO.h
llvm/trunk/include/llvm/Object/MachOUniversal.h
llvm/trunk/include/llvm/Object/ObjectFile.h
llvm/trunk/include/llvm/Object/RelocVisitor.h
llvm/trunk/include/llvm/Object/SymbolicFile.h
llvm/trunk/include/llvm/Object/Wasm.h
llvm/trunk/include/llvm/Object/WindowsResource.h
llvm/trunk/include/llvm/ObjectYAML/COFFYAML.h
llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h
llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h
llvm/trunk/include/llvm/ObjectYAML/MachOYAML.h
llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h
llvm/trunk/include/llvm/Support/FileSystem.h
llvm/trunk/lib/AsmParser/LLParser.cpp
llvm/trunk/lib/CMakeLists.txt
llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp
llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
llvm/trunk/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldELFMips.cpp
llvm/trunk/lib/IR/AsmWriter.cpp
llvm/trunk/lib/IR/DIBuilder.cpp
llvm/trunk/lib/IR/LLVMBuild.txt
llvm/trunk/lib/IR/LLVMContextImpl.h
llvm/trunk/lib/IR/Verifier.cpp
llvm/trunk/lib/LLVMBuild.txt
llvm/trunk/lib/MC/ELFObjectWriter.cpp
llvm/trunk/lib/MC/MCAsmInfo.cpp
llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
llvm/trunk/lib/MC/MCAsmInfoELF.cpp
llvm/trunk/lib/MC/MCCodeView.cpp
llvm/trunk/lib/MC/MCContext.cpp
llvm/trunk/lib/MC/MCDwarf.cpp
llvm/trunk/lib/MC/MCELFStreamer.cpp
llvm/trunk/lib/MC/MCObjectFileInfo.cpp
llvm/trunk/lib/MC/MCParser/AsmParser.cpp
llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp
llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
llvm/trunk/lib/MC/MCSectionCOFF.cpp
llvm/trunk/lib/MC/MCSectionELF.cpp
llvm/trunk/lib/MC/MCStreamer.cpp
llvm/trunk/lib/MC/MCSymbolELF.cpp
llvm/trunk/lib/MC/MCWinEH.cpp
llvm/trunk/lib/MC/MachObjectWriter.cpp
llvm/trunk/lib/MC/StringTableBuilder.cpp
llvm/trunk/lib/MC/WasmObjectWriter.cpp
llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
llvm/trunk/lib/MC/WinCOFFStreamer.cpp
llvm/trunk/lib/Object/ArchiveWriter.cpp
llvm/trunk/lib/Object/Binary.cpp
llvm/trunk/lib/Object/COFFObjectFile.cpp
llvm/trunk/lib/Object/Decompressor.cpp
llvm/trunk/lib/Object/ELF.cpp
llvm/trunk/lib/Object/ELFObjectFile.cpp
llvm/trunk/lib/Object/IRObjectFile.cpp
llvm/trunk/lib/Object/LLVMBuild.txt
llvm/trunk/lib/Object/MachOObjectFile.cpp
llvm/trunk/lib/Object/ObjectFile.cpp
llvm/trunk/lib/Object/SymbolicFile.cpp
llvm/trunk/lib/Object/WasmObjectFile.cpp
llvm/trunk/lib/Object/WindowsResource.cpp
llvm/trunk/lib/ObjectYAML/DWARFVisitor.h
llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
llvm/trunk/lib/ObjectYAML/MachOYAML.cpp
llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
llvm/trunk/lib/Support/CMakeLists.txt
llvm/trunk/lib/Support/Path.cpp
llvm/trunk/lib/Target/AArch64/AArch64TargetObjectFile.cpp
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
llvm/trunk/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
llvm/trunk/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp
llvm/trunk/lib/Target/AVR/AVRSubtarget.cpp
llvm/trunk/lib/Target/AVR/AVRTargetObjectFile.cpp
llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp
llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp
llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp
llvm/trunk/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp
llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp
llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
llvm/trunk/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.h
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp
llvm/trunk/lib/ToolDrivers/llvm-lib/LibDriver.cpp
llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h
llvm/trunk/tools/dsymutil/DwarfLinker.cpp
llvm/trunk/tools/llvm-nm/llvm-nm.cpp
llvm/trunk/tools/llvm-objdump/MachODump.cpp
llvm/trunk/tools/llvm-readobj/CMakeLists.txt
llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
llvm/trunk/tools/llvm-readobj/COFFImportDumper.cpp
llvm/trunk/tools/llvm-readobj/LLVMBuild.txt
llvm/trunk/tools/llvm-xray/xray-extract.cc
llvm/trunk/tools/obj2yaml/macho2yaml.cpp
llvm/trunk/tools/yaml2obj/yaml2elf.cpp
llvm/trunk/tools/yaml2obj/yaml2macho.cpp
llvm/trunk/unittests/CMakeLists.txt
llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
llvm/trunk/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
llvm/trunk/unittests/MC/DwarfLineTables.cpp
llvm/trunk/unittests/Support/CMakeLists.txt
llvm/trunk/unittests/Support/Path.cpp
Modified: llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp (original)
+++ llvm/trunk/examples/ExceptionDemo/ExceptionDemo.cpp Tue Jun 6 22:48:56 2017
@@ -49,7 +49,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ADT/STLExtras.h"
-#include "llvm/IR/Verifier.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/ExecutionEngine/MCJIT.h"
#include "llvm/ExecutionEngine/SectionMemoryManager.h"
#include "llvm/IR/DataLayout.h"
@@ -59,7 +59,7 @@
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/Module.h"
-#include "llvm/Support/Dwarf.h"
+#include "llvm/IR/Verifier.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Target/TargetOptions.h"
#include "llvm/Transforms/Scalar.h"
Added: llvm/trunk/include/llvm/BinaryFormat/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/COFF.h?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/COFF.h (added)
+++ llvm/trunk/include/llvm/BinaryFormat/COFF.h Tue Jun 6 22:48:56 2017
@@ -0,0 +1,713 @@
+//===-- llvm/BinaryFormat/COFF.h --------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains an definitions used in Windows COFF Files.
+//
+// Structures and enums defined within this file where created using
+// information from Microsoft's publicly available PE/COFF format document:
+//
+// Microsoft Portable Executable and Common Object File Format Specification
+// Revision 8.1 - February 15, 2008
+//
+// As of 5/2/2010, hosted by Microsoft at:
+// http://www.microsoft.com/whdc/system/platform/firmware/pecoff.mspx
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_BINARYFORMAT_COFF_H
+#define LLVM_BINARYFORMAT_COFF_H
+
+#include "llvm/Support/DataTypes.h"
+#include <cassert>
+#include <cstring>
+
+namespace llvm {
+namespace COFF {
+
+// The maximum number of sections that a COFF object can have (inclusive).
+const int32_t MaxNumberOfSections16 = 65279;
+
+// The PE signature bytes that follows the DOS stub header.
+static const char PEMagic[] = {'P', 'E', '\0', '\0'};
+
+static const char BigObjMagic[] = {
+ '\xc7', '\xa1', '\xba', '\xd1', '\xee', '\xba', '\xa9', '\x4b',
+ '\xaf', '\x20', '\xfa', '\xf6', '\x6a', '\xa4', '\xdc', '\xb8',
+};
+
+static const char ClGlObjMagic[] = {
+ '\x38', '\xfe', '\xb3', '\x0c', '\xa5', '\xd9', '\xab', '\x4d',
+ '\xac', '\x9b', '\xd6', '\xb6', '\x22', '\x26', '\x53', '\xc2',
+};
+
+// Sizes in bytes of various things in the COFF format.
+enum {
+ Header16Size = 20,
+ Header32Size = 56,
+ NameSize = 8,
+ Symbol16Size = 18,
+ Symbol32Size = 20,
+ SectionSize = 40,
+ RelocationSize = 10
+};
+
+struct header {
+ uint16_t Machine;
+ int32_t NumberOfSections;
+ uint32_t TimeDateStamp;
+ uint32_t PointerToSymbolTable;
+ uint32_t NumberOfSymbols;
+ uint16_t SizeOfOptionalHeader;
+ uint16_t Characteristics;
+};
+
+struct BigObjHeader {
+ enum : uint16_t { MinBigObjectVersion = 2 };
+
+ uint16_t Sig1; ///< Must be IMAGE_FILE_MACHINE_UNKNOWN (0).
+ uint16_t Sig2; ///< Must be 0xFFFF.
+ uint16_t Version;
+ uint16_t Machine;
+ uint32_t TimeDateStamp;
+ uint8_t UUID[16];
+ uint32_t unused1;
+ uint32_t unused2;
+ uint32_t unused3;
+ uint32_t unused4;
+ uint32_t NumberOfSections;
+ uint32_t PointerToSymbolTable;
+ uint32_t NumberOfSymbols;
+};
+
+enum MachineTypes {
+ MT_Invalid = 0xffff,
+
+ IMAGE_FILE_MACHINE_UNKNOWN = 0x0,
+ IMAGE_FILE_MACHINE_AM33 = 0x13,
+ IMAGE_FILE_MACHINE_AMD64 = 0x8664,
+ IMAGE_FILE_MACHINE_ARM = 0x1C0,
+ IMAGE_FILE_MACHINE_ARMNT = 0x1C4,
+ IMAGE_FILE_MACHINE_ARM64 = 0xAA64,
+ IMAGE_FILE_MACHINE_EBC = 0xEBC,
+ IMAGE_FILE_MACHINE_I386 = 0x14C,
+ IMAGE_FILE_MACHINE_IA64 = 0x200,
+ IMAGE_FILE_MACHINE_M32R = 0x9041,
+ IMAGE_FILE_MACHINE_MIPS16 = 0x266,
+ IMAGE_FILE_MACHINE_MIPSFPU = 0x366,
+ IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466,
+ IMAGE_FILE_MACHINE_POWERPC = 0x1F0,
+ IMAGE_FILE_MACHINE_POWERPCFP = 0x1F1,
+ IMAGE_FILE_MACHINE_R4000 = 0x166,
+ IMAGE_FILE_MACHINE_SH3 = 0x1A2,
+ IMAGE_FILE_MACHINE_SH3DSP = 0x1A3,
+ IMAGE_FILE_MACHINE_SH4 = 0x1A6,
+ IMAGE_FILE_MACHINE_SH5 = 0x1A8,
+ IMAGE_FILE_MACHINE_THUMB = 0x1C2,
+ IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
+};
+
+enum Characteristics {
+ C_Invalid = 0,
+
+ /// The file does not contain base relocations and must be loaded at its
+ /// preferred base. If this cannot be done, the loader will error.
+ IMAGE_FILE_RELOCS_STRIPPED = 0x0001,
+ /// The file is valid and can be run.
+ IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002,
+ /// COFF line numbers have been stripped. This is deprecated and should be
+ /// 0.
+ IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004,
+ /// COFF symbol table entries for local symbols have been removed. This is
+ /// deprecated and should be 0.
+ IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008,
+ /// Aggressively trim working set. This is deprecated and must be 0.
+ IMAGE_FILE_AGGRESSIVE_WS_TRIM = 0x0010,
+ /// Image can handle > 2GiB addresses.
+ IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020,
+ /// Little endian: the LSB precedes the MSB in memory. This is deprecated
+ /// and should be 0.
+ IMAGE_FILE_BYTES_REVERSED_LO = 0x0080,
+ /// Machine is based on a 32bit word architecture.
+ IMAGE_FILE_32BIT_MACHINE = 0x0100,
+ /// Debugging info has been removed.
+ IMAGE_FILE_DEBUG_STRIPPED = 0x0200,
+ /// If the image is on removable media, fully load it and copy it to swap.
+ IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400,
+ /// If the image is on network media, fully load it and copy it to swap.
+ IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800,
+ /// The image file is a system file, not a user program.
+ IMAGE_FILE_SYSTEM = 0x1000,
+ /// The image file is a DLL.
+ IMAGE_FILE_DLL = 0x2000,
+ /// This file should only be run on a uniprocessor machine.
+ IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000,
+ /// Big endian: the MSB precedes the LSB in memory. This is deprecated
+ /// and should be 0.
+ IMAGE_FILE_BYTES_REVERSED_HI = 0x8000
+};
+
+enum ResourceTypeID {
+ RID_Cursor = 1,
+ RID_Bitmap = 2,
+ RID_Icon = 3,
+ RID_Menu = 4,
+ RID_Dialog = 5,
+ RID_String = 6,
+ RID_FontDir = 7,
+ RID_Font = 8,
+ RID_Accelerator = 9,
+ RID_RCData = 10,
+ RID_MessageTable = 11,
+ RID_Group_Cursor = 12,
+ RID_Group_Icon = 14,
+ RID_Version = 16,
+ RID_DLGInclude = 17,
+ RID_PlugPlay = 19,
+ RID_VXD = 20,
+ RID_AniCursor = 21,
+ RID_AniIcon = 22,
+ RID_HTML = 23,
+ RID_Manifest = 24,
+};
+
+struct symbol {
+ char Name[NameSize];
+ uint32_t Value;
+ int32_t SectionNumber;
+ uint16_t Type;
+ uint8_t StorageClass;
+ uint8_t NumberOfAuxSymbols;
+};
+
+enum SymbolSectionNumber : int32_t {
+ IMAGE_SYM_DEBUG = -2,
+ IMAGE_SYM_ABSOLUTE = -1,
+ IMAGE_SYM_UNDEFINED = 0
+};
+
+/// Storage class tells where and what the symbol represents
+enum SymbolStorageClass {
+ SSC_Invalid = 0xff,
+
+ IMAGE_SYM_CLASS_END_OF_FUNCTION = -1, ///< Physical end of function
+ IMAGE_SYM_CLASS_NULL = 0, ///< No symbol
+ IMAGE_SYM_CLASS_AUTOMATIC = 1, ///< Stack variable
+ IMAGE_SYM_CLASS_EXTERNAL = 2, ///< External symbol
+ IMAGE_SYM_CLASS_STATIC = 3, ///< Static
+ IMAGE_SYM_CLASS_REGISTER = 4, ///< Register variable
+ IMAGE_SYM_CLASS_EXTERNAL_DEF = 5, ///< External definition
+ IMAGE_SYM_CLASS_LABEL = 6, ///< Label
+ IMAGE_SYM_CLASS_UNDEFINED_LABEL = 7, ///< Undefined label
+ IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = 8, ///< Member of structure
+ IMAGE_SYM_CLASS_ARGUMENT = 9, ///< Function argument
+ IMAGE_SYM_CLASS_STRUCT_TAG = 10, ///< Structure tag
+ IMAGE_SYM_CLASS_MEMBER_OF_UNION = 11, ///< Member of union
+ IMAGE_SYM_CLASS_UNION_TAG = 12, ///< Union tag
+ IMAGE_SYM_CLASS_TYPE_DEFINITION = 13, ///< Type definition
+ IMAGE_SYM_CLASS_UNDEFINED_STATIC = 14, ///< Undefined static
+ IMAGE_SYM_CLASS_ENUM_TAG = 15, ///< Enumeration tag
+ IMAGE_SYM_CLASS_MEMBER_OF_ENUM = 16, ///< Member of enumeration
+ IMAGE_SYM_CLASS_REGISTER_PARAM = 17, ///< Register parameter
+ IMAGE_SYM_CLASS_BIT_FIELD = 18, ///< Bit field
+ /// ".bb" or ".eb" - beginning or end of block
+ IMAGE_SYM_CLASS_BLOCK = 100,
+ /// ".bf" or ".ef" - beginning or end of function
+ IMAGE_SYM_CLASS_FUNCTION = 101,
+ IMAGE_SYM_CLASS_END_OF_STRUCT = 102, ///< End of structure
+ IMAGE_SYM_CLASS_FILE = 103, ///< File name
+ /// Line number, reformatted as symbol
+ IMAGE_SYM_CLASS_SECTION = 104,
+ IMAGE_SYM_CLASS_WEAK_EXTERNAL = 105, ///< Duplicate tag
+ /// External symbol in dmert public lib
+ IMAGE_SYM_CLASS_CLR_TOKEN = 107
+};
+
+enum SymbolBaseType {
+ IMAGE_SYM_TYPE_NULL = 0, ///< No type information or unknown base type.
+ IMAGE_SYM_TYPE_VOID = 1, ///< Used with void pointers and functions.
+ IMAGE_SYM_TYPE_CHAR = 2, ///< A character (signed byte).
+ IMAGE_SYM_TYPE_SHORT = 3, ///< A 2-byte signed integer.
+ IMAGE_SYM_TYPE_INT = 4, ///< A natural integer type on the target.
+ IMAGE_SYM_TYPE_LONG = 5, ///< A 4-byte signed integer.
+ IMAGE_SYM_TYPE_FLOAT = 6, ///< A 4-byte floating-point number.
+ IMAGE_SYM_TYPE_DOUBLE = 7, ///< An 8-byte floating-point number.
+ IMAGE_SYM_TYPE_STRUCT = 8, ///< A structure.
+ IMAGE_SYM_TYPE_UNION = 9, ///< An union.
+ IMAGE_SYM_TYPE_ENUM = 10, ///< An enumerated type.
+ IMAGE_SYM_TYPE_MOE = 11, ///< A member of enumeration (a specific value).
+ IMAGE_SYM_TYPE_BYTE = 12, ///< A byte; unsigned 1-byte integer.
+ IMAGE_SYM_TYPE_WORD = 13, ///< A word; unsigned 2-byte integer.
+ IMAGE_SYM_TYPE_UINT = 14, ///< An unsigned integer of natural size.
+ IMAGE_SYM_TYPE_DWORD = 15 ///< An unsigned 4-byte integer.
+};
+
+enum SymbolComplexType {
+ IMAGE_SYM_DTYPE_NULL = 0, ///< No complex type; simple scalar variable.
+ IMAGE_SYM_DTYPE_POINTER = 1, ///< A pointer to base type.
+ IMAGE_SYM_DTYPE_FUNCTION = 2, ///< A function that returns a base type.
+ IMAGE_SYM_DTYPE_ARRAY = 3, ///< An array of base type.
+
+ /// Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
+ SCT_COMPLEX_TYPE_SHIFT = 4
+};
+
+enum AuxSymbolType { IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1 };
+
+struct section {
+ char Name[NameSize];
+ uint32_t VirtualSize;
+ uint32_t VirtualAddress;
+ uint32_t SizeOfRawData;
+ uint32_t PointerToRawData;
+ uint32_t PointerToRelocations;
+ uint32_t PointerToLineNumbers;
+ uint16_t NumberOfRelocations;
+ uint16_t NumberOfLineNumbers;
+ uint32_t Characteristics;
+};
+
+enum SectionCharacteristics : uint32_t {
+ SC_Invalid = 0xffffffff,
+
+ IMAGE_SCN_TYPE_NOLOAD = 0x00000002,
+ IMAGE_SCN_TYPE_NO_PAD = 0x00000008,
+ IMAGE_SCN_CNT_CODE = 0x00000020,
+ IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040,
+ IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080,
+ IMAGE_SCN_LNK_OTHER = 0x00000100,
+ IMAGE_SCN_LNK_INFO = 0x00000200,
+ IMAGE_SCN_LNK_REMOVE = 0x00000800,
+ IMAGE_SCN_LNK_COMDAT = 0x00001000,
+ IMAGE_SCN_GPREL = 0x00008000,
+ IMAGE_SCN_MEM_PURGEABLE = 0x00020000,
+ IMAGE_SCN_MEM_16BIT = 0x00020000,
+ IMAGE_SCN_MEM_LOCKED = 0x00040000,
+ IMAGE_SCN_MEM_PRELOAD = 0x00080000,
+ IMAGE_SCN_ALIGN_1BYTES = 0x00100000,
+ IMAGE_SCN_ALIGN_2BYTES = 0x00200000,
+ IMAGE_SCN_ALIGN_4BYTES = 0x00300000,
+ IMAGE_SCN_ALIGN_8BYTES = 0x00400000,
+ IMAGE_SCN_ALIGN_16BYTES = 0x00500000,
+ IMAGE_SCN_ALIGN_32BYTES = 0x00600000,
+ IMAGE_SCN_ALIGN_64BYTES = 0x00700000,
+ IMAGE_SCN_ALIGN_128BYTES = 0x00800000,
+ IMAGE_SCN_ALIGN_256BYTES = 0x00900000,
+ IMAGE_SCN_ALIGN_512BYTES = 0x00A00000,
+ IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000,
+ IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000,
+ IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000,
+ IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000,
+ IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000,
+ IMAGE_SCN_MEM_DISCARDABLE = 0x02000000,
+ IMAGE_SCN_MEM_NOT_CACHED = 0x04000000,
+ IMAGE_SCN_MEM_NOT_PAGED = 0x08000000,
+ IMAGE_SCN_MEM_SHARED = 0x10000000,
+ IMAGE_SCN_MEM_EXECUTE = 0x20000000,
+ IMAGE_SCN_MEM_READ = 0x40000000,
+ IMAGE_SCN_MEM_WRITE = 0x80000000
+};
+
+struct relocation {
+ uint32_t VirtualAddress;
+ uint32_t SymbolTableIndex;
+ uint16_t Type;
+};
+
+enum RelocationTypeI386 {
+ IMAGE_REL_I386_ABSOLUTE = 0x0000,
+ IMAGE_REL_I386_DIR16 = 0x0001,
+ IMAGE_REL_I386_REL16 = 0x0002,
+ IMAGE_REL_I386_DIR32 = 0x0006,
+ IMAGE_REL_I386_DIR32NB = 0x0007,
+ IMAGE_REL_I386_SEG12 = 0x0009,
+ IMAGE_REL_I386_SECTION = 0x000A,
+ IMAGE_REL_I386_SECREL = 0x000B,
+ IMAGE_REL_I386_TOKEN = 0x000C,
+ IMAGE_REL_I386_SECREL7 = 0x000D,
+ IMAGE_REL_I386_REL32 = 0x0014
+};
+
+enum RelocationTypeAMD64 {
+ IMAGE_REL_AMD64_ABSOLUTE = 0x0000,
+ IMAGE_REL_AMD64_ADDR64 = 0x0001,
+ IMAGE_REL_AMD64_ADDR32 = 0x0002,
+ IMAGE_REL_AMD64_ADDR32NB = 0x0003,
+ IMAGE_REL_AMD64_REL32 = 0x0004,
+ IMAGE_REL_AMD64_REL32_1 = 0x0005,
+ IMAGE_REL_AMD64_REL32_2 = 0x0006,
+ IMAGE_REL_AMD64_REL32_3 = 0x0007,
+ IMAGE_REL_AMD64_REL32_4 = 0x0008,
+ IMAGE_REL_AMD64_REL32_5 = 0x0009,
+ IMAGE_REL_AMD64_SECTION = 0x000A,
+ IMAGE_REL_AMD64_SECREL = 0x000B,
+ IMAGE_REL_AMD64_SECREL7 = 0x000C,
+ IMAGE_REL_AMD64_TOKEN = 0x000D,
+ IMAGE_REL_AMD64_SREL32 = 0x000E,
+ IMAGE_REL_AMD64_PAIR = 0x000F,
+ IMAGE_REL_AMD64_SSPAN32 = 0x0010
+};
+
+enum RelocationTypesARM {
+ IMAGE_REL_ARM_ABSOLUTE = 0x0000,
+ IMAGE_REL_ARM_ADDR32 = 0x0001,
+ IMAGE_REL_ARM_ADDR32NB = 0x0002,
+ IMAGE_REL_ARM_BRANCH24 = 0x0003,
+ IMAGE_REL_ARM_BRANCH11 = 0x0004,
+ IMAGE_REL_ARM_TOKEN = 0x0005,
+ IMAGE_REL_ARM_BLX24 = 0x0008,
+ IMAGE_REL_ARM_BLX11 = 0x0009,
+ IMAGE_REL_ARM_SECTION = 0x000E,
+ IMAGE_REL_ARM_SECREL = 0x000F,
+ IMAGE_REL_ARM_MOV32A = 0x0010,
+ IMAGE_REL_ARM_MOV32T = 0x0011,
+ IMAGE_REL_ARM_BRANCH20T = 0x0012,
+ IMAGE_REL_ARM_BRANCH24T = 0x0014,
+ IMAGE_REL_ARM_BLX23T = 0x0015
+};
+
+enum RelocationTypesARM64 {
+ IMAGE_REL_ARM64_ABSOLUTE = 0x0000,
+ IMAGE_REL_ARM64_ADDR32 = 0x0001,
+ IMAGE_REL_ARM64_ADDR32NB = 0x0002,
+ IMAGE_REL_ARM64_BRANCH26 = 0x0003,
+ IMAGE_REL_ARM64_PAGEBASE_REL2 = 0x0004,
+ IMAGE_REL_ARM64_REL21 = 0x0005,
+ IMAGE_REL_ARM64_PAGEOFFSET_12A = 0x0006,
+ IMAGE_REL_ARM64_PAGEOFFSET_12L = 0x0007,
+ IMAGE_REL_ARM64_SECREL = 0x0008,
+ IMAGE_REL_ARM64_SECREL_LOW12A = 0x0009,
+ IMAGE_REL_ARM64_SECREL_HIGH12A = 0x000A,
+ IMAGE_REL_ARM64_SECREL_LOW12L = 0x000B,
+ IMAGE_REL_ARM64_TOKEN = 0x000C,
+ IMAGE_REL_ARM64_SECTION = 0x000D,
+ IMAGE_REL_ARM64_ADDR64 = 0x000E,
+ IMAGE_REL_ARM64_BRANCH19 = 0x000F,
+ IMAGE_REL_ARM64_BRANCH14 = 0x0010,
+};
+
+enum COMDATType {
+ IMAGE_COMDAT_SELECT_NODUPLICATES = 1,
+ IMAGE_COMDAT_SELECT_ANY,
+ IMAGE_COMDAT_SELECT_SAME_SIZE,
+ IMAGE_COMDAT_SELECT_EXACT_MATCH,
+ IMAGE_COMDAT_SELECT_ASSOCIATIVE,
+ IMAGE_COMDAT_SELECT_LARGEST,
+ IMAGE_COMDAT_SELECT_NEWEST
+};
+
+// Auxiliary Symbol Formats
+struct AuxiliaryFunctionDefinition {
+ uint32_t TagIndex;
+ uint32_t TotalSize;
+ uint32_t PointerToLinenumber;
+ uint32_t PointerToNextFunction;
+ char unused[2];
+};
+
+struct AuxiliarybfAndefSymbol {
+ uint8_t unused1[4];
+ uint16_t Linenumber;
+ uint8_t unused2[6];
+ uint32_t PointerToNextFunction;
+ uint8_t unused3[2];
+};
+
+struct AuxiliaryWeakExternal {
+ uint32_t TagIndex;
+ uint32_t Characteristics;
+ uint8_t unused[10];
+};
+
+enum WeakExternalCharacteristics {
+ IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1,
+ IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2,
+ IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
+};
+
+struct AuxiliarySectionDefinition {
+ uint32_t Length;
+ uint16_t NumberOfRelocations;
+ uint16_t NumberOfLinenumbers;
+ uint32_t CheckSum;
+ uint32_t Number;
+ uint8_t Selection;
+ char unused;
+};
+
+struct AuxiliaryCLRToken {
+ uint8_t AuxType;
+ uint8_t unused1;
+ uint32_t SymbolTableIndex;
+ char unused2[12];
+};
+
+union Auxiliary {
+ AuxiliaryFunctionDefinition FunctionDefinition;
+ AuxiliarybfAndefSymbol bfAndefSymbol;
+ AuxiliaryWeakExternal WeakExternal;
+ AuxiliarySectionDefinition SectionDefinition;
+};
+
+/// @brief The Import Directory Table.
+///
+/// There is a single array of these and one entry per imported DLL.
+struct ImportDirectoryTableEntry {
+ uint32_t ImportLookupTableRVA;
+ uint32_t TimeDateStamp;
+ uint32_t ForwarderChain;
+ uint32_t NameRVA;
+ uint32_t ImportAddressTableRVA;
+};
+
+/// @brief The PE32 Import Lookup Table.
+///
+/// There is an array of these for each imported DLL. It represents either
+/// the ordinal to import from the target DLL, or a name to lookup and import
+/// from the target DLL.
+///
+/// This also happens to be the same format used by the Import Address Table
+/// when it is initially written out to the image.
+struct ImportLookupTableEntry32 {
+ uint32_t data;
+
+ /// @brief Is this entry specified by ordinal, or name?
+ bool isOrdinal() const { return data & 0x80000000; }
+
+ /// @brief Get the ordinal value of this entry. isOrdinal must be true.
+ uint16_t getOrdinal() const {
+ assert(isOrdinal() && "ILT entry is not an ordinal!");
+ return data & 0xFFFF;
+ }
+
+ /// @brief Set the ordinal value and set isOrdinal to true.
+ void setOrdinal(uint16_t o) {
+ data = o;
+ data |= 0x80000000;
+ }
+
+ /// @brief Get the Hint/Name entry RVA. isOrdinal must be false.
+ uint32_t getHintNameRVA() const {
+ assert(!isOrdinal() && "ILT entry is not a Hint/Name RVA!");
+ return data;
+ }
+
+ /// @brief Set the Hint/Name entry RVA and set isOrdinal to false.
+ void setHintNameRVA(uint32_t rva) { data = rva; }
+};
+
+/// @brief The DOS compatible header at the front of all PEs.
+struct DOSHeader {
+ uint16_t Magic;
+ uint16_t UsedBytesInTheLastPage;
+ uint16_t FileSizeInPages;
+ uint16_t NumberOfRelocationItems;
+ uint16_t HeaderSizeInParagraphs;
+ uint16_t MinimumExtraParagraphs;
+ uint16_t MaximumExtraParagraphs;
+ uint16_t InitialRelativeSS;
+ uint16_t InitialSP;
+ uint16_t Checksum;
+ uint16_t InitialIP;
+ uint16_t InitialRelativeCS;
+ uint16_t AddressOfRelocationTable;
+ uint16_t OverlayNumber;
+ uint16_t Reserved[4];
+ uint16_t OEMid;
+ uint16_t OEMinfo;
+ uint16_t Reserved2[10];
+ uint32_t AddressOfNewExeHeader;
+};
+
+struct PE32Header {
+ enum { PE32 = 0x10b, PE32_PLUS = 0x20b };
+
+ uint16_t Magic;
+ uint8_t MajorLinkerVersion;
+ uint8_t MinorLinkerVersion;
+ uint32_t SizeOfCode;
+ uint32_t SizeOfInitializedData;
+ uint32_t SizeOfUninitializedData;
+ uint32_t AddressOfEntryPoint; // RVA
+ uint32_t BaseOfCode; // RVA
+ uint32_t BaseOfData; // RVA
+ uint32_t ImageBase;
+ uint32_t SectionAlignment;
+ uint32_t FileAlignment;
+ uint16_t MajorOperatingSystemVersion;
+ uint16_t MinorOperatingSystemVersion;
+ uint16_t MajorImageVersion;
+ uint16_t MinorImageVersion;
+ uint16_t MajorSubsystemVersion;
+ uint16_t MinorSubsystemVersion;
+ uint32_t Win32VersionValue;
+ uint32_t SizeOfImage;
+ uint32_t SizeOfHeaders;
+ uint32_t CheckSum;
+ uint16_t Subsystem;
+ // FIXME: This should be DllCharacteristics to match the COFF spec.
+ uint16_t DLLCharacteristics;
+ uint32_t SizeOfStackReserve;
+ uint32_t SizeOfStackCommit;
+ uint32_t SizeOfHeapReserve;
+ uint32_t SizeOfHeapCommit;
+ uint32_t LoaderFlags;
+ // FIXME: This should be NumberOfRvaAndSizes to match the COFF spec.
+ uint32_t NumberOfRvaAndSize;
+};
+
+struct DataDirectory {
+ uint32_t RelativeVirtualAddress;
+ uint32_t Size;
+};
+
+enum DataDirectoryIndex {
+ EXPORT_TABLE = 0,
+ IMPORT_TABLE,
+ RESOURCE_TABLE,
+ EXCEPTION_TABLE,
+ CERTIFICATE_TABLE,
+ BASE_RELOCATION_TABLE,
+ DEBUG_DIRECTORY,
+ ARCHITECTURE,
+ GLOBAL_PTR,
+ TLS_TABLE,
+ LOAD_CONFIG_TABLE,
+ BOUND_IMPORT,
+ IAT,
+ DELAY_IMPORT_DESCRIPTOR,
+ CLR_RUNTIME_HEADER,
+
+ NUM_DATA_DIRECTORIES
+};
+
+enum WindowsSubsystem {
+ IMAGE_SUBSYSTEM_UNKNOWN = 0, ///< An unknown subsystem.
+ IMAGE_SUBSYSTEM_NATIVE = 1, ///< Device drivers and native Windows processes
+ IMAGE_SUBSYSTEM_WINDOWS_GUI = 2, ///< The Windows GUI subsystem.
+ IMAGE_SUBSYSTEM_WINDOWS_CUI = 3, ///< The Windows character subsystem.
+ IMAGE_SUBSYSTEM_OS2_CUI = 5, ///< The OS/2 character subsytem.
+ IMAGE_SUBSYSTEM_POSIX_CUI = 7, ///< The POSIX character subsystem.
+ IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8, ///< Native Windows 9x driver.
+ IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9, ///< Windows CE.
+ IMAGE_SUBSYSTEM_EFI_APPLICATION = 10, ///< An EFI application.
+ IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11, ///< An EFI driver with boot
+ /// services.
+ IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12, ///< An EFI driver with run-time
+ /// services.
+ IMAGE_SUBSYSTEM_EFI_ROM = 13, ///< An EFI ROM image.
+ IMAGE_SUBSYSTEM_XBOX = 14, ///< XBOX.
+ IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 ///< A BCD application.
+};
+
+enum DLLCharacteristics {
+ /// ASLR with 64 bit address space.
+ IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020,
+ /// DLL can be relocated at load time.
+ IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE = 0x0040,
+ /// Code integrity checks are enforced.
+ IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY = 0x0080,
+ ///< Image is NX compatible.
+ IMAGE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100,
+ /// Isolation aware, but do not isolate the image.
+ IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION = 0x0200,
+ /// Does not use structured exception handling (SEH). No SEH handler may be
+ /// called in this image.
+ IMAGE_DLL_CHARACTERISTICS_NO_SEH = 0x0400,
+ /// Do not bind the image.
+ IMAGE_DLL_CHARACTERISTICS_NO_BIND = 0x0800,
+ ///< Image should execute in an AppContainer.
+ IMAGE_DLL_CHARACTERISTICS_APPCONTAINER = 0x1000,
+ ///< A WDM driver.
+ IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER = 0x2000,
+ ///< Image supports Control Flow Guard.
+ IMAGE_DLL_CHARACTERISTICS_GUARD_CF = 0x4000,
+ /// Terminal Server aware.
+ IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
+};
+
+enum DebugType {
+ IMAGE_DEBUG_TYPE_UNKNOWN = 0,
+ IMAGE_DEBUG_TYPE_COFF = 1,
+ IMAGE_DEBUG_TYPE_CODEVIEW = 2,
+ IMAGE_DEBUG_TYPE_FPO = 3,
+ IMAGE_DEBUG_TYPE_MISC = 4,
+ IMAGE_DEBUG_TYPE_EXCEPTION = 5,
+ IMAGE_DEBUG_TYPE_FIXUP = 6,
+ IMAGE_DEBUG_TYPE_OMAP_TO_SRC = 7,
+ IMAGE_DEBUG_TYPE_OMAP_FROM_SRC = 8,
+ IMAGE_DEBUG_TYPE_BORLAND = 9,
+ IMAGE_DEBUG_TYPE_RESERVED10 = 10,
+ IMAGE_DEBUG_TYPE_CLSID = 11,
+ IMAGE_DEBUG_TYPE_VC_FEATURE = 12,
+ IMAGE_DEBUG_TYPE_POGO = 13,
+ IMAGE_DEBUG_TYPE_ILTCG = 14,
+ IMAGE_DEBUG_TYPE_MPX = 15,
+ IMAGE_DEBUG_TYPE_REPRO = 16,
+};
+
+enum BaseRelocationType {
+ IMAGE_REL_BASED_ABSOLUTE = 0,
+ IMAGE_REL_BASED_HIGH = 1,
+ IMAGE_REL_BASED_LOW = 2,
+ IMAGE_REL_BASED_HIGHLOW = 3,
+ IMAGE_REL_BASED_HIGHADJ = 4,
+ IMAGE_REL_BASED_MIPS_JMPADDR = 5,
+ IMAGE_REL_BASED_ARM_MOV32A = 5,
+ IMAGE_REL_BASED_ARM_MOV32T = 7,
+ IMAGE_REL_BASED_MIPS_JMPADDR16 = 9,
+ IMAGE_REL_BASED_DIR64 = 10
+};
+
+enum ImportType { IMPORT_CODE = 0, IMPORT_DATA = 1, IMPORT_CONST = 2 };
+
+enum ImportNameType {
+ /// Import is by ordinal. This indicates that the value in the Ordinal/Hint
+ /// field of the import header is the import's ordinal. If this constant is
+ /// not specified, then the Ordinal/Hint field should always be interpreted
+ /// as the import's hint.
+ IMPORT_ORDINAL = 0,
+ /// The import name is identical to the public symbol name
+ IMPORT_NAME = 1,
+ /// The import name is the public symbol name, but skipping the leading ?,
+ /// @, or optionally _.
+ IMPORT_NAME_NOPREFIX = 2,
+ /// The import name is the public symbol name, but skipping the leading ?,
+ /// @, or optionally _, and truncating at the first @.
+ IMPORT_NAME_UNDECORATE = 3
+};
+
+struct ImportHeader {
+ uint16_t Sig1; ///< Must be IMAGE_FILE_MACHINE_UNKNOWN (0).
+ uint16_t Sig2; ///< Must be 0xFFFF.
+ uint16_t Version;
+ uint16_t Machine;
+ uint32_t TimeDateStamp;
+ uint32_t SizeOfData;
+ uint16_t OrdinalHint;
+ uint16_t TypeInfo;
+
+ ImportType getType() const { return static_cast<ImportType>(TypeInfo & 0x3); }
+
+ ImportNameType getNameType() const {
+ return static_cast<ImportNameType>((TypeInfo & 0x1C) >> 2);
+ }
+};
+
+enum CodeViewIdentifiers {
+ DEBUG_SECTION_MAGIC = 0x4,
+};
+
+inline bool isReservedSectionNumber(int32_t SectionNumber) {
+ return SectionNumber <= 0;
+}
+
+} // End namespace COFF.
+} // End namespace llvm.
+
+#endif
Added: llvm/trunk/include/llvm/BinaryFormat/Dwarf.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/Dwarf.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Dwarf.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/Dwarf.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,838 @@
+//===- llvm/Support/Dwarf.def - Dwarf definitions ---------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Macros for running through Dwarf enumerators.
+//
+//===----------------------------------------------------------------------===//
+
+// TODO: Add other DW-based macros.
+#if !(defined HANDLE_DW_TAG || defined HANDLE_DW_AT || \
+ defined HANDLE_DW_FORM || defined HANDLE_DW_OP || \
+ defined HANDLE_DW_LANG || defined HANDLE_DW_ATE || \
+ defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
+ defined HANDLE_DW_CC || defined HANDLE_DW_LNS || \
+ defined HANDLE_DW_LNE || defined HANDLE_DW_LNCT || \
+ defined HANDLE_DW_MACRO || defined HANDLE_DW_RLE || \
+ defined HANDLE_DW_CFA || defined HANDLE_DW_APPLE_PROPERTY || \
+ defined HANDLE_DW_UT)
+#error "Missing macro definition of HANDLE_DW*"
+#endif
+
+#ifndef HANDLE_DW_TAG
+#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR)
+#endif
+
+#ifndef HANDLE_DW_AT
+#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR)
+#endif
+
+#ifndef HANDLE_DW_FORM
+#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR)
+#endif
+
+#ifndef HANDLE_DW_OP
+#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR)
+#endif
+
+#ifndef HANDLE_DW_LANG
+#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR)
+#endif
+
+#ifndef HANDLE_DW_ATE
+#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR)
+#endif
+
+#ifndef HANDLE_DW_VIRTUALITY
+#define HANDLE_DW_VIRTUALITY(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_DEFAULTED
+#define HANDLE_DW_DEFAULTED(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_CC
+#define HANDLE_DW_CC(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_LNS
+#define HANDLE_DW_LNS(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_LNE
+#define HANDLE_DW_LNE(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_LNCT
+#define HANDLE_DW_LNCT(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_MACRO
+#define HANDLE_DW_MACRO(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_RLE
+#define HANDLE_DW_RLE(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_CFA
+#define HANDLE_DW_CFA(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_APPLE_PROPERTY
+#define HANDLE_DW_APPLE_PROPERTY(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_UT
+#define HANDLE_DW_UT(ID, NAME)
+#endif
+
+HANDLE_DW_TAG(0x0000, null, 2, DWARF)
+HANDLE_DW_TAG(0x0001, array_type, 2, DWARF)
+HANDLE_DW_TAG(0x0002, class_type, 2, DWARF)
+HANDLE_DW_TAG(0x0003, entry_point, 2, DWARF)
+HANDLE_DW_TAG(0x0004, enumeration_type, 2, DWARF)
+HANDLE_DW_TAG(0x0005, formal_parameter, 2, DWARF)
+HANDLE_DW_TAG(0x0008, imported_declaration, 2, DWARF)
+HANDLE_DW_TAG(0x000a, label, 2, DWARF)
+HANDLE_DW_TAG(0x000b, lexical_block, 2, DWARF)
+HANDLE_DW_TAG(0x000d, member, 2, DWARF)
+HANDLE_DW_TAG(0x000f, pointer_type, 2, DWARF)
+HANDLE_DW_TAG(0x0010, reference_type, 2, DWARF)
+HANDLE_DW_TAG(0x0011, compile_unit, 2, DWARF)
+HANDLE_DW_TAG(0x0012, string_type, 2, DWARF)
+HANDLE_DW_TAG(0x0013, structure_type, 2, DWARF)
+HANDLE_DW_TAG(0x0015, subroutine_type, 2, DWARF)
+HANDLE_DW_TAG(0x0016, typedef, 2, DWARF)
+HANDLE_DW_TAG(0x0017, union_type, 2, DWARF)
+HANDLE_DW_TAG(0x0018, unspecified_parameters, 2, DWARF)
+HANDLE_DW_TAG(0x0019, variant, 2, DWARF)
+HANDLE_DW_TAG(0x001a, common_block, 2, DWARF)
+HANDLE_DW_TAG(0x001b, common_inclusion, 2, DWARF)
+HANDLE_DW_TAG(0x001c, inheritance, 2, DWARF)
+HANDLE_DW_TAG(0x001d, inlined_subroutine, 2, DWARF)
+HANDLE_DW_TAG(0x001e, module, 2, DWARF)
+HANDLE_DW_TAG(0x001f, ptr_to_member_type, 2, DWARF)
+HANDLE_DW_TAG(0x0020, set_type, 2, DWARF)
+HANDLE_DW_TAG(0x0021, subrange_type, 2, DWARF)
+HANDLE_DW_TAG(0x0022, with_stmt, 2, DWARF)
+HANDLE_DW_TAG(0x0023, access_declaration, 2, DWARF)
+HANDLE_DW_TAG(0x0024, base_type, 2, DWARF)
+HANDLE_DW_TAG(0x0025, catch_block, 2, DWARF)
+HANDLE_DW_TAG(0x0026, const_type, 2, DWARF)
+HANDLE_DW_TAG(0x0027, constant, 2, DWARF)
+HANDLE_DW_TAG(0x0028, enumerator, 2, DWARF)
+HANDLE_DW_TAG(0x0029, file_type, 2, DWARF)
+HANDLE_DW_TAG(0x002a, friend, 2, DWARF)
+HANDLE_DW_TAG(0x002b, namelist, 2, DWARF)
+HANDLE_DW_TAG(0x002c, namelist_item, 2, DWARF)
+HANDLE_DW_TAG(0x002d, packed_type, 2, DWARF)
+HANDLE_DW_TAG(0x002e, subprogram, 2, DWARF)
+HANDLE_DW_TAG(0x002f, template_type_parameter, 2, DWARF)
+HANDLE_DW_TAG(0x0030, template_value_parameter, 2, DWARF)
+HANDLE_DW_TAG(0x0031, thrown_type, 2, DWARF)
+HANDLE_DW_TAG(0x0032, try_block, 2, DWARF)
+HANDLE_DW_TAG(0x0033, variant_part, 2, DWARF)
+HANDLE_DW_TAG(0x0034, variable, 2, DWARF)
+HANDLE_DW_TAG(0x0035, volatile_type, 2, DWARF)
+// New in DWARF v3:
+HANDLE_DW_TAG(0x0036, dwarf_procedure, 3, DWARF)
+HANDLE_DW_TAG(0x0037, restrict_type, 3, DWARF)
+HANDLE_DW_TAG(0x0038, interface_type, 3, DWARF)
+HANDLE_DW_TAG(0x0039, namespace, 3, DWARF)
+HANDLE_DW_TAG(0x003a, imported_module, 3, DWARF)
+HANDLE_DW_TAG(0x003b, unspecified_type, 3, DWARF)
+HANDLE_DW_TAG(0x003c, partial_unit, 3, DWARF)
+HANDLE_DW_TAG(0x003d, imported_unit, 3, DWARF)
+HANDLE_DW_TAG(0x003f, condition, 3, DWARF)
+HANDLE_DW_TAG(0x0040, shared_type, 3, DWARF)
+// New in DWARF v4:
+HANDLE_DW_TAG(0x0041, type_unit, 4, DWARF)
+HANDLE_DW_TAG(0x0042, rvalue_reference_type, 4, DWARF)
+HANDLE_DW_TAG(0x0043, template_alias, 4, DWARF)
+// New in DWARF v5:
+HANDLE_DW_TAG(0x0044, coarray_type, 5, DWARF)
+HANDLE_DW_TAG(0x0045, generic_subrange, 5, DWARF)
+HANDLE_DW_TAG(0x0046, dynamic_type, 5, DWARF)
+HANDLE_DW_TAG(0x0047, atomic_type, 5, DWARF)
+HANDLE_DW_TAG(0x0048, call_site, 5, DWARF)
+HANDLE_DW_TAG(0x0049, call_site_parameter, 5, DWARF)
+HANDLE_DW_TAG(0x004a, skeleton_unit, 5, DWARF)
+HANDLE_DW_TAG(0x004b, immutable_type, 5, DWARF)
+// Vendor extensions:
+HANDLE_DW_TAG(0x4081, MIPS_loop, 0, MIPS)
+HANDLE_DW_TAG(0x4101, format_label, 0, GNU)
+HANDLE_DW_TAG(0x4102, function_template, 0, GNU)
+HANDLE_DW_TAG(0x4103, class_template, 0, GNU)
+HANDLE_DW_TAG(0x4106, GNU_template_template_param, 0, GNU)
+HANDLE_DW_TAG(0x4107, GNU_template_parameter_pack, 0, GNU)
+HANDLE_DW_TAG(0x4108, GNU_formal_parameter_pack, 0, GNU)
+HANDLE_DW_TAG(0x4200, APPLE_property, 0, APPLE)
+HANDLE_DW_TAG(0xb000, BORLAND_property, 0, BORLAND)
+HANDLE_DW_TAG(0xb001, BORLAND_Delphi_string, 0, BORLAND)
+HANDLE_DW_TAG(0xb002, BORLAND_Delphi_dynamic_array, 0, BORLAND)
+HANDLE_DW_TAG(0xb003, BORLAND_Delphi_set, 0, BORLAND)
+HANDLE_DW_TAG(0xb004, BORLAND_Delphi_variant, 0, BORLAND)
+
+// Attributes.
+HANDLE_DW_AT(0x01, sibling, 2, DWARF)
+HANDLE_DW_AT(0x02, location, 2, DWARF)
+HANDLE_DW_AT(0x03, name, 2, DWARF)
+HANDLE_DW_AT(0x09, ordering, 2, DWARF)
+HANDLE_DW_AT(0x0b, byte_size, 2, DWARF)
+HANDLE_DW_AT(0x0c, bit_offset, 2, DWARF)
+HANDLE_DW_AT(0x0d, bit_size, 2, DWARF)
+HANDLE_DW_AT(0x10, stmt_list, 2, DWARF)
+HANDLE_DW_AT(0x11, low_pc, 2, DWARF)
+HANDLE_DW_AT(0x12, high_pc, 2, DWARF)
+HANDLE_DW_AT(0x13, language, 2, DWARF)
+HANDLE_DW_AT(0x15, discr, 2, DWARF)
+HANDLE_DW_AT(0x16, discr_value, 2, DWARF)
+HANDLE_DW_AT(0x17, visibility, 2, DWARF)
+HANDLE_DW_AT(0x18, import, 2, DWARF)
+HANDLE_DW_AT(0x19, string_length, 2, DWARF)
+HANDLE_DW_AT(0x1a, common_reference, 2, DWARF)
+HANDLE_DW_AT(0x1b, comp_dir, 2, DWARF)
+HANDLE_DW_AT(0x1c, const_value, 2, DWARF)
+HANDLE_DW_AT(0x1d, containing_type, 2, DWARF)
+HANDLE_DW_AT(0x1e, default_value, 2, DWARF)
+HANDLE_DW_AT(0x20, inline, 2, DWARF)
+HANDLE_DW_AT(0x21, is_optional, 2, DWARF)
+HANDLE_DW_AT(0x22, lower_bound, 2, DWARF)
+HANDLE_DW_AT(0x25, producer, 2, DWARF)
+HANDLE_DW_AT(0x27, prototyped, 2, DWARF)
+HANDLE_DW_AT(0x2a, return_addr, 2, DWARF)
+HANDLE_DW_AT(0x2c, start_scope, 2, DWARF)
+HANDLE_DW_AT(0x2e, bit_stride, 2, DWARF)
+HANDLE_DW_AT(0x2f, upper_bound, 2, DWARF)
+HANDLE_DW_AT(0x31, abstract_origin, 2, DWARF)
+HANDLE_DW_AT(0x32, accessibility, 2, DWARF)
+HANDLE_DW_AT(0x33, address_class, 2, DWARF)
+HANDLE_DW_AT(0x34, artificial, 2, DWARF)
+HANDLE_DW_AT(0x35, base_types, 2, DWARF)
+HANDLE_DW_AT(0x36, calling_convention, 2, DWARF)
+HANDLE_DW_AT(0x37, count, 2, DWARF)
+HANDLE_DW_AT(0x38, data_member_location, 2, DWARF)
+HANDLE_DW_AT(0x39, decl_column, 2, DWARF)
+HANDLE_DW_AT(0x3a, decl_file, 2, DWARF)
+HANDLE_DW_AT(0x3b, decl_line, 2, DWARF)
+HANDLE_DW_AT(0x3c, declaration, 2, DWARF)
+HANDLE_DW_AT(0x3d, discr_list, 2, DWARF)
+HANDLE_DW_AT(0x3e, encoding, 2, DWARF)
+HANDLE_DW_AT(0x3f, external, 2, DWARF)
+HANDLE_DW_AT(0x40, frame_base, 2, DWARF)
+HANDLE_DW_AT(0x41, friend, 2, DWARF)
+HANDLE_DW_AT(0x42, identifier_case, 2, DWARF)
+HANDLE_DW_AT(0x43, macro_info, 2, DWARF)
+HANDLE_DW_AT(0x44, namelist_item, 2, DWARF)
+HANDLE_DW_AT(0x45, priority, 2, DWARF)
+HANDLE_DW_AT(0x46, segment, 2, DWARF)
+HANDLE_DW_AT(0x47, specification, 2, DWARF)
+HANDLE_DW_AT(0x48, static_link, 2, DWARF)
+HANDLE_DW_AT(0x49, type, 2, DWARF)
+HANDLE_DW_AT(0x4a, use_location, 2, DWARF)
+HANDLE_DW_AT(0x4b, variable_parameter, 2, DWARF)
+HANDLE_DW_AT(0x4c, virtuality, 2, DWARF)
+HANDLE_DW_AT(0x4d, vtable_elem_location, 2, DWARF)
+// New in DWARF v3:
+HANDLE_DW_AT(0x4e, allocated, 3, DWARF)
+HANDLE_DW_AT(0x4f, associated, 3, DWARF)
+HANDLE_DW_AT(0x50, data_location, 3, DWARF)
+HANDLE_DW_AT(0x51, byte_stride, 3, DWARF)
+HANDLE_DW_AT(0x52, entry_pc, 3, DWARF)
+HANDLE_DW_AT(0x53, use_UTF8, 3, DWARF)
+HANDLE_DW_AT(0x54, extension, 3, DWARF)
+HANDLE_DW_AT(0x55, ranges, 3, DWARF)
+HANDLE_DW_AT(0x56, trampoline, 3, DWARF)
+HANDLE_DW_AT(0x57, call_column, 3, DWARF)
+HANDLE_DW_AT(0x58, call_file, 3, DWARF)
+HANDLE_DW_AT(0x59, call_line, 3, DWARF)
+HANDLE_DW_AT(0x5a, description, 3, DWARF)
+HANDLE_DW_AT(0x5b, binary_scale, 3, DWARF)
+HANDLE_DW_AT(0x5c, decimal_scale, 3, DWARF)
+HANDLE_DW_AT(0x5d, small, 3, DWARF)
+HANDLE_DW_AT(0x5e, decimal_sign, 3, DWARF)
+HANDLE_DW_AT(0x5f, digit_count, 3, DWARF)
+HANDLE_DW_AT(0x60, picture_string, 3, DWARF)
+HANDLE_DW_AT(0x61, mutable, 3, DWARF)
+HANDLE_DW_AT(0x62, threads_scaled, 3, DWARF)
+HANDLE_DW_AT(0x63, explicit, 3, DWARF)
+HANDLE_DW_AT(0x64, object_pointer, 3, DWARF)
+HANDLE_DW_AT(0x65, endianity, 3, DWARF)
+HANDLE_DW_AT(0x66, elemental, 3, DWARF)
+HANDLE_DW_AT(0x67, pure, 3, DWARF)
+HANDLE_DW_AT(0x68, recursive, 3, DWARF)
+// New in DWARF v4:
+HANDLE_DW_AT(0x69, signature, 4, DWARF)
+HANDLE_DW_AT(0x6a, main_subprogram, 4, DWARF)
+HANDLE_DW_AT(0x6b, data_bit_offset, 4, DWARF)
+HANDLE_DW_AT(0x6c, const_expr, 4, DWARF)
+HANDLE_DW_AT(0x6d, enum_class, 4, DWARF)
+HANDLE_DW_AT(0x6e, linkage_name, 4, DWARF)
+// New in DWARF v5:
+HANDLE_DW_AT(0x6f, string_length_bit_size, 5, DWARF)
+HANDLE_DW_AT(0x70, string_length_byte_size, 5, DWARF)
+HANDLE_DW_AT(0x71, rank, 5, DWARF)
+HANDLE_DW_AT(0x72, str_offsets_base, 5, DWARF)
+HANDLE_DW_AT(0x73, addr_base, 5, DWARF)
+HANDLE_DW_AT(0x74, rnglists_base, 5, DWARF)
+HANDLE_DW_AT(0x75, dwo_id, 0, DWARF) ///< Retracted from DWARF v5.
+HANDLE_DW_AT(0x76, dwo_name, 5, DWARF)
+HANDLE_DW_AT(0x77, reference, 5, DWARF)
+HANDLE_DW_AT(0x78, rvalue_reference, 5, DWARF)
+HANDLE_DW_AT(0x79, macros, 5, DWARF)
+HANDLE_DW_AT(0x7a, call_all_calls, 5, DWARF)
+HANDLE_DW_AT(0x7b, call_all_source_calls, 5, DWARF)
+HANDLE_DW_AT(0x7c, call_all_tail_calls, 5, DWARF)
+HANDLE_DW_AT(0x7d, call_return_pc, 5, DWARF)
+HANDLE_DW_AT(0x7e, call_value, 5, DWARF)
+HANDLE_DW_AT(0x7f, call_origin, 5, DWARF)
+HANDLE_DW_AT(0x80, call_parameter, 5, DWARF)
+HANDLE_DW_AT(0x81, call_pc, 5, DWARF)
+HANDLE_DW_AT(0x82, call_tail_call, 5, DWARF)
+HANDLE_DW_AT(0x83, call_target, 5, DWARF)
+HANDLE_DW_AT(0x84, call_target_clobbered, 5, DWARF)
+HANDLE_DW_AT(0x85, call_data_location, 5, DWARF)
+HANDLE_DW_AT(0x86, call_data_value, 5, DWARF)
+HANDLE_DW_AT(0x87, noreturn, 5, DWARF)
+HANDLE_DW_AT(0x88, alignment, 5, DWARF)
+HANDLE_DW_AT(0x89, export_symbols, 5, DWARF)
+HANDLE_DW_AT(0x8a, deleted, 5, DWARF)
+HANDLE_DW_AT(0x8b, defaulted, 5, DWARF)
+HANDLE_DW_AT(0x8c, loclists_base, 5, DWARF)
+// Vendor extensions:
+HANDLE_DW_AT(0x2002, MIPS_loop_begin, 0, MIPS)
+HANDLE_DW_AT(0x2003, MIPS_tail_loop_begin, 0, MIPS)
+HANDLE_DW_AT(0x2004, MIPS_epilog_begin, 0, MIPS)
+HANDLE_DW_AT(0x2005, MIPS_loop_unroll_factor, 0, MIPS)
+HANDLE_DW_AT(0x2006, MIPS_software_pipeline_depth, 0, MIPS)
+HANDLE_DW_AT(0x2007, MIPS_linkage_name, 0, MIPS)
+HANDLE_DW_AT(0x2008, MIPS_stride, 0, MIPS)
+HANDLE_DW_AT(0x2009, MIPS_abstract_name, 0, MIPS)
+HANDLE_DW_AT(0x200a, MIPS_clone_origin, 0, MIPS)
+HANDLE_DW_AT(0x200b, MIPS_has_inlines, 0, MIPS)
+HANDLE_DW_AT(0x200c, MIPS_stride_byte, 0, MIPS)
+HANDLE_DW_AT(0x200d, MIPS_stride_elem, 0, MIPS)
+HANDLE_DW_AT(0x200e, MIPS_ptr_dopetype, 0, MIPS)
+HANDLE_DW_AT(0x200f, MIPS_allocatable_dopetype, 0, MIPS)
+HANDLE_DW_AT(0x2010, MIPS_assumed_shape_dopetype, 0, MIPS)
+// This one appears to have only been implemented by Open64 for
+// fortran and may conflict with other extensions.
+HANDLE_DW_AT(0x2011, MIPS_assumed_size, 0, MIPS)
+// GNU extensions
+HANDLE_DW_AT(0x2101, sf_names, 0, GNU)
+HANDLE_DW_AT(0x2102, src_info, 0, GNU)
+HANDLE_DW_AT(0x2103, mac_info, 0, GNU)
+HANDLE_DW_AT(0x2104, src_coords, 0, GNU)
+HANDLE_DW_AT(0x2105, body_begin, 0, GNU)
+HANDLE_DW_AT(0x2106, body_end, 0, GNU)
+HANDLE_DW_AT(0x2107, GNU_vector, 0, GNU)
+HANDLE_DW_AT(0x2110, GNU_template_name, 0, GNU)
+HANDLE_DW_AT(0x210f, GNU_odr_signature, 0, GNU)
+HANDLE_DW_AT(0x2119, GNU_macros, 0, GNU)
+// Extensions for Fission proposal.
+HANDLE_DW_AT(0x2130, GNU_dwo_name, 0, GNU)
+HANDLE_DW_AT(0x2131, GNU_dwo_id, 0, GNU)
+HANDLE_DW_AT(0x2132, GNU_ranges_base, 0, GNU)
+HANDLE_DW_AT(0x2133, GNU_addr_base, 0, GNU)
+HANDLE_DW_AT(0x2134, GNU_pubnames, 0, GNU)
+HANDLE_DW_AT(0x2135, GNU_pubtypes, 0, GNU)
+HANDLE_DW_AT(0x2136, GNU_discriminator, 0, GNU)
+// Borland extensions.
+HANDLE_DW_AT(0x3b11, BORLAND_property_read, 0, BORLAND)
+HANDLE_DW_AT(0x3b12, BORLAND_property_write, 0, BORLAND)
+HANDLE_DW_AT(0x3b13, BORLAND_property_implements, 0, BORLAND)
+HANDLE_DW_AT(0x3b14, BORLAND_property_index, 0, BORLAND)
+HANDLE_DW_AT(0x3b15, BORLAND_property_default, 0, BORLAND)
+HANDLE_DW_AT(0x3b20, BORLAND_Delphi_unit, 0, BORLAND)
+HANDLE_DW_AT(0x3b21, BORLAND_Delphi_class, 0, BORLAND)
+HANDLE_DW_AT(0x3b22, BORLAND_Delphi_record, 0, BORLAND)
+HANDLE_DW_AT(0x3b23, BORLAND_Delphi_metaclass, 0, BORLAND)
+HANDLE_DW_AT(0x3b24, BORLAND_Delphi_constructor, 0, BORLAND)
+HANDLE_DW_AT(0x3b25, BORLAND_Delphi_destructor, 0, BORLAND)
+HANDLE_DW_AT(0x3b26, BORLAND_Delphi_anonymous_method, 0, BORLAND)
+HANDLE_DW_AT(0x3b27, BORLAND_Delphi_interface, 0, BORLAND)
+HANDLE_DW_AT(0x3b28, BORLAND_Delphi_ABI, 0, BORLAND)
+HANDLE_DW_AT(0x3b29, BORLAND_Delphi_return, 0, BORLAND)
+HANDLE_DW_AT(0x3b30, BORLAND_Delphi_frameptr, 0, BORLAND)
+HANDLE_DW_AT(0x3b31, BORLAND_closure, 0, BORLAND)
+// LLVM project extensions.
+HANDLE_DW_AT(0x3e00, LLVM_include_path, 0, LLVM)
+HANDLE_DW_AT(0x3e01, LLVM_config_macros, 0, LLVM)
+HANDLE_DW_AT(0x3e02, LLVM_isysroot, 0, LLVM)
+// Apple extensions.
+HANDLE_DW_AT(0x3fe1, APPLE_optimized, 0, APPLE)
+HANDLE_DW_AT(0x3fe2, APPLE_flags, 0, APPLE)
+HANDLE_DW_AT(0x3fe3, APPLE_isa, 0, APPLE)
+HANDLE_DW_AT(0x3fe4, APPLE_block, 0, APPLE)
+HANDLE_DW_AT(0x3fe5, APPLE_major_runtime_vers, 0, APPLE)
+HANDLE_DW_AT(0x3fe6, APPLE_runtime_class, 0, APPLE)
+HANDLE_DW_AT(0x3fe7, APPLE_omit_frame_ptr, 0, APPLE)
+HANDLE_DW_AT(0x3fe8, APPLE_property_name, 0, APPLE)
+HANDLE_DW_AT(0x3fe9, APPLE_property_getter, 0, APPLE)
+HANDLE_DW_AT(0x3fea, APPLE_property_setter, 0, APPLE)
+HANDLE_DW_AT(0x3feb, APPLE_property_attribute, 0, APPLE)
+HANDLE_DW_AT(0x3fec, APPLE_objc_complete_type, 0, APPLE)
+HANDLE_DW_AT(0x3fed, APPLE_property, 0, APPLE)
+
+// Attribute form encodings.
+HANDLE_DW_FORM(0x01, addr, 2, DWARF)
+HANDLE_DW_FORM(0x03, block2, 2, DWARF)
+HANDLE_DW_FORM(0x04, block4, 2, DWARF)
+HANDLE_DW_FORM(0x05, data2, 2, DWARF)
+HANDLE_DW_FORM(0x06, data4, 2, DWARF)
+HANDLE_DW_FORM(0x07, data8, 2, DWARF)
+HANDLE_DW_FORM(0x08, string, 2, DWARF)
+HANDLE_DW_FORM(0x09, block, 2, DWARF)
+HANDLE_DW_FORM(0x0a, block1, 2, DWARF)
+HANDLE_DW_FORM(0x0b, data1, 2, DWARF)
+HANDLE_DW_FORM(0x0c, flag, 2, DWARF)
+HANDLE_DW_FORM(0x0d, sdata, 2, DWARF)
+HANDLE_DW_FORM(0x0e, strp, 2, DWARF)
+HANDLE_DW_FORM(0x0f, udata, 2, DWARF)
+HANDLE_DW_FORM(0x10, ref_addr, 2, DWARF)
+HANDLE_DW_FORM(0x11, ref1, 2, DWARF)
+HANDLE_DW_FORM(0x12, ref2, 2, DWARF)
+HANDLE_DW_FORM(0x13, ref4, 2, DWARF)
+HANDLE_DW_FORM(0x14, ref8, 2, DWARF)
+HANDLE_DW_FORM(0x15, ref_udata, 2, DWARF)
+HANDLE_DW_FORM(0x16, indirect, 2, DWARF)
+// New in DWARF v4:
+HANDLE_DW_FORM(0x17, sec_offset, 4, DWARF)
+HANDLE_DW_FORM(0x18, exprloc, 4, DWARF)
+HANDLE_DW_FORM(0x19, flag_present, 4, DWARF)
+// This was defined out of sequence.
+HANDLE_DW_FORM(0x20, ref_sig8, 4, DWARF)
+// New in DWARF v5:
+HANDLE_DW_FORM(0x1a, strx, 5, DWARF)
+HANDLE_DW_FORM(0x1b, addrx, 5, DWARF)
+HANDLE_DW_FORM(0x1c, ref_sup4, 5, DWARF)
+HANDLE_DW_FORM(0x1d, strp_sup, 5, DWARF)
+HANDLE_DW_FORM(0x1e, data16, 5, DWARF)
+HANDLE_DW_FORM(0x1f, line_strp, 5, DWARF)
+HANDLE_DW_FORM(0x21, implicit_const, 5, DWARF)
+HANDLE_DW_FORM(0x22, loclistx, 5, DWARF)
+HANDLE_DW_FORM(0x23, rnglistx, 5, DWARF)
+HANDLE_DW_FORM(0x24, ref_sup8, 5, DWARF)
+HANDLE_DW_FORM(0x25, strx1, 5, DWARF)
+HANDLE_DW_FORM(0x26, strx2, 5, DWARF)
+HANDLE_DW_FORM(0x27, strx3, 5, DWARF)
+HANDLE_DW_FORM(0x28, strx4, 5, DWARF)
+HANDLE_DW_FORM(0x29, addrx1, 5, DWARF)
+HANDLE_DW_FORM(0x2a, addrx2, 5, DWARF)
+HANDLE_DW_FORM(0x2b, addrx3, 5, DWARF)
+HANDLE_DW_FORM(0x2c, addrx4, 5, DWARF)
+// Extensions for Fission proposal
+HANDLE_DW_FORM(0x1f01, GNU_addr_index, 0, GNU)
+HANDLE_DW_FORM(0x1f02, GNU_str_index, 0, GNU)
+// Alternate debug sections proposal (output of "dwz" tool).
+HANDLE_DW_FORM(0x1f20, GNU_ref_alt, 0, GNU)
+HANDLE_DW_FORM(0x1f21, GNU_strp_alt, 0, GNU)
+
+// DWARF Expression operators.
+HANDLE_DW_OP(0x03, addr, 2, DWARF)
+HANDLE_DW_OP(0x06, deref, 2, DWARF)
+HANDLE_DW_OP(0x08, const1u, 2, DWARF)
+HANDLE_DW_OP(0x09, const1s, 2, DWARF)
+HANDLE_DW_OP(0x0a, const2u, 2, DWARF)
+HANDLE_DW_OP(0x0b, const2s, 2, DWARF)
+HANDLE_DW_OP(0x0c, const4u, 2, DWARF)
+HANDLE_DW_OP(0x0d, const4s, 2, DWARF)
+HANDLE_DW_OP(0x0e, const8u, 2, DWARF)
+HANDLE_DW_OP(0x0f, const8s, 2, DWARF)
+HANDLE_DW_OP(0x10, constu, 2, DWARF)
+HANDLE_DW_OP(0x11, consts, 2, DWARF)
+HANDLE_DW_OP(0x12, dup, 2, DWARF)
+HANDLE_DW_OP(0x13, drop, 2, DWARF)
+HANDLE_DW_OP(0x14, over, 2, DWARF)
+HANDLE_DW_OP(0x15, pick, 2, DWARF)
+HANDLE_DW_OP(0x16, swap, 2, DWARF)
+HANDLE_DW_OP(0x17, rot, 2, DWARF)
+HANDLE_DW_OP(0x18, xderef, 2, DWARF)
+HANDLE_DW_OP(0x19, abs, 2, DWARF)
+HANDLE_DW_OP(0x1a, and, 2, DWARF)
+HANDLE_DW_OP(0x1b, div, 2, DWARF)
+HANDLE_DW_OP(0x1c, minus, 2, DWARF)
+HANDLE_DW_OP(0x1d, mod, 2, DWARF)
+HANDLE_DW_OP(0x1e, mul, 2, DWARF)
+HANDLE_DW_OP(0x1f, neg, 2, DWARF)
+HANDLE_DW_OP(0x20, not, 2, DWARF)
+HANDLE_DW_OP(0x21, or, 2, DWARF)
+HANDLE_DW_OP(0x22, plus, 2, DWARF)
+HANDLE_DW_OP(0x23, plus_uconst, 2, DWARF)
+HANDLE_DW_OP(0x24, shl, 2, DWARF)
+HANDLE_DW_OP(0x25, shr, 2, DWARF)
+HANDLE_DW_OP(0x26, shra, 2, DWARF)
+HANDLE_DW_OP(0x27, xor, 2, DWARF)
+HANDLE_DW_OP(0x28, bra, 2, DWARF)
+HANDLE_DW_OP(0x29, eq, 2, DWARF)
+HANDLE_DW_OP(0x2a, ge, 2, DWARF)
+HANDLE_DW_OP(0x2b, gt, 2, DWARF)
+HANDLE_DW_OP(0x2c, le, 2, DWARF)
+HANDLE_DW_OP(0x2d, lt, 2, DWARF)
+HANDLE_DW_OP(0x2e, ne, 2, DWARF)
+HANDLE_DW_OP(0x2f, skip, 2, DWARF)
+HANDLE_DW_OP(0x30, lit0, 2, DWARF)
+HANDLE_DW_OP(0x31, lit1, 2, DWARF)
+HANDLE_DW_OP(0x32, lit2, 2, DWARF)
+HANDLE_DW_OP(0x33, lit3, 2, DWARF)
+HANDLE_DW_OP(0x34, lit4, 2, DWARF)
+HANDLE_DW_OP(0x35, lit5, 2, DWARF)
+HANDLE_DW_OP(0x36, lit6, 2, DWARF)
+HANDLE_DW_OP(0x37, lit7, 2, DWARF)
+HANDLE_DW_OP(0x38, lit8, 2, DWARF)
+HANDLE_DW_OP(0x39, lit9, 2, DWARF)
+HANDLE_DW_OP(0x3a, lit10, 2, DWARF)
+HANDLE_DW_OP(0x3b, lit11, 2, DWARF)
+HANDLE_DW_OP(0x3c, lit12, 2, DWARF)
+HANDLE_DW_OP(0x3d, lit13, 2, DWARF)
+HANDLE_DW_OP(0x3e, lit14, 2, DWARF)
+HANDLE_DW_OP(0x3f, lit15, 2, DWARF)
+HANDLE_DW_OP(0x40, lit16, 2, DWARF)
+HANDLE_DW_OP(0x41, lit17, 2, DWARF)
+HANDLE_DW_OP(0x42, lit18, 2, DWARF)
+HANDLE_DW_OP(0x43, lit19, 2, DWARF)
+HANDLE_DW_OP(0x44, lit20, 2, DWARF)
+HANDLE_DW_OP(0x45, lit21, 2, DWARF)
+HANDLE_DW_OP(0x46, lit22, 2, DWARF)
+HANDLE_DW_OP(0x47, lit23, 2, DWARF)
+HANDLE_DW_OP(0x48, lit24, 2, DWARF)
+HANDLE_DW_OP(0x49, lit25, 2, DWARF)
+HANDLE_DW_OP(0x4a, lit26, 2, DWARF)
+HANDLE_DW_OP(0x4b, lit27, 2, DWARF)
+HANDLE_DW_OP(0x4c, lit28, 2, DWARF)
+HANDLE_DW_OP(0x4d, lit29, 2, DWARF)
+HANDLE_DW_OP(0x4e, lit30, 2, DWARF)
+HANDLE_DW_OP(0x4f, lit31, 2, DWARF)
+HANDLE_DW_OP(0x50, reg0, 2, DWARF)
+HANDLE_DW_OP(0x51, reg1, 2, DWARF)
+HANDLE_DW_OP(0x52, reg2, 2, DWARF)
+HANDLE_DW_OP(0x53, reg3, 2, DWARF)
+HANDLE_DW_OP(0x54, reg4, 2, DWARF)
+HANDLE_DW_OP(0x55, reg5, 2, DWARF)
+HANDLE_DW_OP(0x56, reg6, 2, DWARF)
+HANDLE_DW_OP(0x57, reg7, 2, DWARF)
+HANDLE_DW_OP(0x58, reg8, 2, DWARF)
+HANDLE_DW_OP(0x59, reg9, 2, DWARF)
+HANDLE_DW_OP(0x5a, reg10, 2, DWARF)
+HANDLE_DW_OP(0x5b, reg11, 2, DWARF)
+HANDLE_DW_OP(0x5c, reg12, 2, DWARF)
+HANDLE_DW_OP(0x5d, reg13, 2, DWARF)
+HANDLE_DW_OP(0x5e, reg14, 2, DWARF)
+HANDLE_DW_OP(0x5f, reg15, 2, DWARF)
+HANDLE_DW_OP(0x60, reg16, 2, DWARF)
+HANDLE_DW_OP(0x61, reg17, 2, DWARF)
+HANDLE_DW_OP(0x62, reg18, 2, DWARF)
+HANDLE_DW_OP(0x63, reg19, 2, DWARF)
+HANDLE_DW_OP(0x64, reg20, 2, DWARF)
+HANDLE_DW_OP(0x65, reg21, 2, DWARF)
+HANDLE_DW_OP(0x66, reg22, 2, DWARF)
+HANDLE_DW_OP(0x67, reg23, 2, DWARF)
+HANDLE_DW_OP(0x68, reg24, 2, DWARF)
+HANDLE_DW_OP(0x69, reg25, 2, DWARF)
+HANDLE_DW_OP(0x6a, reg26, 2, DWARF)
+HANDLE_DW_OP(0x6b, reg27, 2, DWARF)
+HANDLE_DW_OP(0x6c, reg28, 2, DWARF)
+HANDLE_DW_OP(0x6d, reg29, 2, DWARF)
+HANDLE_DW_OP(0x6e, reg30, 2, DWARF)
+HANDLE_DW_OP(0x6f, reg31, 2, DWARF)
+HANDLE_DW_OP(0x70, breg0, 2, DWARF)
+HANDLE_DW_OP(0x71, breg1, 2, DWARF)
+HANDLE_DW_OP(0x72, breg2, 2, DWARF)
+HANDLE_DW_OP(0x73, breg3, 2, DWARF)
+HANDLE_DW_OP(0x74, breg4, 2, DWARF)
+HANDLE_DW_OP(0x75, breg5, 2, DWARF)
+HANDLE_DW_OP(0x76, breg6, 2, DWARF)
+HANDLE_DW_OP(0x77, breg7, 2, DWARF)
+HANDLE_DW_OP(0x78, breg8, 2, DWARF)
+HANDLE_DW_OP(0x79, breg9, 2, DWARF)
+HANDLE_DW_OP(0x7a, breg10, 2, DWARF)
+HANDLE_DW_OP(0x7b, breg11, 2, DWARF)
+HANDLE_DW_OP(0x7c, breg12, 2, DWARF)
+HANDLE_DW_OP(0x7d, breg13, 2, DWARF)
+HANDLE_DW_OP(0x7e, breg14, 2, DWARF)
+HANDLE_DW_OP(0x7f, breg15, 2, DWARF)
+HANDLE_DW_OP(0x80, breg16, 2, DWARF)
+HANDLE_DW_OP(0x81, breg17, 2, DWARF)
+HANDLE_DW_OP(0x82, breg18, 2, DWARF)
+HANDLE_DW_OP(0x83, breg19, 2, DWARF)
+HANDLE_DW_OP(0x84, breg20, 2, DWARF)
+HANDLE_DW_OP(0x85, breg21, 2, DWARF)
+HANDLE_DW_OP(0x86, breg22, 2, DWARF)
+HANDLE_DW_OP(0x87, breg23, 2, DWARF)
+HANDLE_DW_OP(0x88, breg24, 2, DWARF)
+HANDLE_DW_OP(0x89, breg25, 2, DWARF)
+HANDLE_DW_OP(0x8a, breg26, 2, DWARF)
+HANDLE_DW_OP(0x8b, breg27, 2, DWARF)
+HANDLE_DW_OP(0x8c, breg28, 2, DWARF)
+HANDLE_DW_OP(0x8d, breg29, 2, DWARF)
+HANDLE_DW_OP(0x8e, breg30, 2, DWARF)
+HANDLE_DW_OP(0x8f, breg31, 2, DWARF)
+HANDLE_DW_OP(0x90, regx, 2, DWARF)
+HANDLE_DW_OP(0x91, fbreg, 2, DWARF)
+HANDLE_DW_OP(0x92, bregx, 2, DWARF)
+HANDLE_DW_OP(0x93, piece, 2, DWARF)
+HANDLE_DW_OP(0x94, deref_size, 2, DWARF)
+HANDLE_DW_OP(0x95, xderef_size, 2, DWARF)
+HANDLE_DW_OP(0x96, nop, 2, DWARF)
+// New in DWARF v3:
+HANDLE_DW_OP(0x97, push_object_address, 3, DWARF)
+HANDLE_DW_OP(0x98, call2, 3, DWARF)
+HANDLE_DW_OP(0x99, call4, 3, DWARF)
+HANDLE_DW_OP(0x9a, call_ref, 3, DWARF)
+HANDLE_DW_OP(0x9b, form_tls_address, 3, DWARF)
+HANDLE_DW_OP(0x9c, call_frame_cfa, 3, DWARF)
+HANDLE_DW_OP(0x9d, bit_piece, 3, DWARF)
+// New in DWARF v4:
+HANDLE_DW_OP(0x9e, implicit_value, 4, DWARF)
+HANDLE_DW_OP(0x9f, stack_value, 4, DWARF)
+// New in DWARF v5:
+HANDLE_DW_OP(0xa0, implicit_pointer, 5, DWARF)
+HANDLE_DW_OP(0xa1, addrx, 5, DWARF)
+HANDLE_DW_OP(0xa2, constx, 5, DWARF)
+HANDLE_DW_OP(0xa3, entry_value, 5, DWARF)
+HANDLE_DW_OP(0xa4, const_type, 5, DWARF)
+HANDLE_DW_OP(0xa5, regval_type, 5, DWARF)
+HANDLE_DW_OP(0xa6, deref_type, 5, DWARF)
+HANDLE_DW_OP(0xa7, xderef_type, 5, DWARF)
+HANDLE_DW_OP(0xa8, convert, 5, DWARF)
+HANDLE_DW_OP(0xa9, reinterpret, 5, DWARF)
+// Vendor extensions:
+// Extensions for GNU-style thread-local storage.
+HANDLE_DW_OP(0xe0, GNU_push_tls_address, 0, GNU)
+// Extensions for Fission proposal.
+HANDLE_DW_OP(0xfb, GNU_addr_index, 0, GNU)
+HANDLE_DW_OP(0xfc, GNU_const_index, 0, GNU)
+
+// DWARF languages.
+HANDLE_DW_LANG(0x0001, C89, 2, DWARF)
+HANDLE_DW_LANG(0x0002, C, 2, DWARF)
+HANDLE_DW_LANG(0x0003, Ada83, 2, DWARF)
+HANDLE_DW_LANG(0x0004, C_plus_plus, 2, DWARF)
+HANDLE_DW_LANG(0x0005, Cobol74, 2, DWARF)
+HANDLE_DW_LANG(0x0006, Cobol85, 2, DWARF)
+HANDLE_DW_LANG(0x0007, Fortran77, 2, DWARF)
+HANDLE_DW_LANG(0x0008, Fortran90, 2, DWARF)
+HANDLE_DW_LANG(0x0009, Pascal83, 2, DWARF)
+HANDLE_DW_LANG(0x000a, Modula2, 2, DWARF)
+// New in DWARF v3:
+HANDLE_DW_LANG(0x000b, Java, 3, DWARF)
+HANDLE_DW_LANG(0x000c, C99, 3, DWARF)
+HANDLE_DW_LANG(0x000d, Ada95, 3, DWARF)
+HANDLE_DW_LANG(0x000e, Fortran95, 3, DWARF)
+HANDLE_DW_LANG(0x000f, PLI, 3, DWARF)
+HANDLE_DW_LANG(0x0010, ObjC, 3, DWARF)
+HANDLE_DW_LANG(0x0011, ObjC_plus_plus, 3, DWARF)
+HANDLE_DW_LANG(0x0012, UPC, 3, DWARF)
+HANDLE_DW_LANG(0x0013, D, 3, DWARF)
+// New in DWARF v4:
+HANDLE_DW_LANG(0x0014, Python, 4, DWARF)
+// New in DWARF v5:
+HANDLE_DW_LANG(0x0015, OpenCL, 5, DWARF)
+HANDLE_DW_LANG(0x0016, Go, 5, DWARF)
+HANDLE_DW_LANG(0x0017, Modula3, 5, DWARF)
+HANDLE_DW_LANG(0x0018, Haskell, 5, DWARF)
+HANDLE_DW_LANG(0x0019, C_plus_plus_03, 5, DWARF)
+HANDLE_DW_LANG(0x001a, C_plus_plus_11, 5, DWARF)
+HANDLE_DW_LANG(0x001b, OCaml, 5, DWARF)
+HANDLE_DW_LANG(0x001c, Rust, 5, DWARF)
+HANDLE_DW_LANG(0x001d, C11, 5, DWARF)
+HANDLE_DW_LANG(0x001e, Swift, 5, DWARF)
+HANDLE_DW_LANG(0x001f, Julia, 5, DWARF)
+HANDLE_DW_LANG(0x0020, Dylan, 5, DWARF)
+HANDLE_DW_LANG(0x0021, C_plus_plus_14, 5, DWARF)
+HANDLE_DW_LANG(0x0022, Fortran03, 5, DWARF)
+HANDLE_DW_LANG(0x0023, Fortran08, 5, DWARF)
+HANDLE_DW_LANG(0x0024, RenderScript, 5, DWARF)
+HANDLE_DW_LANG(0x0025, BLISS, 5, DWARF)
+// Vendor extensions:
+HANDLE_DW_LANG(0x8001, Mips_Assembler, 0, MIPS)
+HANDLE_DW_LANG(0x8e57, GOOGLE_RenderScript, 0, GOOGLE)
+HANDLE_DW_LANG(0xb000, BORLAND_Delphi, 0, BORLAND)
+
+// DWARF attribute type encodings.
+HANDLE_DW_ATE(0x01, address, 2, DWARF)
+HANDLE_DW_ATE(0x02, boolean, 2, DWARF)
+HANDLE_DW_ATE(0x03, complex_float, 2, DWARF)
+HANDLE_DW_ATE(0x04, float, 2, DWARF)
+HANDLE_DW_ATE(0x05, signed, 2, DWARF)
+HANDLE_DW_ATE(0x06, signed_char, 2, DWARF)
+HANDLE_DW_ATE(0x07, unsigned, 2, DWARF)
+HANDLE_DW_ATE(0x08, unsigned_char, 2, DWARF)
+// New in DWARF v3:
+HANDLE_DW_ATE(0x09, imaginary_float, 3, DWARF)
+HANDLE_DW_ATE(0x0a, packed_decimal, 3, DWARF)
+HANDLE_DW_ATE(0x0b, numeric_string, 3, DWARF)
+HANDLE_DW_ATE(0x0c, edited, 3, DWARF)
+HANDLE_DW_ATE(0x0d, signed_fixed, 3, DWARF)
+HANDLE_DW_ATE(0x0e, unsigned_fixed, 3, DWARF)
+HANDLE_DW_ATE(0x0f, decimal_float, 3, DWARF)
+// New in DWARF v4:
+HANDLE_DW_ATE(0x10, UTF, 4, DWARF)
+// New in DWARF v5:
+HANDLE_DW_ATE(0x11, UCS, 5, DWARF)
+HANDLE_DW_ATE(0x12, ASCII, 5, DWARF)
+
+// DWARF virtuality codes.
+HANDLE_DW_VIRTUALITY(0x00, none)
+HANDLE_DW_VIRTUALITY(0x01, virtual)
+HANDLE_DW_VIRTUALITY(0x02, pure_virtual)
+
+// DWARF v5 Defaulted Member Encodings.
+HANDLE_DW_DEFAULTED(0x00, no)
+HANDLE_DW_DEFAULTED(0x01, in_class)
+HANDLE_DW_DEFAULTED(0x02, out_of_class)
+
+// DWARF calling convention codes.
+HANDLE_DW_CC(0x01, normal)
+HANDLE_DW_CC(0x02, program)
+HANDLE_DW_CC(0x03, nocall)
+// New in DWARF v5:
+HANDLE_DW_CC(0x04, pass_by_reference)
+HANDLE_DW_CC(0x05, pass_by_value)
+// Vendor extensions:
+HANDLE_DW_CC(0x41, GNU_borland_fastcall_i386)
+HANDLE_DW_CC(0xb0, BORLAND_safecall)
+HANDLE_DW_CC(0xb1, BORLAND_stdcall)
+HANDLE_DW_CC(0xb2, BORLAND_pascal)
+HANDLE_DW_CC(0xb3, BORLAND_msfastcall)
+HANDLE_DW_CC(0xb4, BORLAND_msreturn)
+HANDLE_DW_CC(0xb5, BORLAND_thiscall)
+HANDLE_DW_CC(0xb6, BORLAND_fastcall)
+HANDLE_DW_CC(0xc0, LLVM_vectorcall)
+
+// Line Number Extended Opcode Encodings
+HANDLE_DW_LNE(0x01, end_sequence)
+HANDLE_DW_LNE(0x02, set_address)
+HANDLE_DW_LNE(0x03, define_file)
+// New in DWARF v4:
+HANDLE_DW_LNE(0x04, set_discriminator)
+
+// Line Number Standard Opcode Encodings.
+HANDLE_DW_LNS(0x00, extended_op)
+HANDLE_DW_LNS(0x01, copy)
+HANDLE_DW_LNS(0x02, advance_pc)
+HANDLE_DW_LNS(0x03, advance_line)
+HANDLE_DW_LNS(0x04, set_file)
+HANDLE_DW_LNS(0x05, set_column)
+HANDLE_DW_LNS(0x06, negate_stmt)
+HANDLE_DW_LNS(0x07, set_basic_block)
+HANDLE_DW_LNS(0x08, const_add_pc)
+HANDLE_DW_LNS(0x09, fixed_advance_pc)
+// New in DWARF v3:
+HANDLE_DW_LNS(0x0a, set_prologue_end)
+HANDLE_DW_LNS(0x0b, set_epilogue_begin)
+HANDLE_DW_LNS(0x0c, set_isa)
+
+// DWARF v5 Line number header entry format.
+HANDLE_DW_LNCT(0x01, path)
+HANDLE_DW_LNCT(0x02, directory_index)
+HANDLE_DW_LNCT(0x03, timestamp)
+HANDLE_DW_LNCT(0x04, size)
+HANDLE_DW_LNCT(0x05, MD5)
+
+// DWARF v5 Macro information.
+HANDLE_DW_MACRO(0x01, define)
+HANDLE_DW_MACRO(0x02, undef)
+HANDLE_DW_MACRO(0x03, start_file)
+HANDLE_DW_MACRO(0x04, end_file)
+HANDLE_DW_MACRO(0x05, define_strp)
+HANDLE_DW_MACRO(0x06, undef_strp)
+HANDLE_DW_MACRO(0x07, import)
+HANDLE_DW_MACRO(0x08, define_sup)
+HANDLE_DW_MACRO(0x09, undef_sup)
+HANDLE_DW_MACRO(0x0a, import_sup)
+HANDLE_DW_MACRO(0x0b, define_strx)
+HANDLE_DW_MACRO(0x0c, undef_strx)
+
+// DWARF v5 Range List Entry encoding values.
+HANDLE_DW_RLE(0x00, end_of_list)
+HANDLE_DW_RLE(0x01, base_addressx)
+HANDLE_DW_RLE(0x02, startx_endx)
+HANDLE_DW_RLE(0x03, startx_length)
+HANDLE_DW_RLE(0x04, offset_pair)
+HANDLE_DW_RLE(0x05, base_address)
+HANDLE_DW_RLE(0x06, start_end)
+HANDLE_DW_RLE(0x07, start_length)
+
+// Call frame instruction encodings.
+HANDLE_DW_CFA(0x00, nop)
+HANDLE_DW_CFA(0x40, advance_loc)
+HANDLE_DW_CFA(0x80, offset)
+HANDLE_DW_CFA(0xc0, restore)
+HANDLE_DW_CFA(0x01, set_loc)
+HANDLE_DW_CFA(0x02, advance_loc1)
+HANDLE_DW_CFA(0x03, advance_loc2)
+HANDLE_DW_CFA(0x04, advance_loc4)
+HANDLE_DW_CFA(0x05, offset_extended)
+HANDLE_DW_CFA(0x06, restore_extended)
+HANDLE_DW_CFA(0x07, undefined)
+HANDLE_DW_CFA(0x08, same_value)
+HANDLE_DW_CFA(0x09, register)
+HANDLE_DW_CFA(0x0a, remember_state)
+HANDLE_DW_CFA(0x0b, restore_state)
+HANDLE_DW_CFA(0x0c, def_cfa)
+HANDLE_DW_CFA(0x0d, def_cfa_register)
+HANDLE_DW_CFA(0x0e, def_cfa_offset)
+// New in DWARF v3:
+HANDLE_DW_CFA(0x0f, def_cfa_expression)
+HANDLE_DW_CFA(0x10, expression)
+HANDLE_DW_CFA(0x11, offset_extended_sf)
+HANDLE_DW_CFA(0x12, def_cfa_sf)
+HANDLE_DW_CFA(0x13, def_cfa_offset_sf)
+HANDLE_DW_CFA(0x14, val_offset)
+HANDLE_DW_CFA(0x15, val_offset_sf)
+HANDLE_DW_CFA(0x16, val_expression)
+// Vendor extensions:
+HANDLE_DW_CFA(0x1d, MIPS_advance_loc8)
+HANDLE_DW_CFA(0x2d, GNU_window_save)
+HANDLE_DW_CFA(0x2e, GNU_args_size)
+
+// Apple Objective-C Property Attributes.
+// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+HANDLE_DW_APPLE_PROPERTY(0x01, readonly)
+HANDLE_DW_APPLE_PROPERTY(0x02, getter)
+HANDLE_DW_APPLE_PROPERTY(0x04, assign)
+HANDLE_DW_APPLE_PROPERTY(0x08, readwrite)
+HANDLE_DW_APPLE_PROPERTY(0x10, retain)
+HANDLE_DW_APPLE_PROPERTY(0x20, copy)
+HANDLE_DW_APPLE_PROPERTY(0x40, nonatomic)
+HANDLE_DW_APPLE_PROPERTY(0x80, setter)
+HANDLE_DW_APPLE_PROPERTY(0x100, atomic)
+HANDLE_DW_APPLE_PROPERTY(0x200, weak)
+HANDLE_DW_APPLE_PROPERTY(0x400, strong)
+HANDLE_DW_APPLE_PROPERTY(0x800, unsafe_unretained)
+HANDLE_DW_APPLE_PROPERTY(0x1000, nullability)
+HANDLE_DW_APPLE_PROPERTY(0x2000, null_resettable)
+HANDLE_DW_APPLE_PROPERTY(0x4000, class)
+
+// DWARF v5 Unit Types.
+HANDLE_DW_UT(0x01, compile)
+HANDLE_DW_UT(0x02, type)
+HANDLE_DW_UT(0x03, partial)
+HANDLE_DW_UT(0x04, skeleton)
+HANDLE_DW_UT(0x05, split_compile)
+HANDLE_DW_UT(0x06, split_type)
+
+#undef HANDLE_DW_TAG
+#undef HANDLE_DW_AT
+#undef HANDLE_DW_FORM
+#undef HANDLE_DW_OP
+#undef HANDLE_DW_LANG
+#undef HANDLE_DW_ATE
+#undef HANDLE_DW_VIRTUALITY
+#undef HANDLE_DW_DEFAULTED
+#undef HANDLE_DW_CC
+#undef HANDLE_DW_LNS
+#undef HANDLE_DW_LNE
+#undef HANDLE_DW_LNCT
+#undef HANDLE_DW_MACRO
+#undef HANDLE_DW_RLE
+#undef HANDLE_DW_CFA
+#undef HANDLE_DW_APPLE_PROPERTY
+#undef HANDLE_DW_UT
Added: llvm/trunk/include/llvm/BinaryFormat/Dwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/Dwarf.h?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Dwarf.h (added)
+++ llvm/trunk/include/llvm/BinaryFormat/Dwarf.h Tue Jun 6 22:48:56 2017
@@ -0,0 +1,493 @@
+//===-- llvm/BinaryFormat/Dwarf.h ---Dwarf Constants-------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// \file
+// \brief This file contains constants used for implementing Dwarf
+// debug support.
+//
+// For details on the Dwarf specfication see the latest DWARF Debugging
+// Information Format standard document on http://www.dwarfstd.org. This
+// file often includes support for non-released standard features.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_BINARYFORMAT_DWARF_H
+#define LLVM_BINARYFORMAT_DWARF_H
+
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/DataTypes.h"
+
+namespace llvm {
+class StringRef;
+
+namespace dwarf {
+
+//===----------------------------------------------------------------------===//
+// DWARF constants as gleaned from the DWARF Debugging Information Format V.5
+// reference manual http://www.dwarfstd.org/.
+//
+
+// Do not mix the following two enumerations sets. DW_TAG_invalid changes the
+// enumeration base type.
+
+enum LLVMConstants : uint32_t {
+ // LLVM mock tags (see also llvm/BinaryFormat/Dwarf.def).
+ DW_TAG_invalid = ~0U, // Tag for invalid results.
+ DW_VIRTUALITY_invalid = ~0U, // Virtuality for invalid results.
+ DW_MACINFO_invalid = ~0U, // Macinfo type for invalid results.
+
+ // Other constants.
+ DWARF_VERSION = 4, // Default dwarf version we output.
+ DW_PUBTYPES_VERSION = 2, // Section version number for .debug_pubtypes.
+ DW_PUBNAMES_VERSION = 2, // Section version number for .debug_pubnames.
+ DW_ARANGES_VERSION = 2, // Section version number for .debug_aranges.
+ // Identifiers we use to distinguish vendor extensions.
+ DWARF_VENDOR_DWARF = 0, // Defined in v2 or later of the DWARF standard.
+ DWARF_VENDOR_APPLE = 1,
+ DWARF_VENDOR_BORLAND = 2,
+ DWARF_VENDOR_GNU = 3,
+ DWARF_VENDOR_GOOGLE = 4,
+ DWARF_VENDOR_LLVM = 5,
+ DWARF_VENDOR_MIPS = 6
+};
+
+// Special ID values that distinguish a CIE from a FDE in DWARF CFI.
+// Not inside an enum because a 64-bit value is needed.
+const uint32_t DW_CIE_ID = UINT32_MAX;
+const uint64_t DW64_CIE_ID = UINT64_MAX;
+
+enum Tag : uint16_t {
+#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) DW_TAG_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_TAG_lo_user = 0x4080,
+ DW_TAG_hi_user = 0xffff,
+ DW_TAG_user_base = 0x1000 // Recommended base for user tags.
+};
+
+inline bool isType(Tag T) {
+ switch (T) {
+ case DW_TAG_array_type:
+ case DW_TAG_class_type:
+ case DW_TAG_interface_type:
+ case DW_TAG_enumeration_type:
+ case DW_TAG_pointer_type:
+ case DW_TAG_reference_type:
+ case DW_TAG_rvalue_reference_type:
+ case DW_TAG_string_type:
+ case DW_TAG_structure_type:
+ case DW_TAG_subroutine_type:
+ case DW_TAG_union_type:
+ case DW_TAG_ptr_to_member_type:
+ case DW_TAG_set_type:
+ case DW_TAG_subrange_type:
+ case DW_TAG_base_type:
+ case DW_TAG_const_type:
+ case DW_TAG_file_type:
+ case DW_TAG_packed_type:
+ case DW_TAG_volatile_type:
+ case DW_TAG_typedef:
+ return true;
+ default:
+ return false;
+ }
+}
+
+/// Attributes.
+enum Attribute : uint16_t {
+#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) DW_AT_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_AT_lo_user = 0x2000,
+ DW_AT_hi_user = 0x3fff,
+};
+
+enum Form : uint16_t {
+#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) DW_FORM_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_FORM_lo_user = 0x1f00, ///< Not specified by DWARF.
+};
+
+enum LocationAtom {
+#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) DW_OP_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_OP_lo_user = 0xe0,
+ DW_OP_hi_user = 0xff,
+ DW_OP_LLVM_fragment = 0x1000 ///< Only used in LLVM metadata.
+};
+
+enum TypeKind {
+#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) DW_ATE_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_ATE_lo_user = 0x80,
+ DW_ATE_hi_user = 0xff
+};
+
+enum DecimalSignEncoding {
+ // Decimal sign attribute values
+ DW_DS_unsigned = 0x01,
+ DW_DS_leading_overpunch = 0x02,
+ DW_DS_trailing_overpunch = 0x03,
+ DW_DS_leading_separate = 0x04,
+ DW_DS_trailing_separate = 0x05
+};
+
+enum EndianityEncoding {
+ // Endianity attribute values
+ DW_END_default = 0x00,
+ DW_END_big = 0x01,
+ DW_END_little = 0x02,
+ DW_END_lo_user = 0x40,
+ DW_END_hi_user = 0xff
+};
+
+enum AccessAttribute {
+ // Accessibility codes
+ DW_ACCESS_public = 0x01,
+ DW_ACCESS_protected = 0x02,
+ DW_ACCESS_private = 0x03
+};
+
+enum VisibilityAttribute {
+ // Visibility codes
+ DW_VIS_local = 0x01,
+ DW_VIS_exported = 0x02,
+ DW_VIS_qualified = 0x03
+};
+
+enum VirtualityAttribute {
+#define HANDLE_DW_VIRTUALITY(ID, NAME) DW_VIRTUALITY_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_VIRTUALITY_max = 0x02
+};
+
+enum DefaultedMemberAttribute {
+#define HANDLE_DW_DEFAULTED(ID, NAME) DW_DEFAULTED_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_DEFAULTED_max = 0x02
+};
+
+enum SourceLanguage {
+#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) DW_LANG_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_LANG_lo_user = 0x8000,
+ DW_LANG_hi_user = 0xffff
+};
+
+enum CaseSensitivity {
+ // Identifier case codes
+ DW_ID_case_sensitive = 0x00,
+ DW_ID_up_case = 0x01,
+ DW_ID_down_case = 0x02,
+ DW_ID_case_insensitive = 0x03
+};
+
+enum CallingConvention {
+// Calling convention codes
+#define HANDLE_DW_CC(ID, NAME) DW_CC_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_CC_lo_user = 0x40,
+ DW_CC_hi_user = 0xff
+};
+
+enum InlineAttribute {
+ // Inline codes
+ DW_INL_not_inlined = 0x00,
+ DW_INL_inlined = 0x01,
+ DW_INL_declared_not_inlined = 0x02,
+ DW_INL_declared_inlined = 0x03
+};
+
+enum ArrayDimensionOrdering {
+ // Array ordering
+ DW_ORD_row_major = 0x00,
+ DW_ORD_col_major = 0x01
+};
+
+enum DiscriminantList {
+ // Discriminant descriptor values
+ DW_DSC_label = 0x00,
+ DW_DSC_range = 0x01
+};
+
+/// Line Number Standard Opcode Encodings.
+enum LineNumberOps : uint8_t {
+#define HANDLE_DW_LNS(ID, NAME) DW_LNS_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+};
+
+/// Line Number Extended Opcode Encodings.
+enum LineNumberExtendedOps {
+#define HANDLE_DW_LNE(ID, NAME) DW_LNE_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_LNE_lo_user = 0x80,
+ DW_LNE_hi_user = 0xff
+};
+
+enum LineNumberEntryFormat {
+#define HANDLE_DW_LNCT(ID, NAME) DW_LNCT_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_LNCT_lo_user = 0x2000,
+ DW_LNCT_hi_user = 0x3fff,
+};
+
+enum MacinfoRecordType {
+ // Macinfo Type Encodings
+ DW_MACINFO_define = 0x01,
+ DW_MACINFO_undef = 0x02,
+ DW_MACINFO_start_file = 0x03,
+ DW_MACINFO_end_file = 0x04,
+ DW_MACINFO_vendor_ext = 0xff
+};
+
+/// DWARF v5 macro information entry type encodings.
+enum MacroEntryType {
+#define HANDLE_DW_MACRO(ID, NAME) DW_MACRO_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_MACRO_lo_user = 0xe0,
+ DW_MACRO_hi_user = 0xff
+};
+
+/// DWARF v5 range list entry encoding values.
+enum RangeListEntries {
+#define HANDLE_DW_RLE(ID, NAME) DW_RLE_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+};
+
+/// Call frame instruction encodings.
+enum CallFrameInfo {
+#define HANDLE_DW_CFA(ID, NAME) DW_CFA_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_CFA_extended = 0x00,
+
+ DW_CFA_lo_user = 0x1c,
+ DW_CFA_hi_user = 0x3f
+};
+
+enum Constants {
+ // Children flag
+ DW_CHILDREN_no = 0x00,
+ DW_CHILDREN_yes = 0x01,
+
+ DW_EH_PE_absptr = 0x00,
+ DW_EH_PE_omit = 0xff,
+ DW_EH_PE_uleb128 = 0x01,
+ DW_EH_PE_udata2 = 0x02,
+ DW_EH_PE_udata4 = 0x03,
+ DW_EH_PE_udata8 = 0x04,
+ DW_EH_PE_sleb128 = 0x09,
+ DW_EH_PE_sdata2 = 0x0A,
+ DW_EH_PE_sdata4 = 0x0B,
+ DW_EH_PE_sdata8 = 0x0C,
+ DW_EH_PE_signed = 0x08,
+ DW_EH_PE_pcrel = 0x10,
+ DW_EH_PE_textrel = 0x20,
+ DW_EH_PE_datarel = 0x30,
+ DW_EH_PE_funcrel = 0x40,
+ DW_EH_PE_aligned = 0x50,
+ DW_EH_PE_indirect = 0x80
+};
+
+/// Constants for location lists in DWARF v5.
+enum LocationListEntry : unsigned char {
+ DW_LLE_end_of_list = 0x00,
+ DW_LLE_base_addressx = 0x01,
+ DW_LLE_startx_endx = 0x02,
+ DW_LLE_startx_length = 0x03,
+ DW_LLE_offset_pair = 0x04,
+ DW_LLE_default_location = 0x05,
+ DW_LLE_base_address = 0x06,
+ DW_LLE_start_end = 0x07,
+ DW_LLE_start_length = 0x08
+};
+
+/// Constants for the DW_APPLE_PROPERTY_attributes attribute.
+/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
+enum ApplePropertyAttributes {
+#define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+};
+
+/// Constants for unit types in DWARF v5.
+enum UnitType : unsigned char {
+#define HANDLE_DW_UT(ID, NAME) DW_UT_##NAME = ID,
+#include "llvm/BinaryFormat/Dwarf.def"
+ DW_UT_lo_user = 0x80,
+ DW_UT_hi_user = 0xff
+};
+
+// Constants for the DWARF v5 Accelerator Table Proposal
+enum AcceleratorTable {
+ // Data layout descriptors.
+ DW_ATOM_null = 0u, // Marker as the end of a list of atoms.
+ DW_ATOM_die_offset = 1u, // DIE offset in the debug_info section.
+ DW_ATOM_cu_offset = 2u, // Offset of the compile unit header that contains the
+ // item in question.
+ DW_ATOM_die_tag = 3u, // A tag entry.
+ DW_ATOM_type_flags = 4u, // Set of flags for a type.
+
+ // DW_ATOM_type_flags values.
+
+ // Always set for C++, only set for ObjC if this is the @implementation for a
+ // class.
+ DW_FLAG_type_implementation = 2u,
+
+ // Hash functions.
+
+ // Daniel J. Bernstein hash.
+ DW_hash_function_djb = 0u
+};
+
+// Constants for the GNU pubnames/pubtypes extensions supporting gdb index.
+enum GDBIndexEntryKind {
+ GIEK_NONE,
+ GIEK_TYPE,
+ GIEK_VARIABLE,
+ GIEK_FUNCTION,
+ GIEK_OTHER,
+ GIEK_UNUSED5,
+ GIEK_UNUSED6,
+ GIEK_UNUSED7
+};
+
+enum GDBIndexEntryLinkage { GIEL_EXTERNAL, GIEL_STATIC };
+
+/// \defgroup DwarfConstantsDumping Dwarf constants dumping functions
+///
+/// All these functions map their argument's value back to the
+/// corresponding enumerator name or return nullptr if the value isn't
+/// known.
+///
+/// @{
+StringRef TagString(unsigned Tag);
+StringRef ChildrenString(unsigned Children);
+StringRef AttributeString(unsigned Attribute);
+StringRef FormEncodingString(unsigned Encoding);
+StringRef OperationEncodingString(unsigned Encoding);
+StringRef AttributeEncodingString(unsigned Encoding);
+StringRef DecimalSignString(unsigned Sign);
+StringRef EndianityString(unsigned Endian);
+StringRef AccessibilityString(unsigned Access);
+StringRef VisibilityString(unsigned Visibility);
+StringRef VirtualityString(unsigned Virtuality);
+StringRef LanguageString(unsigned Language);
+StringRef CaseString(unsigned Case);
+StringRef ConventionString(unsigned Convention);
+StringRef InlineCodeString(unsigned Code);
+StringRef ArrayOrderString(unsigned Order);
+StringRef DiscriminantString(unsigned Discriminant);
+StringRef LNStandardString(unsigned Standard);
+StringRef LNExtendedString(unsigned Encoding);
+StringRef MacinfoString(unsigned Encoding);
+StringRef CallFrameString(unsigned Encoding);
+StringRef ApplePropertyString(unsigned);
+StringRef UnitTypeString(unsigned);
+StringRef AtomTypeString(unsigned Atom);
+StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind);
+StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
+/// @}
+
+/// \defgroup DwarfConstantsParsing Dwarf constants parsing functions
+///
+/// These functions map their strings back to the corresponding enumeration
+/// value or return 0 if there is none, except for these exceptions:
+///
+/// \li \a getTag() returns \a DW_TAG_invalid on invalid input.
+/// \li \a getVirtuality() returns \a DW_VIRTUALITY_invalid on invalid input.
+/// \li \a getMacinfo() returns \a DW_MACINFO_invalid on invalid input.
+///
+/// @{
+unsigned getTag(StringRef TagString);
+unsigned getOperationEncoding(StringRef OperationEncodingString);
+unsigned getVirtuality(StringRef VirtualityString);
+unsigned getLanguage(StringRef LanguageString);
+unsigned getCallingConvention(StringRef LanguageString);
+unsigned getAttributeEncoding(StringRef EncodingString);
+unsigned getMacinfo(StringRef MacinfoString);
+/// @}
+
+/// \defgroup DwarfConstantsVersioning Dwarf version for constants
+///
+/// For constants defined by DWARF, returns the DWARF version when the constant
+/// was first defined. For vendor extensions, if there is a version-related
+/// policy for when to emit it, returns a version number for that policy.
+/// Otherwise returns 0.
+///
+/// @{
+unsigned TagVersion(Tag T);
+unsigned AttributeVersion(Attribute A);
+unsigned FormVersion(Form F);
+unsigned OperationVersion(LocationAtom O);
+unsigned AttributeEncodingVersion(TypeKind E);
+unsigned LanguageVersion(SourceLanguage L);
+/// @}
+
+/// \defgroup DwarfConstantsVendor Dwarf "vendor" for constants
+///
+/// These functions return an identifier describing "who" defined the constant,
+/// either the DWARF standard itself or the vendor who defined the extension.
+///
+/// @{
+unsigned TagVendor(Tag T);
+unsigned AttributeVendor(Attribute A);
+unsigned FormVendor(Form F);
+unsigned OperationVendor(LocationAtom O);
+unsigned AttributeEncodingVendor(TypeKind E);
+unsigned LanguageVendor(SourceLanguage L);
+/// @}
+
+/// Tells whether the specified form is defined in the specified version,
+/// or is an extension if extensions are allowed.
+bool isValidFormForVersion(Form F, unsigned Version, bool ExtensionsOk = true);
+
+/// \brief Returns the symbolic string representing Val when used as a value
+/// for attribute Attr.
+StringRef AttributeValueString(uint16_t Attr, unsigned Val);
+
+/// \brief Decsribes an entry of the various gnu_pub* debug sections.
+///
+/// The gnu_pub* kind looks like:
+///
+/// 0-3 reserved
+/// 4-6 symbol kind
+/// 7 0 == global, 1 == static
+///
+/// A gdb_index descriptor includes the above kind, shifted 24 bits up with the
+/// offset of the cu within the debug_info section stored in those 24 bits.
+struct PubIndexEntryDescriptor {
+ GDBIndexEntryKind Kind;
+ GDBIndexEntryLinkage Linkage;
+ PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
+ : Kind(Kind), Linkage(Linkage) {}
+ /* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
+ : Kind(Kind), Linkage(GIEL_EXTERNAL) {}
+ explicit PubIndexEntryDescriptor(uint8_t Value)
+ : Kind(
+ static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >> KIND_OFFSET)),
+ Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
+ LINKAGE_OFFSET)) {}
+ uint8_t toBits() const {
+ return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET;
+ }
+
+private:
+ enum {
+ KIND_OFFSET = 4,
+ KIND_MASK = 7 << KIND_OFFSET,
+ LINKAGE_OFFSET = 7,
+ LINKAGE_MASK = 1 << LINKAGE_OFFSET
+ };
+};
+
+/// Constants that define the DWARF format as 32 or 64 bit.
+enum DwarfFormat { DWARF32, DWARF64 };
+
+} // End of namespace dwarf
+
+} // End of namespace llvm
+
+#endif
Added: llvm/trunk/include/llvm/BinaryFormat/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELF.h?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELF.h (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELF.h Tue Jun 6 22:48:56 2017
@@ -0,0 +1,1362 @@
+//===-- llvm/BinaryFormat/ELF.h - ELF constants and structures --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This header contains common, non-processor-specific data structures and
+// constants for the ELF file format.
+//
+// The details of the ELF32 bits in this file are largely based on the Tool
+// Interface Standard (TIS) Executable and Linking Format (ELF) Specification
+// Version 1.2, May 1995. The ELF64 stuff is based on ELF-64 Object File Format
+// Version 1.5, Draft 2, May 1998 as well as OpenBSD header files.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_BINARYFORMAT_ELF_H
+#define LLVM_BINARYFORMAT_ELF_H
+
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/DataTypes.h"
+#include <cstring>
+
+namespace llvm {
+
+namespace ELF {
+
+typedef uint32_t Elf32_Addr; // Program address
+typedef uint32_t Elf32_Off; // File offset
+typedef uint16_t Elf32_Half;
+typedef uint32_t Elf32_Word;
+typedef int32_t Elf32_Sword;
+
+typedef uint64_t Elf64_Addr;
+typedef uint64_t Elf64_Off;
+typedef uint16_t Elf64_Half;
+typedef uint32_t Elf64_Word;
+typedef int32_t Elf64_Sword;
+typedef uint64_t Elf64_Xword;
+typedef int64_t Elf64_Sxword;
+
+// Object file magic string.
+static const char ElfMagic[] = {0x7f, 'E', 'L', 'F', '\0'};
+
+// e_ident size and indices.
+enum {
+ EI_MAG0 = 0, // File identification index.
+ EI_MAG1 = 1, // File identification index.
+ EI_MAG2 = 2, // File identification index.
+ EI_MAG3 = 3, // File identification index.
+ EI_CLASS = 4, // File class.
+ EI_DATA = 5, // Data encoding.
+ EI_VERSION = 6, // File version.
+ EI_OSABI = 7, // OS/ABI identification.
+ EI_ABIVERSION = 8, // ABI version.
+ EI_PAD = 9, // Start of padding bytes.
+ EI_NIDENT = 16 // Number of bytes in e_ident.
+};
+
+struct Elf32_Ehdr {
+ unsigned char e_ident[EI_NIDENT]; // ELF Identification bytes
+ Elf32_Half e_type; // Type of file (see ET_* below)
+ Elf32_Half e_machine; // Required architecture for this file (see EM_*)
+ Elf32_Word e_version; // Must be equal to 1
+ Elf32_Addr e_entry; // Address to jump to in order to start program
+ Elf32_Off e_phoff; // Program header table's file offset, in bytes
+ Elf32_Off e_shoff; // Section header table's file offset, in bytes
+ Elf32_Word e_flags; // Processor-specific flags
+ Elf32_Half e_ehsize; // Size of ELF header, in bytes
+ Elf32_Half e_phentsize; // Size of an entry in the program header table
+ Elf32_Half e_phnum; // Number of entries in the program header table
+ Elf32_Half e_shentsize; // Size of an entry in the section header table
+ Elf32_Half e_shnum; // Number of entries in the section header table
+ Elf32_Half e_shstrndx; // Sect hdr table index of sect name string table
+ bool checkMagic() const {
+ return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0;
+ }
+ unsigned char getFileClass() const { return e_ident[EI_CLASS]; }
+ unsigned char getDataEncoding() const { return e_ident[EI_DATA]; }
+};
+
+// 64-bit ELF header. Fields are the same as for ELF32, but with different
+// types (see above).
+struct Elf64_Ehdr {
+ unsigned char e_ident[EI_NIDENT];
+ Elf64_Half e_type;
+ Elf64_Half e_machine;
+ Elf64_Word e_version;
+ Elf64_Addr e_entry;
+ Elf64_Off e_phoff;
+ Elf64_Off e_shoff;
+ Elf64_Word e_flags;
+ Elf64_Half e_ehsize;
+ Elf64_Half e_phentsize;
+ Elf64_Half e_phnum;
+ Elf64_Half e_shentsize;
+ Elf64_Half e_shnum;
+ Elf64_Half e_shstrndx;
+ bool checkMagic() const {
+ return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0;
+ }
+ unsigned char getFileClass() const { return e_ident[EI_CLASS]; }
+ unsigned char getDataEncoding() const { return e_ident[EI_DATA]; }
+};
+
+// File types
+enum {
+ ET_NONE = 0, // No file type
+ ET_REL = 1, // Relocatable file
+ ET_EXEC = 2, // Executable file
+ ET_DYN = 3, // Shared object file
+ ET_CORE = 4, // Core file
+ ET_LOPROC = 0xff00, // Beginning of processor-specific codes
+ ET_HIPROC = 0xffff // Processor-specific
+};
+
+// Versioning
+enum { EV_NONE = 0, EV_CURRENT = 1 };
+
+// Machine architectures
+// See current registered ELF machine architectures at:
+// http://www.uxsglobal.com/developers/gabi/latest/ch4.eheader.html
+enum {
+ EM_NONE = 0, // No machine
+ EM_M32 = 1, // AT&T WE 32100
+ EM_SPARC = 2, // SPARC
+ EM_386 = 3, // Intel 386
+ EM_68K = 4, // Motorola 68000
+ EM_88K = 5, // Motorola 88000
+ EM_IAMCU = 6, // Intel MCU
+ EM_860 = 7, // Intel 80860
+ EM_MIPS = 8, // MIPS R3000
+ EM_S370 = 9, // IBM System/370
+ EM_MIPS_RS3_LE = 10, // MIPS RS3000 Little-endian
+ EM_PARISC = 15, // Hewlett-Packard PA-RISC
+ EM_VPP500 = 17, // Fujitsu VPP500
+ EM_SPARC32PLUS = 18, // Enhanced instruction set SPARC
+ EM_960 = 19, // Intel 80960
+ EM_PPC = 20, // PowerPC
+ EM_PPC64 = 21, // PowerPC64
+ EM_S390 = 22, // IBM System/390
+ EM_SPU = 23, // IBM SPU/SPC
+ EM_V800 = 36, // NEC V800
+ EM_FR20 = 37, // Fujitsu FR20
+ EM_RH32 = 38, // TRW RH-32
+ EM_RCE = 39, // Motorola RCE
+ EM_ARM = 40, // ARM
+ EM_ALPHA = 41, // DEC Alpha
+ EM_SH = 42, // Hitachi SH
+ EM_SPARCV9 = 43, // SPARC V9
+ EM_TRICORE = 44, // Siemens TriCore
+ EM_ARC = 45, // Argonaut RISC Core
+ EM_H8_300 = 46, // Hitachi H8/300
+ EM_H8_300H = 47, // Hitachi H8/300H
+ EM_H8S = 48, // Hitachi H8S
+ EM_H8_500 = 49, // Hitachi H8/500
+ EM_IA_64 = 50, // Intel IA-64 processor architecture
+ EM_MIPS_X = 51, // Stanford MIPS-X
+ EM_COLDFIRE = 52, // Motorola ColdFire
+ EM_68HC12 = 53, // Motorola M68HC12
+ EM_MMA = 54, // Fujitsu MMA Multimedia Accelerator
+ EM_PCP = 55, // Siemens PCP
+ EM_NCPU = 56, // Sony nCPU embedded RISC processor
+ EM_NDR1 = 57, // Denso NDR1 microprocessor
+ EM_STARCORE = 58, // Motorola Star*Core processor
+ EM_ME16 = 59, // Toyota ME16 processor
+ EM_ST100 = 60, // STMicroelectronics ST100 processor
+ EM_TINYJ = 61, // Advanced Logic Corp. TinyJ embedded processor family
+ EM_X86_64 = 62, // AMD x86-64 architecture
+ EM_PDSP = 63, // Sony DSP Processor
+ EM_PDP10 = 64, // Digital Equipment Corp. PDP-10
+ EM_PDP11 = 65, // Digital Equipment Corp. PDP-11
+ EM_FX66 = 66, // Siemens FX66 microcontroller
+ EM_ST9PLUS = 67, // STMicroelectronics ST9+ 8/16 bit microcontroller
+ EM_ST7 = 68, // STMicroelectronics ST7 8-bit microcontroller
+ EM_68HC16 = 69, // Motorola MC68HC16 Microcontroller
+ EM_68HC11 = 70, // Motorola MC68HC11 Microcontroller
+ EM_68HC08 = 71, // Motorola MC68HC08 Microcontroller
+ EM_68HC05 = 72, // Motorola MC68HC05 Microcontroller
+ EM_SVX = 73, // Silicon Graphics SVx
+ EM_ST19 = 74, // STMicroelectronics ST19 8-bit microcontroller
+ EM_VAX = 75, // Digital VAX
+ EM_CRIS = 76, // Axis Communications 32-bit embedded processor
+ EM_JAVELIN = 77, // Infineon Technologies 32-bit embedded processor
+ EM_FIREPATH = 78, // Element 14 64-bit DSP Processor
+ EM_ZSP = 79, // LSI Logic 16-bit DSP Processor
+ EM_MMIX = 80, // Donald Knuth's educational 64-bit processor
+ EM_HUANY = 81, // Harvard University machine-independent object files
+ EM_PRISM = 82, // SiTera Prism
+ EM_AVR = 83, // Atmel AVR 8-bit microcontroller
+ EM_FR30 = 84, // Fujitsu FR30
+ EM_D10V = 85, // Mitsubishi D10V
+ EM_D30V = 86, // Mitsubishi D30V
+ EM_V850 = 87, // NEC v850
+ EM_M32R = 88, // Mitsubishi M32R
+ EM_MN10300 = 89, // Matsushita MN10300
+ EM_MN10200 = 90, // Matsushita MN10200
+ EM_PJ = 91, // picoJava
+ EM_OPENRISC = 92, // OpenRISC 32-bit embedded processor
+ EM_ARC_COMPACT = 93, // ARC International ARCompact processor (old
+ // spelling/synonym: EM_ARC_A5)
+ EM_XTENSA = 94, // Tensilica Xtensa Architecture
+ EM_VIDEOCORE = 95, // Alphamosaic VideoCore processor
+ EM_TMM_GPP = 96, // Thompson Multimedia General Purpose Processor
+ EM_NS32K = 97, // National Semiconductor 32000 series
+ EM_TPC = 98, // Tenor Network TPC processor
+ EM_SNP1K = 99, // Trebia SNP 1000 processor
+ EM_ST200 = 100, // STMicroelectronics (www.st.com) ST200
+ EM_IP2K = 101, // Ubicom IP2xxx microcontroller family
+ EM_MAX = 102, // MAX Processor
+ EM_CR = 103, // National Semiconductor CompactRISC microprocessor
+ EM_F2MC16 = 104, // Fujitsu F2MC16
+ EM_MSP430 = 105, // Texas Instruments embedded microcontroller msp430
+ EM_BLACKFIN = 106, // Analog Devices Blackfin (DSP) processor
+ EM_SE_C33 = 107, // S1C33 Family of Seiko Epson processors
+ EM_SEP = 108, // Sharp embedded microprocessor
+ EM_ARCA = 109, // Arca RISC Microprocessor
+ EM_UNICORE = 110, // Microprocessor series from PKU-Unity Ltd. and MPRC
+ // of Peking University
+ EM_EXCESS = 111, // eXcess: 16/32/64-bit configurable embedded CPU
+ EM_DXP = 112, // Icera Semiconductor Inc. Deep Execution Processor
+ EM_ALTERA_NIOS2 = 113, // Altera Nios II soft-core processor
+ EM_CRX = 114, // National Semiconductor CompactRISC CRX
+ EM_XGATE = 115, // Motorola XGATE embedded processor
+ EM_C166 = 116, // Infineon C16x/XC16x processor
+ EM_M16C = 117, // Renesas M16C series microprocessors
+ EM_DSPIC30F = 118, // Microchip Technology dsPIC30F Digital Signal
+ // Controller
+ EM_CE = 119, // Freescale Communication Engine RISC core
+ EM_M32C = 120, // Renesas M32C series microprocessors
+ EM_TSK3000 = 131, // Altium TSK3000 core
+ EM_RS08 = 132, // Freescale RS08 embedded processor
+ EM_SHARC = 133, // Analog Devices SHARC family of 32-bit DSP
+ // processors
+ EM_ECOG2 = 134, // Cyan Technology eCOG2 microprocessor
+ EM_SCORE7 = 135, // Sunplus S+core7 RISC processor
+ EM_DSP24 = 136, // New Japan Radio (NJR) 24-bit DSP Processor
+ EM_VIDEOCORE3 = 137, // Broadcom VideoCore III processor
+ EM_LATTICEMICO32 = 138, // RISC processor for Lattice FPGA architecture
+ EM_SE_C17 = 139, // Seiko Epson C17 family
+ EM_TI_C6000 = 140, // The Texas Instruments TMS320C6000 DSP family
+ EM_TI_C2000 = 141, // The Texas Instruments TMS320C2000 DSP family
+ EM_TI_C5500 = 142, // The Texas Instruments TMS320C55x DSP family
+ EM_MMDSP_PLUS = 160, // STMicroelectronics 64bit VLIW Data Signal Processor
+ EM_CYPRESS_M8C = 161, // Cypress M8C microprocessor
+ EM_R32C = 162, // Renesas R32C series microprocessors
+ EM_TRIMEDIA = 163, // NXP Semiconductors TriMedia architecture family
+ EM_HEXAGON = 164, // Qualcomm Hexagon processor
+ EM_8051 = 165, // Intel 8051 and variants
+ EM_STXP7X = 166, // STMicroelectronics STxP7x family of configurable
+ // and extensible RISC processors
+ EM_NDS32 = 167, // Andes Technology compact code size embedded RISC
+ // processor family
+ EM_ECOG1 = 168, // Cyan Technology eCOG1X family
+ EM_ECOG1X = 168, // Cyan Technology eCOG1X family
+ EM_MAXQ30 = 169, // Dallas Semiconductor MAXQ30 Core Micro-controllers
+ EM_XIMO16 = 170, // New Japan Radio (NJR) 16-bit DSP Processor
+ EM_MANIK = 171, // M2000 Reconfigurable RISC Microprocessor
+ EM_CRAYNV2 = 172, // Cray Inc. NV2 vector architecture
+ EM_RX = 173, // Renesas RX family
+ EM_METAG = 174, // Imagination Technologies META processor
+ // architecture
+ EM_MCST_ELBRUS = 175, // MCST Elbrus general purpose hardware architecture
+ EM_ECOG16 = 176, // Cyan Technology eCOG16 family
+ EM_CR16 = 177, // National Semiconductor CompactRISC CR16 16-bit
+ // microprocessor
+ EM_ETPU = 178, // Freescale Extended Time Processing Unit
+ EM_SLE9X = 179, // Infineon Technologies SLE9X core
+ EM_L10M = 180, // Intel L10M
+ EM_K10M = 181, // Intel K10M
+ EM_AARCH64 = 183, // ARM AArch64
+ EM_AVR32 = 185, // Atmel Corporation 32-bit microprocessor family
+ EM_STM8 = 186, // STMicroeletronics STM8 8-bit microcontroller
+ EM_TILE64 = 187, // Tilera TILE64 multicore architecture family
+ EM_TILEPRO = 188, // Tilera TILEPro multicore architecture family
+ EM_CUDA = 190, // NVIDIA CUDA architecture
+ EM_TILEGX = 191, // Tilera TILE-Gx multicore architecture family
+ EM_CLOUDSHIELD = 192, // CloudShield architecture family
+ EM_COREA_1ST = 193, // KIPO-KAIST Core-A 1st generation processor family
+ EM_COREA_2ND = 194, // KIPO-KAIST Core-A 2nd generation processor family
+ EM_ARC_COMPACT2 = 195, // Synopsys ARCompact V2
+ EM_OPEN8 = 196, // Open8 8-bit RISC soft processor core
+ EM_RL78 = 197, // Renesas RL78 family
+ EM_VIDEOCORE5 = 198, // Broadcom VideoCore V processor
+ EM_78KOR = 199, // Renesas 78KOR family
+ EM_56800EX = 200, // Freescale 56800EX Digital Signal Controller (DSC)
+ EM_BA1 = 201, // Beyond BA1 CPU architecture
+ EM_BA2 = 202, // Beyond BA2 CPU architecture
+ EM_XCORE = 203, // XMOS xCORE processor family
+ EM_MCHP_PIC = 204, // Microchip 8-bit PIC(r) family
+ EM_INTEL205 = 205, // Reserved by Intel
+ EM_INTEL206 = 206, // Reserved by Intel
+ EM_INTEL207 = 207, // Reserved by Intel
+ EM_INTEL208 = 208, // Reserved by Intel
+ EM_INTEL209 = 209, // Reserved by Intel
+ EM_KM32 = 210, // KM211 KM32 32-bit processor
+ EM_KMX32 = 211, // KM211 KMX32 32-bit processor
+ EM_KMX16 = 212, // KM211 KMX16 16-bit processor
+ EM_KMX8 = 213, // KM211 KMX8 8-bit processor
+ EM_KVARC = 214, // KM211 KVARC processor
+ EM_CDP = 215, // Paneve CDP architecture family
+ EM_COGE = 216, // Cognitive Smart Memory Processor
+ EM_COOL = 217, // iCelero CoolEngine
+ EM_NORC = 218, // Nanoradio Optimized RISC
+ EM_CSR_KALIMBA = 219, // CSR Kalimba architecture family
+ EM_AMDGPU = 224, // AMD GPU architecture
+ EM_RISCV = 243, // RISC-V
+ EM_LANAI = 244, // Lanai 32-bit processor
+ EM_BPF = 247, // Linux kernel bpf virtual machine
+
+ // A request has been made to the maintainer of the official registry for
+ // such numbers for an official value for WebAssembly. As soon as one is
+ // allocated, this enum will be updated to use it.
+ EM_WEBASSEMBLY = 0x4157, // WebAssembly architecture
+};
+
+// Object file classes.
+enum {
+ ELFCLASSNONE = 0,
+ ELFCLASS32 = 1, // 32-bit object file
+ ELFCLASS64 = 2 // 64-bit object file
+};
+
+// Object file byte orderings.
+enum {
+ ELFDATANONE = 0, // Invalid data encoding.
+ ELFDATA2LSB = 1, // Little-endian object file
+ ELFDATA2MSB = 2 // Big-endian object file
+};
+
+// OS ABI identification.
+enum {
+ ELFOSABI_NONE = 0, // UNIX System V ABI
+ ELFOSABI_HPUX = 1, // HP-UX operating system
+ ELFOSABI_NETBSD = 2, // NetBSD
+ ELFOSABI_GNU = 3, // GNU/Linux
+ ELFOSABI_LINUX = 3, // Historical alias for ELFOSABI_GNU.
+ ELFOSABI_HURD = 4, // GNU/Hurd
+ ELFOSABI_SOLARIS = 6, // Solaris
+ ELFOSABI_AIX = 7, // AIX
+ ELFOSABI_IRIX = 8, // IRIX
+ ELFOSABI_FREEBSD = 9, // FreeBSD
+ ELFOSABI_TRU64 = 10, // TRU64 UNIX
+ ELFOSABI_MODESTO = 11, // Novell Modesto
+ ELFOSABI_OPENBSD = 12, // OpenBSD
+ ELFOSABI_OPENVMS = 13, // OpenVMS
+ ELFOSABI_NSK = 14, // Hewlett-Packard Non-Stop Kernel
+ ELFOSABI_AROS = 15, // AROS
+ ELFOSABI_FENIXOS = 16, // FenixOS
+ ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
+ ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000
+ ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
+ ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
+ ELFOSABI_ARM = 97, // ARM
+ ELFOSABI_STANDALONE = 255 // Standalone (embedded) application
+};
+
+#define ELF_RELOC(name, value) name = value,
+
+// X86_64 relocations.
+enum {
+#include "ELFRelocs/x86_64.def"
+};
+
+// i386 relocations.
+enum {
+#include "ELFRelocs/i386.def"
+};
+
+// ELF Relocation types for PPC32
+enum {
+#include "ELFRelocs/PowerPC.def"
+};
+
+// Specific e_flags for PPC64
+enum {
+ // e_flags bits specifying ABI:
+ // 1 for original ABI using function descriptors,
+ // 2 for revised ABI without function descriptors,
+ // 0 for unspecified or not using any features affected by the differences.
+ EF_PPC64_ABI = 3
+};
+
+// Special values for the st_other field in the symbol table entry for PPC64.
+enum {
+ STO_PPC64_LOCAL_BIT = 5,
+ STO_PPC64_LOCAL_MASK = (7 << STO_PPC64_LOCAL_BIT)
+};
+static inline int64_t decodePPC64LocalEntryOffset(unsigned Other) {
+ unsigned Val = (Other & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT;
+ return ((1 << Val) >> 2) << 2;
+}
+static inline unsigned encodePPC64LocalEntryOffset(int64_t Offset) {
+ unsigned Val =
+ (Offset >= 4 * 4 ? (Offset >= 8 * 4 ? (Offset >= 16 * 4 ? 6 : 5) : 4)
+ : (Offset >= 2 * 4 ? 3 : (Offset >= 1 * 4 ? 2 : 0)));
+ return Val << STO_PPC64_LOCAL_BIT;
+}
+
+// ELF Relocation types for PPC64
+enum {
+#include "ELFRelocs/PowerPC64.def"
+};
+
+// ELF Relocation types for AArch64
+enum {
+#include "ELFRelocs/AArch64.def"
+};
+
+// ARM Specific e_flags
+enum : unsigned {
+ EF_ARM_SOFT_FLOAT = 0x00000200U,
+ EF_ARM_VFP_FLOAT = 0x00000400U,
+ EF_ARM_EABI_UNKNOWN = 0x00000000U,
+ EF_ARM_EABI_VER1 = 0x01000000U,
+ EF_ARM_EABI_VER2 = 0x02000000U,
+ EF_ARM_EABI_VER3 = 0x03000000U,
+ EF_ARM_EABI_VER4 = 0x04000000U,
+ EF_ARM_EABI_VER5 = 0x05000000U,
+ EF_ARM_EABIMASK = 0xFF000000U
+};
+
+// ELF Relocation types for ARM
+enum {
+#include "ELFRelocs/ARM.def"
+};
+
+// AVR specific e_flags
+enum : unsigned {
+ EF_AVR_ARCH_AVR1 = 1,
+ EF_AVR_ARCH_AVR2 = 2,
+ EF_AVR_ARCH_AVR25 = 25,
+ EF_AVR_ARCH_AVR3 = 3,
+ EF_AVR_ARCH_AVR31 = 31,
+ EF_AVR_ARCH_AVR35 = 35,
+ EF_AVR_ARCH_AVR4 = 4,
+ EF_AVR_ARCH_AVR5 = 5,
+ EF_AVR_ARCH_AVR51 = 51,
+ EF_AVR_ARCH_AVR6 = 6,
+ EF_AVR_ARCH_AVRTINY = 100,
+ EF_AVR_ARCH_XMEGA1 = 101,
+ EF_AVR_ARCH_XMEGA2 = 102,
+ EF_AVR_ARCH_XMEGA3 = 103,
+ EF_AVR_ARCH_XMEGA4 = 104,
+ EF_AVR_ARCH_XMEGA5 = 105,
+ EF_AVR_ARCH_XMEGA6 = 106,
+ EF_AVR_ARCH_XMEGA7 = 107
+};
+
+// ELF Relocation types for AVR
+enum {
+#include "ELFRelocs/AVR.def"
+};
+
+// Mips Specific e_flags
+enum : unsigned {
+ EF_MIPS_NOREORDER = 0x00000001, // Don't reorder instructions
+ EF_MIPS_PIC = 0x00000002, // Position independent code
+ EF_MIPS_CPIC = 0x00000004, // Call object with Position independent code
+ EF_MIPS_ABI2 = 0x00000020, // File uses N32 ABI
+ EF_MIPS_32BITMODE = 0x00000100, // Code compiled for a 64-bit machine
+ // in 32-bit mode
+ EF_MIPS_FP64 = 0x00000200, // Code compiled for a 32-bit machine
+ // but uses 64-bit FP registers
+ EF_MIPS_NAN2008 = 0x00000400, // Uses IEE 754-2008 NaN encoding
+
+ // ABI flags
+ EF_MIPS_ABI_O32 = 0x00001000, // This file follows the first MIPS 32 bit ABI
+ EF_MIPS_ABI_O64 = 0x00002000, // O32 ABI extended for 64-bit architecture.
+ EF_MIPS_ABI_EABI32 = 0x00003000, // EABI in 32 bit mode.
+ EF_MIPS_ABI_EABI64 = 0x00004000, // EABI in 64 bit mode.
+ EF_MIPS_ABI = 0x0000f000, // Mask for selecting EF_MIPS_ABI_ variant.
+
+ // MIPS machine variant
+ EF_MIPS_MACH_NONE = 0x00000000, // A standard MIPS implementation.
+ EF_MIPS_MACH_3900 = 0x00810000, // Toshiba R3900
+ EF_MIPS_MACH_4010 = 0x00820000, // LSI R4010
+ EF_MIPS_MACH_4100 = 0x00830000, // NEC VR4100
+ EF_MIPS_MACH_4650 = 0x00850000, // MIPS R4650
+ EF_MIPS_MACH_4120 = 0x00870000, // NEC VR4120
+ EF_MIPS_MACH_4111 = 0x00880000, // NEC VR4111/VR4181
+ EF_MIPS_MACH_SB1 = 0x008a0000, // Broadcom SB-1
+ EF_MIPS_MACH_OCTEON = 0x008b0000, // Cavium Networks Octeon
+ EF_MIPS_MACH_XLR = 0x008c0000, // RMI Xlr
+ EF_MIPS_MACH_OCTEON2 = 0x008d0000, // Cavium Networks Octeon2
+ EF_MIPS_MACH_OCTEON3 = 0x008e0000, // Cavium Networks Octeon3
+ EF_MIPS_MACH_5400 = 0x00910000, // NEC VR5400
+ EF_MIPS_MACH_5900 = 0x00920000, // MIPS R5900
+ EF_MIPS_MACH_5500 = 0x00980000, // NEC VR5500
+ EF_MIPS_MACH_9000 = 0x00990000, // Unknown
+ EF_MIPS_MACH_LS2E = 0x00a00000, // ST Microelectronics Loongson 2E
+ EF_MIPS_MACH_LS2F = 0x00a10000, // ST Microelectronics Loongson 2F
+ EF_MIPS_MACH_LS3A = 0x00a20000, // Loongson 3A
+ EF_MIPS_MACH = 0x00ff0000, // EF_MIPS_MACH_xxx selection mask
+
+ // ARCH_ASE
+ EF_MIPS_MICROMIPS = 0x02000000, // microMIPS
+ EF_MIPS_ARCH_ASE_M16 = 0x04000000, // Has Mips-16 ISA extensions
+ EF_MIPS_ARCH_ASE_MDMX = 0x08000000, // Has MDMX multimedia extensions
+ EF_MIPS_ARCH_ASE = 0x0f000000, // Mask for EF_MIPS_ARCH_ASE_xxx flags
+
+ // ARCH
+ EF_MIPS_ARCH_1 = 0x00000000, // MIPS1 instruction set
+ EF_MIPS_ARCH_2 = 0x10000000, // MIPS2 instruction set
+ EF_MIPS_ARCH_3 = 0x20000000, // MIPS3 instruction set
+ EF_MIPS_ARCH_4 = 0x30000000, // MIPS4 instruction set
+ EF_MIPS_ARCH_5 = 0x40000000, // MIPS5 instruction set
+ EF_MIPS_ARCH_32 = 0x50000000, // MIPS32 instruction set per linux not elf.h
+ EF_MIPS_ARCH_64 = 0x60000000, // MIPS64 instruction set per linux not elf.h
+ EF_MIPS_ARCH_32R2 = 0x70000000, // mips32r2, mips32r3, mips32r5
+ EF_MIPS_ARCH_64R2 = 0x80000000, // mips64r2, mips64r3, mips64r5
+ EF_MIPS_ARCH_32R6 = 0x90000000, // mips32r6
+ EF_MIPS_ARCH_64R6 = 0xa0000000, // mips64r6
+ EF_MIPS_ARCH = 0xf0000000 // Mask for applying EF_MIPS_ARCH_ variant
+};
+
+// ELF Relocation types for Mips
+enum {
+#include "ELFRelocs/Mips.def"
+};
+
+// Special values for the st_other field in the symbol table entry for MIPS.
+enum {
+ STO_MIPS_OPTIONAL = 0x04, // Symbol whose definition is optional
+ STO_MIPS_PLT = 0x08, // PLT entry related dynamic table record
+ STO_MIPS_PIC = 0x20, // PIC func in an object mixes PIC/non-PIC
+ STO_MIPS_MICROMIPS = 0x80, // MIPS Specific ISA for MicroMips
+ STO_MIPS_MIPS16 = 0xf0 // MIPS Specific ISA for Mips16
+};
+
+// .MIPS.options section descriptor kinds
+enum {
+ ODK_NULL = 0, // Undefined
+ ODK_REGINFO = 1, // Register usage information
+ ODK_EXCEPTIONS = 2, // Exception processing options
+ ODK_PAD = 3, // Section padding options
+ ODK_HWPATCH = 4, // Hardware patches applied
+ ODK_FILL = 5, // Linker fill value
+ ODK_TAGS = 6, // Space for tool identification
+ ODK_HWAND = 7, // Hardware AND patches applied
+ ODK_HWOR = 8, // Hardware OR patches applied
+ ODK_GP_GROUP = 9, // GP group to use for text/data sections
+ ODK_IDENT = 10, // ID information
+ ODK_PAGESIZE = 11 // Page size information
+};
+
+// Hexagon-specific e_flags
+enum {
+ // Object processor version flags, bits[11:0]
+ EF_HEXAGON_MACH_V2 = 0x00000001, // Hexagon V2
+ EF_HEXAGON_MACH_V3 = 0x00000002, // Hexagon V3
+ EF_HEXAGON_MACH_V4 = 0x00000003, // Hexagon V4
+ EF_HEXAGON_MACH_V5 = 0x00000004, // Hexagon V5
+ EF_HEXAGON_MACH_V55 = 0x00000005, // Hexagon V55
+ EF_HEXAGON_MACH_V60 = 0x00000060, // Hexagon V60
+ EF_HEXAGON_MACH_V62 = 0x00000062, // Hexagon V62
+
+ // Highest ISA version flags
+ EF_HEXAGON_ISA_MACH = 0x00000000, // Same as specified in bits[11:0]
+ // of e_flags
+ EF_HEXAGON_ISA_V2 = 0x00000010, // Hexagon V2 ISA
+ EF_HEXAGON_ISA_V3 = 0x00000020, // Hexagon V3 ISA
+ EF_HEXAGON_ISA_V4 = 0x00000030, // Hexagon V4 ISA
+ EF_HEXAGON_ISA_V5 = 0x00000040, // Hexagon V5 ISA
+ EF_HEXAGON_ISA_V55 = 0x00000050, // Hexagon V55 ISA
+ EF_HEXAGON_ISA_V60 = 0x00000060, // Hexagon V60 ISA
+ EF_HEXAGON_ISA_V62 = 0x00000062, // Hexagon V62 ISA
+};
+
+// Hexagon-specific section indexes for common small data
+enum {
+ SHN_HEXAGON_SCOMMON = 0xff00, // Other access sizes
+ SHN_HEXAGON_SCOMMON_1 = 0xff01, // Byte-sized access
+ SHN_HEXAGON_SCOMMON_2 = 0xff02, // Half-word-sized access
+ SHN_HEXAGON_SCOMMON_4 = 0xff03, // Word-sized access
+ SHN_HEXAGON_SCOMMON_8 = 0xff04 // Double-word-size access
+};
+
+// ELF Relocation types for Hexagon
+enum {
+#include "ELFRelocs/Hexagon.def"
+};
+
+// ELF Relocation type for Lanai.
+enum {
+#include "ELFRelocs/Lanai.def"
+};
+
+// ELF Relocation types for RISC-V
+enum {
+#include "ELFRelocs/RISCV.def"
+};
+
+// ELF Relocation types for S390/zSeries
+enum {
+#include "ELFRelocs/SystemZ.def"
+};
+
+// ELF Relocation type for Sparc.
+enum {
+#include "ELFRelocs/Sparc.def"
+};
+
+// ELF Relocation types for WebAssembly
+enum {
+#include "ELFRelocs/WebAssembly.def"
+};
+
+// ELF Relocation types for AMDGPU
+enum {
+#include "ELFRelocs/AMDGPU.def"
+};
+
+// ELF Relocation types for BPF
+enum {
+#include "ELFRelocs/BPF.def"
+};
+
+#undef ELF_RELOC
+
+// Section header.
+struct Elf32_Shdr {
+ Elf32_Word sh_name; // Section name (index into string table)
+ Elf32_Word sh_type; // Section type (SHT_*)
+ Elf32_Word sh_flags; // Section flags (SHF_*)
+ Elf32_Addr sh_addr; // Address where section is to be loaded
+ Elf32_Off sh_offset; // File offset of section data, in bytes
+ Elf32_Word sh_size; // Size of section, in bytes
+ Elf32_Word sh_link; // Section type-specific header table index link
+ Elf32_Word sh_info; // Section type-specific extra information
+ Elf32_Word sh_addralign; // Section address alignment
+ Elf32_Word sh_entsize; // Size of records contained within the section
+};
+
+// Section header for ELF64 - same fields as ELF32, different types.
+struct Elf64_Shdr {
+ Elf64_Word sh_name;
+ Elf64_Word sh_type;
+ Elf64_Xword sh_flags;
+ Elf64_Addr sh_addr;
+ Elf64_Off sh_offset;
+ Elf64_Xword sh_size;
+ Elf64_Word sh_link;
+ Elf64_Word sh_info;
+ Elf64_Xword sh_addralign;
+ Elf64_Xword sh_entsize;
+};
+
+// Special section indices.
+enum {
+ SHN_UNDEF = 0, // Undefined, missing, irrelevant, or meaningless
+ SHN_LORESERVE = 0xff00, // Lowest reserved index
+ SHN_LOPROC = 0xff00, // Lowest processor-specific index
+ SHN_HIPROC = 0xff1f, // Highest processor-specific index
+ SHN_LOOS = 0xff20, // Lowest operating system-specific index
+ SHN_HIOS = 0xff3f, // Highest operating system-specific index
+ SHN_ABS = 0xfff1, // Symbol has absolute value; does not need relocation
+ SHN_COMMON = 0xfff2, // FORTRAN COMMON or C external global variables
+ SHN_XINDEX = 0xffff, // Mark that the index is >= SHN_LORESERVE
+ SHN_HIRESERVE = 0xffff // Highest reserved index
+};
+
+// Section types.
+enum : unsigned {
+ SHT_NULL = 0, // No associated section (inactive entry).
+ SHT_PROGBITS = 1, // Program-defined contents.
+ SHT_SYMTAB = 2, // Symbol table.
+ SHT_STRTAB = 3, // String table.
+ SHT_RELA = 4, // Relocation entries; explicit addends.
+ SHT_HASH = 5, // Symbol hash table.
+ SHT_DYNAMIC = 6, // Information for dynamic linking.
+ SHT_NOTE = 7, // Information about the file.
+ SHT_NOBITS = 8, // Data occupies no space in the file.
+ SHT_REL = 9, // Relocation entries; no explicit addends.
+ SHT_SHLIB = 10, // Reserved.
+ SHT_DYNSYM = 11, // Symbol table.
+ SHT_INIT_ARRAY = 14, // Pointers to initialization functions.
+ SHT_FINI_ARRAY = 15, // Pointers to termination functions.
+ SHT_PREINIT_ARRAY = 16, // Pointers to pre-init functions.
+ SHT_GROUP = 17, // Section group.
+ SHT_SYMTAB_SHNDX = 18, // Indices for SHN_XINDEX entries.
+ SHT_LOOS = 0x60000000, // Lowest operating system-specific type.
+ SHT_GNU_ATTRIBUTES = 0x6ffffff5, // Object attributes.
+ SHT_GNU_HASH = 0x6ffffff6, // GNU-style hash table.
+ SHT_GNU_verdef = 0x6ffffffd, // GNU version definitions.
+ SHT_GNU_verneed = 0x6ffffffe, // GNU version references.
+ SHT_GNU_versym = 0x6fffffff, // GNU symbol versions table.
+ SHT_HIOS = 0x6fffffff, // Highest operating system-specific type.
+ SHT_LOPROC = 0x70000000, // Lowest processor arch-specific type.
+ // Fixme: All this is duplicated in MCSectionELF. Why??
+ // Exception Index table
+ SHT_ARM_EXIDX = 0x70000001U,
+ // BPABI DLL dynamic linking pre-emption map
+ SHT_ARM_PREEMPTMAP = 0x70000002U,
+ // Object file compatibility attributes
+ SHT_ARM_ATTRIBUTES = 0x70000003U,
+ SHT_ARM_DEBUGOVERLAY = 0x70000004U,
+ SHT_ARM_OVERLAYSECTION = 0x70000005U,
+ SHT_HEX_ORDERED = 0x70000000, // Link editor is to sort the entries in
+ // this section based on their sizes
+ SHT_X86_64_UNWIND = 0x70000001, // Unwind information
+
+ SHT_MIPS_REGINFO = 0x70000006, // Register usage information
+ SHT_MIPS_OPTIONS = 0x7000000d, // General options
+ SHT_MIPS_DWARF = 0x7000001e, // DWARF debugging section.
+ SHT_MIPS_ABIFLAGS = 0x7000002a, // ABI information.
+
+ SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type.
+ SHT_LOUSER = 0x80000000, // Lowest type reserved for applications.
+ SHT_HIUSER = 0xffffffff // Highest type reserved for applications.
+};
+
+// Section flags.
+enum : unsigned {
+ // Section data should be writable during execution.
+ SHF_WRITE = 0x1,
+
+ // Section occupies memory during program execution.
+ SHF_ALLOC = 0x2,
+
+ // Section contains executable machine instructions.
+ SHF_EXECINSTR = 0x4,
+
+ // The data in this section may be merged.
+ SHF_MERGE = 0x10,
+
+ // The data in this section is null-terminated strings.
+ SHF_STRINGS = 0x20,
+
+ // A field in this section holds a section header table index.
+ SHF_INFO_LINK = 0x40U,
+
+ // Adds special ordering requirements for link editors.
+ SHF_LINK_ORDER = 0x80U,
+
+ // This section requires special OS-specific processing to avoid incorrect
+ // behavior.
+ SHF_OS_NONCONFORMING = 0x100U,
+
+ // This section is a member of a section group.
+ SHF_GROUP = 0x200U,
+
+ // This section holds Thread-Local Storage.
+ SHF_TLS = 0x400U,
+
+ // Identifies a section containing compressed data.
+ SHF_COMPRESSED = 0x800U,
+
+ // This section is excluded from the final executable or shared library.
+ SHF_EXCLUDE = 0x80000000U,
+
+ // Start of target-specific flags.
+
+ SHF_MASKOS = 0x0ff00000,
+
+ // Bits indicating processor-specific flags.
+ SHF_MASKPROC = 0xf0000000,
+
+ /// All sections with the "d" flag are grouped together by the linker to form
+ /// the data section and the dp register is set to the start of the section by
+ /// the boot code.
+ XCORE_SHF_DP_SECTION = 0x10000000,
+
+ /// All sections with the "c" flag are grouped together by the linker to form
+ /// the constant pool and the cp register is set to the start of the constant
+ /// pool by the boot code.
+ XCORE_SHF_CP_SECTION = 0x20000000,
+
+ // If an object file section does not have this flag set, then it may not hold
+ // more than 2GB and can be freely referred to in objects using smaller code
+ // models. Otherwise, only objects using larger code models can refer to them.
+ // For example, a medium code model object can refer to data in a section that
+ // sets this flag besides being able to refer to data in a section that does
+ // not set it; likewise, a small code model object can refer only to code in a
+ // section that does not set this flag.
+ SHF_X86_64_LARGE = 0x10000000,
+
+ // All sections with the GPREL flag are grouped into a global data area
+ // for faster accesses
+ SHF_HEX_GPREL = 0x10000000,
+
+ // Section contains text/data which may be replicated in other sections.
+ // Linker must retain only one copy.
+ SHF_MIPS_NODUPES = 0x01000000,
+
+ // Linker must generate implicit hidden weak names.
+ SHF_MIPS_NAMES = 0x02000000,
+
+ // Section data local to process.
+ SHF_MIPS_LOCAL = 0x04000000,
+
+ // Do not strip this section.
+ SHF_MIPS_NOSTRIP = 0x08000000,
+
+ // Section must be part of global data area.
+ SHF_MIPS_GPREL = 0x10000000,
+
+ // This section should be merged.
+ SHF_MIPS_MERGE = 0x20000000,
+
+ // Address size to be inferred from section entry size.
+ SHF_MIPS_ADDR = 0x40000000,
+
+ // Section data is string data by default.
+ SHF_MIPS_STRING = 0x80000000,
+
+ // Make code section unreadable when in execute-only mode
+ SHF_ARM_PURECODE = 0x20000000
+};
+
+// Section Group Flags
+enum : unsigned {
+ GRP_COMDAT = 0x1,
+ GRP_MASKOS = 0x0ff00000,
+ GRP_MASKPROC = 0xf0000000
+};
+
+// Symbol table entries for ELF32.
+struct Elf32_Sym {
+ Elf32_Word st_name; // Symbol name (index into string table)
+ Elf32_Addr st_value; // Value or address associated with the symbol
+ Elf32_Word st_size; // Size of the symbol
+ unsigned char st_info; // Symbol's type and binding attributes
+ unsigned char st_other; // Must be zero; reserved
+ Elf32_Half st_shndx; // Which section (header table index) it's defined in
+
+ // These accessors and mutators correspond to the ELF32_ST_BIND,
+ // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
+ unsigned char getBinding() const { return st_info >> 4; }
+ unsigned char getType() const { return st_info & 0x0f; }
+ void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
+ void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
+ void setBindingAndType(unsigned char b, unsigned char t) {
+ st_info = (b << 4) + (t & 0x0f);
+ }
+};
+
+// Symbol table entries for ELF64.
+struct Elf64_Sym {
+ Elf64_Word st_name; // Symbol name (index into string table)
+ unsigned char st_info; // Symbol's type and binding attributes
+ unsigned char st_other; // Must be zero; reserved
+ Elf64_Half st_shndx; // Which section (header tbl index) it's defined in
+ Elf64_Addr st_value; // Value or address associated with the symbol
+ Elf64_Xword st_size; // Size of the symbol
+
+ // These accessors and mutators are identical to those defined for ELF32
+ // symbol table entries.
+ unsigned char getBinding() const { return st_info >> 4; }
+ unsigned char getType() const { return st_info & 0x0f; }
+ void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
+ void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
+ void setBindingAndType(unsigned char b, unsigned char t) {
+ st_info = (b << 4) + (t & 0x0f);
+ }
+};
+
+// The size (in bytes) of symbol table entries.
+enum {
+ SYMENTRY_SIZE32 = 16, // 32-bit symbol entry size
+ SYMENTRY_SIZE64 = 24 // 64-bit symbol entry size.
+};
+
+// Symbol bindings.
+enum {
+ STB_LOCAL = 0, // Local symbol, not visible outside obj file containing def
+ STB_GLOBAL = 1, // Global symbol, visible to all object files being combined
+ STB_WEAK = 2, // Weak symbol, like global but lower-precedence
+ STB_GNU_UNIQUE = 10,
+ STB_LOOS = 10, // Lowest operating system-specific binding type
+ STB_HIOS = 12, // Highest operating system-specific binding type
+ STB_LOPROC = 13, // Lowest processor-specific binding type
+ STB_HIPROC = 15 // Highest processor-specific binding type
+};
+
+// Symbol types.
+enum {
+ STT_NOTYPE = 0, // Symbol's type is not specified
+ STT_OBJECT = 1, // Symbol is a data object (variable, array, etc.)
+ STT_FUNC = 2, // Symbol is executable code (function, etc.)
+ STT_SECTION = 3, // Symbol refers to a section
+ STT_FILE = 4, // Local, absolute symbol that refers to a file
+ STT_COMMON = 5, // An uninitialized common block
+ STT_TLS = 6, // Thread local data object
+ STT_GNU_IFUNC = 10, // GNU indirect function
+ STT_LOOS = 10, // Lowest operating system-specific symbol type
+ STT_HIOS = 12, // Highest operating system-specific symbol type
+ STT_LOPROC = 13, // Lowest processor-specific symbol type
+ STT_HIPROC = 15, // Highest processor-specific symbol type
+
+ // AMDGPU symbol types
+ STT_AMDGPU_HSA_KERNEL = 10
+};
+
+enum {
+ STV_DEFAULT = 0, // Visibility is specified by binding type
+ STV_INTERNAL = 1, // Defined by processor supplements
+ STV_HIDDEN = 2, // Not visible to other components
+ STV_PROTECTED = 3 // Visible in other components but not preemptable
+};
+
+// Symbol number.
+enum { STN_UNDEF = 0 };
+
+// Special relocation symbols used in the MIPS64 ELF relocation entries
+enum {
+ RSS_UNDEF = 0, // None
+ RSS_GP = 1, // Value of gp
+ RSS_GP0 = 2, // Value of gp used to create object being relocated
+ RSS_LOC = 3 // Address of location being relocated
+};
+
+// Relocation entry, without explicit addend.
+struct Elf32_Rel {
+ Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
+ Elf32_Word r_info; // Symbol table index and type of relocation to apply
+
+ // These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE,
+ // and ELF32_R_INFO macros defined in the ELF specification:
+ Elf32_Word getSymbol() const { return (r_info >> 8); }
+ unsigned char getType() const { return (unsigned char)(r_info & 0x0ff); }
+ void setSymbol(Elf32_Word s) { setSymbolAndType(s, getType()); }
+ void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); }
+ void setSymbolAndType(Elf32_Word s, unsigned char t) {
+ r_info = (s << 8) + t;
+ }
+};
+
+// Relocation entry with explicit addend.
+struct Elf32_Rela {
+ Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
+ Elf32_Word r_info; // Symbol table index and type of relocation to apply
+ Elf32_Sword r_addend; // Compute value for relocatable field by adding this
+
+ // These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE,
+ // and ELF32_R_INFO macros defined in the ELF specification:
+ Elf32_Word getSymbol() const { return (r_info >> 8); }
+ unsigned char getType() const { return (unsigned char)(r_info & 0x0ff); }
+ void setSymbol(Elf32_Word s) { setSymbolAndType(s, getType()); }
+ void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); }
+ void setSymbolAndType(Elf32_Word s, unsigned char t) {
+ r_info = (s << 8) + t;
+ }
+};
+
+// Relocation entry, without explicit addend.
+struct Elf64_Rel {
+ Elf64_Addr r_offset; // Location (file byte offset, or program virtual addr).
+ Elf64_Xword r_info; // Symbol table index and type of relocation to apply.
+
+ // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,
+ // and ELF64_R_INFO macros defined in the ELF specification:
+ Elf64_Word getSymbol() const { return (r_info >> 32); }
+ Elf64_Word getType() const { return (Elf64_Word)(r_info & 0xffffffffL); }
+ void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); }
+ void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); }
+ void setSymbolAndType(Elf64_Word s, Elf64_Word t) {
+ r_info = ((Elf64_Xword)s << 32) + (t & 0xffffffffL);
+ }
+};
+
+// Relocation entry with explicit addend.
+struct Elf64_Rela {
+ Elf64_Addr r_offset; // Location (file byte offset, or program virtual addr).
+ Elf64_Xword r_info; // Symbol table index and type of relocation to apply.
+ Elf64_Sxword r_addend; // Compute value for relocatable field by adding this.
+
+ // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,
+ // and ELF64_R_INFO macros defined in the ELF specification:
+ Elf64_Word getSymbol() const { return (r_info >> 32); }
+ Elf64_Word getType() const { return (Elf64_Word)(r_info & 0xffffffffL); }
+ void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); }
+ void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); }
+ void setSymbolAndType(Elf64_Word s, Elf64_Word t) {
+ r_info = ((Elf64_Xword)s << 32) + (t & 0xffffffffL);
+ }
+};
+
+// Program header for ELF32.
+struct Elf32_Phdr {
+ Elf32_Word p_type; // Type of segment
+ Elf32_Off p_offset; // File offset where segment is located, in bytes
+ Elf32_Addr p_vaddr; // Virtual address of beginning of segment
+ Elf32_Addr p_paddr; // Physical address of beginning of segment (OS-specific)
+ Elf32_Word p_filesz; // Num. of bytes in file image of segment (may be zero)
+ Elf32_Word p_memsz; // Num. of bytes in mem image of segment (may be zero)
+ Elf32_Word p_flags; // Segment flags
+ Elf32_Word p_align; // Segment alignment constraint
+};
+
+// Program header for ELF64.
+struct Elf64_Phdr {
+ Elf64_Word p_type; // Type of segment
+ Elf64_Word p_flags; // Segment flags
+ Elf64_Off p_offset; // File offset where segment is located, in bytes
+ Elf64_Addr p_vaddr; // Virtual address of beginning of segment
+ Elf64_Addr p_paddr; // Physical addr of beginning of segment (OS-specific)
+ Elf64_Xword p_filesz; // Num. of bytes in file image of segment (may be zero)
+ Elf64_Xword p_memsz; // Num. of bytes in mem image of segment (may be zero)
+ Elf64_Xword p_align; // Segment alignment constraint
+};
+
+// Segment types.
+enum {
+ PT_NULL = 0, // Unused segment.
+ PT_LOAD = 1, // Loadable segment.
+ PT_DYNAMIC = 2, // Dynamic linking information.
+ PT_INTERP = 3, // Interpreter pathname.
+ PT_NOTE = 4, // Auxiliary information.
+ PT_SHLIB = 5, // Reserved.
+ PT_PHDR = 6, // The program header table itself.
+ PT_TLS = 7, // The thread-local storage template.
+ PT_LOOS = 0x60000000, // Lowest operating system-specific pt entry type.
+ PT_HIOS = 0x6fffffff, // Highest operating system-specific pt entry type.
+ PT_LOPROC = 0x70000000, // Lowest processor-specific program hdr entry type.
+ PT_HIPROC = 0x7fffffff, // Highest processor-specific program hdr entry type.
+
+ // x86-64 program header types.
+ // These all contain stack unwind tables.
+ PT_GNU_EH_FRAME = 0x6474e550,
+ PT_SUNW_EH_FRAME = 0x6474e550,
+ PT_SUNW_UNWIND = 0x6464e550,
+
+ PT_GNU_STACK = 0x6474e551, // Indicates stack executability.
+ PT_GNU_RELRO = 0x6474e552, // Read-only after relocation.
+
+ PT_OPENBSD_RANDOMIZE = 0x65a3dbe6, // Fill with random data.
+ PT_OPENBSD_WXNEEDED = 0x65a3dbe7, // Program does W^X violations.
+ PT_OPENBSD_BOOTDATA = 0x65a41be6, // Section for boot arguments.
+
+ // ARM program header types.
+ PT_ARM_ARCHEXT = 0x70000000, // Platform architecture compatibility info
+ // These all contain stack unwind tables.
+ PT_ARM_EXIDX = 0x70000001,
+ PT_ARM_UNWIND = 0x70000001,
+
+ // MIPS program header types.
+ PT_MIPS_REGINFO = 0x70000000, // Register usage information.
+ PT_MIPS_RTPROC = 0x70000001, // Runtime procedure table.
+ PT_MIPS_OPTIONS = 0x70000002, // Options segment.
+ PT_MIPS_ABIFLAGS = 0x70000003, // Abiflags segment.
+
+ // WebAssembly program header types.
+ PT_WEBASSEMBLY_FUNCTIONS = PT_LOPROC + 0, // Function definitions.
+};
+
+// Segment flag bits.
+enum : unsigned {
+ PF_X = 1, // Execute
+ PF_W = 2, // Write
+ PF_R = 4, // Read
+ PF_MASKOS = 0x0ff00000, // Bits for operating system-specific semantics.
+ PF_MASKPROC = 0xf0000000 // Bits for processor-specific semantics.
+};
+
+// Dynamic table entry for ELF32.
+struct Elf32_Dyn {
+ Elf32_Sword d_tag; // Type of dynamic table entry.
+ union {
+ Elf32_Word d_val; // Integer value of entry.
+ Elf32_Addr d_ptr; // Pointer value of entry.
+ } d_un;
+};
+
+// Dynamic table entry for ELF64.
+struct Elf64_Dyn {
+ Elf64_Sxword d_tag; // Type of dynamic table entry.
+ union {
+ Elf64_Xword d_val; // Integer value of entry.
+ Elf64_Addr d_ptr; // Pointer value of entry.
+ } d_un;
+};
+
+// Dynamic table entry tags.
+enum {
+ DT_NULL = 0, // Marks end of dynamic array.
+ DT_NEEDED = 1, // String table offset of needed library.
+ DT_PLTRELSZ = 2, // Size of relocation entries in PLT.
+ DT_PLTGOT = 3, // Address associated with linkage table.
+ DT_HASH = 4, // Address of symbolic hash table.
+ DT_STRTAB = 5, // Address of dynamic string table.
+ DT_SYMTAB = 6, // Address of dynamic symbol table.
+ DT_RELA = 7, // Address of relocation table (Rela entries).
+ DT_RELASZ = 8, // Size of Rela relocation table.
+ DT_RELAENT = 9, // Size of a Rela relocation entry.
+ DT_STRSZ = 10, // Total size of the string table.
+ DT_SYMENT = 11, // Size of a symbol table entry.
+ DT_INIT = 12, // Address of initialization function.
+ DT_FINI = 13, // Address of termination function.
+ DT_SONAME = 14, // String table offset of a shared objects name.
+ DT_RPATH = 15, // String table offset of library search path.
+ DT_SYMBOLIC = 16, // Changes symbol resolution algorithm.
+ DT_REL = 17, // Address of relocation table (Rel entries).
+ DT_RELSZ = 18, // Size of Rel relocation table.
+ DT_RELENT = 19, // Size of a Rel relocation entry.
+ DT_PLTREL = 20, // Type of relocation entry used for linking.
+ DT_DEBUG = 21, // Reserved for debugger.
+ DT_TEXTREL = 22, // Relocations exist for non-writable segments.
+ DT_JMPREL = 23, // Address of relocations associated with PLT.
+ DT_BIND_NOW = 24, // Process all relocations before execution.
+ DT_INIT_ARRAY = 25, // Pointer to array of initialization functions.
+ DT_FINI_ARRAY = 26, // Pointer to array of termination functions.
+ DT_INIT_ARRAYSZ = 27, // Size of DT_INIT_ARRAY.
+ DT_FINI_ARRAYSZ = 28, // Size of DT_FINI_ARRAY.
+ DT_RUNPATH = 29, // String table offset of lib search path.
+ DT_FLAGS = 30, // Flags.
+ DT_ENCODING = 32, // Values from here to DT_LOOS follow the rules
+ // for the interpretation of the d_un union.
+
+ DT_PREINIT_ARRAY = 32, // Pointer to array of preinit functions.
+ DT_PREINIT_ARRAYSZ = 33, // Size of the DT_PREINIT_ARRAY array.
+
+ DT_LOOS = 0x60000000, // Start of environment specific tags.
+ DT_HIOS = 0x6FFFFFFF, // End of environment specific tags.
+ DT_LOPROC = 0x70000000, // Start of processor specific tags.
+ DT_HIPROC = 0x7FFFFFFF, // End of processor specific tags.
+
+ DT_GNU_HASH = 0x6FFFFEF5, // Reference to the GNU hash table.
+ DT_TLSDESC_PLT =
+ 0x6FFFFEF6, // Location of PLT entry for TLS descriptor resolver calls.
+ DT_TLSDESC_GOT = 0x6FFFFEF7, // Location of GOT entry used by TLS descriptor
+ // resolver PLT entry.
+ DT_RELACOUNT = 0x6FFFFFF9, // ELF32_Rela count.
+ DT_RELCOUNT = 0x6FFFFFFA, // ELF32_Rel count.
+
+ DT_FLAGS_1 = 0X6FFFFFFB, // Flags_1.
+ DT_VERSYM = 0x6FFFFFF0, // The address of .gnu.version section.
+ DT_VERDEF = 0X6FFFFFFC, // The address of the version definition table.
+ DT_VERDEFNUM = 0X6FFFFFFD, // The number of entries in DT_VERDEF.
+ DT_VERNEED = 0X6FFFFFFE, // The address of the version Dependency table.
+ DT_VERNEEDNUM = 0X6FFFFFFF, // The number of entries in DT_VERNEED.
+
+ // Hexagon specific dynamic table entries
+ DT_HEXAGON_SYMSZ = 0x70000000,
+ DT_HEXAGON_VER = 0x70000001,
+ DT_HEXAGON_PLT = 0x70000002,
+
+ // Mips specific dynamic table entry tags.
+ DT_MIPS_RLD_VERSION = 0x70000001, // 32 bit version number for runtime
+ // linker interface.
+ DT_MIPS_TIME_STAMP = 0x70000002, // Time stamp.
+ DT_MIPS_ICHECKSUM = 0x70000003, // Checksum of external strings
+ // and common sizes.
+ DT_MIPS_IVERSION = 0x70000004, // Index of version string
+ // in string table.
+ DT_MIPS_FLAGS = 0x70000005, // 32 bits of flags.
+ DT_MIPS_BASE_ADDRESS = 0x70000006, // Base address of the segment.
+ DT_MIPS_MSYM = 0x70000007, // Address of .msym section.
+ DT_MIPS_CONFLICT = 0x70000008, // Address of .conflict section.
+ DT_MIPS_LIBLIST = 0x70000009, // Address of .liblist section.
+ DT_MIPS_LOCAL_GOTNO = 0x7000000a, // Number of local global offset
+ // table entries.
+ DT_MIPS_CONFLICTNO = 0x7000000b, // Number of entries
+ // in the .conflict section.
+ DT_MIPS_LIBLISTNO = 0x70000010, // Number of entries
+ // in the .liblist section.
+ DT_MIPS_SYMTABNO = 0x70000011, // Number of entries
+ // in the .dynsym section.
+ DT_MIPS_UNREFEXTNO = 0x70000012, // Index of first external dynamic symbol
+ // not referenced locally.
+ DT_MIPS_GOTSYM = 0x70000013, // Index of first dynamic symbol
+ // in global offset table.
+ DT_MIPS_HIPAGENO = 0x70000014, // Number of page table entries
+ // in global offset table.
+ DT_MIPS_RLD_MAP = 0x70000016, // Address of run time loader map,
+ // used for debugging.
+ DT_MIPS_DELTA_CLASS = 0x70000017, // Delta C++ class definition.
+ DT_MIPS_DELTA_CLASS_NO = 0x70000018, // Number of entries
+ // in DT_MIPS_DELTA_CLASS.
+ DT_MIPS_DELTA_INSTANCE = 0x70000019, // Delta C++ class instances.
+ DT_MIPS_DELTA_INSTANCE_NO = 0x7000001A, // Number of entries
+ // in DT_MIPS_DELTA_INSTANCE.
+ DT_MIPS_DELTA_RELOC = 0x7000001B, // Delta relocations.
+ DT_MIPS_DELTA_RELOC_NO = 0x7000001C, // Number of entries
+ // in DT_MIPS_DELTA_RELOC.
+ DT_MIPS_DELTA_SYM = 0x7000001D, // Delta symbols that Delta
+ // relocations refer to.
+ DT_MIPS_DELTA_SYM_NO = 0x7000001E, // Number of entries
+ // in DT_MIPS_DELTA_SYM.
+ DT_MIPS_DELTA_CLASSSYM = 0x70000020, // Delta symbols that hold
+ // class declarations.
+ DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021, // Number of entries
+ // in DT_MIPS_DELTA_CLASSSYM.
+ DT_MIPS_CXX_FLAGS = 0x70000022, // Flags indicating information
+ // about C++ flavor.
+ DT_MIPS_PIXIE_INIT = 0x70000023, // Pixie information.
+ DT_MIPS_SYMBOL_LIB = 0x70000024, // Address of .MIPS.symlib
+ DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025, // The GOT index of the first PTE
+ // for a segment
+ DT_MIPS_LOCAL_GOTIDX = 0x70000026, // The GOT index of the first PTE
+ // for a local symbol
+ DT_MIPS_HIDDEN_GOTIDX = 0x70000027, // The GOT index of the first PTE
+ // for a hidden symbol
+ DT_MIPS_PROTECTED_GOTIDX = 0x70000028, // The GOT index of the first PTE
+ // for a protected symbol
+ DT_MIPS_OPTIONS = 0x70000029, // Address of `.MIPS.options'.
+ DT_MIPS_INTERFACE = 0x7000002A, // Address of `.interface'.
+ DT_MIPS_DYNSTR_ALIGN = 0x7000002B, // Unknown.
+ DT_MIPS_INTERFACE_SIZE = 0x7000002C, // Size of the .interface section.
+ DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002D, // Size of rld_text_resolve
+ // function stored in the GOT.
+ DT_MIPS_PERF_SUFFIX = 0x7000002E, // Default suffix of DSO to be added
+ // by rld on dlopen() calls.
+ DT_MIPS_COMPACT_SIZE = 0x7000002F, // Size of compact relocation
+ // section (O32).
+ DT_MIPS_GP_VALUE = 0x70000030, // GP value for auxiliary GOTs.
+ DT_MIPS_AUX_DYNAMIC = 0x70000031, // Address of auxiliary .dynamic.
+ DT_MIPS_PLTGOT = 0x70000032, // Address of the base of the PLTGOT.
+ DT_MIPS_RWPLT = 0x70000034, // Points to the base
+ // of a writable PLT.
+ DT_MIPS_RLD_MAP_REL = 0x70000035, // Relative offset of run time loader
+ // map, used for debugging.
+
+ // Sun machine-independent extensions.
+ DT_AUXILIARY = 0x7FFFFFFD, // Shared object to load before self
+ DT_FILTER = 0x7FFFFFFF // Shared object to get values from
+};
+
+// DT_FLAGS values.
+enum {
+ DF_ORIGIN = 0x01, // The object may reference $ORIGIN.
+ DF_SYMBOLIC = 0x02, // Search the shared lib before searching the exe.
+ DF_TEXTREL = 0x04, // Relocations may modify a non-writable segment.
+ DF_BIND_NOW = 0x08, // Process all relocations on load.
+ DF_STATIC_TLS = 0x10 // Reject attempts to load dynamically.
+};
+
+// State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 entry.
+enum {
+ DF_1_NOW = 0x00000001, // Set RTLD_NOW for this object.
+ DF_1_GLOBAL = 0x00000002, // Set RTLD_GLOBAL for this object.
+ DF_1_GROUP = 0x00000004, // Set RTLD_GROUP for this object.
+ DF_1_NODELETE = 0x00000008, // Set RTLD_NODELETE for this object.
+ DF_1_LOADFLTR = 0x00000010, // Trigger filtee loading at runtime.
+ DF_1_INITFIRST = 0x00000020, // Set RTLD_INITFIRST for this object.
+ DF_1_NOOPEN = 0x00000040, // Set RTLD_NOOPEN for this object.
+ DF_1_ORIGIN = 0x00000080, // $ORIGIN must be handled.
+ DF_1_DIRECT = 0x00000100, // Direct binding enabled.
+ DF_1_TRANS = 0x00000200,
+ DF_1_INTERPOSE = 0x00000400, // Object is used to interpose.
+ DF_1_NODEFLIB = 0x00000800, // Ignore default lib search path.
+ DF_1_NODUMP = 0x00001000, // Object can't be dldump'ed.
+ DF_1_CONFALT = 0x00002000, // Configuration alternative created.
+ DF_1_ENDFILTEE = 0x00004000, // Filtee terminates filters search.
+ DF_1_DISPRELDNE = 0x00008000, // Disp reloc applied at build time.
+ DF_1_DISPRELPND = 0x00010000, // Disp reloc applied at run-time.
+ DF_1_NODIRECT = 0x00020000, // Object has no-direct binding.
+ DF_1_IGNMULDEF = 0x00040000,
+ DF_1_NOKSYMS = 0x00080000,
+ DF_1_NOHDR = 0x00100000,
+ DF_1_EDITED = 0x00200000, // Object is modified after built.
+ DF_1_NORELOC = 0x00400000,
+ DF_1_SYMINTPOSE = 0x00800000, // Object has individual interposers.
+ DF_1_GLOBAUDIT = 0x01000000, // Global auditing required.
+ DF_1_SINGLETON = 0x02000000 // Singleton symbols are used.
+};
+
+// DT_MIPS_FLAGS values.
+enum {
+ RHF_NONE = 0x00000000, // No flags.
+ RHF_QUICKSTART = 0x00000001, // Uses shortcut pointers.
+ RHF_NOTPOT = 0x00000002, // Hash size is not a power of two.
+ RHS_NO_LIBRARY_REPLACEMENT = 0x00000004, // Ignore LD_LIBRARY_PATH.
+ RHF_NO_MOVE = 0x00000008, // DSO address may not be relocated.
+ RHF_SGI_ONLY = 0x00000010, // SGI specific features.
+ RHF_GUARANTEE_INIT = 0x00000020, // Guarantee that .init will finish
+ // executing before any non-init
+ // code in DSO is called.
+ RHF_DELTA_C_PLUS_PLUS = 0x00000040, // Contains Delta C++ code.
+ RHF_GUARANTEE_START_INIT = 0x00000080, // Guarantee that .init will start
+ // executing before any non-init
+ // code in DSO is called.
+ RHF_PIXIE = 0x00000100, // Generated by pixie.
+ RHF_DEFAULT_DELAY_LOAD = 0x00000200, // Delay-load DSO by default.
+ RHF_REQUICKSTART = 0x00000400, // Object may be requickstarted
+ RHF_REQUICKSTARTED = 0x00000800, // Object has been requickstarted
+ RHF_CORD = 0x00001000, // Generated by cord.
+ RHF_NO_UNRES_UNDEF = 0x00002000, // Object contains no unresolved
+ // undef symbols.
+ RHF_RLD_ORDER_SAFE = 0x00004000 // Symbol table is in a safe order.
+};
+
+// ElfXX_VerDef structure version (GNU versioning)
+enum { VER_DEF_NONE = 0, VER_DEF_CURRENT = 1 };
+
+// VerDef Flags (ElfXX_VerDef::vd_flags)
+enum { VER_FLG_BASE = 0x1, VER_FLG_WEAK = 0x2, VER_FLG_INFO = 0x4 };
+
+// Special constants for the version table. (SHT_GNU_versym/.gnu.version)
+enum {
+ VER_NDX_LOCAL = 0, // Unversioned local symbol
+ VER_NDX_GLOBAL = 1, // Unversioned global symbol
+ VERSYM_VERSION = 0x7fff, // Version Index mask
+ VERSYM_HIDDEN = 0x8000 // Hidden bit (non-default version)
+};
+
+// ElfXX_VerNeed structure version (GNU versioning)
+enum { VER_NEED_NONE = 0, VER_NEED_CURRENT = 1 };
+
+// SHT_NOTE section types
+enum {
+ NT_FREEBSD_THRMISC = 7,
+ NT_FREEBSD_PROCSTAT_PROC = 8,
+ NT_FREEBSD_PROCSTAT_FILES = 9,
+ NT_FREEBSD_PROCSTAT_VMMAP = 10,
+ NT_FREEBSD_PROCSTAT_GROUPS = 11,
+ NT_FREEBSD_PROCSTAT_UMASK = 12,
+ NT_FREEBSD_PROCSTAT_RLIMIT = 13,
+ NT_FREEBSD_PROCSTAT_OSREL = 14,
+ NT_FREEBSD_PROCSTAT_PSSTRINGS = 15,
+ NT_FREEBSD_PROCSTAT_AUXV = 16,
+};
+
+enum {
+ NT_GNU_ABI_TAG = 1,
+ NT_GNU_HWCAP = 2,
+ NT_GNU_BUILD_ID = 3,
+ NT_GNU_GOLD_VERSION = 4,
+};
+
+enum {
+ GNU_ABI_TAG_LINUX = 0,
+ GNU_ABI_TAG_HURD = 1,
+ GNU_ABI_TAG_SOLARIS = 2,
+ GNU_ABI_TAG_FREEBSD = 3,
+ GNU_ABI_TAG_NETBSD = 4,
+ GNU_ABI_TAG_SYLLABLE = 5,
+ GNU_ABI_TAG_NACL = 6,
+};
+
+// Compressed section header for ELF32.
+struct Elf32_Chdr {
+ Elf32_Word ch_type;
+ Elf32_Word ch_size;
+ Elf32_Word ch_addralign;
+};
+
+// Compressed section header for ELF64.
+struct Elf64_Chdr {
+ Elf64_Word ch_type;
+ Elf64_Word ch_reserved;
+ Elf64_Xword ch_size;
+ Elf64_Xword ch_addralign;
+};
+
+// Legal values for ch_type field of compressed section header.
+enum {
+ ELFCOMPRESS_ZLIB = 1, // ZLIB/DEFLATE algorithm.
+ ELFCOMPRESS_LOOS = 0x60000000, // Start of OS-specific.
+ ELFCOMPRESS_HIOS = 0x6fffffff, // End of OS-specific.
+ ELFCOMPRESS_LOPROC = 0x70000000, // Start of processor-specific.
+ ELFCOMPRESS_HIPROC = 0x7fffffff // End of processor-specific.
+};
+
+} // end namespace ELF
+
+} // end namespace llvm
+
+#endif
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AArch64.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AArch64.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AArch64.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AArch64.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,218 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+// Based on ABI release 1.1-beta, dated 6 November 2013. NB: The cover page of
+// this document, IHI0056C_beta_aaelf64.pdf, on infocenter.arm.com, still
+// labels this as release 1.0.
+ELF_RELOC(R_AARCH64_NONE, 0)
+ELF_RELOC(R_AARCH64_ABS64, 0x101)
+ELF_RELOC(R_AARCH64_ABS32, 0x102)
+ELF_RELOC(R_AARCH64_ABS16, 0x103)
+ELF_RELOC(R_AARCH64_PREL64, 0x104)
+ELF_RELOC(R_AARCH64_PREL32, 0x105)
+ELF_RELOC(R_AARCH64_PREL16, 0x106)
+ELF_RELOC(R_AARCH64_MOVW_UABS_G0, 0x107)
+ELF_RELOC(R_AARCH64_MOVW_UABS_G0_NC, 0x108)
+ELF_RELOC(R_AARCH64_MOVW_UABS_G1, 0x109)
+ELF_RELOC(R_AARCH64_MOVW_UABS_G1_NC, 0x10a)
+ELF_RELOC(R_AARCH64_MOVW_UABS_G2, 0x10b)
+ELF_RELOC(R_AARCH64_MOVW_UABS_G2_NC, 0x10c)
+ELF_RELOC(R_AARCH64_MOVW_UABS_G3, 0x10d)
+ELF_RELOC(R_AARCH64_MOVW_SABS_G0, 0x10e)
+ELF_RELOC(R_AARCH64_MOVW_SABS_G1, 0x10f)
+ELF_RELOC(R_AARCH64_MOVW_SABS_G2, 0x110)
+ELF_RELOC(R_AARCH64_LD_PREL_LO19, 0x111)
+ELF_RELOC(R_AARCH64_ADR_PREL_LO21, 0x112)
+ELF_RELOC(R_AARCH64_ADR_PREL_PG_HI21, 0x113)
+ELF_RELOC(R_AARCH64_ADR_PREL_PG_HI21_NC, 0x114)
+ELF_RELOC(R_AARCH64_ADD_ABS_LO12_NC, 0x115)
+ELF_RELOC(R_AARCH64_LDST8_ABS_LO12_NC, 0x116)
+ELF_RELOC(R_AARCH64_TSTBR14, 0x117)
+ELF_RELOC(R_AARCH64_CONDBR19, 0x118)
+ELF_RELOC(R_AARCH64_JUMP26, 0x11a)
+ELF_RELOC(R_AARCH64_CALL26, 0x11b)
+ELF_RELOC(R_AARCH64_LDST16_ABS_LO12_NC, 0x11c)
+ELF_RELOC(R_AARCH64_LDST32_ABS_LO12_NC, 0x11d)
+ELF_RELOC(R_AARCH64_LDST64_ABS_LO12_NC, 0x11e)
+ELF_RELOC(R_AARCH64_MOVW_PREL_G0, 0x11f)
+ELF_RELOC(R_AARCH64_MOVW_PREL_G0_NC, 0x120)
+ELF_RELOC(R_AARCH64_MOVW_PREL_G1, 0x121)
+ELF_RELOC(R_AARCH64_MOVW_PREL_G1_NC, 0x122)
+ELF_RELOC(R_AARCH64_MOVW_PREL_G2, 0x123)
+ELF_RELOC(R_AARCH64_MOVW_PREL_G2_NC, 0x124)
+ELF_RELOC(R_AARCH64_MOVW_PREL_G3, 0x125)
+ELF_RELOC(R_AARCH64_LDST128_ABS_LO12_NC, 0x12b)
+ELF_RELOC(R_AARCH64_MOVW_GOTOFF_G0, 0x12c)
+ELF_RELOC(R_AARCH64_MOVW_GOTOFF_G0_NC, 0x12d)
+ELF_RELOC(R_AARCH64_MOVW_GOTOFF_G1, 0x12e)
+ELF_RELOC(R_AARCH64_MOVW_GOTOFF_G1_NC, 0x12f)
+ELF_RELOC(R_AARCH64_MOVW_GOTOFF_G2, 0x130)
+ELF_RELOC(R_AARCH64_MOVW_GOTOFF_G2_NC, 0x131)
+ELF_RELOC(R_AARCH64_MOVW_GOTOFF_G3, 0x132)
+ELF_RELOC(R_AARCH64_GOTREL64, 0x133)
+ELF_RELOC(R_AARCH64_GOTREL32, 0x134)
+ELF_RELOC(R_AARCH64_GOT_LD_PREL19, 0x135)
+ELF_RELOC(R_AARCH64_LD64_GOTOFF_LO15, 0x136)
+ELF_RELOC(R_AARCH64_ADR_GOT_PAGE, 0x137)
+ELF_RELOC(R_AARCH64_LD64_GOT_LO12_NC, 0x138)
+ELF_RELOC(R_AARCH64_LD64_GOTPAGE_LO15, 0x139)
+ELF_RELOC(R_AARCH64_TLSGD_ADR_PREL21, 0x200)
+ELF_RELOC(R_AARCH64_TLSGD_ADR_PAGE21, 0x201)
+ELF_RELOC(R_AARCH64_TLSGD_ADD_LO12_NC, 0x202)
+ELF_RELOC(R_AARCH64_TLSGD_MOVW_G1, 0x203)
+ELF_RELOC(R_AARCH64_TLSGD_MOVW_G0_NC, 0x204)
+ELF_RELOC(R_AARCH64_TLSLD_ADR_PREL21, 0x205)
+ELF_RELOC(R_AARCH64_TLSLD_ADR_PAGE21, 0x206)
+ELF_RELOC(R_AARCH64_TLSLD_ADD_LO12_NC, 0x207)
+ELF_RELOC(R_AARCH64_TLSLD_MOVW_G1, 0x208)
+ELF_RELOC(R_AARCH64_TLSLD_MOVW_G0_NC, 0x209)
+ELF_RELOC(R_AARCH64_TLSLD_LD_PREL19, 0x20a)
+ELF_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G2, 0x20b)
+ELF_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G1, 0x20c)
+ELF_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G1_NC, 0x20d)
+ELF_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G0, 0x20e)
+ELF_RELOC(R_AARCH64_TLSLD_MOVW_DTPREL_G0_NC, 0x20f)
+ELF_RELOC(R_AARCH64_TLSLD_ADD_DTPREL_HI12, 0x210)
+ELF_RELOC(R_AARCH64_TLSLD_ADD_DTPREL_LO12, 0x211)
+ELF_RELOC(R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC, 0x212)
+ELF_RELOC(R_AARCH64_TLSLD_LDST8_DTPREL_LO12, 0x213)
+ELF_RELOC(R_AARCH64_TLSLD_LDST8_DTPREL_LO12_NC, 0x214)
+ELF_RELOC(R_AARCH64_TLSLD_LDST16_DTPREL_LO12, 0x215)
+ELF_RELOC(R_AARCH64_TLSLD_LDST16_DTPREL_LO12_NC, 0x216)
+ELF_RELOC(R_AARCH64_TLSLD_LDST32_DTPREL_LO12, 0x217)
+ELF_RELOC(R_AARCH64_TLSLD_LDST32_DTPREL_LO12_NC, 0x218)
+ELF_RELOC(R_AARCH64_TLSLD_LDST64_DTPREL_LO12, 0x219)
+ELF_RELOC(R_AARCH64_TLSLD_LDST64_DTPREL_LO12_NC, 0x21a)
+ELF_RELOC(R_AARCH64_TLSIE_MOVW_GOTTPREL_G1, 0x21b)
+ELF_RELOC(R_AARCH64_TLSIE_MOVW_GOTTPREL_G0_NC, 0x21c)
+ELF_RELOC(R_AARCH64_TLSIE_ADR_GOTTPREL_PAGE21, 0x21d)
+ELF_RELOC(R_AARCH64_TLSIE_LD64_GOTTPREL_LO12_NC, 0x21e)
+ELF_RELOC(R_AARCH64_TLSIE_LD_GOTTPREL_PREL19, 0x21f)
+ELF_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G2, 0x220)
+ELF_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G1, 0x221)
+ELF_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G1_NC, 0x222)
+ELF_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G0, 0x223)
+ELF_RELOC(R_AARCH64_TLSLE_MOVW_TPREL_G0_NC, 0x224)
+ELF_RELOC(R_AARCH64_TLSLE_ADD_TPREL_HI12, 0x225)
+ELF_RELOC(R_AARCH64_TLSLE_ADD_TPREL_LO12, 0x226)
+ELF_RELOC(R_AARCH64_TLSLE_ADD_TPREL_LO12_NC, 0x227)
+ELF_RELOC(R_AARCH64_TLSLE_LDST8_TPREL_LO12, 0x228)
+ELF_RELOC(R_AARCH64_TLSLE_LDST8_TPREL_LO12_NC, 0x229)
+ELF_RELOC(R_AARCH64_TLSLE_LDST16_TPREL_LO12, 0x22a)
+ELF_RELOC(R_AARCH64_TLSLE_LDST16_TPREL_LO12_NC, 0x22b)
+ELF_RELOC(R_AARCH64_TLSLE_LDST32_TPREL_LO12, 0x22c)
+ELF_RELOC(R_AARCH64_TLSLE_LDST32_TPREL_LO12_NC, 0x22d)
+ELF_RELOC(R_AARCH64_TLSLE_LDST64_TPREL_LO12, 0x22e)
+ELF_RELOC(R_AARCH64_TLSLE_LDST64_TPREL_LO12_NC, 0x22f)
+ELF_RELOC(R_AARCH64_TLSDESC_LD_PREL19, 0x230)
+ELF_RELOC(R_AARCH64_TLSDESC_ADR_PREL21, 0x231)
+ELF_RELOC(R_AARCH64_TLSDESC_ADR_PAGE21, 0x232)
+ELF_RELOC(R_AARCH64_TLSDESC_LD64_LO12, 0x233)
+ELF_RELOC(R_AARCH64_TLSDESC_ADD_LO12, 0x234)
+ELF_RELOC(R_AARCH64_TLSDESC_OFF_G1, 0x235)
+ELF_RELOC(R_AARCH64_TLSDESC_OFF_G0_NC, 0x236)
+ELF_RELOC(R_AARCH64_TLSDESC_LDR, 0x237)
+ELF_RELOC(R_AARCH64_TLSDESC_ADD, 0x238)
+ELF_RELOC(R_AARCH64_TLSDESC_CALL, 0x239)
+ELF_RELOC(R_AARCH64_TLSLE_LDST128_TPREL_LO12, 0x23a)
+ELF_RELOC(R_AARCH64_TLSLE_LDST128_TPREL_LO12_NC, 0x23b)
+ELF_RELOC(R_AARCH64_TLSLD_LDST128_DTPREL_LO12, 0x23c)
+ELF_RELOC(R_AARCH64_TLSLD_LDST128_DTPREL_LO12_NC, 0x23d)
+ELF_RELOC(R_AARCH64_COPY, 0x400)
+ELF_RELOC(R_AARCH64_GLOB_DAT, 0x401)
+ELF_RELOC(R_AARCH64_JUMP_SLOT, 0x402)
+ELF_RELOC(R_AARCH64_RELATIVE, 0x403)
+ELF_RELOC(R_AARCH64_TLS_DTPREL64, 0x404)
+ELF_RELOC(R_AARCH64_TLS_DTPMOD64, 0x405)
+ELF_RELOC(R_AARCH64_TLS_TPREL64, 0x406)
+ELF_RELOC(R_AARCH64_TLSDESC, 0x407)
+ELF_RELOC(R_AARCH64_IRELATIVE, 0x408)
+
+// ELF_RELOC(R_AARCH64_P32_NONE, 0)
+ELF_RELOC(R_AARCH64_P32_ABS32, 0x001)
+ELF_RELOC(R_AARCH64_P32_ABS16, 0x002)
+ELF_RELOC(R_AARCH64_P32_PREL32, 0x003)
+ELF_RELOC(R_AARCH64_P32_PREL16, 0x004)
+ELF_RELOC(R_AARCH64_P32_MOVW_UABS_G0, 0x005)
+ELF_RELOC(R_AARCH64_P32_MOVW_UABS_G0_NC, 0x006)
+ELF_RELOC(R_AARCH64_P32_MOVW_UABS_G1, 0x007)
+ELF_RELOC(R_AARCH64_P32_MOVW_SABS_G0, 0x008)
+ELF_RELOC(R_AARCH64_P32_LD_PREL_LO19, 0x009)
+ELF_RELOC(R_AARCH64_P32_ADR_PREL_LO21, 0x00a)
+ELF_RELOC(R_AARCH64_P32_ADR_PREL_PG_HI21, 0x00b)
+ELF_RELOC(R_AARCH64_P32_ADD_ABS_LO12_NC, 0x00c)
+ELF_RELOC(R_AARCH64_P32_LDST8_ABS_LO12_NC, 0x00d)
+ELF_RELOC(R_AARCH64_P32_LDST16_ABS_LO12_NC, 0x00e)
+ELF_RELOC(R_AARCH64_P32_LDST32_ABS_LO12_NC, 0x00f)
+ELF_RELOC(R_AARCH64_P32_LDST64_ABS_LO12_NC, 0x010)
+ELF_RELOC(R_AARCH64_P32_LDST128_ABS_LO12_NC, 0x011)
+ELF_RELOC(R_AARCH64_P32_TSTBR14, 0x012)
+ELF_RELOC(R_AARCH64_P32_CONDBR19, 0x013)
+ELF_RELOC(R_AARCH64_P32_JUMP26, 0x014)
+ELF_RELOC(R_AARCH64_P32_CALL26, 0x015)
+ELF_RELOC(R_AARCH64_P32_MOVW_PREL_G0, 0x016)
+ELF_RELOC(R_AARCH64_P32_MOVW_PREL_G0_NC, 0x017)
+ELF_RELOC(R_AARCH64_P32_MOVW_PREL_G1, 0x018)
+ELF_RELOC(R_AARCH64_P32_GOT_LD_PREL19, 0x019)
+ELF_RELOC(R_AARCH64_P32_ADR_GOT_PAGE, 0x01a)
+ELF_RELOC(R_AARCH64_P32_LD32_GOT_LO12_NC, 0x01b)
+ELF_RELOC(R_AARCH64_P32_LD32_GOTPAGE_LO14, 0x01c)
+ELF_RELOC(R_AARCH64_P32_TLSGD_ADR_PREL21, 0x050)
+ELF_RELOC(R_AARCH64_P32_TLSGD_ADR_PAGE21, 0x051)
+ELF_RELOC(R_AARCH64_P32_TLSGD_ADD_LO12_NC, 0x052)
+ELF_RELOC(R_AARCH64_P32_TLSLD_ADR_PREL21, 0x053)
+ELF_RELOC(R_AARCH64_P32_TLSLD_ADR_PAGE21, 0x054)
+ELF_RELOC(R_AARCH64_P32_TLSLD_ADD_LO12_NC, 0x055)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LD_PREL19, 0x056)
+ELF_RELOC(R_AARCH64_P32_TLSLD_MOVW_DTPREL_G1, 0x057)
+ELF_RELOC(R_AARCH64_P32_TLSLD_MOVW_DTPREL_G0, 0x058)
+ELF_RELOC(R_AARCH64_P32_TLSLD_MOVW_DTPREL_G0_NC, 0x059)
+ELF_RELOC(R_AARCH64_P32_TLSLD_ADD_DTPREL_HI12, 0x05a)
+ELF_RELOC(R_AARCH64_P32_TLSLD_ADD_DTPREL_LO12, 0x05b)
+ELF_RELOC(R_AARCH64_P32_TLSLD_ADD_DTPREL_LO12_NC, 0x05c)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST8_DTPREL_LO12, 0x05d)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST8_DTPREL_LO12_NC, 0x05e)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST16_DTPREL_LO12, 0x05f)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST16_DTPREL_LO12_NC, 0x060)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST32_DTPREL_LO12, 0x061)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST32_DTPREL_LO12_NC, 0x062)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST64_DTPREL_LO12, 0x063)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST64_DTPREL_LO12_NC, 0x064)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST128_DTPREL_LO12, 0x065)
+ELF_RELOC(R_AARCH64_P32_TLSLD_LDST128_DTPREL_LO12_NC,0x066)
+ELF_RELOC(R_AARCH64_P32_TLSIE_ADR_GOTTPREL_PAGE21, 0x067)
+ELF_RELOC(R_AARCH64_P32_TLSIE_LD32_GOTTPREL_LO12_NC, 0x068)
+ELF_RELOC(R_AARCH64_P32_TLSIE_LD_GOTTPREL_PREL19, 0x069)
+ELF_RELOC(R_AARCH64_P32_TLSLE_MOVW_TPREL_G1, 0x06a)
+ELF_RELOC(R_AARCH64_P32_TLSLE_MOVW_TPREL_G0, 0x06b)
+ELF_RELOC(R_AARCH64_P32_TLSLE_MOVW_TPREL_G0_NC, 0x06c)
+ELF_RELOC(R_AARCH64_P32_TLSLE_ADD_TPREL_HI12, 0x06d)
+ELF_RELOC(R_AARCH64_P32_TLSLE_ADD_TPREL_LO12, 0x06e)
+ELF_RELOC(R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC, 0x06f)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST8_TPREL_LO12, 0x070)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST8_TPREL_LO12_NC, 0x071)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST16_TPREL_LO12, 0x072)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST16_TPREL_LO12_NC, 0x073)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST32_TPREL_LO12, 0x074)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST32_TPREL_LO12_NC, 0x075)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST64_TPREL_LO12, 0x076)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST64_TPREL_LO12_NC, 0x077)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST128_TPREL_LO12, 0x078)
+ELF_RELOC(R_AARCH64_P32_TLSLE_LDST128_TPREL_LO12_NC, 0x079)
+ELF_RELOC(R_AARCH64_P32_TLSDESC_LD_PREL19, 0x07a)
+ELF_RELOC(R_AARCH64_P32_TLSDESC_ADR_PREL21, 0x07b)
+ELF_RELOC(R_AARCH64_P32_TLSDESC_ADR_PAGE21, 0x07c)
+ELF_RELOC(R_AARCH64_P32_TLSDESC_LD32_LO12, 0x07d)
+ELF_RELOC(R_AARCH64_P32_TLSDESC_ADD_LO12, 0x07e)
+ELF_RELOC(R_AARCH64_P32_TLSDESC_CALL, 0x07f)
+ELF_RELOC(R_AARCH64_P32_COPY, 0x0b4)
+ELF_RELOC(R_AARCH64_P32_GLOB_DAT, 0x0b5)
+ELF_RELOC(R_AARCH64_P32_JUMP_SLOT, 0x0b6)
+ELF_RELOC(R_AARCH64_P32_RELATIVE, 0x0b7)
+ELF_RELOC(R_AARCH64_P32_TLS_DTPREL, 0x0b8)
+ELF_RELOC(R_AARCH64_P32_TLS_DTPMOD, 0x0b9)
+ELF_RELOC(R_AARCH64_P32_TLS_TPREL, 0x0ba)
+ELF_RELOC(R_AARCH64_P32_TLSDESC, 0x0bb)
+ELF_RELOC(R_AARCH64_P32_IRELATIVE, 0x0bc)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AMDGPU.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,16 @@
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_AMDGPU_NONE, 0)
+ELF_RELOC(R_AMDGPU_ABS32_LO, 1)
+ELF_RELOC(R_AMDGPU_ABS32_HI, 2)
+ELF_RELOC(R_AMDGPU_ABS64, 3)
+ELF_RELOC(R_AMDGPU_REL32, 4)
+ELF_RELOC(R_AMDGPU_REL64, 5)
+ELF_RELOC(R_AMDGPU_ABS32, 6)
+ELF_RELOC(R_AMDGPU_GOTPCREL, 7)
+ELF_RELOC(R_AMDGPU_GOTPCREL32_LO, 8)
+ELF_RELOC(R_AMDGPU_GOTPCREL32_HI, 9)
+ELF_RELOC(R_AMDGPU_REL32_LO, 10)
+ELF_RELOC(R_AMDGPU_REL32_HI, 11)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARM.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARM.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARM.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/ARM.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,138 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+// Meets 2.09 ABI Specs.
+ELF_RELOC(R_ARM_NONE, 0x00)
+ELF_RELOC(R_ARM_PC24, 0x01)
+ELF_RELOC(R_ARM_ABS32, 0x02)
+ELF_RELOC(R_ARM_REL32, 0x03)
+ELF_RELOC(R_ARM_LDR_PC_G0, 0x04)
+ELF_RELOC(R_ARM_ABS16, 0x05)
+ELF_RELOC(R_ARM_ABS12, 0x06)
+ELF_RELOC(R_ARM_THM_ABS5, 0x07)
+ELF_RELOC(R_ARM_ABS8, 0x08)
+ELF_RELOC(R_ARM_SBREL32, 0x09)
+ELF_RELOC(R_ARM_THM_CALL, 0x0a)
+ELF_RELOC(R_ARM_THM_PC8, 0x0b)
+ELF_RELOC(R_ARM_BREL_ADJ, 0x0c)
+ELF_RELOC(R_ARM_TLS_DESC, 0x0d)
+ELF_RELOC(R_ARM_THM_SWI8, 0x0e)
+ELF_RELOC(R_ARM_XPC25, 0x0f)
+ELF_RELOC(R_ARM_THM_XPC22, 0x10)
+ELF_RELOC(R_ARM_TLS_DTPMOD32, 0x11)
+ELF_RELOC(R_ARM_TLS_DTPOFF32, 0x12)
+ELF_RELOC(R_ARM_TLS_TPOFF32, 0x13)
+ELF_RELOC(R_ARM_COPY, 0x14)
+ELF_RELOC(R_ARM_GLOB_DAT, 0x15)
+ELF_RELOC(R_ARM_JUMP_SLOT, 0x16)
+ELF_RELOC(R_ARM_RELATIVE, 0x17)
+ELF_RELOC(R_ARM_GOTOFF32, 0x18)
+ELF_RELOC(R_ARM_BASE_PREL, 0x19)
+ELF_RELOC(R_ARM_GOT_BREL, 0x1a)
+ELF_RELOC(R_ARM_PLT32, 0x1b)
+ELF_RELOC(R_ARM_CALL, 0x1c)
+ELF_RELOC(R_ARM_JUMP24, 0x1d)
+ELF_RELOC(R_ARM_THM_JUMP24, 0x1e)
+ELF_RELOC(R_ARM_BASE_ABS, 0x1f)
+ELF_RELOC(R_ARM_ALU_PCREL_7_0, 0x20)
+ELF_RELOC(R_ARM_ALU_PCREL_15_8, 0x21)
+ELF_RELOC(R_ARM_ALU_PCREL_23_15, 0x22)
+ELF_RELOC(R_ARM_LDR_SBREL_11_0_NC, 0x23)
+ELF_RELOC(R_ARM_ALU_SBREL_19_12_NC, 0x24)
+ELF_RELOC(R_ARM_ALU_SBREL_27_20_CK, 0x25)
+ELF_RELOC(R_ARM_TARGET1, 0x26)
+ELF_RELOC(R_ARM_SBREL31, 0x27)
+ELF_RELOC(R_ARM_V4BX, 0x28)
+ELF_RELOC(R_ARM_TARGET2, 0x29)
+ELF_RELOC(R_ARM_PREL31, 0x2a)
+ELF_RELOC(R_ARM_MOVW_ABS_NC, 0x2b)
+ELF_RELOC(R_ARM_MOVT_ABS, 0x2c)
+ELF_RELOC(R_ARM_MOVW_PREL_NC, 0x2d)
+ELF_RELOC(R_ARM_MOVT_PREL, 0x2e)
+ELF_RELOC(R_ARM_THM_MOVW_ABS_NC, 0x2f)
+ELF_RELOC(R_ARM_THM_MOVT_ABS, 0x30)
+ELF_RELOC(R_ARM_THM_MOVW_PREL_NC, 0x31)
+ELF_RELOC(R_ARM_THM_MOVT_PREL, 0x32)
+ELF_RELOC(R_ARM_THM_JUMP19, 0x33)
+ELF_RELOC(R_ARM_THM_JUMP6, 0x34)
+ELF_RELOC(R_ARM_THM_ALU_PREL_11_0, 0x35)
+ELF_RELOC(R_ARM_THM_PC12, 0x36)
+ELF_RELOC(R_ARM_ABS32_NOI, 0x37)
+ELF_RELOC(R_ARM_REL32_NOI, 0x38)
+ELF_RELOC(R_ARM_ALU_PC_G0_NC, 0x39)
+ELF_RELOC(R_ARM_ALU_PC_G0, 0x3a)
+ELF_RELOC(R_ARM_ALU_PC_G1_NC, 0x3b)
+ELF_RELOC(R_ARM_ALU_PC_G1, 0x3c)
+ELF_RELOC(R_ARM_ALU_PC_G2, 0x3d)
+ELF_RELOC(R_ARM_LDR_PC_G1, 0x3e)
+ELF_RELOC(R_ARM_LDR_PC_G2, 0x3f)
+ELF_RELOC(R_ARM_LDRS_PC_G0, 0x40)
+ELF_RELOC(R_ARM_LDRS_PC_G1, 0x41)
+ELF_RELOC(R_ARM_LDRS_PC_G2, 0x42)
+ELF_RELOC(R_ARM_LDC_PC_G0, 0x43)
+ELF_RELOC(R_ARM_LDC_PC_G1, 0x44)
+ELF_RELOC(R_ARM_LDC_PC_G2, 0x45)
+ELF_RELOC(R_ARM_ALU_SB_G0_NC, 0x46)
+ELF_RELOC(R_ARM_ALU_SB_G0, 0x47)
+ELF_RELOC(R_ARM_ALU_SB_G1_NC, 0x48)
+ELF_RELOC(R_ARM_ALU_SB_G1, 0x49)
+ELF_RELOC(R_ARM_ALU_SB_G2, 0x4a)
+ELF_RELOC(R_ARM_LDR_SB_G0, 0x4b)
+ELF_RELOC(R_ARM_LDR_SB_G1, 0x4c)
+ELF_RELOC(R_ARM_LDR_SB_G2, 0x4d)
+ELF_RELOC(R_ARM_LDRS_SB_G0, 0x4e)
+ELF_RELOC(R_ARM_LDRS_SB_G1, 0x4f)
+ELF_RELOC(R_ARM_LDRS_SB_G2, 0x50)
+ELF_RELOC(R_ARM_LDC_SB_G0, 0x51)
+ELF_RELOC(R_ARM_LDC_SB_G1, 0x52)
+ELF_RELOC(R_ARM_LDC_SB_G2, 0x53)
+ELF_RELOC(R_ARM_MOVW_BREL_NC, 0x54)
+ELF_RELOC(R_ARM_MOVT_BREL, 0x55)
+ELF_RELOC(R_ARM_MOVW_BREL, 0x56)
+ELF_RELOC(R_ARM_THM_MOVW_BREL_NC, 0x57)
+ELF_RELOC(R_ARM_THM_MOVT_BREL, 0x58)
+ELF_RELOC(R_ARM_THM_MOVW_BREL, 0x59)
+ELF_RELOC(R_ARM_TLS_GOTDESC, 0x5a)
+ELF_RELOC(R_ARM_TLS_CALL, 0x5b)
+ELF_RELOC(R_ARM_TLS_DESCSEQ, 0x5c)
+ELF_RELOC(R_ARM_THM_TLS_CALL, 0x5d)
+ELF_RELOC(R_ARM_PLT32_ABS, 0x5e)
+ELF_RELOC(R_ARM_GOT_ABS, 0x5f)
+ELF_RELOC(R_ARM_GOT_PREL, 0x60)
+ELF_RELOC(R_ARM_GOT_BREL12, 0x61)
+ELF_RELOC(R_ARM_GOTOFF12, 0x62)
+ELF_RELOC(R_ARM_GOTRELAX, 0x63)
+ELF_RELOC(R_ARM_GNU_VTENTRY, 0x64)
+ELF_RELOC(R_ARM_GNU_VTINHERIT, 0x65)
+ELF_RELOC(R_ARM_THM_JUMP11, 0x66)
+ELF_RELOC(R_ARM_THM_JUMP8, 0x67)
+ELF_RELOC(R_ARM_TLS_GD32, 0x68)
+ELF_RELOC(R_ARM_TLS_LDM32, 0x69)
+ELF_RELOC(R_ARM_TLS_LDO32, 0x6a)
+ELF_RELOC(R_ARM_TLS_IE32, 0x6b)
+ELF_RELOC(R_ARM_TLS_LE32, 0x6c)
+ELF_RELOC(R_ARM_TLS_LDO12, 0x6d)
+ELF_RELOC(R_ARM_TLS_LE12, 0x6e)
+ELF_RELOC(R_ARM_TLS_IE12GP, 0x6f)
+ELF_RELOC(R_ARM_PRIVATE_0, 0x70)
+ELF_RELOC(R_ARM_PRIVATE_1, 0x71)
+ELF_RELOC(R_ARM_PRIVATE_2, 0x72)
+ELF_RELOC(R_ARM_PRIVATE_3, 0x73)
+ELF_RELOC(R_ARM_PRIVATE_4, 0x74)
+ELF_RELOC(R_ARM_PRIVATE_5, 0x75)
+ELF_RELOC(R_ARM_PRIVATE_6, 0x76)
+ELF_RELOC(R_ARM_PRIVATE_7, 0x77)
+ELF_RELOC(R_ARM_PRIVATE_8, 0x78)
+ELF_RELOC(R_ARM_PRIVATE_9, 0x79)
+ELF_RELOC(R_ARM_PRIVATE_10, 0x7a)
+ELF_RELOC(R_ARM_PRIVATE_11, 0x7b)
+ELF_RELOC(R_ARM_PRIVATE_12, 0x7c)
+ELF_RELOC(R_ARM_PRIVATE_13, 0x7d)
+ELF_RELOC(R_ARM_PRIVATE_14, 0x7e)
+ELF_RELOC(R_ARM_PRIVATE_15, 0x7f)
+ELF_RELOC(R_ARM_ME_TOO, 0x80)
+ELF_RELOC(R_ARM_THM_TLS_DESCSEQ16, 0x81)
+ELF_RELOC(R_ARM_THM_TLS_DESCSEQ32, 0x82)
+ELF_RELOC(R_ARM_IRELATIVE, 0xa0)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AVR.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AVR.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AVR.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/AVR.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,40 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_AVR_NONE, 0)
+ELF_RELOC(R_AVR_32, 1)
+ELF_RELOC(R_AVR_7_PCREL, 2)
+ELF_RELOC(R_AVR_13_PCREL, 3)
+ELF_RELOC(R_AVR_16, 4)
+ELF_RELOC(R_AVR_16_PM, 5)
+ELF_RELOC(R_AVR_LO8_LDI, 6)
+ELF_RELOC(R_AVR_HI8_LDI, 7)
+ELF_RELOC(R_AVR_HH8_LDI, 8)
+ELF_RELOC(R_AVR_LO8_LDI_NEG, 9)
+ELF_RELOC(R_AVR_HI8_LDI_NEG, 10)
+ELF_RELOC(R_AVR_HH8_LDI_NEG, 11)
+ELF_RELOC(R_AVR_LO8_LDI_PM, 12)
+ELF_RELOC(R_AVR_HI8_LDI_PM, 13)
+ELF_RELOC(R_AVR_HH8_LDI_PM, 14)
+ELF_RELOC(R_AVR_LO8_LDI_PM_NEG, 15)
+ELF_RELOC(R_AVR_HI8_LDI_PM_NEG, 16)
+ELF_RELOC(R_AVR_HH8_LDI_PM_NEG, 17)
+ELF_RELOC(R_AVR_CALL, 18)
+ELF_RELOC(R_AVR_LDI, 19)
+ELF_RELOC(R_AVR_6, 20)
+ELF_RELOC(R_AVR_6_ADIW, 21)
+ELF_RELOC(R_AVR_MS8_LDI, 22)
+ELF_RELOC(R_AVR_MS8_LDI_NEG, 23)
+ELF_RELOC(R_AVR_LO8_LDI_GS, 24)
+ELF_RELOC(R_AVR_HI8_LDI_GS, 25)
+ELF_RELOC(R_AVR_8, 26)
+ELF_RELOC(R_AVR_8_LO8, 27)
+ELF_RELOC(R_AVR_8_HI8, 28)
+ELF_RELOC(R_AVR_8_HLO8, 29)
+ELF_RELOC(R_AVR_SYM_DIFF, 30)
+ELF_RELOC(R_AVR_16_LDST, 31)
+ELF_RELOC(R_AVR_LDS_STS_16, 33)
+ELF_RELOC(R_AVR_PORT6, 34)
+ELF_RELOC(R_AVR_PORT5, 35)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/BPF.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/BPF.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/BPF.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/BPF.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,8 @@
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+// No relocation
+ELF_RELOC(R_BPF_NONE, 0)
+ELF_RELOC(R_BPF_64_64, 1)
+ELF_RELOC(R_BPF_64_32, 10)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Hexagon.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Hexagon.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Hexagon.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Hexagon.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,106 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+// Release 5 ABI
+ELF_RELOC(R_HEX_NONE, 0)
+ELF_RELOC(R_HEX_B22_PCREL, 1)
+ELF_RELOC(R_HEX_B15_PCREL, 2)
+ELF_RELOC(R_HEX_B7_PCREL, 3)
+ELF_RELOC(R_HEX_LO16, 4)
+ELF_RELOC(R_HEX_HI16, 5)
+ELF_RELOC(R_HEX_32, 6)
+ELF_RELOC(R_HEX_16, 7)
+ELF_RELOC(R_HEX_8, 8)
+ELF_RELOC(R_HEX_GPREL16_0, 9)
+ELF_RELOC(R_HEX_GPREL16_1, 10)
+ELF_RELOC(R_HEX_GPREL16_2, 11)
+ELF_RELOC(R_HEX_GPREL16_3, 12)
+ELF_RELOC(R_HEX_HL16, 13)
+ELF_RELOC(R_HEX_B13_PCREL, 14)
+ELF_RELOC(R_HEX_B9_PCREL, 15)
+ELF_RELOC(R_HEX_B32_PCREL_X, 16)
+ELF_RELOC(R_HEX_32_6_X, 17)
+ELF_RELOC(R_HEX_B22_PCREL_X, 18)
+ELF_RELOC(R_HEX_B15_PCREL_X, 19)
+ELF_RELOC(R_HEX_B13_PCREL_X, 20)
+ELF_RELOC(R_HEX_B9_PCREL_X, 21)
+ELF_RELOC(R_HEX_B7_PCREL_X, 22)
+ELF_RELOC(R_HEX_16_X, 23)
+ELF_RELOC(R_HEX_12_X, 24)
+ELF_RELOC(R_HEX_11_X, 25)
+ELF_RELOC(R_HEX_10_X, 26)
+ELF_RELOC(R_HEX_9_X, 27)
+ELF_RELOC(R_HEX_8_X, 28)
+ELF_RELOC(R_HEX_7_X, 29)
+ELF_RELOC(R_HEX_6_X, 30)
+ELF_RELOC(R_HEX_32_PCREL, 31)
+ELF_RELOC(R_HEX_COPY, 32)
+ELF_RELOC(R_HEX_GLOB_DAT, 33)
+ELF_RELOC(R_HEX_JMP_SLOT, 34)
+ELF_RELOC(R_HEX_RELATIVE, 35)
+ELF_RELOC(R_HEX_PLT_B22_PCREL, 36)
+ELF_RELOC(R_HEX_GOTREL_LO16, 37)
+ELF_RELOC(R_HEX_GOTREL_HI16, 38)
+ELF_RELOC(R_HEX_GOTREL_32, 39)
+ELF_RELOC(R_HEX_GOT_LO16, 40)
+ELF_RELOC(R_HEX_GOT_HI16, 41)
+ELF_RELOC(R_HEX_GOT_32, 42)
+ELF_RELOC(R_HEX_GOT_16, 43)
+ELF_RELOC(R_HEX_DTPMOD_32, 44)
+ELF_RELOC(R_HEX_DTPREL_LO16, 45)
+ELF_RELOC(R_HEX_DTPREL_HI16, 46)
+ELF_RELOC(R_HEX_DTPREL_32, 47)
+ELF_RELOC(R_HEX_DTPREL_16, 48)
+ELF_RELOC(R_HEX_GD_PLT_B22_PCREL, 49)
+ELF_RELOC(R_HEX_GD_GOT_LO16, 50)
+ELF_RELOC(R_HEX_GD_GOT_HI16, 51)
+ELF_RELOC(R_HEX_GD_GOT_32, 52)
+ELF_RELOC(R_HEX_GD_GOT_16, 53)
+ELF_RELOC(R_HEX_IE_LO16, 54)
+ELF_RELOC(R_HEX_IE_HI16, 55)
+ELF_RELOC(R_HEX_IE_32, 56)
+ELF_RELOC(R_HEX_IE_GOT_LO16, 57)
+ELF_RELOC(R_HEX_IE_GOT_HI16, 58)
+ELF_RELOC(R_HEX_IE_GOT_32, 59)
+ELF_RELOC(R_HEX_IE_GOT_16, 60)
+ELF_RELOC(R_HEX_TPREL_LO16, 61)
+ELF_RELOC(R_HEX_TPREL_HI16, 62)
+ELF_RELOC(R_HEX_TPREL_32, 63)
+ELF_RELOC(R_HEX_TPREL_16, 64)
+ELF_RELOC(R_HEX_6_PCREL_X, 65)
+ELF_RELOC(R_HEX_GOTREL_32_6_X, 66)
+ELF_RELOC(R_HEX_GOTREL_16_X, 67)
+ELF_RELOC(R_HEX_GOTREL_11_X, 68)
+ELF_RELOC(R_HEX_GOT_32_6_X, 69)
+ELF_RELOC(R_HEX_GOT_16_X, 70)
+ELF_RELOC(R_HEX_GOT_11_X, 71)
+ELF_RELOC(R_HEX_DTPREL_32_6_X, 72)
+ELF_RELOC(R_HEX_DTPREL_16_X, 73)
+ELF_RELOC(R_HEX_DTPREL_11_X, 74)
+ELF_RELOC(R_HEX_GD_GOT_32_6_X, 75)
+ELF_RELOC(R_HEX_GD_GOT_16_X, 76)
+ELF_RELOC(R_HEX_GD_GOT_11_X, 77)
+ELF_RELOC(R_HEX_IE_32_6_X, 78)
+ELF_RELOC(R_HEX_IE_16_X, 79)
+ELF_RELOC(R_HEX_IE_GOT_32_6_X, 80)
+ELF_RELOC(R_HEX_IE_GOT_16_X, 81)
+ELF_RELOC(R_HEX_IE_GOT_11_X, 82)
+ELF_RELOC(R_HEX_TPREL_32_6_X, 83)
+ELF_RELOC(R_HEX_TPREL_16_X, 84)
+ELF_RELOC(R_HEX_TPREL_11_X, 85)
+ELF_RELOC(R_HEX_LD_PLT_B22_PCREL, 86)
+ELF_RELOC(R_HEX_LD_GOT_LO16, 87)
+ELF_RELOC(R_HEX_LD_GOT_HI16, 88)
+ELF_RELOC(R_HEX_LD_GOT_32, 89)
+ELF_RELOC(R_HEX_LD_GOT_16, 90)
+ELF_RELOC(R_HEX_LD_GOT_32_6_X, 91)
+ELF_RELOC(R_HEX_LD_GOT_16_X, 92)
+ELF_RELOC(R_HEX_LD_GOT_11_X, 93)
+ELF_RELOC(R_HEX_23_REG, 94)
+ELF_RELOC(R_HEX_GD_PLT_B22_PCREL_X, 95)
+ELF_RELOC(R_HEX_GD_PLT_B32_PCREL_X, 96)
+ELF_RELOC(R_HEX_LD_PLT_B22_PCREL_X, 97)
+ELF_RELOC(R_HEX_LD_PLT_B32_PCREL_X, 98)
+ELF_RELOC(R_HEX_27_REG, 99)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Lanai.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Lanai.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Lanai.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Lanai.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,19 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+// No relocation
+ELF_RELOC(R_LANAI_NONE, 0)
+// 21-bit symbol relocation
+ELF_RELOC(R_LANAI_21, 1)
+// 21-bit symbol relocation with last two bits masked to 0
+ELF_RELOC(R_LANAI_21_F, 2)
+// 25-bit branch targets
+ELF_RELOC(R_LANAI_25, 3)
+// General 32-bit relocation
+ELF_RELOC(R_LANAI_32, 4)
+// Upper 16-bits of a symbolic relocation
+ELF_RELOC(R_LANAI_HI16, 5)
+// Lower 16-bits of a symbolic relocation
+ELF_RELOC(R_LANAI_LO16, 6)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Mips.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Mips.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Mips.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Mips.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,117 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_MIPS_NONE, 0)
+ELF_RELOC(R_MIPS_16, 1)
+ELF_RELOC(R_MIPS_32, 2)
+ELF_RELOC(R_MIPS_REL32, 3)
+ELF_RELOC(R_MIPS_26, 4)
+ELF_RELOC(R_MIPS_HI16, 5)
+ELF_RELOC(R_MIPS_LO16, 6)
+ELF_RELOC(R_MIPS_GPREL16, 7)
+ELF_RELOC(R_MIPS_LITERAL, 8)
+ELF_RELOC(R_MIPS_GOT16, 9)
+ELF_RELOC(R_MIPS_PC16, 10)
+ELF_RELOC(R_MIPS_CALL16, 11)
+ELF_RELOC(R_MIPS_GPREL32, 12)
+ELF_RELOC(R_MIPS_UNUSED1, 13)
+ELF_RELOC(R_MIPS_UNUSED2, 14)
+ELF_RELOC(R_MIPS_UNUSED3, 15)
+ELF_RELOC(R_MIPS_SHIFT5, 16)
+ELF_RELOC(R_MIPS_SHIFT6, 17)
+ELF_RELOC(R_MIPS_64, 18)
+ELF_RELOC(R_MIPS_GOT_DISP, 19)
+ELF_RELOC(R_MIPS_GOT_PAGE, 20)
+ELF_RELOC(R_MIPS_GOT_OFST, 21)
+ELF_RELOC(R_MIPS_GOT_HI16, 22)
+ELF_RELOC(R_MIPS_GOT_LO16, 23)
+ELF_RELOC(R_MIPS_SUB, 24)
+ELF_RELOC(R_MIPS_INSERT_A, 25)
+ELF_RELOC(R_MIPS_INSERT_B, 26)
+ELF_RELOC(R_MIPS_DELETE, 27)
+ELF_RELOC(R_MIPS_HIGHER, 28)
+ELF_RELOC(R_MIPS_HIGHEST, 29)
+ELF_RELOC(R_MIPS_CALL_HI16, 30)
+ELF_RELOC(R_MIPS_CALL_LO16, 31)
+ELF_RELOC(R_MIPS_SCN_DISP, 32)
+ELF_RELOC(R_MIPS_REL16, 33)
+ELF_RELOC(R_MIPS_ADD_IMMEDIATE, 34)
+ELF_RELOC(R_MIPS_PJUMP, 35)
+ELF_RELOC(R_MIPS_RELGOT, 36)
+ELF_RELOC(R_MIPS_JALR, 37)
+ELF_RELOC(R_MIPS_TLS_DTPMOD32, 38)
+ELF_RELOC(R_MIPS_TLS_DTPREL32, 39)
+ELF_RELOC(R_MIPS_TLS_DTPMOD64, 40)
+ELF_RELOC(R_MIPS_TLS_DTPREL64, 41)
+ELF_RELOC(R_MIPS_TLS_GD, 42)
+ELF_RELOC(R_MIPS_TLS_LDM, 43)
+ELF_RELOC(R_MIPS_TLS_DTPREL_HI16, 44)
+ELF_RELOC(R_MIPS_TLS_DTPREL_LO16, 45)
+ELF_RELOC(R_MIPS_TLS_GOTTPREL, 46)
+ELF_RELOC(R_MIPS_TLS_TPREL32, 47)
+ELF_RELOC(R_MIPS_TLS_TPREL64, 48)
+ELF_RELOC(R_MIPS_TLS_TPREL_HI16, 49)
+ELF_RELOC(R_MIPS_TLS_TPREL_LO16, 50)
+ELF_RELOC(R_MIPS_GLOB_DAT, 51)
+ELF_RELOC(R_MIPS_PC21_S2, 60)
+ELF_RELOC(R_MIPS_PC26_S2, 61)
+ELF_RELOC(R_MIPS_PC18_S3, 62)
+ELF_RELOC(R_MIPS_PC19_S2, 63)
+ELF_RELOC(R_MIPS_PCHI16, 64)
+ELF_RELOC(R_MIPS_PCLO16, 65)
+ELF_RELOC(R_MIPS16_26, 100)
+ELF_RELOC(R_MIPS16_GPREL, 101)
+ELF_RELOC(R_MIPS16_GOT16, 102)
+ELF_RELOC(R_MIPS16_CALL16, 103)
+ELF_RELOC(R_MIPS16_HI16, 104)
+ELF_RELOC(R_MIPS16_LO16, 105)
+ELF_RELOC(R_MIPS16_TLS_GD, 106)
+ELF_RELOC(R_MIPS16_TLS_LDM, 107)
+ELF_RELOC(R_MIPS16_TLS_DTPREL_HI16, 108)
+ELF_RELOC(R_MIPS16_TLS_DTPREL_LO16, 109)
+ELF_RELOC(R_MIPS16_TLS_GOTTPREL, 110)
+ELF_RELOC(R_MIPS16_TLS_TPREL_HI16, 111)
+ELF_RELOC(R_MIPS16_TLS_TPREL_LO16, 112)
+ELF_RELOC(R_MIPS_COPY, 126)
+ELF_RELOC(R_MIPS_JUMP_SLOT, 127)
+ELF_RELOC(R_MICROMIPS_26_S1, 133)
+ELF_RELOC(R_MICROMIPS_HI16, 134)
+ELF_RELOC(R_MICROMIPS_LO16, 135)
+ELF_RELOC(R_MICROMIPS_GPREL16, 136)
+ELF_RELOC(R_MICROMIPS_LITERAL, 137)
+ELF_RELOC(R_MICROMIPS_GOT16, 138)
+ELF_RELOC(R_MICROMIPS_PC7_S1, 139)
+ELF_RELOC(R_MICROMIPS_PC10_S1, 140)
+ELF_RELOC(R_MICROMIPS_PC16_S1, 141)
+ELF_RELOC(R_MICROMIPS_CALL16, 142)
+ELF_RELOC(R_MICROMIPS_GOT_DISP, 145)
+ELF_RELOC(R_MICROMIPS_GOT_PAGE, 146)
+ELF_RELOC(R_MICROMIPS_GOT_OFST, 147)
+ELF_RELOC(R_MICROMIPS_GOT_HI16, 148)
+ELF_RELOC(R_MICROMIPS_GOT_LO16, 149)
+ELF_RELOC(R_MICROMIPS_SUB, 150)
+ELF_RELOC(R_MICROMIPS_HIGHER, 151)
+ELF_RELOC(R_MICROMIPS_HIGHEST, 152)
+ELF_RELOC(R_MICROMIPS_CALL_HI16, 153)
+ELF_RELOC(R_MICROMIPS_CALL_LO16, 154)
+ELF_RELOC(R_MICROMIPS_SCN_DISP, 155)
+ELF_RELOC(R_MICROMIPS_JALR, 156)
+ELF_RELOC(R_MICROMIPS_HI0_LO16, 157)
+ELF_RELOC(R_MICROMIPS_TLS_GD, 162)
+ELF_RELOC(R_MICROMIPS_TLS_LDM, 163)
+ELF_RELOC(R_MICROMIPS_TLS_DTPREL_HI16, 164)
+ELF_RELOC(R_MICROMIPS_TLS_DTPREL_LO16, 165)
+ELF_RELOC(R_MICROMIPS_TLS_GOTTPREL, 166)
+ELF_RELOC(R_MICROMIPS_TLS_TPREL_HI16, 169)
+ELF_RELOC(R_MICROMIPS_TLS_TPREL_LO16, 170)
+ELF_RELOC(R_MICROMIPS_GPREL7_S2, 172)
+ELF_RELOC(R_MICROMIPS_PC23_S2, 173)
+ELF_RELOC(R_MICROMIPS_PC21_S1, 174)
+ELF_RELOC(R_MICROMIPS_PC26_S1, 175)
+ELF_RELOC(R_MICROMIPS_PC18_S3, 176)
+ELF_RELOC(R_MICROMIPS_PC19_S2, 177)
+ELF_RELOC(R_MIPS_NUM, 218)
+ELF_RELOC(R_MIPS_PC32, 248)
+ELF_RELOC(R_MIPS_EH, 249)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,123 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+// glibc's PowerPC asm/sigcontext.h, when compiling for PPC64, has the
+// unfortunate behavior of including asm/elf.h, which defines R_PPC_NONE, etc.
+// to their corresponding integer values. As a result, we need to undef them
+// here before continuing.
+
+#undef R_PPC_NONE
+#undef R_PPC_ADDR32
+#undef R_PPC_ADDR24
+#undef R_PPC_ADDR16
+#undef R_PPC_ADDR16_LO
+#undef R_PPC_ADDR16_HI
+#undef R_PPC_ADDR16_HA
+#undef R_PPC_ADDR14
+#undef R_PPC_ADDR14_BRTAKEN
+#undef R_PPC_ADDR14_BRNTAKEN
+#undef R_PPC_REL24
+#undef R_PPC_REL14
+#undef R_PPC_REL14_BRTAKEN
+#undef R_PPC_REL14_BRNTAKEN
+#undef R_PPC_GOT16
+#undef R_PPC_GOT16_LO
+#undef R_PPC_GOT16_HI
+#undef R_PPC_GOT16_HA
+#undef R_PPC_PLTREL24
+#undef R_PPC_JMP_SLOT
+#undef R_PPC_LOCAL24PC
+#undef R_PPC_REL32
+#undef R_PPC_TLS
+#undef R_PPC_DTPMOD32
+#undef R_PPC_TPREL16
+#undef R_PPC_TPREL16_LO
+#undef R_PPC_TPREL16_HI
+#undef R_PPC_TPREL16_HA
+#undef R_PPC_TPREL32
+#undef R_PPC_DTPREL16
+#undef R_PPC_DTPREL16_LO
+#undef R_PPC_DTPREL16_HI
+#undef R_PPC_DTPREL16_HA
+#undef R_PPC_DTPREL32
+#undef R_PPC_GOT_TLSGD16
+#undef R_PPC_GOT_TLSGD16_LO
+#undef R_PPC_GOT_TLSGD16_HI
+#undef R_PPC_GOT_TLSGD16_HA
+#undef R_PPC_GOT_TLSLD16
+#undef R_PPC_GOT_TLSLD16_LO
+#undef R_PPC_GOT_TLSLD16_HI
+#undef R_PPC_GOT_TLSLD16_HA
+#undef R_PPC_GOT_TPREL16
+#undef R_PPC_GOT_TPREL16_LO
+#undef R_PPC_GOT_TPREL16_HI
+#undef R_PPC_GOT_TPREL16_HA
+#undef R_PPC_GOT_DTPREL16
+#undef R_PPC_GOT_DTPREL16_LO
+#undef R_PPC_GOT_DTPREL16_HI
+#undef R_PPC_GOT_DTPREL16_HA
+#undef R_PPC_TLSGD
+#undef R_PPC_TLSLD
+#undef R_PPC_REL16
+#undef R_PPC_REL16_LO
+#undef R_PPC_REL16_HI
+#undef R_PPC_REL16_HA
+
+ELF_RELOC(R_PPC_NONE, 0) /* No relocation. */
+ELF_RELOC(R_PPC_ADDR32, 1)
+ELF_RELOC(R_PPC_ADDR24, 2)
+ELF_RELOC(R_PPC_ADDR16, 3)
+ELF_RELOC(R_PPC_ADDR16_LO, 4)
+ELF_RELOC(R_PPC_ADDR16_HI, 5)
+ELF_RELOC(R_PPC_ADDR16_HA, 6)
+ELF_RELOC(R_PPC_ADDR14, 7)
+ELF_RELOC(R_PPC_ADDR14_BRTAKEN, 8)
+ELF_RELOC(R_PPC_ADDR14_BRNTAKEN, 9)
+ELF_RELOC(R_PPC_REL24, 10)
+ELF_RELOC(R_PPC_REL14, 11)
+ELF_RELOC(R_PPC_REL14_BRTAKEN, 12)
+ELF_RELOC(R_PPC_REL14_BRNTAKEN, 13)
+ELF_RELOC(R_PPC_GOT16, 14)
+ELF_RELOC(R_PPC_GOT16_LO, 15)
+ELF_RELOC(R_PPC_GOT16_HI, 16)
+ELF_RELOC(R_PPC_GOT16_HA, 17)
+ELF_RELOC(R_PPC_PLTREL24, 18)
+ELF_RELOC(R_PPC_JMP_SLOT, 21)
+ELF_RELOC(R_PPC_LOCAL24PC, 23)
+ELF_RELOC(R_PPC_REL32, 26)
+ELF_RELOC(R_PPC_TLS, 67)
+ELF_RELOC(R_PPC_DTPMOD32, 68)
+ELF_RELOC(R_PPC_TPREL16, 69)
+ELF_RELOC(R_PPC_TPREL16_LO, 70)
+ELF_RELOC(R_PPC_TPREL16_HI, 71)
+ELF_RELOC(R_PPC_TPREL16_HA, 72)
+ELF_RELOC(R_PPC_TPREL32, 73)
+ELF_RELOC(R_PPC_DTPREL16, 74)
+ELF_RELOC(R_PPC_DTPREL16_LO, 75)
+ELF_RELOC(R_PPC_DTPREL16_HI, 76)
+ELF_RELOC(R_PPC_DTPREL16_HA, 77)
+ELF_RELOC(R_PPC_DTPREL32, 78)
+ELF_RELOC(R_PPC_GOT_TLSGD16, 79)
+ELF_RELOC(R_PPC_GOT_TLSGD16_LO, 80)
+ELF_RELOC(R_PPC_GOT_TLSGD16_HI, 81)
+ELF_RELOC(R_PPC_GOT_TLSGD16_HA, 82)
+ELF_RELOC(R_PPC_GOT_TLSLD16, 83)
+ELF_RELOC(R_PPC_GOT_TLSLD16_LO, 84)
+ELF_RELOC(R_PPC_GOT_TLSLD16_HI, 85)
+ELF_RELOC(R_PPC_GOT_TLSLD16_HA, 86)
+ELF_RELOC(R_PPC_GOT_TPREL16, 87)
+ELF_RELOC(R_PPC_GOT_TPREL16_LO, 88)
+ELF_RELOC(R_PPC_GOT_TPREL16_HI, 89)
+ELF_RELOC(R_PPC_GOT_TPREL16_HA, 90)
+ELF_RELOC(R_PPC_GOT_DTPREL16, 91)
+ELF_RELOC(R_PPC_GOT_DTPREL16_LO, 92)
+ELF_RELOC(R_PPC_GOT_DTPREL16_HI, 93)
+ELF_RELOC(R_PPC_GOT_DTPREL16_HA, 94)
+ELF_RELOC(R_PPC_TLSGD, 95)
+ELF_RELOC(R_PPC_TLSLD, 96)
+ELF_RELOC(R_PPC_REL16, 249)
+ELF_RELOC(R_PPC_REL16_LO, 250)
+ELF_RELOC(R_PPC_REL16_HI, 251)
+ELF_RELOC(R_PPC_REL16_HA, 252)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/PowerPC64.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,181 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+// glibc's PowerPC asm/sigcontext.h, when compiling for PPC64, has the
+// unfortunate behavior of including asm/elf.h, which defines R_PPC_NONE, etc.
+// to their corresponding integer values. As a result, we need to undef them
+// here before continuing.
+
+#undef R_PPC64_NONE
+#undef R_PPC64_ADDR32
+#undef R_PPC64_ADDR24
+#undef R_PPC64_ADDR16
+#undef R_PPC64_ADDR16_LO
+#undef R_PPC64_ADDR16_HI
+#undef R_PPC64_ADDR16_HA
+#undef R_PPC64_ADDR14
+#undef R_PPC64_ADDR14_BRTAKEN
+#undef R_PPC64_ADDR14_BRNTAKEN
+#undef R_PPC64_REL24
+#undef R_PPC64_REL14
+#undef R_PPC64_REL14_BRTAKEN
+#undef R_PPC64_REL14_BRNTAKEN
+#undef R_PPC64_GOT16
+#undef R_PPC64_GOT16_LO
+#undef R_PPC64_GOT16_HI
+#undef R_PPC64_GOT16_HA
+#undef R_PPC64_GLOB_DAT
+#undef R_PPC64_JMP_SLOT
+#undef R_PPC64_RELATIVE
+#undef R_PPC64_REL32
+#undef R_PPC64_ADDR64
+#undef R_PPC64_ADDR16_HIGHER
+#undef R_PPC64_ADDR16_HIGHERA
+#undef R_PPC64_ADDR16_HIGHEST
+#undef R_PPC64_ADDR16_HIGHESTA
+#undef R_PPC64_REL64
+#undef R_PPC64_TOC16
+#undef R_PPC64_TOC16_LO
+#undef R_PPC64_TOC16_HI
+#undef R_PPC64_TOC16_HA
+#undef R_PPC64_TOC
+#undef R_PPC64_ADDR16_DS
+#undef R_PPC64_ADDR16_LO_DS
+#undef R_PPC64_GOT16_DS
+#undef R_PPC64_GOT16_LO_DS
+#undef R_PPC64_TOC16_DS
+#undef R_PPC64_TOC16_LO_DS
+#undef R_PPC64_TLS
+#undef R_PPC64_DTPMOD64
+#undef R_PPC64_TPREL16
+#undef R_PPC64_TPREL16_LO
+#undef R_PPC64_TPREL16_HI
+#undef R_PPC64_TPREL16_HA
+#undef R_PPC64_TPREL64
+#undef R_PPC64_DTPREL16
+#undef R_PPC64_DTPREL16_LO
+#undef R_PPC64_DTPREL16_HI
+#undef R_PPC64_DTPREL16_HA
+#undef R_PPC64_DTPREL64
+#undef R_PPC64_GOT_TLSGD16
+#undef R_PPC64_GOT_TLSGD16_LO
+#undef R_PPC64_GOT_TLSGD16_HI
+#undef R_PPC64_GOT_TLSGD16_HA
+#undef R_PPC64_GOT_TLSLD16
+#undef R_PPC64_GOT_TLSLD16_LO
+#undef R_PPC64_GOT_TLSLD16_HI
+#undef R_PPC64_GOT_TLSLD16_HA
+#undef R_PPC64_GOT_TPREL16_DS
+#undef R_PPC64_GOT_TPREL16_LO_DS
+#undef R_PPC64_GOT_TPREL16_HI
+#undef R_PPC64_GOT_TPREL16_HA
+#undef R_PPC64_GOT_DTPREL16_DS
+#undef R_PPC64_GOT_DTPREL16_LO_DS
+#undef R_PPC64_GOT_DTPREL16_HI
+#undef R_PPC64_GOT_DTPREL16_HA
+#undef R_PPC64_TPREL16_DS
+#undef R_PPC64_TPREL16_LO_DS
+#undef R_PPC64_TPREL16_HIGHER
+#undef R_PPC64_TPREL16_HIGHERA
+#undef R_PPC64_TPREL16_HIGHEST
+#undef R_PPC64_TPREL16_HIGHESTA
+#undef R_PPC64_DTPREL16_DS
+#undef R_PPC64_DTPREL16_LO_DS
+#undef R_PPC64_DTPREL16_HIGHER
+#undef R_PPC64_DTPREL16_HIGHERA
+#undef R_PPC64_DTPREL16_HIGHEST
+#undef R_PPC64_DTPREL16_HIGHESTA
+#undef R_PPC64_TLSGD
+#undef R_PPC64_TLSLD
+#undef R_PPC64_REL16
+#undef R_PPC64_REL16_LO
+#undef R_PPC64_REL16_HI
+#undef R_PPC64_REL16_HA
+
+ELF_RELOC(R_PPC64_NONE, 0)
+ELF_RELOC(R_PPC64_ADDR32, 1)
+ELF_RELOC(R_PPC64_ADDR24, 2)
+ELF_RELOC(R_PPC64_ADDR16, 3)
+ELF_RELOC(R_PPC64_ADDR16_LO, 4)
+ELF_RELOC(R_PPC64_ADDR16_HI, 5)
+ELF_RELOC(R_PPC64_ADDR16_HA, 6)
+ELF_RELOC(R_PPC64_ADDR14, 7)
+ELF_RELOC(R_PPC64_ADDR14_BRTAKEN, 8)
+ELF_RELOC(R_PPC64_ADDR14_BRNTAKEN, 9)
+ELF_RELOC(R_PPC64_REL24, 10)
+ELF_RELOC(R_PPC64_REL14, 11)
+ELF_RELOC(R_PPC64_REL14_BRTAKEN, 12)
+ELF_RELOC(R_PPC64_REL14_BRNTAKEN, 13)
+ELF_RELOC(R_PPC64_GOT16, 14)
+ELF_RELOC(R_PPC64_GOT16_LO, 15)
+ELF_RELOC(R_PPC64_GOT16_HI, 16)
+ELF_RELOC(R_PPC64_GOT16_HA, 17)
+ELF_RELOC(R_PPC64_GLOB_DAT, 20)
+ELF_RELOC(R_PPC64_JMP_SLOT, 21)
+ELF_RELOC(R_PPC64_RELATIVE, 22)
+ELF_RELOC(R_PPC64_REL32, 26)
+ELF_RELOC(R_PPC64_ADDR64, 38)
+ELF_RELOC(R_PPC64_ADDR16_HIGHER, 39)
+ELF_RELOC(R_PPC64_ADDR16_HIGHERA, 40)
+ELF_RELOC(R_PPC64_ADDR16_HIGHEST, 41)
+ELF_RELOC(R_PPC64_ADDR16_HIGHESTA, 42)
+ELF_RELOC(R_PPC64_REL64, 44)
+ELF_RELOC(R_PPC64_TOC16, 47)
+ELF_RELOC(R_PPC64_TOC16_LO, 48)
+ELF_RELOC(R_PPC64_TOC16_HI, 49)
+ELF_RELOC(R_PPC64_TOC16_HA, 50)
+ELF_RELOC(R_PPC64_TOC, 51)
+ELF_RELOC(R_PPC64_ADDR16_DS, 56)
+ELF_RELOC(R_PPC64_ADDR16_LO_DS, 57)
+ELF_RELOC(R_PPC64_GOT16_DS, 58)
+ELF_RELOC(R_PPC64_GOT16_LO_DS, 59)
+ELF_RELOC(R_PPC64_TOC16_DS, 63)
+ELF_RELOC(R_PPC64_TOC16_LO_DS, 64)
+ELF_RELOC(R_PPC64_TLS, 67)
+ELF_RELOC(R_PPC64_DTPMOD64, 68)
+ELF_RELOC(R_PPC64_TPREL16, 69)
+ELF_RELOC(R_PPC64_TPREL16_LO, 70)
+ELF_RELOC(R_PPC64_TPREL16_HI, 71)
+ELF_RELOC(R_PPC64_TPREL16_HA, 72)
+ELF_RELOC(R_PPC64_TPREL64, 73)
+ELF_RELOC(R_PPC64_DTPREL16, 74)
+ELF_RELOC(R_PPC64_DTPREL16_LO, 75)
+ELF_RELOC(R_PPC64_DTPREL16_HI, 76)
+ELF_RELOC(R_PPC64_DTPREL16_HA, 77)
+ELF_RELOC(R_PPC64_DTPREL64, 78)
+ELF_RELOC(R_PPC64_GOT_TLSGD16, 79)
+ELF_RELOC(R_PPC64_GOT_TLSGD16_LO, 80)
+ELF_RELOC(R_PPC64_GOT_TLSGD16_HI, 81)
+ELF_RELOC(R_PPC64_GOT_TLSGD16_HA, 82)
+ELF_RELOC(R_PPC64_GOT_TLSLD16, 83)
+ELF_RELOC(R_PPC64_GOT_TLSLD16_LO, 84)
+ELF_RELOC(R_PPC64_GOT_TLSLD16_HI, 85)
+ELF_RELOC(R_PPC64_GOT_TLSLD16_HA, 86)
+ELF_RELOC(R_PPC64_GOT_TPREL16_DS, 87)
+ELF_RELOC(R_PPC64_GOT_TPREL16_LO_DS, 88)
+ELF_RELOC(R_PPC64_GOT_TPREL16_HI, 89)
+ELF_RELOC(R_PPC64_GOT_TPREL16_HA, 90)
+ELF_RELOC(R_PPC64_GOT_DTPREL16_DS, 91)
+ELF_RELOC(R_PPC64_GOT_DTPREL16_LO_DS, 92)
+ELF_RELOC(R_PPC64_GOT_DTPREL16_HI, 93)
+ELF_RELOC(R_PPC64_GOT_DTPREL16_HA, 94)
+ELF_RELOC(R_PPC64_TPREL16_DS, 95)
+ELF_RELOC(R_PPC64_TPREL16_LO_DS, 96)
+ELF_RELOC(R_PPC64_TPREL16_HIGHER, 97)
+ELF_RELOC(R_PPC64_TPREL16_HIGHERA, 98)
+ELF_RELOC(R_PPC64_TPREL16_HIGHEST, 99)
+ELF_RELOC(R_PPC64_TPREL16_HIGHESTA, 100)
+ELF_RELOC(R_PPC64_DTPREL16_DS, 101)
+ELF_RELOC(R_PPC64_DTPREL16_LO_DS, 102)
+ELF_RELOC(R_PPC64_DTPREL16_HIGHER, 103)
+ELF_RELOC(R_PPC64_DTPREL16_HIGHERA, 104)
+ELF_RELOC(R_PPC64_DTPREL16_HIGHEST, 105)
+ELF_RELOC(R_PPC64_DTPREL16_HIGHESTA, 106)
+ELF_RELOC(R_PPC64_TLSGD, 107)
+ELF_RELOC(R_PPC64_TLSLD, 108)
+ELF_RELOC(R_PPC64_REL16, 249)
+ELF_RELOC(R_PPC64_REL16_LO, 250)
+ELF_RELOC(R_PPC64_REL16_HI, 251)
+ELF_RELOC(R_PPC64_REL16_HA, 252)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/RISCV.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/RISCV.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/RISCV.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/RISCV.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,50 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_RISCV_NONE, 0)
+ELF_RELOC(R_RISCV_32, 1)
+ELF_RELOC(R_RISCV_64, 2)
+ELF_RELOC(R_RISCV_RELATIVE, 3)
+ELF_RELOC(R_RISCV_COPY, 4)
+ELF_RELOC(R_RISCV_JUMP_SLOT, 5)
+ELF_RELOC(R_RISCV_TLS_DTPMOD32, 6)
+ELF_RELOC(R_RISCV_TLS_DTPMOD64, 7)
+ELF_RELOC(R_RISCV_TLS_DTPREL32, 8)
+ELF_RELOC(R_RISCV_TLS_DTPREL64, 9)
+ELF_RELOC(R_RISCV_TLS_TPREL32, 10)
+ELF_RELOC(R_RISCV_TLS_TPREL64, 11)
+ELF_RELOC(R_RISCV_BRANCH, 16)
+ELF_RELOC(R_RISCV_JAL, 17)
+ELF_RELOC(R_RISCV_CALL, 18)
+ELF_RELOC(R_RISCV_CALL_PLT, 19)
+ELF_RELOC(R_RISCV_GOT_HI20, 20)
+ELF_RELOC(R_RISCV_TLS_GOT_HI20, 21)
+ELF_RELOC(R_RISCV_TLS_GD_HI20, 22)
+ELF_RELOC(R_RISCV_PCREL_HI20, 23)
+ELF_RELOC(R_RISCV_PCREL_LO12_I, 24)
+ELF_RELOC(R_RISCV_PCREL_LO12_S, 25)
+ELF_RELOC(R_RISCV_HI20, 26)
+ELF_RELOC(R_RISCV_LO12_I, 27)
+ELF_RELOC(R_RISCV_LO12_S, 28)
+ELF_RELOC(R_RISCV_TPREL_HI20, 29)
+ELF_RELOC(R_RISCV_TPREL_LO12_I, 30)
+ELF_RELOC(R_RISCV_TPREL_LO12_S, 31)
+ELF_RELOC(R_RISCV_TPREL_ADD, 32)
+ELF_RELOC(R_RISCV_ADD8, 33)
+ELF_RELOC(R_RISCV_ADD16, 34)
+ELF_RELOC(R_RISCV_ADD32, 35)
+ELF_RELOC(R_RISCV_ADD64, 36)
+ELF_RELOC(R_RISCV_SUB8, 37)
+ELF_RELOC(R_RISCV_SUB16, 38)
+ELF_RELOC(R_RISCV_SUB32, 39)
+ELF_RELOC(R_RISCV_SUB64, 40)
+ELF_RELOC(R_RISCV_GNU_VTINHERIT, 41)
+ELF_RELOC(R_RISCV_GNU_VTENTRY, 42)
+ELF_RELOC(R_RISCV_ALIGN, 43)
+ELF_RELOC(R_RISCV_RVC_BRANCH, 44)
+ELF_RELOC(R_RISCV_RVC_JUMP, 45)
+ELF_RELOC(R_RISCV_RVC_LUI, 46)
+ELF_RELOC(R_RISCV_GPREL_I, 47)
+ELF_RELOC(R_RISCV_GPREL_S, 48)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Sparc.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Sparc.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Sparc.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/Sparc.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,89 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_SPARC_NONE, 0)
+ELF_RELOC(R_SPARC_8, 1)
+ELF_RELOC(R_SPARC_16, 2)
+ELF_RELOC(R_SPARC_32, 3)
+ELF_RELOC(R_SPARC_DISP8, 4)
+ELF_RELOC(R_SPARC_DISP16, 5)
+ELF_RELOC(R_SPARC_DISP32, 6)
+ELF_RELOC(R_SPARC_WDISP30, 7)
+ELF_RELOC(R_SPARC_WDISP22, 8)
+ELF_RELOC(R_SPARC_HI22, 9)
+ELF_RELOC(R_SPARC_22, 10)
+ELF_RELOC(R_SPARC_13, 11)
+ELF_RELOC(R_SPARC_LO10, 12)
+ELF_RELOC(R_SPARC_GOT10, 13)
+ELF_RELOC(R_SPARC_GOT13, 14)
+ELF_RELOC(R_SPARC_GOT22, 15)
+ELF_RELOC(R_SPARC_PC10, 16)
+ELF_RELOC(R_SPARC_PC22, 17)
+ELF_RELOC(R_SPARC_WPLT30, 18)
+ELF_RELOC(R_SPARC_COPY, 19)
+ELF_RELOC(R_SPARC_GLOB_DAT, 20)
+ELF_RELOC(R_SPARC_JMP_SLOT, 21)
+ELF_RELOC(R_SPARC_RELATIVE, 22)
+ELF_RELOC(R_SPARC_UA32, 23)
+ELF_RELOC(R_SPARC_PLT32, 24)
+ELF_RELOC(R_SPARC_HIPLT22, 25)
+ELF_RELOC(R_SPARC_LOPLT10, 26)
+ELF_RELOC(R_SPARC_PCPLT32, 27)
+ELF_RELOC(R_SPARC_PCPLT22, 28)
+ELF_RELOC(R_SPARC_PCPLT10, 29)
+ELF_RELOC(R_SPARC_10, 30)
+ELF_RELOC(R_SPARC_11, 31)
+ELF_RELOC(R_SPARC_64, 32)
+ELF_RELOC(R_SPARC_OLO10, 33)
+ELF_RELOC(R_SPARC_HH22, 34)
+ELF_RELOC(R_SPARC_HM10, 35)
+ELF_RELOC(R_SPARC_LM22, 36)
+ELF_RELOC(R_SPARC_PC_HH22, 37)
+ELF_RELOC(R_SPARC_PC_HM10, 38)
+ELF_RELOC(R_SPARC_PC_LM22, 39)
+ELF_RELOC(R_SPARC_WDISP16, 40)
+ELF_RELOC(R_SPARC_WDISP19, 41)
+ELF_RELOC(R_SPARC_7, 43)
+ELF_RELOC(R_SPARC_5, 44)
+ELF_RELOC(R_SPARC_6, 45)
+ELF_RELOC(R_SPARC_DISP64, 46)
+ELF_RELOC(R_SPARC_PLT64, 47)
+ELF_RELOC(R_SPARC_HIX22, 48)
+ELF_RELOC(R_SPARC_LOX10, 49)
+ELF_RELOC(R_SPARC_H44, 50)
+ELF_RELOC(R_SPARC_M44, 51)
+ELF_RELOC(R_SPARC_L44, 52)
+ELF_RELOC(R_SPARC_REGISTER, 53)
+ELF_RELOC(R_SPARC_UA64, 54)
+ELF_RELOC(R_SPARC_UA16, 55)
+ELF_RELOC(R_SPARC_TLS_GD_HI22, 56)
+ELF_RELOC(R_SPARC_TLS_GD_LO10, 57)
+ELF_RELOC(R_SPARC_TLS_GD_ADD, 58)
+ELF_RELOC(R_SPARC_TLS_GD_CALL, 59)
+ELF_RELOC(R_SPARC_TLS_LDM_HI22, 60)
+ELF_RELOC(R_SPARC_TLS_LDM_LO10, 61)
+ELF_RELOC(R_SPARC_TLS_LDM_ADD, 62)
+ELF_RELOC(R_SPARC_TLS_LDM_CALL, 63)
+ELF_RELOC(R_SPARC_TLS_LDO_HIX22, 64)
+ELF_RELOC(R_SPARC_TLS_LDO_LOX10, 65)
+ELF_RELOC(R_SPARC_TLS_LDO_ADD, 66)
+ELF_RELOC(R_SPARC_TLS_IE_HI22, 67)
+ELF_RELOC(R_SPARC_TLS_IE_LO10, 68)
+ELF_RELOC(R_SPARC_TLS_IE_LD, 69)
+ELF_RELOC(R_SPARC_TLS_IE_LDX, 70)
+ELF_RELOC(R_SPARC_TLS_IE_ADD, 71)
+ELF_RELOC(R_SPARC_TLS_LE_HIX22, 72)
+ELF_RELOC(R_SPARC_TLS_LE_LOX10, 73)
+ELF_RELOC(R_SPARC_TLS_DTPMOD32, 74)
+ELF_RELOC(R_SPARC_TLS_DTPMOD64, 75)
+ELF_RELOC(R_SPARC_TLS_DTPOFF32, 76)
+ELF_RELOC(R_SPARC_TLS_DTPOFF64, 77)
+ELF_RELOC(R_SPARC_TLS_TPOFF32, 78)
+ELF_RELOC(R_SPARC_TLS_TPOFF64, 79)
+ELF_RELOC(R_SPARC_GOTDATA_HIX22, 80)
+ELF_RELOC(R_SPARC_GOTDATA_LOX10, 81)
+ELF_RELOC(R_SPARC_GOTDATA_OP_HIX22, 82)
+ELF_RELOC(R_SPARC_GOTDATA_OP_LOX10, 83)
+ELF_RELOC(R_SPARC_GOTDATA_OP, 84)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/SystemZ.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/SystemZ.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/SystemZ.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/SystemZ.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,71 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_390_NONE, 0)
+ELF_RELOC(R_390_8, 1)
+ELF_RELOC(R_390_12, 2)
+ELF_RELOC(R_390_16, 3)
+ELF_RELOC(R_390_32, 4)
+ELF_RELOC(R_390_PC32, 5)
+ELF_RELOC(R_390_GOT12, 6)
+ELF_RELOC(R_390_GOT32, 7)
+ELF_RELOC(R_390_PLT32, 8)
+ELF_RELOC(R_390_COPY, 9)
+ELF_RELOC(R_390_GLOB_DAT, 10)
+ELF_RELOC(R_390_JMP_SLOT, 11)
+ELF_RELOC(R_390_RELATIVE, 12)
+ELF_RELOC(R_390_GOTOFF, 13)
+ELF_RELOC(R_390_GOTPC, 14)
+ELF_RELOC(R_390_GOT16, 15)
+ELF_RELOC(R_390_PC16, 16)
+ELF_RELOC(R_390_PC16DBL, 17)
+ELF_RELOC(R_390_PLT16DBL, 18)
+ELF_RELOC(R_390_PC32DBL, 19)
+ELF_RELOC(R_390_PLT32DBL, 20)
+ELF_RELOC(R_390_GOTPCDBL, 21)
+ELF_RELOC(R_390_64, 22)
+ELF_RELOC(R_390_PC64, 23)
+ELF_RELOC(R_390_GOT64, 24)
+ELF_RELOC(R_390_PLT64, 25)
+ELF_RELOC(R_390_GOTENT, 26)
+ELF_RELOC(R_390_GOTOFF16, 27)
+ELF_RELOC(R_390_GOTOFF64, 28)
+ELF_RELOC(R_390_GOTPLT12, 29)
+ELF_RELOC(R_390_GOTPLT16, 30)
+ELF_RELOC(R_390_GOTPLT32, 31)
+ELF_RELOC(R_390_GOTPLT64, 32)
+ELF_RELOC(R_390_GOTPLTENT, 33)
+ELF_RELOC(R_390_PLTOFF16, 34)
+ELF_RELOC(R_390_PLTOFF32, 35)
+ELF_RELOC(R_390_PLTOFF64, 36)
+ELF_RELOC(R_390_TLS_LOAD, 37)
+ELF_RELOC(R_390_TLS_GDCALL, 38)
+ELF_RELOC(R_390_TLS_LDCALL, 39)
+ELF_RELOC(R_390_TLS_GD32, 40)
+ELF_RELOC(R_390_TLS_GD64, 41)
+ELF_RELOC(R_390_TLS_GOTIE12, 42)
+ELF_RELOC(R_390_TLS_GOTIE32, 43)
+ELF_RELOC(R_390_TLS_GOTIE64, 44)
+ELF_RELOC(R_390_TLS_LDM32, 45)
+ELF_RELOC(R_390_TLS_LDM64, 46)
+ELF_RELOC(R_390_TLS_IE32, 47)
+ELF_RELOC(R_390_TLS_IE64, 48)
+ELF_RELOC(R_390_TLS_IEENT, 49)
+ELF_RELOC(R_390_TLS_LE32, 50)
+ELF_RELOC(R_390_TLS_LE64, 51)
+ELF_RELOC(R_390_TLS_LDO32, 52)
+ELF_RELOC(R_390_TLS_LDO64, 53)
+ELF_RELOC(R_390_TLS_DTPMOD, 54)
+ELF_RELOC(R_390_TLS_DTPOFF, 55)
+ELF_RELOC(R_390_TLS_TPOFF, 56)
+ELF_RELOC(R_390_20, 57)
+ELF_RELOC(R_390_GOT20, 58)
+ELF_RELOC(R_390_GOTPLT20, 59)
+ELF_RELOC(R_390_TLS_GOTIE20, 60)
+ELF_RELOC(R_390_IRELATIVE, 61)
+ELF_RELOC(R_390_PC12DBL, 62)
+ELF_RELOC(R_390_PLT12DBL, 63)
+ELF_RELOC(R_390_PC24DBL, 64)
+ELF_RELOC(R_390_PLT24DBL, 65)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/WebAssembly.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/WebAssembly.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/WebAssembly.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/WebAssembly.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,8 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_WEBASSEMBLY_NONE, 0)
+ELF_RELOC(R_WEBASSEMBLY_DATA, 1)
+ELF_RELOC(R_WEBASSEMBLY_FUNCTION, 2)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/i386.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/i386.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/i386.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/i386.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,47 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+// TODO: this is just a subset
+ELF_RELOC(R_386_NONE, 0)
+ELF_RELOC(R_386_32, 1)
+ELF_RELOC(R_386_PC32, 2)
+ELF_RELOC(R_386_GOT32, 3)
+ELF_RELOC(R_386_PLT32, 4)
+ELF_RELOC(R_386_COPY, 5)
+ELF_RELOC(R_386_GLOB_DAT, 6)
+ELF_RELOC(R_386_JUMP_SLOT, 7)
+ELF_RELOC(R_386_RELATIVE, 8)
+ELF_RELOC(R_386_GOTOFF, 9)
+ELF_RELOC(R_386_GOTPC, 10)
+ELF_RELOC(R_386_32PLT, 11)
+ELF_RELOC(R_386_TLS_TPOFF, 14)
+ELF_RELOC(R_386_TLS_IE, 15)
+ELF_RELOC(R_386_TLS_GOTIE, 16)
+ELF_RELOC(R_386_TLS_LE, 17)
+ELF_RELOC(R_386_TLS_GD, 18)
+ELF_RELOC(R_386_TLS_LDM, 19)
+ELF_RELOC(R_386_16, 20)
+ELF_RELOC(R_386_PC16, 21)
+ELF_RELOC(R_386_8, 22)
+ELF_RELOC(R_386_PC8, 23)
+ELF_RELOC(R_386_TLS_GD_32, 24)
+ELF_RELOC(R_386_TLS_GD_PUSH, 25)
+ELF_RELOC(R_386_TLS_GD_CALL, 26)
+ELF_RELOC(R_386_TLS_GD_POP, 27)
+ELF_RELOC(R_386_TLS_LDM_32, 28)
+ELF_RELOC(R_386_TLS_LDM_PUSH, 29)
+ELF_RELOC(R_386_TLS_LDM_CALL, 30)
+ELF_RELOC(R_386_TLS_LDM_POP, 31)
+ELF_RELOC(R_386_TLS_LDO_32, 32)
+ELF_RELOC(R_386_TLS_IE_32, 33)
+ELF_RELOC(R_386_TLS_LE_32, 34)
+ELF_RELOC(R_386_TLS_DTPMOD32, 35)
+ELF_RELOC(R_386_TLS_DTPOFF32, 36)
+ELF_RELOC(R_386_TLS_TPOFF32, 37)
+ELF_RELOC(R_386_TLS_GOTDESC, 39)
+ELF_RELOC(R_386_TLS_DESC_CALL, 40)
+ELF_RELOC(R_386_TLS_DESC, 41)
+ELF_RELOC(R_386_IRELATIVE, 42)
+ELF_RELOC(R_386_GOT32X, 43)
Added: llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/x86_64.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/x86_64.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/x86_64.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/ELFRelocs/x86_64.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,45 @@
+
+#ifndef ELF_RELOC
+#error "ELF_RELOC must be defined"
+#endif
+
+ELF_RELOC(R_X86_64_NONE, 0)
+ELF_RELOC(R_X86_64_64, 1)
+ELF_RELOC(R_X86_64_PC32, 2)
+ELF_RELOC(R_X86_64_GOT32, 3)
+ELF_RELOC(R_X86_64_PLT32, 4)
+ELF_RELOC(R_X86_64_COPY, 5)
+ELF_RELOC(R_X86_64_GLOB_DAT, 6)
+ELF_RELOC(R_X86_64_JUMP_SLOT, 7)
+ELF_RELOC(R_X86_64_RELATIVE, 8)
+ELF_RELOC(R_X86_64_GOTPCREL, 9)
+ELF_RELOC(R_X86_64_32, 10)
+ELF_RELOC(R_X86_64_32S, 11)
+ELF_RELOC(R_X86_64_16, 12)
+ELF_RELOC(R_X86_64_PC16, 13)
+ELF_RELOC(R_X86_64_8, 14)
+ELF_RELOC(R_X86_64_PC8, 15)
+ELF_RELOC(R_X86_64_DTPMOD64, 16)
+ELF_RELOC(R_X86_64_DTPOFF64, 17)
+ELF_RELOC(R_X86_64_TPOFF64, 18)
+ELF_RELOC(R_X86_64_TLSGD, 19)
+ELF_RELOC(R_X86_64_TLSLD, 20)
+ELF_RELOC(R_X86_64_DTPOFF32, 21)
+ELF_RELOC(R_X86_64_GOTTPOFF, 22)
+ELF_RELOC(R_X86_64_TPOFF32, 23)
+ELF_RELOC(R_X86_64_PC64, 24)
+ELF_RELOC(R_X86_64_GOTOFF64, 25)
+ELF_RELOC(R_X86_64_GOTPC32, 26)
+ELF_RELOC(R_X86_64_GOT64, 27)
+ELF_RELOC(R_X86_64_GOTPCREL64, 28)
+ELF_RELOC(R_X86_64_GOTPC64, 29)
+ELF_RELOC(R_X86_64_GOTPLT64, 30)
+ELF_RELOC(R_X86_64_PLTOFF64, 31)
+ELF_RELOC(R_X86_64_SIZE32, 32)
+ELF_RELOC(R_X86_64_SIZE64, 33)
+ELF_RELOC(R_X86_64_GOTPC32_TLSDESC, 34)
+ELF_RELOC(R_X86_64_TLSDESC_CALL, 35)
+ELF_RELOC(R_X86_64_TLSDESC, 36)
+ELF_RELOC(R_X86_64_IRELATIVE, 37)
+ELF_RELOC(R_X86_64_GOTPCRELX, 41)
+ELF_RELOC(R_X86_64_REX_GOTPCRELX, 42)
Added: llvm/trunk/include/llvm/BinaryFormat/MachO.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/MachO.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/MachO.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/MachO.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,120 @@
+//,,,-- llvm/Support/MachO.def - The MachO file definitions -----*- C++ -*-,,,//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//,,,----------------------------------------------------------------------,,,//
+//
+// Definitions for MachO files
+//
+//,,,----------------------------------------------------------------------,,,//
+
+#ifdef HANDLE_LOAD_COMMAND
+
+HANDLE_LOAD_COMMAND(LC_SEGMENT, 0x00000001u, segment_command)
+HANDLE_LOAD_COMMAND(LC_SYMTAB, 0x00000002u, symtab_command)
+// LC_SYMSEG is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_SYMSEG, 0x00000003u, symseg_command)
+HANDLE_LOAD_COMMAND(LC_THREAD, 0x00000004u, thread_command)
+HANDLE_LOAD_COMMAND(LC_UNIXTHREAD, 0x00000005u, thread_command)
+// LC_LOADFVMLIB is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_LOADFVMLIB, 0x00000006u, fvmlib_command)
+// LC_IDFVMLIB is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_IDFVMLIB, 0x00000007u, fvmlib_command)
+// LC_IDENT is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_IDENT, 0x00000008u, ident_command)
+// LC_FVMFILE is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_FVMFILE, 0x00000009u, fvmfile_command)
+// LC_PREPAGE is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_PREPAGE, 0x0000000Au, load_command)
+HANDLE_LOAD_COMMAND(LC_DYSYMTAB, 0x0000000Bu, dysymtab_command)
+HANDLE_LOAD_COMMAND(LC_LOAD_DYLIB, 0x0000000Cu, dylib_command)
+HANDLE_LOAD_COMMAND(LC_ID_DYLIB, 0x0000000Du, dylib_command)
+HANDLE_LOAD_COMMAND(LC_LOAD_DYLINKER, 0x0000000Eu, dylinker_command)
+HANDLE_LOAD_COMMAND(LC_ID_DYLINKER, 0x0000000Fu, dylinker_command)
+// LC_PREBOUND_DYLIB is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_PREBOUND_DYLIB, 0x00000010u, prebound_dylib_command)
+HANDLE_LOAD_COMMAND(LC_ROUTINES, 0x00000011u, routines_command)
+HANDLE_LOAD_COMMAND(LC_SUB_FRAMEWORK, 0x00000012u, sub_framework_command)
+HANDLE_LOAD_COMMAND(LC_SUB_UMBRELLA, 0x00000013u, sub_umbrella_command)
+HANDLE_LOAD_COMMAND(LC_SUB_CLIENT, 0x00000014u, sub_client_command)
+HANDLE_LOAD_COMMAND(LC_SUB_LIBRARY, 0x00000015u, sub_library_command)
+// LC_TWOLEVEL_HINTS is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_TWOLEVEL_HINTS, 0x00000016u, twolevel_hints_command)
+// LC_PREBIND_CKSUM is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_PREBIND_CKSUM, 0x00000017u, prebind_cksum_command)
+// LC_LOAD_WEAK_DYLIB is obsolete and no longer supported.
+HANDLE_LOAD_COMMAND(LC_LOAD_WEAK_DYLIB, 0x80000018u, dylib_command)
+HANDLE_LOAD_COMMAND(LC_SEGMENT_64, 0x00000019u, segment_command_64)
+HANDLE_LOAD_COMMAND(LC_ROUTINES_64, 0x0000001Au, routines_command_64)
+HANDLE_LOAD_COMMAND(LC_UUID, 0x0000001Bu, uuid_command)
+HANDLE_LOAD_COMMAND(LC_RPATH, 0x8000001Cu, rpath_command)
+HANDLE_LOAD_COMMAND(LC_CODE_SIGNATURE, 0x0000001Du, linkedit_data_command)
+HANDLE_LOAD_COMMAND(LC_SEGMENT_SPLIT_INFO, 0x0000001Eu, linkedit_data_command)
+HANDLE_LOAD_COMMAND(LC_REEXPORT_DYLIB, 0x8000001Fu, dylib_command)
+HANDLE_LOAD_COMMAND(LC_LAZY_LOAD_DYLIB, 0x00000020u, dylib_command)
+HANDLE_LOAD_COMMAND(LC_ENCRYPTION_INFO, 0x00000021u, encryption_info_command)
+HANDLE_LOAD_COMMAND(LC_DYLD_INFO, 0x00000022u, dyld_info_command)
+HANDLE_LOAD_COMMAND(LC_DYLD_INFO_ONLY, 0x80000022u, dyld_info_command)
+HANDLE_LOAD_COMMAND(LC_LOAD_UPWARD_DYLIB, 0x80000023u, dylib_command)
+HANDLE_LOAD_COMMAND(LC_VERSION_MIN_MACOSX, 0x00000024u, version_min_command)
+HANDLE_LOAD_COMMAND(LC_VERSION_MIN_IPHONEOS, 0x00000025u, version_min_command)
+HANDLE_LOAD_COMMAND(LC_FUNCTION_STARTS, 0x00000026u, linkedit_data_command)
+HANDLE_LOAD_COMMAND(LC_DYLD_ENVIRONMENT, 0x00000027u, dylinker_command)
+HANDLE_LOAD_COMMAND(LC_MAIN, 0x80000028u, entry_point_command)
+HANDLE_LOAD_COMMAND(LC_DATA_IN_CODE, 0x00000029u, linkedit_data_command)
+HANDLE_LOAD_COMMAND(LC_SOURCE_VERSION, 0x0000002Au, source_version_command)
+HANDLE_LOAD_COMMAND(LC_DYLIB_CODE_SIGN_DRS, 0x0000002Bu, linkedit_data_command)
+HANDLE_LOAD_COMMAND(LC_ENCRYPTION_INFO_64, 0x0000002Cu,
+ encryption_info_command_64)
+HANDLE_LOAD_COMMAND(LC_LINKER_OPTION, 0x0000002Du, linker_option_command)
+HANDLE_LOAD_COMMAND(LC_LINKER_OPTIMIZATION_HINT, 0x0000002Eu, linkedit_data_command)
+HANDLE_LOAD_COMMAND(LC_VERSION_MIN_TVOS, 0x0000002Fu, version_min_command)
+HANDLE_LOAD_COMMAND(LC_VERSION_MIN_WATCHOS, 0x00000030u, version_min_command)
+HANDLE_LOAD_COMMAND(LC_NOTE, 0x00000031u, note_command)
+HANDLE_LOAD_COMMAND(LC_BUILD_VERSION, 0x00000032u, build_version_command)
+
+#endif
+
+#ifdef LOAD_COMMAND_STRUCT
+
+LOAD_COMMAND_STRUCT(dyld_info_command)
+LOAD_COMMAND_STRUCT(dylib_command)
+LOAD_COMMAND_STRUCT(dylinker_command)
+LOAD_COMMAND_STRUCT(dysymtab_command)
+LOAD_COMMAND_STRUCT(encryption_info_command)
+LOAD_COMMAND_STRUCT(encryption_info_command_64)
+LOAD_COMMAND_STRUCT(entry_point_command)
+LOAD_COMMAND_STRUCT(fvmfile_command)
+LOAD_COMMAND_STRUCT(fvmlib_command)
+LOAD_COMMAND_STRUCT(ident_command)
+LOAD_COMMAND_STRUCT(linkedit_data_command)
+LOAD_COMMAND_STRUCT(linker_option_command)
+LOAD_COMMAND_STRUCT(load_command)
+LOAD_COMMAND_STRUCT(prebind_cksum_command)
+LOAD_COMMAND_STRUCT(prebound_dylib_command)
+LOAD_COMMAND_STRUCT(routines_command)
+LOAD_COMMAND_STRUCT(routines_command_64)
+LOAD_COMMAND_STRUCT(rpath_command)
+LOAD_COMMAND_STRUCT(segment_command)
+LOAD_COMMAND_STRUCT(segment_command_64)
+LOAD_COMMAND_STRUCT(source_version_command)
+LOAD_COMMAND_STRUCT(sub_client_command)
+LOAD_COMMAND_STRUCT(sub_framework_command)
+LOAD_COMMAND_STRUCT(sub_library_command)
+LOAD_COMMAND_STRUCT(sub_umbrella_command)
+LOAD_COMMAND_STRUCT(symseg_command)
+LOAD_COMMAND_STRUCT(symtab_command)
+LOAD_COMMAND_STRUCT(thread_command)
+LOAD_COMMAND_STRUCT(twolevel_hints_command)
+LOAD_COMMAND_STRUCT(uuid_command)
+LOAD_COMMAND_STRUCT(version_min_command)
+LOAD_COMMAND_STRUCT(note_command)
+LOAD_COMMAND_STRUCT(build_version_command)
+
+#endif
+
+#undef HANDLE_LOAD_COMMAND
+#undef LOAD_COMMAND_STRUCT
Added: llvm/trunk/include/llvm/BinaryFormat/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/MachO.h?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/MachO.h (added)
+++ llvm/trunk/include/llvm/BinaryFormat/MachO.h Tue Jun 6 22:48:56 2017
@@ -0,0 +1,1984 @@
+//===-- llvm/BinaryFormat/MachO.h - The MachO file format -------*- C++/-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines manifest constants for the MachO object file format.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_BINARYFORMAT_MACHO_H
+#define LLVM_BINARYFORMAT_MACHO_H
+
+#include "llvm/Support/Compiler.h"
+#include "llvm/Support/DataTypes.h"
+#include "llvm/Support/Host.h"
+
+namespace llvm {
+namespace MachO {
+// Enums from <mach-o/loader.h>
+enum : uint32_t {
+ // Constants for the "magic" field in llvm::MachO::mach_header and
+ // llvm::MachO::mach_header_64
+ MH_MAGIC = 0xFEEDFACEu,
+ MH_CIGAM = 0xCEFAEDFEu,
+ MH_MAGIC_64 = 0xFEEDFACFu,
+ MH_CIGAM_64 = 0xCFFAEDFEu,
+ FAT_MAGIC = 0xCAFEBABEu,
+ FAT_CIGAM = 0xBEBAFECAu,
+ FAT_MAGIC_64 = 0xCAFEBABFu,
+ FAT_CIGAM_64 = 0xBFBAFECAu
+};
+
+enum HeaderFileType {
+ // Constants for the "filetype" field in llvm::MachO::mach_header and
+ // llvm::MachO::mach_header_64
+ MH_OBJECT = 0x1u,
+ MH_EXECUTE = 0x2u,
+ MH_FVMLIB = 0x3u,
+ MH_CORE = 0x4u,
+ MH_PRELOAD = 0x5u,
+ MH_DYLIB = 0x6u,
+ MH_DYLINKER = 0x7u,
+ MH_BUNDLE = 0x8u,
+ MH_DYLIB_STUB = 0x9u,
+ MH_DSYM = 0xAu,
+ MH_KEXT_BUNDLE = 0xBu
+};
+
+enum {
+ // Constant bits for the "flags" field in llvm::MachO::mach_header and
+ // llvm::MachO::mach_header_64
+ MH_NOUNDEFS = 0x00000001u,
+ MH_INCRLINK = 0x00000002u,
+ MH_DYLDLINK = 0x00000004u,
+ MH_BINDATLOAD = 0x00000008u,
+ MH_PREBOUND = 0x00000010u,
+ MH_SPLIT_SEGS = 0x00000020u,
+ MH_LAZY_INIT = 0x00000040u,
+ MH_TWOLEVEL = 0x00000080u,
+ MH_FORCE_FLAT = 0x00000100u,
+ MH_NOMULTIDEFS = 0x00000200u,
+ MH_NOFIXPREBINDING = 0x00000400u,
+ MH_PREBINDABLE = 0x00000800u,
+ MH_ALLMODSBOUND = 0x00001000u,
+ MH_SUBSECTIONS_VIA_SYMBOLS = 0x00002000u,
+ MH_CANONICAL = 0x00004000u,
+ MH_WEAK_DEFINES = 0x00008000u,
+ MH_BINDS_TO_WEAK = 0x00010000u,
+ MH_ALLOW_STACK_EXECUTION = 0x00020000u,
+ MH_ROOT_SAFE = 0x00040000u,
+ MH_SETUID_SAFE = 0x00080000u,
+ MH_NO_REEXPORTED_DYLIBS = 0x00100000u,
+ MH_PIE = 0x00200000u,
+ MH_DEAD_STRIPPABLE_DYLIB = 0x00400000u,
+ MH_HAS_TLV_DESCRIPTORS = 0x00800000u,
+ MH_NO_HEAP_EXECUTION = 0x01000000u,
+ MH_APP_EXTENSION_SAFE = 0x02000000u
+};
+
+enum : uint32_t {
+ // Flags for the "cmd" field in llvm::MachO::load_command
+ LC_REQ_DYLD = 0x80000000u
+};
+
+#define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) LCName = LCValue,
+
+enum LoadCommandType : uint32_t {
+#include "llvm/BinaryFormat/MachO.def"
+};
+
+#undef HANDLE_LOAD_COMMAND
+
+enum : uint32_t {
+ // Constant bits for the "flags" field in llvm::MachO::segment_command
+ SG_HIGHVM = 0x1u,
+ SG_FVMLIB = 0x2u,
+ SG_NORELOC = 0x4u,
+ SG_PROTECTED_VERSION_1 = 0x8u,
+
+ // Constant masks for the "flags" field in llvm::MachO::section and
+ // llvm::MachO::section_64
+ SECTION_TYPE = 0x000000ffu, // SECTION_TYPE
+ SECTION_ATTRIBUTES = 0xffffff00u, // SECTION_ATTRIBUTES
+ SECTION_ATTRIBUTES_USR = 0xff000000u, // SECTION_ATTRIBUTES_USR
+ SECTION_ATTRIBUTES_SYS = 0x00ffff00u // SECTION_ATTRIBUTES_SYS
+};
+
+/// These are the section type and attributes fields. A MachO section can
+/// have only one Type, but can have any of the attributes specified.
+enum SectionType : uint32_t {
+ // Constant masks for the "flags[7:0]" field in llvm::MachO::section and
+ // llvm::MachO::section_64 (mask "flags" with SECTION_TYPE)
+
+ /// S_REGULAR - Regular section.
+ S_REGULAR = 0x00u,
+ /// S_ZEROFILL - Zero fill on demand section.
+ S_ZEROFILL = 0x01u,
+ /// S_CSTRING_LITERALS - Section with literal C strings.
+ S_CSTRING_LITERALS = 0x02u,
+ /// S_4BYTE_LITERALS - Section with 4 byte literals.
+ S_4BYTE_LITERALS = 0x03u,
+ /// S_8BYTE_LITERALS - Section with 8 byte literals.
+ S_8BYTE_LITERALS = 0x04u,
+ /// S_LITERAL_POINTERS - Section with pointers to literals.
+ S_LITERAL_POINTERS = 0x05u,
+ /// S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
+ S_NON_LAZY_SYMBOL_POINTERS = 0x06u,
+ /// S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
+ S_LAZY_SYMBOL_POINTERS = 0x07u,
+ /// S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in
+ /// the Reserved2 field.
+ S_SYMBOL_STUBS = 0x08u,
+ /// S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for
+ /// initialization.
+ S_MOD_INIT_FUNC_POINTERS = 0x09u,
+ /// S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for
+ /// termination.
+ S_MOD_TERM_FUNC_POINTERS = 0x0au,
+ /// S_COALESCED - Section contains symbols that are to be coalesced.
+ S_COALESCED = 0x0bu,
+ /// S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4
+ /// gigabytes).
+ S_GB_ZEROFILL = 0x0cu,
+ /// S_INTERPOSING - Section with only pairs of function pointers for
+ /// interposing.
+ S_INTERPOSING = 0x0du,
+ /// S_16BYTE_LITERALS - Section with only 16 byte literals.
+ S_16BYTE_LITERALS = 0x0eu,
+ /// S_DTRACE_DOF - Section contains DTrace Object Format.
+ S_DTRACE_DOF = 0x0fu,
+ /// S_LAZY_DYLIB_SYMBOL_POINTERS - Section with lazy symbol pointers to
+ /// lazy loaded dylibs.
+ S_LAZY_DYLIB_SYMBOL_POINTERS = 0x10u,
+ /// S_THREAD_LOCAL_REGULAR - Thread local data section.
+ S_THREAD_LOCAL_REGULAR = 0x11u,
+ /// S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
+ S_THREAD_LOCAL_ZEROFILL = 0x12u,
+ /// S_THREAD_LOCAL_VARIABLES - Section with thread local variable
+ /// structure data.
+ S_THREAD_LOCAL_VARIABLES = 0x13u,
+ /// S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread
+ /// local structures.
+ S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14u,
+ /// S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local
+ /// variable initialization pointers to functions.
+ S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15u,
+
+ LAST_KNOWN_SECTION_TYPE = S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
+};
+
+enum : uint32_t {
+ // Constant masks for the "flags[31:24]" field in llvm::MachO::section and
+ // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_USR)
+
+ /// S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine
+ /// instructions.
+ S_ATTR_PURE_INSTRUCTIONS = 0x80000000u,
+ /// S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be
+ /// in a ranlib table of contents.
+ S_ATTR_NO_TOC = 0x40000000u,
+ /// S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section
+ /// in files with the MY_DYLDLINK flag.
+ S_ATTR_STRIP_STATIC_SYMS = 0x20000000u,
+ /// S_ATTR_NO_DEAD_STRIP - No dead stripping.
+ S_ATTR_NO_DEAD_STRIP = 0x10000000u,
+ /// S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
+ S_ATTR_LIVE_SUPPORT = 0x08000000u,
+ /// S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by
+ /// dyld.
+ S_ATTR_SELF_MODIFYING_CODE = 0x04000000u,
+ /// S_ATTR_DEBUG - A debug section.
+ S_ATTR_DEBUG = 0x02000000u,
+
+ // Constant masks for the "flags[23:8]" field in llvm::MachO::section and
+ // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_SYS)
+
+ /// S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
+ S_ATTR_SOME_INSTRUCTIONS = 0x00000400u,
+ /// S_ATTR_EXT_RELOC - Section has external relocation entries.
+ S_ATTR_EXT_RELOC = 0x00000200u,
+ /// S_ATTR_LOC_RELOC - Section has local relocation entries.
+ S_ATTR_LOC_RELOC = 0x00000100u,
+
+ // Constant masks for the value of an indirect symbol in an indirect
+ // symbol table
+ INDIRECT_SYMBOL_LOCAL = 0x80000000u,
+ INDIRECT_SYMBOL_ABS = 0x40000000u
+};
+
+enum DataRegionType {
+ // Constants for the "kind" field in a data_in_code_entry structure
+ DICE_KIND_DATA = 1u,
+ DICE_KIND_JUMP_TABLE8 = 2u,
+ DICE_KIND_JUMP_TABLE16 = 3u,
+ DICE_KIND_JUMP_TABLE32 = 4u,
+ DICE_KIND_ABS_JUMP_TABLE32 = 5u
+};
+
+enum RebaseType {
+ REBASE_TYPE_POINTER = 1u,
+ REBASE_TYPE_TEXT_ABSOLUTE32 = 2u,
+ REBASE_TYPE_TEXT_PCREL32 = 3u
+};
+
+enum { REBASE_OPCODE_MASK = 0xF0u, REBASE_IMMEDIATE_MASK = 0x0Fu };
+
+enum RebaseOpcode {
+ REBASE_OPCODE_DONE = 0x00u,
+ REBASE_OPCODE_SET_TYPE_IMM = 0x10u,
+ REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x20u,
+ REBASE_OPCODE_ADD_ADDR_ULEB = 0x30u,
+ REBASE_OPCODE_ADD_ADDR_IMM_SCALED = 0x40u,
+ REBASE_OPCODE_DO_REBASE_IMM_TIMES = 0x50u,
+ REBASE_OPCODE_DO_REBASE_ULEB_TIMES = 0x60u,
+ REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB = 0x70u,
+ REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB = 0x80u
+};
+
+enum BindType {
+ BIND_TYPE_POINTER = 1u,
+ BIND_TYPE_TEXT_ABSOLUTE32 = 2u,
+ BIND_TYPE_TEXT_PCREL32 = 3u
+};
+
+enum BindSpecialDylib {
+ BIND_SPECIAL_DYLIB_SELF = 0,
+ BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE = -1,
+ BIND_SPECIAL_DYLIB_FLAT_LOOKUP = -2
+};
+
+enum {
+ BIND_SYMBOL_FLAGS_WEAK_IMPORT = 0x1u,
+ BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION = 0x8u,
+
+ BIND_OPCODE_MASK = 0xF0u,
+ BIND_IMMEDIATE_MASK = 0x0Fu
+};
+
+enum BindOpcode {
+ BIND_OPCODE_DONE = 0x00u,
+ BIND_OPCODE_SET_DYLIB_ORDINAL_IMM = 0x10u,
+ BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB = 0x20u,
+ BIND_OPCODE_SET_DYLIB_SPECIAL_IMM = 0x30u,
+ BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM = 0x40u,
+ BIND_OPCODE_SET_TYPE_IMM = 0x50u,
+ BIND_OPCODE_SET_ADDEND_SLEB = 0x60u,
+ BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x70u,
+ BIND_OPCODE_ADD_ADDR_ULEB = 0x80u,
+ BIND_OPCODE_DO_BIND = 0x90u,
+ BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB = 0xA0u,
+ BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED = 0xB0u,
+ BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB = 0xC0u
+};
+
+enum {
+ EXPORT_SYMBOL_FLAGS_KIND_MASK = 0x03u,
+ EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION = 0x04u,
+ EXPORT_SYMBOL_FLAGS_REEXPORT = 0x08u,
+ EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER = 0x10u
+};
+
+enum ExportSymbolKind {
+ EXPORT_SYMBOL_FLAGS_KIND_REGULAR = 0x00u,
+ EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL = 0x01u,
+ EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE = 0x02u
+};
+
+enum {
+ // Constant masks for the "n_type" field in llvm::MachO::nlist and
+ // llvm::MachO::nlist_64
+ N_STAB = 0xe0,
+ N_PEXT = 0x10,
+ N_TYPE = 0x0e,
+ N_EXT = 0x01
+};
+
+enum NListType : uint8_t {
+ // Constants for the "n_type & N_TYPE" llvm::MachO::nlist and
+ // llvm::MachO::nlist_64
+ N_UNDF = 0x0u,
+ N_ABS = 0x2u,
+ N_SECT = 0xeu,
+ N_PBUD = 0xcu,
+ N_INDR = 0xau
+};
+
+enum SectionOrdinal {
+ // Constants for the "n_sect" field in llvm::MachO::nlist and
+ // llvm::MachO::nlist_64
+ NO_SECT = 0u,
+ MAX_SECT = 0xffu
+};
+
+enum {
+ // Constant masks for the "n_desc" field in llvm::MachO::nlist and
+ // llvm::MachO::nlist_64
+ // The low 3 bits are the for the REFERENCE_TYPE.
+ REFERENCE_TYPE = 0x7,
+ REFERENCE_FLAG_UNDEFINED_NON_LAZY = 0,
+ REFERENCE_FLAG_UNDEFINED_LAZY = 1,
+ REFERENCE_FLAG_DEFINED = 2,
+ REFERENCE_FLAG_PRIVATE_DEFINED = 3,
+ REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY = 4,
+ REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY = 5,
+ // Flag bits (some overlap with the library ordinal bits).
+ N_ARM_THUMB_DEF = 0x0008u,
+ REFERENCED_DYNAMICALLY = 0x0010u,
+ N_NO_DEAD_STRIP = 0x0020u,
+ N_WEAK_REF = 0x0040u,
+ N_WEAK_DEF = 0x0080u,
+ N_SYMBOL_RESOLVER = 0x0100u,
+ N_ALT_ENTRY = 0x0200u,
+ // For undefined symbols coming from libraries, see GET_LIBRARY_ORDINAL()
+ // as these are in the top 8 bits.
+ SELF_LIBRARY_ORDINAL = 0x0,
+ MAX_LIBRARY_ORDINAL = 0xfd,
+ DYNAMIC_LOOKUP_ORDINAL = 0xfe,
+ EXECUTABLE_ORDINAL = 0xff
+};
+
+enum StabType {
+ // Constant values for the "n_type" field in llvm::MachO::nlist and
+ // llvm::MachO::nlist_64 when "(n_type & N_STAB) != 0"
+ N_GSYM = 0x20u,
+ N_FNAME = 0x22u,
+ N_FUN = 0x24u,
+ N_STSYM = 0x26u,
+ N_LCSYM = 0x28u,
+ N_BNSYM = 0x2Eu,
+ N_PC = 0x30u,
+ N_AST = 0x32u,
+ N_OPT = 0x3Cu,
+ N_RSYM = 0x40u,
+ N_SLINE = 0x44u,
+ N_ENSYM = 0x4Eu,
+ N_SSYM = 0x60u,
+ N_SO = 0x64u,
+ N_OSO = 0x66u,
+ N_LSYM = 0x80u,
+ N_BINCL = 0x82u,
+ N_SOL = 0x84u,
+ N_PARAMS = 0x86u,
+ N_VERSION = 0x88u,
+ N_OLEVEL = 0x8Au,
+ N_PSYM = 0xA0u,
+ N_EINCL = 0xA2u,
+ N_ENTRY = 0xA4u,
+ N_LBRAC = 0xC0u,
+ N_EXCL = 0xC2u,
+ N_RBRAC = 0xE0u,
+ N_BCOMM = 0xE2u,
+ N_ECOMM = 0xE4u,
+ N_ECOML = 0xE8u,
+ N_LENG = 0xFEu
+};
+
+enum : uint32_t {
+ // Constant values for the r_symbolnum field in an
+ // llvm::MachO::relocation_info structure when r_extern is 0.
+ R_ABS = 0,
+
+ // Constant bits for the r_address field in an
+ // llvm::MachO::relocation_info structure.
+ R_SCATTERED = 0x80000000
+};
+
+enum RelocationInfoType {
+ // Constant values for the r_type field in an
+ // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
+ // structure.
+ GENERIC_RELOC_VANILLA = 0,
+ GENERIC_RELOC_PAIR = 1,
+ GENERIC_RELOC_SECTDIFF = 2,
+ GENERIC_RELOC_PB_LA_PTR = 3,
+ GENERIC_RELOC_LOCAL_SECTDIFF = 4,
+ GENERIC_RELOC_TLV = 5,
+
+ // Constant values for the r_type field in a PowerPC architecture
+ // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
+ // structure.
+ PPC_RELOC_VANILLA = GENERIC_RELOC_VANILLA,
+ PPC_RELOC_PAIR = GENERIC_RELOC_PAIR,
+ PPC_RELOC_BR14 = 2,
+ PPC_RELOC_BR24 = 3,
+ PPC_RELOC_HI16 = 4,
+ PPC_RELOC_LO16 = 5,
+ PPC_RELOC_HA16 = 6,
+ PPC_RELOC_LO14 = 7,
+ PPC_RELOC_SECTDIFF = 8,
+ PPC_RELOC_PB_LA_PTR = 9,
+ PPC_RELOC_HI16_SECTDIFF = 10,
+ PPC_RELOC_LO16_SECTDIFF = 11,
+ PPC_RELOC_HA16_SECTDIFF = 12,
+ PPC_RELOC_JBSR = 13,
+ PPC_RELOC_LO14_SECTDIFF = 14,
+ PPC_RELOC_LOCAL_SECTDIFF = 15,
+
+ // Constant values for the r_type field in an ARM architecture
+ // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
+ // structure.
+ ARM_RELOC_VANILLA = GENERIC_RELOC_VANILLA,
+ ARM_RELOC_PAIR = GENERIC_RELOC_PAIR,
+ ARM_RELOC_SECTDIFF = GENERIC_RELOC_SECTDIFF,
+ ARM_RELOC_LOCAL_SECTDIFF = 3,
+ ARM_RELOC_PB_LA_PTR = 4,
+ ARM_RELOC_BR24 = 5,
+ ARM_THUMB_RELOC_BR22 = 6,
+ ARM_THUMB_32BIT_BRANCH = 7, // obsolete
+ ARM_RELOC_HALF = 8,
+ ARM_RELOC_HALF_SECTDIFF = 9,
+
+ // Constant values for the r_type field in an ARM64 architecture
+ // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
+ // structure.
+
+ // For pointers.
+ ARM64_RELOC_UNSIGNED = 0,
+ // Must be followed by an ARM64_RELOC_UNSIGNED
+ ARM64_RELOC_SUBTRACTOR = 1,
+ // A B/BL instruction with 26-bit displacement.
+ ARM64_RELOC_BRANCH26 = 2,
+ // PC-rel distance to page of target.
+ ARM64_RELOC_PAGE21 = 3,
+ // Offset within page, scaled by r_length.
+ ARM64_RELOC_PAGEOFF12 = 4,
+ // PC-rel distance to page of GOT slot.
+ ARM64_RELOC_GOT_LOAD_PAGE21 = 5,
+ // Offset within page of GOT slot, scaled by r_length.
+ ARM64_RELOC_GOT_LOAD_PAGEOFF12 = 6,
+ // For pointers to GOT slots.
+ ARM64_RELOC_POINTER_TO_GOT = 7,
+ // PC-rel distance to page of TLVP slot.
+ ARM64_RELOC_TLVP_LOAD_PAGE21 = 8,
+ // Offset within page of TLVP slot, scaled by r_length.
+ ARM64_RELOC_TLVP_LOAD_PAGEOFF12 = 9,
+ // Must be followed by ARM64_RELOC_PAGE21 or ARM64_RELOC_PAGEOFF12.
+ ARM64_RELOC_ADDEND = 10,
+
+ // Constant values for the r_type field in an x86_64 architecture
+ // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
+ // structure
+ X86_64_RELOC_UNSIGNED = 0,
+ X86_64_RELOC_SIGNED = 1,
+ X86_64_RELOC_BRANCH = 2,
+ X86_64_RELOC_GOT_LOAD = 3,
+ X86_64_RELOC_GOT = 4,
+ X86_64_RELOC_SUBTRACTOR = 5,
+ X86_64_RELOC_SIGNED_1 = 6,
+ X86_64_RELOC_SIGNED_2 = 7,
+ X86_64_RELOC_SIGNED_4 = 8,
+ X86_64_RELOC_TLV = 9
+};
+
+// Values for segment_command.initprot.
+// From <mach/vm_prot.h>
+enum { VM_PROT_READ = 0x1, VM_PROT_WRITE = 0x2, VM_PROT_EXECUTE = 0x4 };
+
+// Values for platform field in build_version_command.
+enum {
+ PLATFORM_MACOS = 1,
+ PLATFORM_IOS = 2,
+ PLATFORM_TVOS = 3,
+ PLATFORM_WATCHOS = 4,
+ PLATFORM_BRIDGEOS = 5
+};
+
+// Values for tools enum in build_tool_version.
+enum { TOOL_CLANG = 1, TOOL_SWIFT = 2, TOOL_LD = 3 };
+
+// Structs from <mach-o/loader.h>
+
+struct mach_header {
+ uint32_t magic;
+ uint32_t cputype;
+ uint32_t cpusubtype;
+ uint32_t filetype;
+ uint32_t ncmds;
+ uint32_t sizeofcmds;
+ uint32_t flags;
+};
+
+struct mach_header_64 {
+ uint32_t magic;
+ uint32_t cputype;
+ uint32_t cpusubtype;
+ uint32_t filetype;
+ uint32_t ncmds;
+ uint32_t sizeofcmds;
+ uint32_t flags;
+ uint32_t reserved;
+};
+
+struct load_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+};
+
+struct segment_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ char segname[16];
+ uint32_t vmaddr;
+ uint32_t vmsize;
+ uint32_t fileoff;
+ uint32_t filesize;
+ uint32_t maxprot;
+ uint32_t initprot;
+ uint32_t nsects;
+ uint32_t flags;
+};
+
+struct segment_command_64 {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ char segname[16];
+ uint64_t vmaddr;
+ uint64_t vmsize;
+ uint64_t fileoff;
+ uint64_t filesize;
+ uint32_t maxprot;
+ uint32_t initprot;
+ uint32_t nsects;
+ uint32_t flags;
+};
+
+struct section {
+ char sectname[16];
+ char segname[16];
+ uint32_t addr;
+ uint32_t size;
+ uint32_t offset;
+ uint32_t align;
+ uint32_t reloff;
+ uint32_t nreloc;
+ uint32_t flags;
+ uint32_t reserved1;
+ uint32_t reserved2;
+};
+
+struct section_64 {
+ char sectname[16];
+ char segname[16];
+ uint64_t addr;
+ uint64_t size;
+ uint32_t offset;
+ uint32_t align;
+ uint32_t reloff;
+ uint32_t nreloc;
+ uint32_t flags;
+ uint32_t reserved1;
+ uint32_t reserved2;
+ uint32_t reserved3;
+};
+
+struct fvmlib {
+ uint32_t name;
+ uint32_t minor_version;
+ uint32_t header_addr;
+};
+
+// The fvmlib_command is obsolete and no longer supported.
+struct fvmlib_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ struct fvmlib fvmlib;
+};
+
+struct dylib {
+ uint32_t name;
+ uint32_t timestamp;
+ uint32_t current_version;
+ uint32_t compatibility_version;
+};
+
+struct dylib_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ struct dylib dylib;
+};
+
+struct sub_framework_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t umbrella;
+};
+
+struct sub_client_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t client;
+};
+
+struct sub_umbrella_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t sub_umbrella;
+};
+
+struct sub_library_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t sub_library;
+};
+
+// The prebound_dylib_command is obsolete and no longer supported.
+struct prebound_dylib_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t name;
+ uint32_t nmodules;
+ uint32_t linked_modules;
+};
+
+struct dylinker_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t name;
+};
+
+struct thread_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+};
+
+struct routines_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t init_address;
+ uint32_t init_module;
+ uint32_t reserved1;
+ uint32_t reserved2;
+ uint32_t reserved3;
+ uint32_t reserved4;
+ uint32_t reserved5;
+ uint32_t reserved6;
+};
+
+struct routines_command_64 {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint64_t init_address;
+ uint64_t init_module;
+ uint64_t reserved1;
+ uint64_t reserved2;
+ uint64_t reserved3;
+ uint64_t reserved4;
+ uint64_t reserved5;
+ uint64_t reserved6;
+};
+
+struct symtab_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t symoff;
+ uint32_t nsyms;
+ uint32_t stroff;
+ uint32_t strsize;
+};
+
+struct dysymtab_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t ilocalsym;
+ uint32_t nlocalsym;
+ uint32_t iextdefsym;
+ uint32_t nextdefsym;
+ uint32_t iundefsym;
+ uint32_t nundefsym;
+ uint32_t tocoff;
+ uint32_t ntoc;
+ uint32_t modtaboff;
+ uint32_t nmodtab;
+ uint32_t extrefsymoff;
+ uint32_t nextrefsyms;
+ uint32_t indirectsymoff;
+ uint32_t nindirectsyms;
+ uint32_t extreloff;
+ uint32_t nextrel;
+ uint32_t locreloff;
+ uint32_t nlocrel;
+};
+
+struct dylib_table_of_contents {
+ uint32_t symbol_index;
+ uint32_t module_index;
+};
+
+struct dylib_module {
+ uint32_t module_name;
+ uint32_t iextdefsym;
+ uint32_t nextdefsym;
+ uint32_t irefsym;
+ uint32_t nrefsym;
+ uint32_t ilocalsym;
+ uint32_t nlocalsym;
+ uint32_t iextrel;
+ uint32_t nextrel;
+ uint32_t iinit_iterm;
+ uint32_t ninit_nterm;
+ uint32_t objc_module_info_addr;
+ uint32_t objc_module_info_size;
+};
+
+struct dylib_module_64 {
+ uint32_t module_name;
+ uint32_t iextdefsym;
+ uint32_t nextdefsym;
+ uint32_t irefsym;
+ uint32_t nrefsym;
+ uint32_t ilocalsym;
+ uint32_t nlocalsym;
+ uint32_t iextrel;
+ uint32_t nextrel;
+ uint32_t iinit_iterm;
+ uint32_t ninit_nterm;
+ uint32_t objc_module_info_size;
+ uint64_t objc_module_info_addr;
+};
+
+struct dylib_reference {
+ uint32_t isym : 24, flags : 8;
+};
+
+// The twolevel_hints_command is obsolete and no longer supported.
+struct twolevel_hints_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t offset;
+ uint32_t nhints;
+};
+
+// The twolevel_hints_command is obsolete and no longer supported.
+struct twolevel_hint {
+ uint32_t isub_image : 8, itoc : 24;
+};
+
+// The prebind_cksum_command is obsolete and no longer supported.
+struct prebind_cksum_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t cksum;
+};
+
+struct uuid_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint8_t uuid[16];
+};
+
+struct rpath_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t path;
+};
+
+struct linkedit_data_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t dataoff;
+ uint32_t datasize;
+};
+
+struct data_in_code_entry {
+ uint32_t offset;
+ uint16_t length;
+ uint16_t kind;
+};
+
+struct source_version_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint64_t version;
+};
+
+struct encryption_info_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t cryptoff;
+ uint32_t cryptsize;
+ uint32_t cryptid;
+};
+
+struct encryption_info_command_64 {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t cryptoff;
+ uint32_t cryptsize;
+ uint32_t cryptid;
+ uint32_t pad;
+};
+
+struct version_min_command {
+ uint32_t cmd; // LC_VERSION_MIN_MACOSX or
+ // LC_VERSION_MIN_IPHONEOS
+ uint32_t cmdsize; // sizeof(struct version_min_command)
+ uint32_t version; // X.Y.Z is encoded in nibbles xxxx.yy.zz
+ uint32_t sdk; // X.Y.Z is encoded in nibbles xxxx.yy.zz
+};
+
+struct note_command {
+ uint32_t cmd; // LC_NOTE
+ uint32_t cmdsize; // sizeof(struct note_command)
+ char data_owner[16]; // owner name for this LC_NOTE
+ uint64_t offset; // file offset of this data
+ uint64_t size; // length of data region
+};
+
+struct build_tool_version {
+ uint32_t tool; // enum for the tool
+ uint32_t version; // version of the tool
+};
+
+struct build_version_command {
+ uint32_t cmd; // LC_BUILD_VERSION
+ uint32_t cmdsize; // sizeof(struct build_version_command) +
+ // ntools * sizeof(struct build_tool_version)
+ uint32_t platform; // platform
+ uint32_t minos; // X.Y.Z is encoded in nibbles xxxx.yy.zz
+ uint32_t sdk; // X.Y.Z is encoded in nibbles xxxx.yy.zz
+ uint32_t ntools; // number of tool entries following this
+};
+
+struct dyld_info_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t rebase_off;
+ uint32_t rebase_size;
+ uint32_t bind_off;
+ uint32_t bind_size;
+ uint32_t weak_bind_off;
+ uint32_t weak_bind_size;
+ uint32_t lazy_bind_off;
+ uint32_t lazy_bind_size;
+ uint32_t export_off;
+ uint32_t export_size;
+};
+
+struct linker_option_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t count;
+};
+
+// The symseg_command is obsolete and no longer supported.
+struct symseg_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t offset;
+ uint32_t size;
+};
+
+// The ident_command is obsolete and no longer supported.
+struct ident_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+};
+
+// The fvmfile_command is obsolete and no longer supported.
+struct fvmfile_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint32_t name;
+ uint32_t header_addr;
+};
+
+struct tlv_descriptor_32 {
+ uint32_t thunk;
+ uint32_t key;
+ uint32_t offset;
+};
+
+struct tlv_descriptor_64 {
+ uint64_t thunk;
+ uint64_t key;
+ uint64_t offset;
+};
+
+struct tlv_descriptor {
+ uintptr_t thunk;
+ uintptr_t key;
+ uintptr_t offset;
+};
+
+struct entry_point_command {
+ uint32_t cmd;
+ uint32_t cmdsize;
+ uint64_t entryoff;
+ uint64_t stacksize;
+};
+
+// Structs from <mach-o/fat.h>
+struct fat_header {
+ uint32_t magic;
+ uint32_t nfat_arch;
+};
+
+struct fat_arch {
+ uint32_t cputype;
+ uint32_t cpusubtype;
+ uint32_t offset;
+ uint32_t size;
+ uint32_t align;
+};
+
+struct fat_arch_64 {
+ uint32_t cputype;
+ uint32_t cpusubtype;
+ uint64_t offset;
+ uint64_t size;
+ uint32_t align;
+ uint32_t reserved;
+};
+
+// Structs from <mach-o/reloc.h>
+struct relocation_info {
+ int32_t r_address;
+ uint32_t r_symbolnum : 24, r_pcrel : 1, r_length : 2, r_extern : 1,
+ r_type : 4;
+};
+
+struct scattered_relocation_info {
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)
+ uint32_t r_scattered : 1, r_pcrel : 1, r_length : 2, r_type : 4,
+ r_address : 24;
+#else
+ uint32_t r_address : 24, r_type : 4, r_length : 2, r_pcrel : 1,
+ r_scattered : 1;
+#endif
+ int32_t r_value;
+};
+
+// Structs NOT from <mach-o/reloc.h>, but that make LLVM's life easier
+struct any_relocation_info {
+ uint32_t r_word0, r_word1;
+};
+
+// Structs from <mach-o/nlist.h>
+struct nlist_base {
+ uint32_t n_strx;
+ uint8_t n_type;
+ uint8_t n_sect;
+ uint16_t n_desc;
+};
+
+struct nlist {
+ uint32_t n_strx;
+ uint8_t n_type;
+ uint8_t n_sect;
+ int16_t n_desc;
+ uint32_t n_value;
+};
+
+struct nlist_64 {
+ uint32_t n_strx;
+ uint8_t n_type;
+ uint8_t n_sect;
+ uint16_t n_desc;
+ uint64_t n_value;
+};
+
+// Byte order swapping functions for MachO structs
+
+inline void swapStruct(fat_header &mh) {
+ sys::swapByteOrder(mh.magic);
+ sys::swapByteOrder(mh.nfat_arch);
+}
+
+inline void swapStruct(fat_arch &mh) {
+ sys::swapByteOrder(mh.cputype);
+ sys::swapByteOrder(mh.cpusubtype);
+ sys::swapByteOrder(mh.offset);
+ sys::swapByteOrder(mh.size);
+ sys::swapByteOrder(mh.align);
+}
+
+inline void swapStruct(fat_arch_64 &mh) {
+ sys::swapByteOrder(mh.cputype);
+ sys::swapByteOrder(mh.cpusubtype);
+ sys::swapByteOrder(mh.offset);
+ sys::swapByteOrder(mh.size);
+ sys::swapByteOrder(mh.align);
+ sys::swapByteOrder(mh.reserved);
+}
+
+inline void swapStruct(mach_header &mh) {
+ sys::swapByteOrder(mh.magic);
+ sys::swapByteOrder(mh.cputype);
+ sys::swapByteOrder(mh.cpusubtype);
+ sys::swapByteOrder(mh.filetype);
+ sys::swapByteOrder(mh.ncmds);
+ sys::swapByteOrder(mh.sizeofcmds);
+ sys::swapByteOrder(mh.flags);
+}
+
+inline void swapStruct(mach_header_64 &H) {
+ sys::swapByteOrder(H.magic);
+ sys::swapByteOrder(H.cputype);
+ sys::swapByteOrder(H.cpusubtype);
+ sys::swapByteOrder(H.filetype);
+ sys::swapByteOrder(H.ncmds);
+ sys::swapByteOrder(H.sizeofcmds);
+ sys::swapByteOrder(H.flags);
+ sys::swapByteOrder(H.reserved);
+}
+
+inline void swapStruct(load_command &lc) {
+ sys::swapByteOrder(lc.cmd);
+ sys::swapByteOrder(lc.cmdsize);
+}
+
+inline void swapStruct(symtab_command &lc) {
+ sys::swapByteOrder(lc.cmd);
+ sys::swapByteOrder(lc.cmdsize);
+ sys::swapByteOrder(lc.symoff);
+ sys::swapByteOrder(lc.nsyms);
+ sys::swapByteOrder(lc.stroff);
+ sys::swapByteOrder(lc.strsize);
+}
+
+inline void swapStruct(segment_command_64 &seg) {
+ sys::swapByteOrder(seg.cmd);
+ sys::swapByteOrder(seg.cmdsize);
+ sys::swapByteOrder(seg.vmaddr);
+ sys::swapByteOrder(seg.vmsize);
+ sys::swapByteOrder(seg.fileoff);
+ sys::swapByteOrder(seg.filesize);
+ sys::swapByteOrder(seg.maxprot);
+ sys::swapByteOrder(seg.initprot);
+ sys::swapByteOrder(seg.nsects);
+ sys::swapByteOrder(seg.flags);
+}
+
+inline void swapStruct(segment_command &seg) {
+ sys::swapByteOrder(seg.cmd);
+ sys::swapByteOrder(seg.cmdsize);
+ sys::swapByteOrder(seg.vmaddr);
+ sys::swapByteOrder(seg.vmsize);
+ sys::swapByteOrder(seg.fileoff);
+ sys::swapByteOrder(seg.filesize);
+ sys::swapByteOrder(seg.maxprot);
+ sys::swapByteOrder(seg.initprot);
+ sys::swapByteOrder(seg.nsects);
+ sys::swapByteOrder(seg.flags);
+}
+
+inline void swapStruct(section_64 §) {
+ sys::swapByteOrder(sect.addr);
+ sys::swapByteOrder(sect.size);
+ sys::swapByteOrder(sect.offset);
+ sys::swapByteOrder(sect.align);
+ sys::swapByteOrder(sect.reloff);
+ sys::swapByteOrder(sect.nreloc);
+ sys::swapByteOrder(sect.flags);
+ sys::swapByteOrder(sect.reserved1);
+ sys::swapByteOrder(sect.reserved2);
+}
+
+inline void swapStruct(section §) {
+ sys::swapByteOrder(sect.addr);
+ sys::swapByteOrder(sect.size);
+ sys::swapByteOrder(sect.offset);
+ sys::swapByteOrder(sect.align);
+ sys::swapByteOrder(sect.reloff);
+ sys::swapByteOrder(sect.nreloc);
+ sys::swapByteOrder(sect.flags);
+ sys::swapByteOrder(sect.reserved1);
+ sys::swapByteOrder(sect.reserved2);
+}
+
+inline void swapStruct(dyld_info_command &info) {
+ sys::swapByteOrder(info.cmd);
+ sys::swapByteOrder(info.cmdsize);
+ sys::swapByteOrder(info.rebase_off);
+ sys::swapByteOrder(info.rebase_size);
+ sys::swapByteOrder(info.bind_off);
+ sys::swapByteOrder(info.bind_size);
+ sys::swapByteOrder(info.weak_bind_off);
+ sys::swapByteOrder(info.weak_bind_size);
+ sys::swapByteOrder(info.lazy_bind_off);
+ sys::swapByteOrder(info.lazy_bind_size);
+ sys::swapByteOrder(info.export_off);
+ sys::swapByteOrder(info.export_size);
+}
+
+inline void swapStruct(dylib_command &d) {
+ sys::swapByteOrder(d.cmd);
+ sys::swapByteOrder(d.cmdsize);
+ sys::swapByteOrder(d.dylib.name);
+ sys::swapByteOrder(d.dylib.timestamp);
+ sys::swapByteOrder(d.dylib.current_version);
+ sys::swapByteOrder(d.dylib.compatibility_version);
+}
+
+inline void swapStruct(sub_framework_command &s) {
+ sys::swapByteOrder(s.cmd);
+ sys::swapByteOrder(s.cmdsize);
+ sys::swapByteOrder(s.umbrella);
+}
+
+inline void swapStruct(sub_umbrella_command &s) {
+ sys::swapByteOrder(s.cmd);
+ sys::swapByteOrder(s.cmdsize);
+ sys::swapByteOrder(s.sub_umbrella);
+}
+
+inline void swapStruct(sub_library_command &s) {
+ sys::swapByteOrder(s.cmd);
+ sys::swapByteOrder(s.cmdsize);
+ sys::swapByteOrder(s.sub_library);
+}
+
+inline void swapStruct(sub_client_command &s) {
+ sys::swapByteOrder(s.cmd);
+ sys::swapByteOrder(s.cmdsize);
+ sys::swapByteOrder(s.client);
+}
+
+inline void swapStruct(routines_command &r) {
+ sys::swapByteOrder(r.cmd);
+ sys::swapByteOrder(r.cmdsize);
+ sys::swapByteOrder(r.init_address);
+ sys::swapByteOrder(r.init_module);
+ sys::swapByteOrder(r.reserved1);
+ sys::swapByteOrder(r.reserved2);
+ sys::swapByteOrder(r.reserved3);
+ sys::swapByteOrder(r.reserved4);
+ sys::swapByteOrder(r.reserved5);
+ sys::swapByteOrder(r.reserved6);
+}
+
+inline void swapStruct(routines_command_64 &r) {
+ sys::swapByteOrder(r.cmd);
+ sys::swapByteOrder(r.cmdsize);
+ sys::swapByteOrder(r.init_address);
+ sys::swapByteOrder(r.init_module);
+ sys::swapByteOrder(r.reserved1);
+ sys::swapByteOrder(r.reserved2);
+ sys::swapByteOrder(r.reserved3);
+ sys::swapByteOrder(r.reserved4);
+ sys::swapByteOrder(r.reserved5);
+ sys::swapByteOrder(r.reserved6);
+}
+
+inline void swapStruct(thread_command &t) {
+ sys::swapByteOrder(t.cmd);
+ sys::swapByteOrder(t.cmdsize);
+}
+
+inline void swapStruct(dylinker_command &d) {
+ sys::swapByteOrder(d.cmd);
+ sys::swapByteOrder(d.cmdsize);
+ sys::swapByteOrder(d.name);
+}
+
+inline void swapStruct(uuid_command &u) {
+ sys::swapByteOrder(u.cmd);
+ sys::swapByteOrder(u.cmdsize);
+}
+
+inline void swapStruct(rpath_command &r) {
+ sys::swapByteOrder(r.cmd);
+ sys::swapByteOrder(r.cmdsize);
+ sys::swapByteOrder(r.path);
+}
+
+inline void swapStruct(source_version_command &s) {
+ sys::swapByteOrder(s.cmd);
+ sys::swapByteOrder(s.cmdsize);
+ sys::swapByteOrder(s.version);
+}
+
+inline void swapStruct(entry_point_command &e) {
+ sys::swapByteOrder(e.cmd);
+ sys::swapByteOrder(e.cmdsize);
+ sys::swapByteOrder(e.entryoff);
+ sys::swapByteOrder(e.stacksize);
+}
+
+inline void swapStruct(encryption_info_command &e) {
+ sys::swapByteOrder(e.cmd);
+ sys::swapByteOrder(e.cmdsize);
+ sys::swapByteOrder(e.cryptoff);
+ sys::swapByteOrder(e.cryptsize);
+ sys::swapByteOrder(e.cryptid);
+}
+
+inline void swapStruct(encryption_info_command_64 &e) {
+ sys::swapByteOrder(e.cmd);
+ sys::swapByteOrder(e.cmdsize);
+ sys::swapByteOrder(e.cryptoff);
+ sys::swapByteOrder(e.cryptsize);
+ sys::swapByteOrder(e.cryptid);
+ sys::swapByteOrder(e.pad);
+}
+
+inline void swapStruct(dysymtab_command &dst) {
+ sys::swapByteOrder(dst.cmd);
+ sys::swapByteOrder(dst.cmdsize);
+ sys::swapByteOrder(dst.ilocalsym);
+ sys::swapByteOrder(dst.nlocalsym);
+ sys::swapByteOrder(dst.iextdefsym);
+ sys::swapByteOrder(dst.nextdefsym);
+ sys::swapByteOrder(dst.iundefsym);
+ sys::swapByteOrder(dst.nundefsym);
+ sys::swapByteOrder(dst.tocoff);
+ sys::swapByteOrder(dst.ntoc);
+ sys::swapByteOrder(dst.modtaboff);
+ sys::swapByteOrder(dst.nmodtab);
+ sys::swapByteOrder(dst.extrefsymoff);
+ sys::swapByteOrder(dst.nextrefsyms);
+ sys::swapByteOrder(dst.indirectsymoff);
+ sys::swapByteOrder(dst.nindirectsyms);
+ sys::swapByteOrder(dst.extreloff);
+ sys::swapByteOrder(dst.nextrel);
+ sys::swapByteOrder(dst.locreloff);
+ sys::swapByteOrder(dst.nlocrel);
+}
+
+inline void swapStruct(any_relocation_info &reloc) {
+ sys::swapByteOrder(reloc.r_word0);
+ sys::swapByteOrder(reloc.r_word1);
+}
+
+inline void swapStruct(nlist_base &S) {
+ sys::swapByteOrder(S.n_strx);
+ sys::swapByteOrder(S.n_desc);
+}
+
+inline void swapStruct(nlist &sym) {
+ sys::swapByteOrder(sym.n_strx);
+ sys::swapByteOrder(sym.n_desc);
+ sys::swapByteOrder(sym.n_value);
+}
+
+inline void swapStruct(nlist_64 &sym) {
+ sys::swapByteOrder(sym.n_strx);
+ sys::swapByteOrder(sym.n_desc);
+ sys::swapByteOrder(sym.n_value);
+}
+
+inline void swapStruct(linkedit_data_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.dataoff);
+ sys::swapByteOrder(C.datasize);
+}
+
+inline void swapStruct(linker_option_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.count);
+}
+
+inline void swapStruct(version_min_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.version);
+ sys::swapByteOrder(C.sdk);
+}
+
+inline void swapStruct(note_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.offset);
+ sys::swapByteOrder(C.size);
+}
+
+inline void swapStruct(build_version_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.platform);
+ sys::swapByteOrder(C.minos);
+ sys::swapByteOrder(C.sdk);
+ sys::swapByteOrder(C.ntools);
+}
+
+inline void swapStruct(build_tool_version &C) {
+ sys::swapByteOrder(C.tool);
+ sys::swapByteOrder(C.version);
+}
+
+inline void swapStruct(data_in_code_entry &C) {
+ sys::swapByteOrder(C.offset);
+ sys::swapByteOrder(C.length);
+ sys::swapByteOrder(C.kind);
+}
+
+inline void swapStruct(uint32_t &C) { sys::swapByteOrder(C); }
+
+// The prebind_cksum_command is obsolete and no longer supported.
+inline void swapStruct(prebind_cksum_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.cksum);
+}
+
+// The twolevel_hints_command is obsolete and no longer supported.
+inline void swapStruct(twolevel_hints_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.offset);
+ sys::swapByteOrder(C.nhints);
+}
+
+// The prebound_dylib_command is obsolete and no longer supported.
+inline void swapStruct(prebound_dylib_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.name);
+ sys::swapByteOrder(C.nmodules);
+ sys::swapByteOrder(C.linked_modules);
+}
+
+// The fvmfile_command is obsolete and no longer supported.
+inline void swapStruct(fvmfile_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.name);
+ sys::swapByteOrder(C.header_addr);
+}
+
+// The symseg_command is obsolete and no longer supported.
+inline void swapStruct(symseg_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ sys::swapByteOrder(C.offset);
+ sys::swapByteOrder(C.size);
+}
+
+// The ident_command is obsolete and no longer supported.
+inline void swapStruct(ident_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+}
+
+inline void swapStruct(fvmlib &C) {
+ sys::swapByteOrder(C.name);
+ sys::swapByteOrder(C.minor_version);
+ sys::swapByteOrder(C.header_addr);
+}
+
+// The fvmlib_command is obsolete and no longer supported.
+inline void swapStruct(fvmlib_command &C) {
+ sys::swapByteOrder(C.cmd);
+ sys::swapByteOrder(C.cmdsize);
+ swapStruct(C.fvmlib);
+}
+
+// Get/Set functions from <mach-o/nlist.h>
+
+static inline uint16_t GET_LIBRARY_ORDINAL(uint16_t n_desc) {
+ return (((n_desc) >> 8u) & 0xffu);
+}
+
+static inline void SET_LIBRARY_ORDINAL(uint16_t &n_desc, uint8_t ordinal) {
+ n_desc = (((n_desc)&0x00ff) | (((ordinal)&0xff) << 8));
+}
+
+static inline uint8_t GET_COMM_ALIGN(uint16_t n_desc) {
+ return (n_desc >> 8u) & 0x0fu;
+}
+
+static inline void SET_COMM_ALIGN(uint16_t &n_desc, uint8_t align) {
+ n_desc = ((n_desc & 0xf0ffu) | ((align & 0x0fu) << 8u));
+}
+
+// Enums from <mach/machine.h>
+enum : uint32_t {
+ // Capability bits used in the definition of cpu_type.
+ CPU_ARCH_MASK = 0xff000000, // Mask for architecture bits
+ CPU_ARCH_ABI64 = 0x01000000 // 64 bit ABI
+};
+
+// Constants for the cputype field.
+enum CPUType {
+ CPU_TYPE_ANY = -1,
+ CPU_TYPE_X86 = 7,
+ CPU_TYPE_I386 = CPU_TYPE_X86,
+ CPU_TYPE_X86_64 = CPU_TYPE_X86 | CPU_ARCH_ABI64,
+ /* CPU_TYPE_MIPS = 8, */
+ CPU_TYPE_MC98000 = 10, // Old Motorola PowerPC
+ CPU_TYPE_ARM = 12,
+ CPU_TYPE_ARM64 = CPU_TYPE_ARM | CPU_ARCH_ABI64,
+ CPU_TYPE_SPARC = 14,
+ CPU_TYPE_POWERPC = 18,
+ CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC | CPU_ARCH_ABI64
+};
+
+enum : uint32_t {
+ // Capability bits used in the definition of cpusubtype.
+ CPU_SUBTYPE_MASK = 0xff000000, // Mask for architecture bits
+ CPU_SUBTYPE_LIB64 = 0x80000000, // 64 bit libraries
+
+ // Special CPU subtype constants.
+ CPU_SUBTYPE_MULTIPLE = ~0u
+};
+
+// Constants for the cpusubtype field.
+enum CPUSubTypeX86 {
+ CPU_SUBTYPE_I386_ALL = 3,
+ CPU_SUBTYPE_386 = 3,
+ CPU_SUBTYPE_486 = 4,
+ CPU_SUBTYPE_486SX = 0x84,
+ CPU_SUBTYPE_586 = 5,
+ CPU_SUBTYPE_PENT = CPU_SUBTYPE_586,
+ CPU_SUBTYPE_PENTPRO = 0x16,
+ CPU_SUBTYPE_PENTII_M3 = 0x36,
+ CPU_SUBTYPE_PENTII_M5 = 0x56,
+ CPU_SUBTYPE_CELERON = 0x67,
+ CPU_SUBTYPE_CELERON_MOBILE = 0x77,
+ CPU_SUBTYPE_PENTIUM_3 = 0x08,
+ CPU_SUBTYPE_PENTIUM_3_M = 0x18,
+ CPU_SUBTYPE_PENTIUM_3_XEON = 0x28,
+ CPU_SUBTYPE_PENTIUM_M = 0x09,
+ CPU_SUBTYPE_PENTIUM_4 = 0x0a,
+ CPU_SUBTYPE_PENTIUM_4_M = 0x1a,
+ CPU_SUBTYPE_ITANIUM = 0x0b,
+ CPU_SUBTYPE_ITANIUM_2 = 0x1b,
+ CPU_SUBTYPE_XEON = 0x0c,
+ CPU_SUBTYPE_XEON_MP = 0x1c,
+
+ CPU_SUBTYPE_X86_ALL = 3,
+ CPU_SUBTYPE_X86_64_ALL = 3,
+ CPU_SUBTYPE_X86_ARCH1 = 4,
+ CPU_SUBTYPE_X86_64_H = 8
+};
+static inline int CPU_SUBTYPE_INTEL(int Family, int Model) {
+ return Family | (Model << 4);
+}
+static inline int CPU_SUBTYPE_INTEL_FAMILY(CPUSubTypeX86 ST) {
+ return ((int)ST) & 0x0f;
+}
+static inline int CPU_SUBTYPE_INTEL_MODEL(CPUSubTypeX86 ST) {
+ return ((int)ST) >> 4;
+}
+enum { CPU_SUBTYPE_INTEL_FAMILY_MAX = 15, CPU_SUBTYPE_INTEL_MODEL_ALL = 0 };
+
+enum CPUSubTypeARM {
+ CPU_SUBTYPE_ARM_ALL = 0,
+ CPU_SUBTYPE_ARM_V4T = 5,
+ CPU_SUBTYPE_ARM_V6 = 6,
+ CPU_SUBTYPE_ARM_V5 = 7,
+ CPU_SUBTYPE_ARM_V5TEJ = 7,
+ CPU_SUBTYPE_ARM_XSCALE = 8,
+ CPU_SUBTYPE_ARM_V7 = 9,
+ // unused ARM_V7F = 10,
+ CPU_SUBTYPE_ARM_V7S = 11,
+ CPU_SUBTYPE_ARM_V7K = 12,
+ CPU_SUBTYPE_ARM_V6M = 14,
+ CPU_SUBTYPE_ARM_V7M = 15,
+ CPU_SUBTYPE_ARM_V7EM = 16
+};
+
+enum CPUSubTypeARM64 { CPU_SUBTYPE_ARM64_ALL = 0 };
+
+enum CPUSubTypeSPARC { CPU_SUBTYPE_SPARC_ALL = 0 };
+
+enum CPUSubTypePowerPC {
+ CPU_SUBTYPE_POWERPC_ALL = 0,
+ CPU_SUBTYPE_POWERPC_601 = 1,
+ CPU_SUBTYPE_POWERPC_602 = 2,
+ CPU_SUBTYPE_POWERPC_603 = 3,
+ CPU_SUBTYPE_POWERPC_603e = 4,
+ CPU_SUBTYPE_POWERPC_603ev = 5,
+ CPU_SUBTYPE_POWERPC_604 = 6,
+ CPU_SUBTYPE_POWERPC_604e = 7,
+ CPU_SUBTYPE_POWERPC_620 = 8,
+ CPU_SUBTYPE_POWERPC_750 = 9,
+ CPU_SUBTYPE_POWERPC_7400 = 10,
+ CPU_SUBTYPE_POWERPC_7450 = 11,
+ CPU_SUBTYPE_POWERPC_970 = 100,
+
+ CPU_SUBTYPE_MC980000_ALL = CPU_SUBTYPE_POWERPC_ALL,
+ CPU_SUBTYPE_MC98601 = CPU_SUBTYPE_POWERPC_601
+};
+
+struct x86_thread_state32_t {
+ uint32_t eax;
+ uint32_t ebx;
+ uint32_t ecx;
+ uint32_t edx;
+ uint32_t edi;
+ uint32_t esi;
+ uint32_t ebp;
+ uint32_t esp;
+ uint32_t ss;
+ uint32_t eflags;
+ uint32_t eip;
+ uint32_t cs;
+ uint32_t ds;
+ uint32_t es;
+ uint32_t fs;
+ uint32_t gs;
+};
+
+struct x86_thread_state64_t {
+ uint64_t rax;
+ uint64_t rbx;
+ uint64_t rcx;
+ uint64_t rdx;
+ uint64_t rdi;
+ uint64_t rsi;
+ uint64_t rbp;
+ uint64_t rsp;
+ uint64_t r8;
+ uint64_t r9;
+ uint64_t r10;
+ uint64_t r11;
+ uint64_t r12;
+ uint64_t r13;
+ uint64_t r14;
+ uint64_t r15;
+ uint64_t rip;
+ uint64_t rflags;
+ uint64_t cs;
+ uint64_t fs;
+ uint64_t gs;
+};
+
+enum x86_fp_control_precis {
+ x86_FP_PREC_24B = 0,
+ x86_FP_PREC_53B = 2,
+ x86_FP_PREC_64B = 3
+};
+
+enum x86_fp_control_rc {
+ x86_FP_RND_NEAR = 0,
+ x86_FP_RND_DOWN = 1,
+ x86_FP_RND_UP = 2,
+ x86_FP_CHOP = 3
+};
+
+struct fp_control_t {
+ unsigned short invalid : 1, denorm : 1, zdiv : 1, ovrfl : 1, undfl : 1,
+ precis : 1, : 2, pc : 2, rc : 2, : 1, : 3;
+};
+
+struct fp_status_t {
+ unsigned short invalid : 1, denorm : 1, zdiv : 1, ovrfl : 1, undfl : 1,
+ precis : 1, stkflt : 1, errsumm : 1, c0 : 1, c1 : 1, c2 : 1, tos : 3,
+ c3 : 1, busy : 1;
+};
+
+struct mmst_reg_t {
+ char mmst_reg[10];
+ char mmst_rsrv[6];
+};
+
+struct xmm_reg_t {
+ char xmm_reg[16];
+};
+
+struct x86_float_state64_t {
+ int32_t fpu_reserved[2];
+ fp_control_t fpu_fcw;
+ fp_status_t fpu_fsw;
+ uint8_t fpu_ftw;
+ uint8_t fpu_rsrv1;
+ uint16_t fpu_fop;
+ uint32_t fpu_ip;
+ uint16_t fpu_cs;
+ uint16_t fpu_rsrv2;
+ uint32_t fpu_dp;
+ uint16_t fpu_ds;
+ uint16_t fpu_rsrv3;
+ uint32_t fpu_mxcsr;
+ uint32_t fpu_mxcsrmask;
+ mmst_reg_t fpu_stmm0;
+ mmst_reg_t fpu_stmm1;
+ mmst_reg_t fpu_stmm2;
+ mmst_reg_t fpu_stmm3;
+ mmst_reg_t fpu_stmm4;
+ mmst_reg_t fpu_stmm5;
+ mmst_reg_t fpu_stmm6;
+ mmst_reg_t fpu_stmm7;
+ xmm_reg_t fpu_xmm0;
+ xmm_reg_t fpu_xmm1;
+ xmm_reg_t fpu_xmm2;
+ xmm_reg_t fpu_xmm3;
+ xmm_reg_t fpu_xmm4;
+ xmm_reg_t fpu_xmm5;
+ xmm_reg_t fpu_xmm6;
+ xmm_reg_t fpu_xmm7;
+ xmm_reg_t fpu_xmm8;
+ xmm_reg_t fpu_xmm9;
+ xmm_reg_t fpu_xmm10;
+ xmm_reg_t fpu_xmm11;
+ xmm_reg_t fpu_xmm12;
+ xmm_reg_t fpu_xmm13;
+ xmm_reg_t fpu_xmm14;
+ xmm_reg_t fpu_xmm15;
+ char fpu_rsrv4[6 * 16];
+ uint32_t fpu_reserved1;
+};
+
+struct x86_exception_state64_t {
+ uint16_t trapno;
+ uint16_t cpu;
+ uint32_t err;
+ uint64_t faultvaddr;
+};
+
+inline void swapStruct(x86_thread_state32_t &x) {
+ sys::swapByteOrder(x.eax);
+ sys::swapByteOrder(x.ebx);
+ sys::swapByteOrder(x.ecx);
+ sys::swapByteOrder(x.edx);
+ sys::swapByteOrder(x.edi);
+ sys::swapByteOrder(x.esi);
+ sys::swapByteOrder(x.ebp);
+ sys::swapByteOrder(x.esp);
+ sys::swapByteOrder(x.ss);
+ sys::swapByteOrder(x.eflags);
+ sys::swapByteOrder(x.eip);
+ sys::swapByteOrder(x.cs);
+ sys::swapByteOrder(x.ds);
+ sys::swapByteOrder(x.es);
+ sys::swapByteOrder(x.fs);
+ sys::swapByteOrder(x.gs);
+}
+
+inline void swapStruct(x86_thread_state64_t &x) {
+ sys::swapByteOrder(x.rax);
+ sys::swapByteOrder(x.rbx);
+ sys::swapByteOrder(x.rcx);
+ sys::swapByteOrder(x.rdx);
+ sys::swapByteOrder(x.rdi);
+ sys::swapByteOrder(x.rsi);
+ sys::swapByteOrder(x.rbp);
+ sys::swapByteOrder(x.rsp);
+ sys::swapByteOrder(x.r8);
+ sys::swapByteOrder(x.r9);
+ sys::swapByteOrder(x.r10);
+ sys::swapByteOrder(x.r11);
+ sys::swapByteOrder(x.r12);
+ sys::swapByteOrder(x.r13);
+ sys::swapByteOrder(x.r14);
+ sys::swapByteOrder(x.r15);
+ sys::swapByteOrder(x.rip);
+ sys::swapByteOrder(x.rflags);
+ sys::swapByteOrder(x.cs);
+ sys::swapByteOrder(x.fs);
+ sys::swapByteOrder(x.gs);
+}
+
+inline void swapStruct(x86_float_state64_t &x) {
+ sys::swapByteOrder(x.fpu_reserved[0]);
+ sys::swapByteOrder(x.fpu_reserved[1]);
+ // TODO swap: fp_control_t fpu_fcw;
+ // TODO swap: fp_status_t fpu_fsw;
+ sys::swapByteOrder(x.fpu_fop);
+ sys::swapByteOrder(x.fpu_ip);
+ sys::swapByteOrder(x.fpu_cs);
+ sys::swapByteOrder(x.fpu_rsrv2);
+ sys::swapByteOrder(x.fpu_dp);
+ sys::swapByteOrder(x.fpu_ds);
+ sys::swapByteOrder(x.fpu_rsrv3);
+ sys::swapByteOrder(x.fpu_mxcsr);
+ sys::swapByteOrder(x.fpu_mxcsrmask);
+ sys::swapByteOrder(x.fpu_reserved1);
+}
+
+inline void swapStruct(x86_exception_state64_t &x) {
+ sys::swapByteOrder(x.trapno);
+ sys::swapByteOrder(x.cpu);
+ sys::swapByteOrder(x.err);
+ sys::swapByteOrder(x.faultvaddr);
+}
+
+struct x86_state_hdr_t {
+ uint32_t flavor;
+ uint32_t count;
+};
+
+struct x86_thread_state_t {
+ x86_state_hdr_t tsh;
+ union {
+ x86_thread_state64_t ts64;
+ x86_thread_state32_t ts32;
+ } uts;
+};
+
+struct x86_float_state_t {
+ x86_state_hdr_t fsh;
+ union {
+ x86_float_state64_t fs64;
+ } ufs;
+};
+
+struct x86_exception_state_t {
+ x86_state_hdr_t esh;
+ union {
+ x86_exception_state64_t es64;
+ } ues;
+};
+
+inline void swapStruct(x86_state_hdr_t &x) {
+ sys::swapByteOrder(x.flavor);
+ sys::swapByteOrder(x.count);
+}
+
+enum X86ThreadFlavors {
+ x86_THREAD_STATE32 = 1,
+ x86_FLOAT_STATE32 = 2,
+ x86_EXCEPTION_STATE32 = 3,
+ x86_THREAD_STATE64 = 4,
+ x86_FLOAT_STATE64 = 5,
+ x86_EXCEPTION_STATE64 = 6,
+ x86_THREAD_STATE = 7,
+ x86_FLOAT_STATE = 8,
+ x86_EXCEPTION_STATE = 9,
+ x86_DEBUG_STATE32 = 10,
+ x86_DEBUG_STATE64 = 11,
+ x86_DEBUG_STATE = 12
+};
+
+inline void swapStruct(x86_thread_state_t &x) {
+ swapStruct(x.tsh);
+ if (x.tsh.flavor == x86_THREAD_STATE64)
+ swapStruct(x.uts.ts64);
+}
+
+inline void swapStruct(x86_float_state_t &x) {
+ swapStruct(x.fsh);
+ if (x.fsh.flavor == x86_FLOAT_STATE64)
+ swapStruct(x.ufs.fs64);
+}
+
+inline void swapStruct(x86_exception_state_t &x) {
+ swapStruct(x.esh);
+ if (x.esh.flavor == x86_EXCEPTION_STATE64)
+ swapStruct(x.ues.es64);
+}
+
+const uint32_t x86_THREAD_STATE32_COUNT =
+ sizeof(x86_thread_state32_t) / sizeof(uint32_t);
+
+const uint32_t x86_THREAD_STATE64_COUNT =
+ sizeof(x86_thread_state64_t) / sizeof(uint32_t);
+const uint32_t x86_FLOAT_STATE64_COUNT =
+ sizeof(x86_float_state64_t) / sizeof(uint32_t);
+const uint32_t x86_EXCEPTION_STATE64_COUNT =
+ sizeof(x86_exception_state64_t) / sizeof(uint32_t);
+
+const uint32_t x86_THREAD_STATE_COUNT =
+ sizeof(x86_thread_state_t) / sizeof(uint32_t);
+const uint32_t x86_FLOAT_STATE_COUNT =
+ sizeof(x86_float_state_t) / sizeof(uint32_t);
+const uint32_t x86_EXCEPTION_STATE_COUNT =
+ sizeof(x86_exception_state_t) / sizeof(uint32_t);
+
+struct arm_thread_state32_t {
+ uint32_t r[13];
+ uint32_t sp;
+ uint32_t lr;
+ uint32_t pc;
+ uint32_t cpsr;
+};
+
+inline void swapStruct(arm_thread_state32_t &x) {
+ for (int i = 0; i < 13; i++)
+ sys::swapByteOrder(x.r[i]);
+ sys::swapByteOrder(x.sp);
+ sys::swapByteOrder(x.lr);
+ sys::swapByteOrder(x.pc);
+ sys::swapByteOrder(x.cpsr);
+}
+
+struct arm_thread_state64_t {
+ uint64_t x[29];
+ uint64_t fp;
+ uint64_t lr;
+ uint64_t sp;
+ uint64_t pc;
+ uint32_t cpsr;
+ uint32_t pad;
+};
+
+inline void swapStruct(arm_thread_state64_t &x) {
+ for (int i = 0; i < 29; i++)
+ sys::swapByteOrder(x.x[i]);
+ sys::swapByteOrder(x.fp);
+ sys::swapByteOrder(x.lr);
+ sys::swapByteOrder(x.sp);
+ sys::swapByteOrder(x.pc);
+ sys::swapByteOrder(x.cpsr);
+}
+
+struct arm_state_hdr_t {
+ uint32_t flavor;
+ uint32_t count;
+};
+
+struct arm_thread_state_t {
+ arm_state_hdr_t tsh;
+ union {
+ arm_thread_state32_t ts32;
+ } uts;
+};
+
+inline void swapStruct(arm_state_hdr_t &x) {
+ sys::swapByteOrder(x.flavor);
+ sys::swapByteOrder(x.count);
+}
+
+enum ARMThreadFlavors {
+ ARM_THREAD_STATE = 1,
+ ARM_VFP_STATE = 2,
+ ARM_EXCEPTION_STATE = 3,
+ ARM_DEBUG_STATE = 4,
+ ARN_THREAD_STATE_NONE = 5,
+ ARM_THREAD_STATE64 = 6,
+ ARM_EXCEPTION_STATE64 = 7
+};
+
+inline void swapStruct(arm_thread_state_t &x) {
+ swapStruct(x.tsh);
+ if (x.tsh.flavor == ARM_THREAD_STATE)
+ swapStruct(x.uts.ts32);
+}
+
+const uint32_t ARM_THREAD_STATE_COUNT =
+ sizeof(arm_thread_state32_t) / sizeof(uint32_t);
+
+const uint32_t ARM_THREAD_STATE64_COUNT =
+ sizeof(arm_thread_state64_t) / sizeof(uint32_t);
+
+struct ppc_thread_state32_t {
+ uint32_t srr0;
+ uint32_t srr1;
+ uint32_t r0;
+ uint32_t r1;
+ uint32_t r2;
+ uint32_t r3;
+ uint32_t r4;
+ uint32_t r5;
+ uint32_t r6;
+ uint32_t r7;
+ uint32_t r8;
+ uint32_t r9;
+ uint32_t r10;
+ uint32_t r11;
+ uint32_t r12;
+ uint32_t r13;
+ uint32_t r14;
+ uint32_t r15;
+ uint32_t r16;
+ uint32_t r17;
+ uint32_t r18;
+ uint32_t r19;
+ uint32_t r20;
+ uint32_t r21;
+ uint32_t r22;
+ uint32_t r23;
+ uint32_t r24;
+ uint32_t r25;
+ uint32_t r26;
+ uint32_t r27;
+ uint32_t r28;
+ uint32_t r29;
+ uint32_t r30;
+ uint32_t r31;
+ uint32_t ct;
+ uint32_t xer;
+ uint32_t lr;
+ uint32_t ctr;
+ uint32_t mq;
+ uint32_t vrsave;
+};
+
+inline void swapStruct(ppc_thread_state32_t &x) {
+ sys::swapByteOrder(x.srr0);
+ sys::swapByteOrder(x.srr1);
+ sys::swapByteOrder(x.r0);
+ sys::swapByteOrder(x.r1);
+ sys::swapByteOrder(x.r2);
+ sys::swapByteOrder(x.r3);
+ sys::swapByteOrder(x.r4);
+ sys::swapByteOrder(x.r5);
+ sys::swapByteOrder(x.r6);
+ sys::swapByteOrder(x.r7);
+ sys::swapByteOrder(x.r8);
+ sys::swapByteOrder(x.r9);
+ sys::swapByteOrder(x.r10);
+ sys::swapByteOrder(x.r11);
+ sys::swapByteOrder(x.r12);
+ sys::swapByteOrder(x.r13);
+ sys::swapByteOrder(x.r14);
+ sys::swapByteOrder(x.r15);
+ sys::swapByteOrder(x.r16);
+ sys::swapByteOrder(x.r17);
+ sys::swapByteOrder(x.r18);
+ sys::swapByteOrder(x.r19);
+ sys::swapByteOrder(x.r20);
+ sys::swapByteOrder(x.r21);
+ sys::swapByteOrder(x.r22);
+ sys::swapByteOrder(x.r23);
+ sys::swapByteOrder(x.r24);
+ sys::swapByteOrder(x.r25);
+ sys::swapByteOrder(x.r26);
+ sys::swapByteOrder(x.r27);
+ sys::swapByteOrder(x.r28);
+ sys::swapByteOrder(x.r29);
+ sys::swapByteOrder(x.r30);
+ sys::swapByteOrder(x.r31);
+ sys::swapByteOrder(x.ct);
+ sys::swapByteOrder(x.xer);
+ sys::swapByteOrder(x.lr);
+ sys::swapByteOrder(x.ctr);
+ sys::swapByteOrder(x.mq);
+ sys::swapByteOrder(x.vrsave);
+}
+
+struct ppc_state_hdr_t {
+ uint32_t flavor;
+ uint32_t count;
+};
+
+struct ppc_thread_state_t {
+ ppc_state_hdr_t tsh;
+ union {
+ ppc_thread_state32_t ts32;
+ } uts;
+};
+
+inline void swapStruct(ppc_state_hdr_t &x) {
+ sys::swapByteOrder(x.flavor);
+ sys::swapByteOrder(x.count);
+}
+
+enum PPCThreadFlavors {
+ PPC_THREAD_STATE = 1,
+ PPC_FLOAT_STATE = 2,
+ PPC_EXCEPTION_STATE = 3,
+ PPC_VECTOR_STATE = 4,
+ PPC_THREAD_STATE64 = 5,
+ PPC_EXCEPTION_STATE64 = 6,
+ PPC_THREAD_STATE_NONE = 7
+};
+
+inline void swapStruct(ppc_thread_state_t &x) {
+ swapStruct(x.tsh);
+ if (x.tsh.flavor == PPC_THREAD_STATE)
+ swapStruct(x.uts.ts32);
+}
+
+const uint32_t PPC_THREAD_STATE_COUNT =
+ sizeof(ppc_thread_state32_t) / sizeof(uint32_t);
+
+// Define a union of all load command structs
+#define LOAD_COMMAND_STRUCT(LCStruct) LCStruct LCStruct##_data;
+
+union macho_load_command {
+#include "llvm/BinaryFormat/MachO.def"
+};
+
+} // end namespace MachO
+} // end namespace llvm
+
+#endif
Added: llvm/trunk/include/llvm/BinaryFormat/Magic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/Magic.h?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Magic.h (added)
+++ llvm/trunk/include/llvm/BinaryFormat/Magic.h Tue Jun 6 22:48:56 2017
@@ -0,0 +1,71 @@
+//===- llvm/BinaryFormat/Magic.h - File magic identification ----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_BINARYFORMAT_MAGIC_H
+#define LLVM_BINARYFORMAT_MAGIC_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/Twine.h"
+
+namespace llvm {
+/// file_magic - An "enum class" enumeration of file types based on magic (the
+/// first N bytes of the file).
+struct file_magic {
+ enum Impl {
+ unknown = 0, ///< Unrecognized file
+ bitcode, ///< Bitcode file
+ archive, ///< ar style archive file
+ elf, ///< ELF Unknown type
+ elf_relocatable, ///< ELF Relocatable object file
+ elf_executable, ///< ELF Executable image
+ elf_shared_object, ///< ELF dynamically linked shared lib
+ elf_core, ///< ELF core image
+ macho_object, ///< Mach-O Object file
+ macho_executable, ///< Mach-O Executable
+ macho_fixed_virtual_memory_shared_lib, ///< Mach-O Shared Lib, FVM
+ macho_core, ///< Mach-O Core File
+ macho_preload_executable, ///< Mach-O Preloaded Executable
+ macho_dynamically_linked_shared_lib, ///< Mach-O dynlinked shared lib
+ macho_dynamic_linker, ///< The Mach-O dynamic linker
+ macho_bundle, ///< Mach-O Bundle file
+ macho_dynamically_linked_shared_lib_stub, ///< Mach-O Shared lib stub
+ macho_dsym_companion, ///< Mach-O dSYM companion file
+ macho_kext_bundle, ///< Mach-O kext bundle file
+ macho_universal_binary, ///< Mach-O universal binary
+ coff_cl_gl_object, ///< Microsoft cl.exe's intermediate code file
+ coff_object, ///< COFF object file
+ coff_import_library, ///< COFF import library
+ pecoff_executable, ///< PECOFF executable file
+ windows_resource, ///< Windows compiled resource file (.res)
+ wasm_object ///< WebAssembly Object file
+ };
+
+ bool is_object() const { return V != unknown; }
+
+ file_magic() = default;
+ file_magic(Impl V) : V(V) {}
+ operator Impl() const { return V; }
+
+private:
+ Impl V = unknown;
+};
+
+/// @brief Identify the type of a binary file based on how magical it is.
+file_magic identify_magic(StringRef magic);
+
+/// @brief Get and identify \a path's type based on its content.
+///
+/// @param path Input path.
+/// @param result Set to the type of file, or file_magic::unknown.
+/// @returns errc::success if result has been successfully set, otherwise a
+/// platform-specific error_code.
+std::error_code identify_magic(const Twine &path, file_magic &result);
+} // namespace llvm
+
+#endif
Added: llvm/trunk/include/llvm/BinaryFormat/Wasm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/Wasm.h?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/Wasm.h (added)
+++ llvm/trunk/include/llvm/BinaryFormat/Wasm.h Tue Jun 6 22:48:56 2017
@@ -0,0 +1,205 @@
+//===- Wasm.h - Wasm object file format -------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines manifest constants for the wasm object file format.
+// See: https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_BINARYFORMAT_WASM_H
+#define LLVM_BINARYFORMAT_WASM_H
+
+#include "llvm/ADT/ArrayRef.h"
+
+namespace llvm {
+namespace wasm {
+
+// Object file magic string.
+const char WasmMagic[] = {'\0', 'a', 's', 'm'};
+// Wasm binary format version
+const uint32_t WasmVersion = 0x1;
+// Wasm uses a 64k page size
+const uint32_t WasmPageSize = 65536;
+
+struct WasmObjectHeader {
+ StringRef Magic;
+ uint32_t Version;
+};
+
+struct WasmSignature {
+ std::vector<int32_t> ParamTypes;
+ int32_t ReturnType;
+};
+
+struct WasmExport {
+ StringRef Name;
+ uint32_t Kind;
+ uint32_t Index;
+};
+
+struct WasmLimits {
+ uint32_t Flags;
+ uint32_t Initial;
+ uint32_t Maximum;
+};
+
+struct WasmTable {
+ int32_t ElemType;
+ WasmLimits Limits;
+};
+
+struct WasmInitExpr {
+ uint8_t Opcode;
+ union {
+ int32_t Int32;
+ int64_t Int64;
+ int32_t Float32;
+ int64_t Float64;
+ uint32_t Global;
+ } Value;
+};
+
+struct WasmGlobal {
+ int32_t Type;
+ bool Mutable;
+ WasmInitExpr InitExpr;
+};
+
+struct WasmImport {
+ StringRef Module;
+ StringRef Field;
+ uint32_t Kind;
+ union {
+ uint32_t SigIndex;
+ WasmGlobal Global;
+ WasmTable Table;
+ WasmLimits Memory;
+ };
+};
+
+struct WasmLocalDecl {
+ int32_t Type;
+ uint32_t Count;
+};
+
+struct WasmFunction {
+ std::vector<WasmLocalDecl> Locals;
+ ArrayRef<uint8_t> Body;
+};
+
+struct WasmDataSegment {
+ uint32_t Index;
+ WasmInitExpr Offset;
+ ArrayRef<uint8_t> Content;
+};
+
+struct WasmElemSegment {
+ uint32_t TableIndex;
+ WasmInitExpr Offset;
+ std::vector<uint32_t> Functions;
+};
+
+struct WasmRelocation {
+ uint32_t Type; // The type of the relocation.
+ int32_t Index; // Index into function to global index space.
+ uint64_t Offset; // Offset from the start of the section.
+ int64_t Addend; // A value to add to the symbol.
+};
+
+enum : unsigned {
+ WASM_SEC_CUSTOM = 0, // Custom / User-defined section
+ WASM_SEC_TYPE = 1, // Function signature declarations
+ WASM_SEC_IMPORT = 2, // Import declarations
+ WASM_SEC_FUNCTION = 3, // Function declarations
+ WASM_SEC_TABLE = 4, // Indirect function table and other tables
+ WASM_SEC_MEMORY = 5, // Memory attributes
+ WASM_SEC_GLOBAL = 6, // Global declarations
+ WASM_SEC_EXPORT = 7, // Exports
+ WASM_SEC_START = 8, // Start function declaration
+ WASM_SEC_ELEM = 9, // Elements section
+ WASM_SEC_CODE = 10, // Function bodies (code)
+ WASM_SEC_DATA = 11 // Data segments
+};
+
+// Type immediate encodings used in various contexts.
+enum {
+ WASM_TYPE_I32 = -0x01,
+ WASM_TYPE_I64 = -0x02,
+ WASM_TYPE_F32 = -0x03,
+ WASM_TYPE_F64 = -0x04,
+ WASM_TYPE_ANYFUNC = -0x10,
+ WASM_TYPE_FUNC = -0x20,
+ WASM_TYPE_NORESULT = -0x40, // for blocks with no result values
+};
+
+// Kinds of externals (for imports and exports).
+enum : unsigned {
+ WASM_EXTERNAL_FUNCTION = 0x0,
+ WASM_EXTERNAL_TABLE = 0x1,
+ WASM_EXTERNAL_MEMORY = 0x2,
+ WASM_EXTERNAL_GLOBAL = 0x3,
+};
+
+// Opcodes used in initializer expressions.
+enum : unsigned {
+ WASM_OPCODE_END = 0x0b,
+ WASM_OPCODE_GET_GLOBAL = 0x23,
+ WASM_OPCODE_I32_CONST = 0x41,
+ WASM_OPCODE_I64_CONST = 0x42,
+ WASM_OPCODE_F32_CONST = 0x43,
+ WASM_OPCODE_F64_CONST = 0x44,
+};
+
+enum : unsigned {
+ WASM_NAMES_FUNCTION = 0x1,
+ WASM_NAMES_LOCAL = 0x2,
+};
+
+enum : unsigned {
+ WASM_LIMITS_FLAG_HAS_MAX = 0x1,
+};
+
+// Subset of types that a value can have
+enum class ValType {
+ I32 = WASM_TYPE_I32,
+ I64 = WASM_TYPE_I64,
+ F32 = WASM_TYPE_F32,
+ F64 = WASM_TYPE_F64,
+};
+
+// Linking metadata kinds.
+enum : unsigned {
+ WASM_STACK_POINTER = 0x1,
+};
+
+#define WASM_RELOC(name, value) name = value,
+
+enum : unsigned {
+#include "WasmRelocs/WebAssembly.def"
+};
+
+#undef WASM_RELOC
+
+struct Global {
+ ValType Type;
+ bool Mutable;
+
+ // The initial value for this global is either the value of an imported
+ // global, in which case InitialModule and InitialName specify the global
+ // import, or a value, in which case InitialModule is empty and InitialValue
+ // holds the value.
+ StringRef InitialModule;
+ StringRef InitialName;
+ uint64_t InitialValue;
+};
+
+} // end namespace wasm
+} // end namespace llvm
+
+#endif
Added: llvm/trunk/include/llvm/BinaryFormat/WasmRelocs/WebAssembly.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/BinaryFormat/WasmRelocs/WebAssembly.def?rev=304864&view=auto
==============================================================================
--- llvm/trunk/include/llvm/BinaryFormat/WasmRelocs/WebAssembly.def (added)
+++ llvm/trunk/include/llvm/BinaryFormat/WasmRelocs/WebAssembly.def Tue Jun 6 22:48:56 2017
@@ -0,0 +1,13 @@
+
+#ifndef WASM_RELOC
+#error "WASM_RELOC must be defined"
+#endif
+
+WASM_RELOC(R_WEBASSEMBLY_FUNCTION_INDEX_LEB, 0)
+WASM_RELOC(R_WEBASSEMBLY_TABLE_INDEX_SLEB, 1)
+WASM_RELOC(R_WEBASSEMBLY_TABLE_INDEX_I32, 2)
+WASM_RELOC(R_WEBASSEMBLY_GLOBAL_ADDR_LEB, 3)
+WASM_RELOC(R_WEBASSEMBLY_GLOBAL_ADDR_SLEB, 4)
+WASM_RELOC(R_WEBASSEMBLY_GLOBAL_ADDR_I32, 5)
+WASM_RELOC(R_WEBASSEMBLY_TYPE_INDEX_LEB, 6)
+WASM_RELOC(R_WEBASSEMBLY_GLOBAL_INDEX_LEB, 7)
Modified: llvm/trunk/include/llvm/CodeGen/DIE.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/DIE.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/DIE.h (original)
+++ llvm/trunk/include/llvm/CodeGen/DIE.h Tue Jun 6 22:48:56 2017
@@ -21,10 +21,10 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/DwarfStringPoolEntry.h"
#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Allocator.h"
-#include "llvm/Support/Dwarf.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
Modified: llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineModuleInfoImpls.h Tue Jun 6 22:48:56 2017
@@ -15,9 +15,9 @@
#ifndef LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
#define LLVM_CODEGEN_MACHINEMODULEINFOIMPLS_H
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/ValueTypes.h"
-#include "llvm/Support/Wasm.h"
namespace llvm {
class MCSymbol;
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/EnumTables.h Tue Jun 6 22:48:56 2017
@@ -11,8 +11,8 @@
#define LLVM_DEBUGINFO_CODEVIEW_ENUMTABLES_H
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/ScopedPrinter.h"
#include <stdint.h>
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h Tue Jun 6 22:48:56 2017
@@ -13,8 +13,8 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include <cassert>
#include <cstddef>
#include <cstdint>
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h Tue Jun 6 22:48:56 2017
@@ -11,9 +11,9 @@
#define LLVM_DEBUGINFO_DWARFACCELERATORTABLE_H
#include "llvm/ADT/SmallVector.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include <cstdint>
#include <utility>
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFAttribute.h Tue Jun 6 22:48:56 2017
@@ -10,8 +10,8 @@
#ifndef LLVM_DEBUGINFO_DWARFATTRIBUTE_H
#define LLVM_DEBUGINFO_DWARFATTRIBUTE_H
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
-#include "llvm/Support/Dwarf.h"
#include <cstdint>
namespace llvm {
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h Tue Jun 6 22:48:56 2017
@@ -10,8 +10,8 @@
#ifndef LLVM_DEBUGINFO_DWARFDEBUGINFOENTRY_H
#define LLVM_DEBUGINFO_DWARFDEBUGINFOENTRY_H
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
-#include "llvm/Support/Dwarf.h"
#include <cstdint>
namespace llvm {
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h Tue Jun 6 22:48:56 2017
@@ -12,7 +12,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Dwarf.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include <cstdint>
#include <vector>
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDie.h Tue Jun 6 22:48:56 2017
@@ -14,11 +14,11 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/iterator.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFAttribute.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
-#include "llvm/Support/Dwarf.h"
#include <cassert>
#include <cstdint>
#include <iterator>
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFFormValue.h Tue Jun 6 22:48:56 2017
@@ -13,8 +13,8 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include <cstdint>
namespace llvm {
Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFUnit.h Tue Jun 6 22:48:56 2017
@@ -15,6 +15,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/DebugInfo/DWARF/DWARFDie.h"
@@ -24,7 +25,6 @@
#include "llvm/Object/Binary.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
Modified: llvm/trunk/include/llvm/IR/DebugInfoMetadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/DebugInfoMetadata.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/DebugInfoMetadata.h (original)
+++ llvm/trunk/include/llvm/IR/DebugInfoMetadata.h Tue Jun 6 22:48:56 2017
@@ -22,9 +22,9 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Metadata.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/Dwarf.h"
#include <cassert>
#include <climits>
#include <cstddef>
@@ -148,7 +148,7 @@ public:
/// Tagged DWARF-like metadata node.
///
/// A metadata node with a DWARF tag (i.e., a constant named \c DW_TAG_*,
-/// defined in llvm/Support/Dwarf.h). Called \a DINode because it's
+/// defined in llvm/BinaryFormat/Dwarf.h). Called \a DINode because it's
/// potentially used for non-DWARF output.
class DINode : public MDNode {
friend class LLVMContextImpl;
@@ -2642,7 +2642,8 @@ public:
/// Macro Info DWARF-like metadata node.
///
/// A metadata node with a DWARF macro info (i.e., a constant named
-/// \c DW_MACINFO_*, defined in llvm/Support/Dwarf.h). Called \a DIMacroNode
+/// \c DW_MACINFO_*, defined in llvm/BinaryFormat/Dwarf.h). Called \a
+/// DIMacroNode
/// because it's potentially used for non-DWARF output.
class DIMacroNode : public MDNode {
friend class LLVMContextImpl;
Modified: llvm/trunk/include/llvm/LinkAllIR.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/LinkAllIR.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/LinkAllIR.h (original)
+++ llvm/trunk/include/llvm/LinkAllIR.h Tue Jun 6 22:48:56 2017
@@ -16,13 +16,13 @@
#ifndef LLVM_LINKALLIR_H
#define LLVM_LINKALLIR_H
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/DynamicLibrary.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Memory.h"
Modified: llvm/trunk/include/llvm/MC/MCContext.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCContext.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCContext.h (original)
+++ llvm/trunk/include/llvm/MC/MCContext.h Tue Jun 6 22:48:56 2017
@@ -17,12 +17,12 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cassert>
Modified: llvm/trunk/include/llvm/MC/MCELFObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCELFObjectWriter.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCELFObjectWriter.h (original)
+++ llvm/trunk/include/llvm/MC/MCELFObjectWriter.h Tue Jun 6 22:48:56 2017
@@ -11,8 +11,8 @@
#define LLVM_MC_MCELFOBJECTWRITER_H
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdint>
#include <vector>
Modified: llvm/trunk/include/llvm/MC/MCMachObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCMachObjectWriter.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCMachObjectWriter.h (original)
+++ llvm/trunk/include/llvm/MC/MCMachObjectWriter.h Tue Jun 6 22:48:56 2017
@@ -12,11 +12,11 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCObjectWriter.h"
#include "llvm/MC/MCSection.h"
#include "llvm/MC/StringTableBuilder.h"
-#include "llvm/Support/MachO.h"
#include <cstdint>
#include <memory>
#include <string>
Modified: llvm/trunk/include/llvm/MC/MCSectionMachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSectionMachO.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSectionMachO.h (original)
+++ llvm/trunk/include/llvm/MC/MCSectionMachO.h Tue Jun 6 22:48:56 2017
@@ -15,8 +15,8 @@
#define LLVM_MC_MCSECTIONMACHO_H
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCSection.h"
-#include "llvm/Support/MachO.h"
namespace llvm {
Modified: llvm/trunk/include/llvm/MC/MCSymbolWasm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCSymbolWasm.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCSymbolWasm.h (original)
+++ llvm/trunk/include/llvm/MC/MCSymbolWasm.h Tue Jun 6 22:48:56 2017
@@ -9,8 +9,8 @@
#ifndef LLVM_MC_MCSYMBOLWASM_H
#define LLVM_MC_MCSYMBOLWASM_H
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Support/Wasm.h"
namespace llvm {
class MCSymbolWasm : public MCSymbol {
Modified: llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h (original)
+++ llvm/trunk/include/llvm/MC/MCWasmObjectWriter.h Tue Jun 6 22:48:56 2017
@@ -11,10 +11,10 @@
#define LLVM_MC_MCWASMOBJECTWRITER_H
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/raw_ostream.h"
-#include "llvm/Support/Wasm.h"
#include <vector>
namespace llvm {
Modified: llvm/trunk/include/llvm/Object/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/COFF.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/COFF.h (original)
+++ llvm/trunk/include/llvm/Object/COFF.h Tue Jun 6 22:48:56 2017
@@ -15,13 +15,13 @@
#define LLVM_OBJECT_COFF_H
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/CVDebugRecord.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/Error.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/BinaryByteStream.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/trunk/include/llvm/Object/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELF.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELF.h (original)
+++ llvm/trunk/include/llvm/Object/ELF.h Tue Jun 6 22:48:56 2017
@@ -17,9 +17,9 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Object/ELFTypes.h"
#include "llvm/Object/Error.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cassert>
Modified: llvm/trunk/include/llvm/Object/ELFObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFObjectFile.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ELFObjectFile.h Tue Jun 6 22:48:56 2017
@@ -19,6 +19,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/ELF.h"
@@ -29,7 +30,6 @@
#include "llvm/Support/ARMAttributeParser.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/trunk/include/llvm/Object/ELFTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ELFTypes.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ELFTypes.h (original)
+++ llvm/trunk/include/llvm/Object/ELFTypes.h Tue Jun 6 22:48:56 2017
@@ -12,8 +12,8 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Object/Error.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include <cassert>
Modified: llvm/trunk/include/llvm/Object/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachO.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachO.h (original)
+++ llvm/trunk/include/llvm/Object/MachO.h Tue Jun 6 22:48:56 2017
@@ -22,13 +22,13 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/SymbolicFile.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/Format.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdint>
Modified: llvm/trunk/include/llvm/Object/MachOUniversal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/MachOUniversal.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/MachOUniversal.h (original)
+++ llvm/trunk/include/llvm/Object/MachOUniversal.h Tue Jun 6 22:48:56 2017
@@ -16,10 +16,10 @@
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/MachO.h"
-#include "llvm/Support/MachO.h"
namespace llvm {
class StringRef;
Modified: llvm/trunk/include/llvm/Object/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/ObjectFile.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/ObjectFile.h (original)
+++ llvm/trunk/include/llvm/Object/ObjectFile.h Tue Jun 6 22:48:56 2017
@@ -16,6 +16,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Magic.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/Error.h"
@@ -306,10 +307,10 @@ public:
createObjectFile(StringRef ObjectPath);
static Expected<std::unique_ptr<ObjectFile>>
- createObjectFile(MemoryBufferRef Object, sys::fs::file_magic Type);
+ createObjectFile(MemoryBufferRef Object, llvm::file_magic Type);
static Expected<std::unique_ptr<ObjectFile>>
createObjectFile(MemoryBufferRef Object) {
- return createObjectFile(Object, sys::fs::file_magic::unknown);
+ return createObjectFile(Object, llvm::file_magic::unknown);
}
static inline bool classof(const Binary *v) {
Modified: llvm/trunk/include/llvm/Object/RelocVisitor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/RelocVisitor.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/RelocVisitor.h (original)
+++ llvm/trunk/include/llvm/Object/RelocVisitor.h Tue Jun 6 22:48:56 2017
@@ -17,15 +17,15 @@
#define LLVM_OBJECT_RELOCVISITOR_H
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/MachO.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/ErrorOr.h"
-#include "llvm/Support/MachO.h"
#include <cstdint>
#include <system_error>
Modified: llvm/trunk/include/llvm/Object/SymbolicFile.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/SymbolicFile.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/SymbolicFile.h (original)
+++ llvm/trunk/include/llvm/Object/SymbolicFile.h Tue Jun 6 22:48:56 2017
@@ -16,6 +16,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Object/Binary.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
@@ -162,12 +163,12 @@ public:
// construction aux.
static Expected<std::unique_ptr<SymbolicFile>>
- createSymbolicFile(MemoryBufferRef Object, sys::fs::file_magic Type,
+ createSymbolicFile(MemoryBufferRef Object, llvm::file_magic Type,
LLVMContext *Context);
static Expected<std::unique_ptr<SymbolicFile>>
createSymbolicFile(MemoryBufferRef Object) {
- return createSymbolicFile(Object, sys::fs::file_magic::unknown, nullptr);
+ return createSymbolicFile(Object, llvm::file_magic::unknown, nullptr);
}
static Expected<OwningBinary<SymbolicFile>>
createSymbolicFile(StringRef ObjectPath);
Modified: llvm/trunk/include/llvm/Object/Wasm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/Wasm.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/Wasm.h (original)
+++ llvm/trunk/include/llvm/Object/Wasm.h Tue Jun 6 22:48:56 2017
@@ -19,11 +19,11 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
-#include "llvm/Support/Wasm.h"
#include <cstddef>
#include <cstdint>
#include <vector>
Modified: llvm/trunk/include/llvm/Object/WindowsResource.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Object/WindowsResource.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Object/WindowsResource.h (original)
+++ llvm/trunk/include/llvm/Object/WindowsResource.h Tue Jun 6 22:48:56 2017
@@ -31,11 +31,11 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/BinaryByteStream.h"
#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
Modified: llvm/trunk/include/llvm/ObjectYAML/COFFYAML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/COFFYAML.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ObjectYAML/COFFYAML.h (original)
+++ llvm/trunk/include/llvm/ObjectYAML/COFFYAML.h Tue Jun 6 22:48:56 2017
@@ -15,8 +15,8 @@
#define LLVM_OBJECTYAML_COFFYAML_H
#include "llvm/ADT/Optional.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/ObjectYAML/YAML.h"
-#include "llvm/Support/COFF.h"
namespace llvm {
Modified: llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h (original)
+++ llvm/trunk/include/llvm/ObjectYAML/DWARFYAML.h Tue Jun 6 22:48:56 2017
@@ -16,8 +16,8 @@
#ifndef LLVM_OBJECTYAML_DWARFYAML_H
#define LLVM_OBJECTYAML_DWARFYAML_H
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/ObjectYAML/YAML.h"
-#include "llvm/Support/Dwarf.h"
namespace llvm {
namespace DWARFYAML {
@@ -241,7 +241,7 @@ template <> struct MappingTraits<DWARFYA
template <> struct ScalarEnumerationTraits<dwarf::Tag> {
static void enumeration(IO &io, dwarf::Tag &value) {
-#include "llvm/Support/Dwarf.def"
+#include "llvm/BinaryFormat/Dwarf.def"
io.enumFallback<Hex16>(value);
}
};
@@ -251,7 +251,7 @@ template <> struct ScalarEnumerationTrai
template <> struct ScalarEnumerationTraits<dwarf::LineNumberOps> {
static void enumeration(IO &io, dwarf::LineNumberOps &value) {
-#include "llvm/Support/Dwarf.def"
+#include "llvm/BinaryFormat/Dwarf.def"
io.enumFallback<Hex8>(value);
}
};
@@ -261,7 +261,7 @@ template <> struct ScalarEnumerationTrai
template <> struct ScalarEnumerationTraits<dwarf::LineNumberExtendedOps> {
static void enumeration(IO &io, dwarf::LineNumberExtendedOps &value) {
-#include "llvm/Support/Dwarf.def"
+#include "llvm/BinaryFormat/Dwarf.def"
io.enumFallback<Hex16>(value);
}
};
@@ -271,7 +271,7 @@ template <> struct ScalarEnumerationTrai
template <> struct ScalarEnumerationTraits<dwarf::Attribute> {
static void enumeration(IO &io, dwarf::Attribute &value) {
-#include "llvm/Support/Dwarf.def"
+#include "llvm/BinaryFormat/Dwarf.def"
io.enumFallback<Hex16>(value);
}
};
@@ -281,7 +281,7 @@ template <> struct ScalarEnumerationTrai
template <> struct ScalarEnumerationTraits<dwarf::Form> {
static void enumeration(IO &io, dwarf::Form &value) {
-#include "llvm/Support/Dwarf.def"
+#include "llvm/BinaryFormat/Dwarf.def"
io.enumFallback<Hex16>(value);
}
};
@@ -291,7 +291,7 @@ template <> struct ScalarEnumerationTrai
template <> struct ScalarEnumerationTraits<dwarf::UnitType> {
static void enumeration(IO &io, dwarf::UnitType &value) {
-#include "llvm/Support/Dwarf.def"
+#include "llvm/BinaryFormat/Dwarf.def"
io.enumFallback<Hex8>(value);
}
};
Modified: llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h (original)
+++ llvm/trunk/include/llvm/ObjectYAML/ELFYAML.h Tue Jun 6 22:48:56 2017
@@ -16,8 +16,8 @@
#ifndef LLVM_OBJECTYAML_ELFYAML_H
#define LLVM_OBJECTYAML_ELFYAML_H
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/ObjectYAML/YAML.h"
-#include "llvm/Support/ELF.h"
namespace llvm {
namespace ELFYAML {
Modified: llvm/trunk/include/llvm/ObjectYAML/MachOYAML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/MachOYAML.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ObjectYAML/MachOYAML.h (original)
+++ llvm/trunk/include/llvm/ObjectYAML/MachOYAML.h Tue Jun 6 22:48:56 2017
@@ -16,9 +16,9 @@
#ifndef LLVM_OBJECTYAML_MACHOYAML_H
#define LLVM_OBJECTYAML_MACHOYAML_H
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/ObjectYAML/DWARFYAML.h"
#include "llvm/ObjectYAML/YAML.h"
-#include "llvm/Support/MachO.h"
namespace llvm {
namespace MachOYAML {
@@ -209,7 +209,7 @@ template <> struct MappingTraits<MachO::
template <> struct ScalarEnumerationTraits<MachO::LoadCommandType> {
static void enumeration(IO &io, MachO::LoadCommandType &value) {
-#include "llvm/Support/MachO.def"
+#include "llvm/BinaryFormat/MachO.def"
io.enumFallback<Hex32>(value);
}
};
@@ -278,7 +278,7 @@ template <> struct ScalarTraits<uuid_t>
static void mapping(IO &IO, MachO::LCStruct &LoadCommand); \
};
-#include "llvm/Support/MachO.def"
+#include "llvm/BinaryFormat/MachO.def"
// Extra structures used by load commands
template <> struct MappingTraits<MachO::dylib> {
Modified: llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h (original)
+++ llvm/trunk/include/llvm/ObjectYAML/WasmYAML.h Tue Jun 6 22:48:56 2017
@@ -16,8 +16,8 @@
#ifndef LLVM_OBJECTYAML_WASMYAML_H
#define LLVM_OBJECTYAML_WASMYAML_H
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/ObjectYAML/YAML.h"
-#include "llvm/Support/Wasm.h"
namespace llvm {
namespace WasmYAML {
Removed: llvm/trunk/include/llvm/Support/COFF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/COFF.h?rev=304863&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/COFF.h (original)
+++ llvm/trunk/include/llvm/Support/COFF.h (removed)
@@ -1,724 +0,0 @@
-//===-- llvm/Support/COFF.h -------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains an definitions used in Windows COFF Files.
-//
-// Structures and enums defined within this file where created using
-// information from Microsoft's publicly available PE/COFF format document:
-//
-// Microsoft Portable Executable and Common Object File Format Specification
-// Revision 8.1 - February 15, 2008
-//
-// As of 5/2/2010, hosted by Microsoft at:
-// http://www.microsoft.com/whdc/system/platform/firmware/pecoff.mspx
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_COFF_H
-#define LLVM_SUPPORT_COFF_H
-
-#include "llvm/Support/DataTypes.h"
-#include <cassert>
-#include <cstring>
-
-namespace llvm {
-namespace COFF {
-
- // The maximum number of sections that a COFF object can have (inclusive).
- const int32_t MaxNumberOfSections16 = 65279;
-
- // The PE signature bytes that follows the DOS stub header.
- static const char PEMagic[] = { 'P', 'E', '\0', '\0' };
-
- static const char BigObjMagic[] = {
- '\xc7', '\xa1', '\xba', '\xd1', '\xee', '\xba', '\xa9', '\x4b',
- '\xaf', '\x20', '\xfa', '\xf6', '\x6a', '\xa4', '\xdc', '\xb8',
- };
-
- static const char ClGlObjMagic[] = {
- '\x38', '\xfe', '\xb3', '\x0c', '\xa5', '\xd9', '\xab', '\x4d',
- '\xac', '\x9b', '\xd6', '\xb6', '\x22', '\x26', '\x53', '\xc2',
- };
-
- // Sizes in bytes of various things in the COFF format.
- enum {
- Header16Size = 20,
- Header32Size = 56,
- NameSize = 8,
- Symbol16Size = 18,
- Symbol32Size = 20,
- SectionSize = 40,
- RelocationSize = 10
- };
-
- struct header {
- uint16_t Machine;
- int32_t NumberOfSections;
- uint32_t TimeDateStamp;
- uint32_t PointerToSymbolTable;
- uint32_t NumberOfSymbols;
- uint16_t SizeOfOptionalHeader;
- uint16_t Characteristics;
- };
-
- struct BigObjHeader {
- enum : uint16_t { MinBigObjectVersion = 2 };
-
- uint16_t Sig1; ///< Must be IMAGE_FILE_MACHINE_UNKNOWN (0).
- uint16_t Sig2; ///< Must be 0xFFFF.
- uint16_t Version;
- uint16_t Machine;
- uint32_t TimeDateStamp;
- uint8_t UUID[16];
- uint32_t unused1;
- uint32_t unused2;
- uint32_t unused3;
- uint32_t unused4;
- uint32_t NumberOfSections;
- uint32_t PointerToSymbolTable;
- uint32_t NumberOfSymbols;
- };
-
- enum MachineTypes {
- MT_Invalid = 0xffff,
-
- IMAGE_FILE_MACHINE_UNKNOWN = 0x0,
- IMAGE_FILE_MACHINE_AM33 = 0x13,
- IMAGE_FILE_MACHINE_AMD64 = 0x8664,
- IMAGE_FILE_MACHINE_ARM = 0x1C0,
- IMAGE_FILE_MACHINE_ARMNT = 0x1C4,
- IMAGE_FILE_MACHINE_ARM64 = 0xAA64,
- IMAGE_FILE_MACHINE_EBC = 0xEBC,
- IMAGE_FILE_MACHINE_I386 = 0x14C,
- IMAGE_FILE_MACHINE_IA64 = 0x200,
- IMAGE_FILE_MACHINE_M32R = 0x9041,
- IMAGE_FILE_MACHINE_MIPS16 = 0x266,
- IMAGE_FILE_MACHINE_MIPSFPU = 0x366,
- IMAGE_FILE_MACHINE_MIPSFPU16 = 0x466,
- IMAGE_FILE_MACHINE_POWERPC = 0x1F0,
- IMAGE_FILE_MACHINE_POWERPCFP = 0x1F1,
- IMAGE_FILE_MACHINE_R4000 = 0x166,
- IMAGE_FILE_MACHINE_SH3 = 0x1A2,
- IMAGE_FILE_MACHINE_SH3DSP = 0x1A3,
- IMAGE_FILE_MACHINE_SH4 = 0x1A6,
- IMAGE_FILE_MACHINE_SH5 = 0x1A8,
- IMAGE_FILE_MACHINE_THUMB = 0x1C2,
- IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x169
- };
-
- enum Characteristics {
- C_Invalid = 0,
-
- /// The file does not contain base relocations and must be loaded at its
- /// preferred base. If this cannot be done, the loader will error.
- IMAGE_FILE_RELOCS_STRIPPED = 0x0001,
- /// The file is valid and can be run.
- IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002,
- /// COFF line numbers have been stripped. This is deprecated and should be
- /// 0.
- IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004,
- /// COFF symbol table entries for local symbols have been removed. This is
- /// deprecated and should be 0.
- IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008,
- /// Aggressively trim working set. This is deprecated and must be 0.
- IMAGE_FILE_AGGRESSIVE_WS_TRIM = 0x0010,
- /// Image can handle > 2GiB addresses.
- IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020,
- /// Little endian: the LSB precedes the MSB in memory. This is deprecated
- /// and should be 0.
- IMAGE_FILE_BYTES_REVERSED_LO = 0x0080,
- /// Machine is based on a 32bit word architecture.
- IMAGE_FILE_32BIT_MACHINE = 0x0100,
- /// Debugging info has been removed.
- IMAGE_FILE_DEBUG_STRIPPED = 0x0200,
- /// If the image is on removable media, fully load it and copy it to swap.
- IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400,
- /// If the image is on network media, fully load it and copy it to swap.
- IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800,
- /// The image file is a system file, not a user program.
- IMAGE_FILE_SYSTEM = 0x1000,
- /// The image file is a DLL.
- IMAGE_FILE_DLL = 0x2000,
- /// This file should only be run on a uniprocessor machine.
- IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000,
- /// Big endian: the MSB precedes the LSB in memory. This is deprecated
- /// and should be 0.
- IMAGE_FILE_BYTES_REVERSED_HI = 0x8000
- };
-
- enum ResourceTypeID {
- RID_Cursor = 1,
- RID_Bitmap = 2,
- RID_Icon = 3,
- RID_Menu = 4,
- RID_Dialog = 5,
- RID_String = 6,
- RID_FontDir = 7,
- RID_Font = 8,
- RID_Accelerator = 9,
- RID_RCData = 10,
- RID_MessageTable = 11,
- RID_Group_Cursor = 12,
- RID_Group_Icon = 14,
- RID_Version = 16,
- RID_DLGInclude = 17,
- RID_PlugPlay = 19,
- RID_VXD = 20,
- RID_AniCursor = 21,
- RID_AniIcon = 22,
- RID_HTML = 23,
- RID_Manifest = 24,
- };
-
- struct symbol {
- char Name[NameSize];
- uint32_t Value;
- int32_t SectionNumber;
- uint16_t Type;
- uint8_t StorageClass;
- uint8_t NumberOfAuxSymbols;
- };
-
- enum SymbolSectionNumber : int32_t {
- IMAGE_SYM_DEBUG = -2,
- IMAGE_SYM_ABSOLUTE = -1,
- IMAGE_SYM_UNDEFINED = 0
- };
-
- /// Storage class tells where and what the symbol represents
- enum SymbolStorageClass {
- SSC_Invalid = 0xff,
-
- IMAGE_SYM_CLASS_END_OF_FUNCTION = -1, ///< Physical end of function
- IMAGE_SYM_CLASS_NULL = 0, ///< No symbol
- IMAGE_SYM_CLASS_AUTOMATIC = 1, ///< Stack variable
- IMAGE_SYM_CLASS_EXTERNAL = 2, ///< External symbol
- IMAGE_SYM_CLASS_STATIC = 3, ///< Static
- IMAGE_SYM_CLASS_REGISTER = 4, ///< Register variable
- IMAGE_SYM_CLASS_EXTERNAL_DEF = 5, ///< External definition
- IMAGE_SYM_CLASS_LABEL = 6, ///< Label
- IMAGE_SYM_CLASS_UNDEFINED_LABEL = 7, ///< Undefined label
- IMAGE_SYM_CLASS_MEMBER_OF_STRUCT = 8, ///< Member of structure
- IMAGE_SYM_CLASS_ARGUMENT = 9, ///< Function argument
- IMAGE_SYM_CLASS_STRUCT_TAG = 10, ///< Structure tag
- IMAGE_SYM_CLASS_MEMBER_OF_UNION = 11, ///< Member of union
- IMAGE_SYM_CLASS_UNION_TAG = 12, ///< Union tag
- IMAGE_SYM_CLASS_TYPE_DEFINITION = 13, ///< Type definition
- IMAGE_SYM_CLASS_UNDEFINED_STATIC = 14, ///< Undefined static
- IMAGE_SYM_CLASS_ENUM_TAG = 15, ///< Enumeration tag
- IMAGE_SYM_CLASS_MEMBER_OF_ENUM = 16, ///< Member of enumeration
- IMAGE_SYM_CLASS_REGISTER_PARAM = 17, ///< Register parameter
- IMAGE_SYM_CLASS_BIT_FIELD = 18, ///< Bit field
- /// ".bb" or ".eb" - beginning or end of block
- IMAGE_SYM_CLASS_BLOCK = 100,
- /// ".bf" or ".ef" - beginning or end of function
- IMAGE_SYM_CLASS_FUNCTION = 101,
- IMAGE_SYM_CLASS_END_OF_STRUCT = 102, ///< End of structure
- IMAGE_SYM_CLASS_FILE = 103, ///< File name
- /// Line number, reformatted as symbol
- IMAGE_SYM_CLASS_SECTION = 104,
- IMAGE_SYM_CLASS_WEAK_EXTERNAL = 105, ///< Duplicate tag
- /// External symbol in dmert public lib
- IMAGE_SYM_CLASS_CLR_TOKEN = 107
- };
-
- enum SymbolBaseType {
- IMAGE_SYM_TYPE_NULL = 0, ///< No type information or unknown base type.
- IMAGE_SYM_TYPE_VOID = 1, ///< Used with void pointers and functions.
- IMAGE_SYM_TYPE_CHAR = 2, ///< A character (signed byte).
- IMAGE_SYM_TYPE_SHORT = 3, ///< A 2-byte signed integer.
- IMAGE_SYM_TYPE_INT = 4, ///< A natural integer type on the target.
- IMAGE_SYM_TYPE_LONG = 5, ///< A 4-byte signed integer.
- IMAGE_SYM_TYPE_FLOAT = 6, ///< A 4-byte floating-point number.
- IMAGE_SYM_TYPE_DOUBLE = 7, ///< An 8-byte floating-point number.
- IMAGE_SYM_TYPE_STRUCT = 8, ///< A structure.
- IMAGE_SYM_TYPE_UNION = 9, ///< An union.
- IMAGE_SYM_TYPE_ENUM = 10, ///< An enumerated type.
- IMAGE_SYM_TYPE_MOE = 11, ///< A member of enumeration (a specific value).
- IMAGE_SYM_TYPE_BYTE = 12, ///< A byte; unsigned 1-byte integer.
- IMAGE_SYM_TYPE_WORD = 13, ///< A word; unsigned 2-byte integer.
- IMAGE_SYM_TYPE_UINT = 14, ///< An unsigned integer of natural size.
- IMAGE_SYM_TYPE_DWORD = 15 ///< An unsigned 4-byte integer.
- };
-
- enum SymbolComplexType {
- IMAGE_SYM_DTYPE_NULL = 0, ///< No complex type; simple scalar variable.
- IMAGE_SYM_DTYPE_POINTER = 1, ///< A pointer to base type.
- IMAGE_SYM_DTYPE_FUNCTION = 2, ///< A function that returns a base type.
- IMAGE_SYM_DTYPE_ARRAY = 3, ///< An array of base type.
-
- /// Type is formed as (base + (derived << SCT_COMPLEX_TYPE_SHIFT))
- SCT_COMPLEX_TYPE_SHIFT = 4
- };
-
- enum AuxSymbolType {
- IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1
- };
-
- struct section {
- char Name[NameSize];
- uint32_t VirtualSize;
- uint32_t VirtualAddress;
- uint32_t SizeOfRawData;
- uint32_t PointerToRawData;
- uint32_t PointerToRelocations;
- uint32_t PointerToLineNumbers;
- uint16_t NumberOfRelocations;
- uint16_t NumberOfLineNumbers;
- uint32_t Characteristics;
- };
-
- enum SectionCharacteristics : uint32_t {
- SC_Invalid = 0xffffffff,
-
- IMAGE_SCN_TYPE_NOLOAD = 0x00000002,
- IMAGE_SCN_TYPE_NO_PAD = 0x00000008,
- IMAGE_SCN_CNT_CODE = 0x00000020,
- IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040,
- IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080,
- IMAGE_SCN_LNK_OTHER = 0x00000100,
- IMAGE_SCN_LNK_INFO = 0x00000200,
- IMAGE_SCN_LNK_REMOVE = 0x00000800,
- IMAGE_SCN_LNK_COMDAT = 0x00001000,
- IMAGE_SCN_GPREL = 0x00008000,
- IMAGE_SCN_MEM_PURGEABLE = 0x00020000,
- IMAGE_SCN_MEM_16BIT = 0x00020000,
- IMAGE_SCN_MEM_LOCKED = 0x00040000,
- IMAGE_SCN_MEM_PRELOAD = 0x00080000,
- IMAGE_SCN_ALIGN_1BYTES = 0x00100000,
- IMAGE_SCN_ALIGN_2BYTES = 0x00200000,
- IMAGE_SCN_ALIGN_4BYTES = 0x00300000,
- IMAGE_SCN_ALIGN_8BYTES = 0x00400000,
- IMAGE_SCN_ALIGN_16BYTES = 0x00500000,
- IMAGE_SCN_ALIGN_32BYTES = 0x00600000,
- IMAGE_SCN_ALIGN_64BYTES = 0x00700000,
- IMAGE_SCN_ALIGN_128BYTES = 0x00800000,
- IMAGE_SCN_ALIGN_256BYTES = 0x00900000,
- IMAGE_SCN_ALIGN_512BYTES = 0x00A00000,
- IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000,
- IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000,
- IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000,
- IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000,
- IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000,
- IMAGE_SCN_MEM_DISCARDABLE = 0x02000000,
- IMAGE_SCN_MEM_NOT_CACHED = 0x04000000,
- IMAGE_SCN_MEM_NOT_PAGED = 0x08000000,
- IMAGE_SCN_MEM_SHARED = 0x10000000,
- IMAGE_SCN_MEM_EXECUTE = 0x20000000,
- IMAGE_SCN_MEM_READ = 0x40000000,
- IMAGE_SCN_MEM_WRITE = 0x80000000
- };
-
- struct relocation {
- uint32_t VirtualAddress;
- uint32_t SymbolTableIndex;
- uint16_t Type;
- };
-
- enum RelocationTypeI386 {
- IMAGE_REL_I386_ABSOLUTE = 0x0000,
- IMAGE_REL_I386_DIR16 = 0x0001,
- IMAGE_REL_I386_REL16 = 0x0002,
- IMAGE_REL_I386_DIR32 = 0x0006,
- IMAGE_REL_I386_DIR32NB = 0x0007,
- IMAGE_REL_I386_SEG12 = 0x0009,
- IMAGE_REL_I386_SECTION = 0x000A,
- IMAGE_REL_I386_SECREL = 0x000B,
- IMAGE_REL_I386_TOKEN = 0x000C,
- IMAGE_REL_I386_SECREL7 = 0x000D,
- IMAGE_REL_I386_REL32 = 0x0014
- };
-
- enum RelocationTypeAMD64 {
- IMAGE_REL_AMD64_ABSOLUTE = 0x0000,
- IMAGE_REL_AMD64_ADDR64 = 0x0001,
- IMAGE_REL_AMD64_ADDR32 = 0x0002,
- IMAGE_REL_AMD64_ADDR32NB = 0x0003,
- IMAGE_REL_AMD64_REL32 = 0x0004,
- IMAGE_REL_AMD64_REL32_1 = 0x0005,
- IMAGE_REL_AMD64_REL32_2 = 0x0006,
- IMAGE_REL_AMD64_REL32_3 = 0x0007,
- IMAGE_REL_AMD64_REL32_4 = 0x0008,
- IMAGE_REL_AMD64_REL32_5 = 0x0009,
- IMAGE_REL_AMD64_SECTION = 0x000A,
- IMAGE_REL_AMD64_SECREL = 0x000B,
- IMAGE_REL_AMD64_SECREL7 = 0x000C,
- IMAGE_REL_AMD64_TOKEN = 0x000D,
- IMAGE_REL_AMD64_SREL32 = 0x000E,
- IMAGE_REL_AMD64_PAIR = 0x000F,
- IMAGE_REL_AMD64_SSPAN32 = 0x0010
- };
-
- enum RelocationTypesARM {
- IMAGE_REL_ARM_ABSOLUTE = 0x0000,
- IMAGE_REL_ARM_ADDR32 = 0x0001,
- IMAGE_REL_ARM_ADDR32NB = 0x0002,
- IMAGE_REL_ARM_BRANCH24 = 0x0003,
- IMAGE_REL_ARM_BRANCH11 = 0x0004,
- IMAGE_REL_ARM_TOKEN = 0x0005,
- IMAGE_REL_ARM_BLX24 = 0x0008,
- IMAGE_REL_ARM_BLX11 = 0x0009,
- IMAGE_REL_ARM_SECTION = 0x000E,
- IMAGE_REL_ARM_SECREL = 0x000F,
- IMAGE_REL_ARM_MOV32A = 0x0010,
- IMAGE_REL_ARM_MOV32T = 0x0011,
- IMAGE_REL_ARM_BRANCH20T = 0x0012,
- IMAGE_REL_ARM_BRANCH24T = 0x0014,
- IMAGE_REL_ARM_BLX23T = 0x0015
- };
-
- enum RelocationTypesARM64 {
- IMAGE_REL_ARM64_ABSOLUTE = 0x0000,
- IMAGE_REL_ARM64_ADDR32 = 0x0001,
- IMAGE_REL_ARM64_ADDR32NB = 0x0002,
- IMAGE_REL_ARM64_BRANCH26 = 0x0003,
- IMAGE_REL_ARM64_PAGEBASE_REL2 = 0x0004,
- IMAGE_REL_ARM64_REL21 = 0x0005,
- IMAGE_REL_ARM64_PAGEOFFSET_12A = 0x0006,
- IMAGE_REL_ARM64_PAGEOFFSET_12L = 0x0007,
- IMAGE_REL_ARM64_SECREL = 0x0008,
- IMAGE_REL_ARM64_SECREL_LOW12A = 0x0009,
- IMAGE_REL_ARM64_SECREL_HIGH12A = 0x000A,
- IMAGE_REL_ARM64_SECREL_LOW12L = 0x000B,
- IMAGE_REL_ARM64_TOKEN = 0x000C,
- IMAGE_REL_ARM64_SECTION = 0x000D,
- IMAGE_REL_ARM64_ADDR64 = 0x000E,
- IMAGE_REL_ARM64_BRANCH19 = 0x000F,
- IMAGE_REL_ARM64_BRANCH14 = 0x0010,
- };
-
- enum COMDATType {
- IMAGE_COMDAT_SELECT_NODUPLICATES = 1,
- IMAGE_COMDAT_SELECT_ANY,
- IMAGE_COMDAT_SELECT_SAME_SIZE,
- IMAGE_COMDAT_SELECT_EXACT_MATCH,
- IMAGE_COMDAT_SELECT_ASSOCIATIVE,
- IMAGE_COMDAT_SELECT_LARGEST,
- IMAGE_COMDAT_SELECT_NEWEST
- };
-
- // Auxiliary Symbol Formats
- struct AuxiliaryFunctionDefinition {
- uint32_t TagIndex;
- uint32_t TotalSize;
- uint32_t PointerToLinenumber;
- uint32_t PointerToNextFunction;
- char unused[2];
- };
-
- struct AuxiliarybfAndefSymbol {
- uint8_t unused1[4];
- uint16_t Linenumber;
- uint8_t unused2[6];
- uint32_t PointerToNextFunction;
- uint8_t unused3[2];
- };
-
- struct AuxiliaryWeakExternal {
- uint32_t TagIndex;
- uint32_t Characteristics;
- uint8_t unused[10];
- };
-
- enum WeakExternalCharacteristics {
- IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1,
- IMAGE_WEAK_EXTERN_SEARCH_LIBRARY = 2,
- IMAGE_WEAK_EXTERN_SEARCH_ALIAS = 3
- };
-
- struct AuxiliarySectionDefinition {
- uint32_t Length;
- uint16_t NumberOfRelocations;
- uint16_t NumberOfLinenumbers;
- uint32_t CheckSum;
- uint32_t Number;
- uint8_t Selection;
- char unused;
- };
-
- struct AuxiliaryCLRToken {
- uint8_t AuxType;
- uint8_t unused1;
- uint32_t SymbolTableIndex;
- char unused2[12];
- };
-
- union Auxiliary {
- AuxiliaryFunctionDefinition FunctionDefinition;
- AuxiliarybfAndefSymbol bfAndefSymbol;
- AuxiliaryWeakExternal WeakExternal;
- AuxiliarySectionDefinition SectionDefinition;
- };
-
- /// @brief The Import Directory Table.
- ///
- /// There is a single array of these and one entry per imported DLL.
- struct ImportDirectoryTableEntry {
- uint32_t ImportLookupTableRVA;
- uint32_t TimeDateStamp;
- uint32_t ForwarderChain;
- uint32_t NameRVA;
- uint32_t ImportAddressTableRVA;
- };
-
- /// @brief The PE32 Import Lookup Table.
- ///
- /// There is an array of these for each imported DLL. It represents either
- /// the ordinal to import from the target DLL, or a name to lookup and import
- /// from the target DLL.
- ///
- /// This also happens to be the same format used by the Import Address Table
- /// when it is initially written out to the image.
- struct ImportLookupTableEntry32 {
- uint32_t data;
-
- /// @brief Is this entry specified by ordinal, or name?
- bool isOrdinal() const { return data & 0x80000000; }
-
- /// @brief Get the ordinal value of this entry. isOrdinal must be true.
- uint16_t getOrdinal() const {
- assert(isOrdinal() && "ILT entry is not an ordinal!");
- return data & 0xFFFF;
- }
-
- /// @brief Set the ordinal value and set isOrdinal to true.
- void setOrdinal(uint16_t o) {
- data = o;
- data |= 0x80000000;
- }
-
- /// @brief Get the Hint/Name entry RVA. isOrdinal must be false.
- uint32_t getHintNameRVA() const {
- assert(!isOrdinal() && "ILT entry is not a Hint/Name RVA!");
- return data;
- }
-
- /// @brief Set the Hint/Name entry RVA and set isOrdinal to false.
- void setHintNameRVA(uint32_t rva) { data = rva; }
- };
-
- /// @brief The DOS compatible header at the front of all PEs.
- struct DOSHeader {
- uint16_t Magic;
- uint16_t UsedBytesInTheLastPage;
- uint16_t FileSizeInPages;
- uint16_t NumberOfRelocationItems;
- uint16_t HeaderSizeInParagraphs;
- uint16_t MinimumExtraParagraphs;
- uint16_t MaximumExtraParagraphs;
- uint16_t InitialRelativeSS;
- uint16_t InitialSP;
- uint16_t Checksum;
- uint16_t InitialIP;
- uint16_t InitialRelativeCS;
- uint16_t AddressOfRelocationTable;
- uint16_t OverlayNumber;
- uint16_t Reserved[4];
- uint16_t OEMid;
- uint16_t OEMinfo;
- uint16_t Reserved2[10];
- uint32_t AddressOfNewExeHeader;
- };
-
- struct PE32Header {
- enum {
- PE32 = 0x10b,
- PE32_PLUS = 0x20b
- };
-
- uint16_t Magic;
- uint8_t MajorLinkerVersion;
- uint8_t MinorLinkerVersion;
- uint32_t SizeOfCode;
- uint32_t SizeOfInitializedData;
- uint32_t SizeOfUninitializedData;
- uint32_t AddressOfEntryPoint; // RVA
- uint32_t BaseOfCode; // RVA
- uint32_t BaseOfData; // RVA
- uint32_t ImageBase;
- uint32_t SectionAlignment;
- uint32_t FileAlignment;
- uint16_t MajorOperatingSystemVersion;
- uint16_t MinorOperatingSystemVersion;
- uint16_t MajorImageVersion;
- uint16_t MinorImageVersion;
- uint16_t MajorSubsystemVersion;
- uint16_t MinorSubsystemVersion;
- uint32_t Win32VersionValue;
- uint32_t SizeOfImage;
- uint32_t SizeOfHeaders;
- uint32_t CheckSum;
- uint16_t Subsystem;
- // FIXME: This should be DllCharacteristics to match the COFF spec.
- uint16_t DLLCharacteristics;
- uint32_t SizeOfStackReserve;
- uint32_t SizeOfStackCommit;
- uint32_t SizeOfHeapReserve;
- uint32_t SizeOfHeapCommit;
- uint32_t LoaderFlags;
- // FIXME: This should be NumberOfRvaAndSizes to match the COFF spec.
- uint32_t NumberOfRvaAndSize;
- };
-
- struct DataDirectory {
- uint32_t RelativeVirtualAddress;
- uint32_t Size;
- };
-
- enum DataDirectoryIndex {
- EXPORT_TABLE = 0,
- IMPORT_TABLE,
- RESOURCE_TABLE,
- EXCEPTION_TABLE,
- CERTIFICATE_TABLE,
- BASE_RELOCATION_TABLE,
- DEBUG_DIRECTORY,
- ARCHITECTURE,
- GLOBAL_PTR,
- TLS_TABLE,
- LOAD_CONFIG_TABLE,
- BOUND_IMPORT,
- IAT,
- DELAY_IMPORT_DESCRIPTOR,
- CLR_RUNTIME_HEADER,
-
- NUM_DATA_DIRECTORIES
- };
-
- enum WindowsSubsystem {
- IMAGE_SUBSYSTEM_UNKNOWN = 0, ///< An unknown subsystem.
- IMAGE_SUBSYSTEM_NATIVE = 1, ///< Device drivers and native Windows processes
- IMAGE_SUBSYSTEM_WINDOWS_GUI = 2, ///< The Windows GUI subsystem.
- IMAGE_SUBSYSTEM_WINDOWS_CUI = 3, ///< The Windows character subsystem.
- IMAGE_SUBSYSTEM_OS2_CUI = 5, ///< The OS/2 character subsytem.
- IMAGE_SUBSYSTEM_POSIX_CUI = 7, ///< The POSIX character subsystem.
- IMAGE_SUBSYSTEM_NATIVE_WINDOWS = 8, ///< Native Windows 9x driver.
- IMAGE_SUBSYSTEM_WINDOWS_CE_GUI = 9, ///< Windows CE.
- IMAGE_SUBSYSTEM_EFI_APPLICATION = 10, ///< An EFI application.
- IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER = 11, ///< An EFI driver with boot
- /// services.
- IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12, ///< An EFI driver with run-time
- /// services.
- IMAGE_SUBSYSTEM_EFI_ROM = 13, ///< An EFI ROM image.
- IMAGE_SUBSYSTEM_XBOX = 14, ///< XBOX.
- IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 ///< A BCD application.
- };
-
- enum DLLCharacteristics {
- /// ASLR with 64 bit address space.
- IMAGE_DLL_CHARACTERISTICS_HIGH_ENTROPY_VA = 0x0020,
- /// DLL can be relocated at load time.
- IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE = 0x0040,
- /// Code integrity checks are enforced.
- IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY = 0x0080,
- ///< Image is NX compatible.
- IMAGE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100,
- /// Isolation aware, but do not isolate the image.
- IMAGE_DLL_CHARACTERISTICS_NO_ISOLATION = 0x0200,
- /// Does not use structured exception handling (SEH). No SEH handler may be
- /// called in this image.
- IMAGE_DLL_CHARACTERISTICS_NO_SEH = 0x0400,
- /// Do not bind the image.
- IMAGE_DLL_CHARACTERISTICS_NO_BIND = 0x0800,
- ///< Image should execute in an AppContainer.
- IMAGE_DLL_CHARACTERISTICS_APPCONTAINER = 0x1000,
- ///< A WDM driver.
- IMAGE_DLL_CHARACTERISTICS_WDM_DRIVER = 0x2000,
- ///< Image supports Control Flow Guard.
- IMAGE_DLL_CHARACTERISTICS_GUARD_CF = 0x4000,
- /// Terminal Server aware.
- IMAGE_DLL_CHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
- };
-
- enum DebugType {
- IMAGE_DEBUG_TYPE_UNKNOWN = 0,
- IMAGE_DEBUG_TYPE_COFF = 1,
- IMAGE_DEBUG_TYPE_CODEVIEW = 2,
- IMAGE_DEBUG_TYPE_FPO = 3,
- IMAGE_DEBUG_TYPE_MISC = 4,
- IMAGE_DEBUG_TYPE_EXCEPTION = 5,
- IMAGE_DEBUG_TYPE_FIXUP = 6,
- IMAGE_DEBUG_TYPE_OMAP_TO_SRC = 7,
- IMAGE_DEBUG_TYPE_OMAP_FROM_SRC = 8,
- IMAGE_DEBUG_TYPE_BORLAND = 9,
- IMAGE_DEBUG_TYPE_RESERVED10 = 10,
- IMAGE_DEBUG_TYPE_CLSID = 11,
- IMAGE_DEBUG_TYPE_VC_FEATURE = 12,
- IMAGE_DEBUG_TYPE_POGO = 13,
- IMAGE_DEBUG_TYPE_ILTCG = 14,
- IMAGE_DEBUG_TYPE_MPX = 15,
- IMAGE_DEBUG_TYPE_REPRO = 16,
- };
-
- enum BaseRelocationType {
- IMAGE_REL_BASED_ABSOLUTE = 0,
- IMAGE_REL_BASED_HIGH = 1,
- IMAGE_REL_BASED_LOW = 2,
- IMAGE_REL_BASED_HIGHLOW = 3,
- IMAGE_REL_BASED_HIGHADJ = 4,
- IMAGE_REL_BASED_MIPS_JMPADDR = 5,
- IMAGE_REL_BASED_ARM_MOV32A = 5,
- IMAGE_REL_BASED_ARM_MOV32T = 7,
- IMAGE_REL_BASED_MIPS_JMPADDR16 = 9,
- IMAGE_REL_BASED_DIR64 = 10
- };
-
- enum ImportType {
- IMPORT_CODE = 0,
- IMPORT_DATA = 1,
- IMPORT_CONST = 2
- };
-
- enum ImportNameType {
- /// Import is by ordinal. This indicates that the value in the Ordinal/Hint
- /// field of the import header is the import's ordinal. If this constant is
- /// not specified, then the Ordinal/Hint field should always be interpreted
- /// as the import's hint.
- IMPORT_ORDINAL = 0,
- /// The import name is identical to the public symbol name
- IMPORT_NAME = 1,
- /// The import name is the public symbol name, but skipping the leading ?,
- /// @, or optionally _.
- IMPORT_NAME_NOPREFIX = 2,
- /// The import name is the public symbol name, but skipping the leading ?,
- /// @, or optionally _, and truncating at the first @.
- IMPORT_NAME_UNDECORATE = 3
- };
-
- struct ImportHeader {
- uint16_t Sig1; ///< Must be IMAGE_FILE_MACHINE_UNKNOWN (0).
- uint16_t Sig2; ///< Must be 0xFFFF.
- uint16_t Version;
- uint16_t Machine;
- uint32_t TimeDateStamp;
- uint32_t SizeOfData;
- uint16_t OrdinalHint;
- uint16_t TypeInfo;
-
- ImportType getType() const {
- return static_cast<ImportType>(TypeInfo & 0x3);
- }
-
- ImportNameType getNameType() const {
- return static_cast<ImportNameType>((TypeInfo & 0x1C) >> 2);
- }
- };
-
- enum CodeViewIdentifiers {
- DEBUG_SECTION_MAGIC = 0x4,
- };
-
- inline bool isReservedSectionNumber(int32_t SectionNumber) {
- return SectionNumber <= 0;
- }
-
-} // End namespace COFF.
-} // End namespace llvm.
-
-#endif
Removed: llvm/trunk/include/llvm/Support/Dwarf.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.def?rev=304863&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.def (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.def (removed)
@@ -1,838 +0,0 @@
-//===- llvm/Support/Dwarf.def - Dwarf definitions ---------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Macros for running through Dwarf enumerators.
-//
-//===----------------------------------------------------------------------===//
-
-// TODO: Add other DW-based macros.
-#if !(defined HANDLE_DW_TAG || defined HANDLE_DW_AT || \
- defined HANDLE_DW_FORM || defined HANDLE_DW_OP || \
- defined HANDLE_DW_LANG || defined HANDLE_DW_ATE || \
- defined HANDLE_DW_VIRTUALITY || defined HANDLE_DW_DEFAULTED || \
- defined HANDLE_DW_CC || defined HANDLE_DW_LNS || \
- defined HANDLE_DW_LNE || defined HANDLE_DW_LNCT || \
- defined HANDLE_DW_MACRO || defined HANDLE_DW_RLE || \
- defined HANDLE_DW_CFA || defined HANDLE_DW_APPLE_PROPERTY || \
- defined HANDLE_DW_UT)
-#error "Missing macro definition of HANDLE_DW*"
-#endif
-
-#ifndef HANDLE_DW_TAG
-#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR)
-#endif
-
-#ifndef HANDLE_DW_AT
-#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR)
-#endif
-
-#ifndef HANDLE_DW_FORM
-#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR)
-#endif
-
-#ifndef HANDLE_DW_OP
-#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR)
-#endif
-
-#ifndef HANDLE_DW_LANG
-#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR)
-#endif
-
-#ifndef HANDLE_DW_ATE
-#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR)
-#endif
-
-#ifndef HANDLE_DW_VIRTUALITY
-#define HANDLE_DW_VIRTUALITY(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_DEFAULTED
-#define HANDLE_DW_DEFAULTED(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_CC
-#define HANDLE_DW_CC(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_LNS
-#define HANDLE_DW_LNS(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_LNE
-#define HANDLE_DW_LNE(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_LNCT
-#define HANDLE_DW_LNCT(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_MACRO
-#define HANDLE_DW_MACRO(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_RLE
-#define HANDLE_DW_RLE(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_CFA
-#define HANDLE_DW_CFA(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_APPLE_PROPERTY
-#define HANDLE_DW_APPLE_PROPERTY(ID, NAME)
-#endif
-
-#ifndef HANDLE_DW_UT
-#define HANDLE_DW_UT(ID, NAME)
-#endif
-
-HANDLE_DW_TAG(0x0000, null, 2, DWARF)
-HANDLE_DW_TAG(0x0001, array_type, 2, DWARF)
-HANDLE_DW_TAG(0x0002, class_type, 2, DWARF)
-HANDLE_DW_TAG(0x0003, entry_point, 2, DWARF)
-HANDLE_DW_TAG(0x0004, enumeration_type, 2, DWARF)
-HANDLE_DW_TAG(0x0005, formal_parameter, 2, DWARF)
-HANDLE_DW_TAG(0x0008, imported_declaration, 2, DWARF)
-HANDLE_DW_TAG(0x000a, label, 2, DWARF)
-HANDLE_DW_TAG(0x000b, lexical_block, 2, DWARF)
-HANDLE_DW_TAG(0x000d, member, 2, DWARF)
-HANDLE_DW_TAG(0x000f, pointer_type, 2, DWARF)
-HANDLE_DW_TAG(0x0010, reference_type, 2, DWARF)
-HANDLE_DW_TAG(0x0011, compile_unit, 2, DWARF)
-HANDLE_DW_TAG(0x0012, string_type, 2, DWARF)
-HANDLE_DW_TAG(0x0013, structure_type, 2, DWARF)
-HANDLE_DW_TAG(0x0015, subroutine_type, 2, DWARF)
-HANDLE_DW_TAG(0x0016, typedef, 2, DWARF)
-HANDLE_DW_TAG(0x0017, union_type, 2, DWARF)
-HANDLE_DW_TAG(0x0018, unspecified_parameters, 2, DWARF)
-HANDLE_DW_TAG(0x0019, variant, 2, DWARF)
-HANDLE_DW_TAG(0x001a, common_block, 2, DWARF)
-HANDLE_DW_TAG(0x001b, common_inclusion, 2, DWARF)
-HANDLE_DW_TAG(0x001c, inheritance, 2, DWARF)
-HANDLE_DW_TAG(0x001d, inlined_subroutine, 2, DWARF)
-HANDLE_DW_TAG(0x001e, module, 2, DWARF)
-HANDLE_DW_TAG(0x001f, ptr_to_member_type, 2, DWARF)
-HANDLE_DW_TAG(0x0020, set_type, 2, DWARF)
-HANDLE_DW_TAG(0x0021, subrange_type, 2, DWARF)
-HANDLE_DW_TAG(0x0022, with_stmt, 2, DWARF)
-HANDLE_DW_TAG(0x0023, access_declaration, 2, DWARF)
-HANDLE_DW_TAG(0x0024, base_type, 2, DWARF)
-HANDLE_DW_TAG(0x0025, catch_block, 2, DWARF)
-HANDLE_DW_TAG(0x0026, const_type, 2, DWARF)
-HANDLE_DW_TAG(0x0027, constant, 2, DWARF)
-HANDLE_DW_TAG(0x0028, enumerator, 2, DWARF)
-HANDLE_DW_TAG(0x0029, file_type, 2, DWARF)
-HANDLE_DW_TAG(0x002a, friend, 2, DWARF)
-HANDLE_DW_TAG(0x002b, namelist, 2, DWARF)
-HANDLE_DW_TAG(0x002c, namelist_item, 2, DWARF)
-HANDLE_DW_TAG(0x002d, packed_type, 2, DWARF)
-HANDLE_DW_TAG(0x002e, subprogram, 2, DWARF)
-HANDLE_DW_TAG(0x002f, template_type_parameter, 2, DWARF)
-HANDLE_DW_TAG(0x0030, template_value_parameter, 2, DWARF)
-HANDLE_DW_TAG(0x0031, thrown_type, 2, DWARF)
-HANDLE_DW_TAG(0x0032, try_block, 2, DWARF)
-HANDLE_DW_TAG(0x0033, variant_part, 2, DWARF)
-HANDLE_DW_TAG(0x0034, variable, 2, DWARF)
-HANDLE_DW_TAG(0x0035, volatile_type, 2, DWARF)
-// New in DWARF v3:
-HANDLE_DW_TAG(0x0036, dwarf_procedure, 3, DWARF)
-HANDLE_DW_TAG(0x0037, restrict_type, 3, DWARF)
-HANDLE_DW_TAG(0x0038, interface_type, 3, DWARF)
-HANDLE_DW_TAG(0x0039, namespace, 3, DWARF)
-HANDLE_DW_TAG(0x003a, imported_module, 3, DWARF)
-HANDLE_DW_TAG(0x003b, unspecified_type, 3, DWARF)
-HANDLE_DW_TAG(0x003c, partial_unit, 3, DWARF)
-HANDLE_DW_TAG(0x003d, imported_unit, 3, DWARF)
-HANDLE_DW_TAG(0x003f, condition, 3, DWARF)
-HANDLE_DW_TAG(0x0040, shared_type, 3, DWARF)
-// New in DWARF v4:
-HANDLE_DW_TAG(0x0041, type_unit, 4, DWARF)
-HANDLE_DW_TAG(0x0042, rvalue_reference_type, 4, DWARF)
-HANDLE_DW_TAG(0x0043, template_alias, 4, DWARF)
-// New in DWARF v5:
-HANDLE_DW_TAG(0x0044, coarray_type, 5, DWARF)
-HANDLE_DW_TAG(0x0045, generic_subrange, 5, DWARF)
-HANDLE_DW_TAG(0x0046, dynamic_type, 5, DWARF)
-HANDLE_DW_TAG(0x0047, atomic_type, 5, DWARF)
-HANDLE_DW_TAG(0x0048, call_site, 5, DWARF)
-HANDLE_DW_TAG(0x0049, call_site_parameter, 5, DWARF)
-HANDLE_DW_TAG(0x004a, skeleton_unit, 5, DWARF)
-HANDLE_DW_TAG(0x004b, immutable_type, 5, DWARF)
-// Vendor extensions:
-HANDLE_DW_TAG(0x4081, MIPS_loop, 0, MIPS)
-HANDLE_DW_TAG(0x4101, format_label, 0, GNU)
-HANDLE_DW_TAG(0x4102, function_template, 0, GNU)
-HANDLE_DW_TAG(0x4103, class_template, 0, GNU)
-HANDLE_DW_TAG(0x4106, GNU_template_template_param, 0, GNU)
-HANDLE_DW_TAG(0x4107, GNU_template_parameter_pack, 0, GNU)
-HANDLE_DW_TAG(0x4108, GNU_formal_parameter_pack, 0, GNU)
-HANDLE_DW_TAG(0x4200, APPLE_property, 0, APPLE)
-HANDLE_DW_TAG(0xb000, BORLAND_property, 0, BORLAND)
-HANDLE_DW_TAG(0xb001, BORLAND_Delphi_string, 0, BORLAND)
-HANDLE_DW_TAG(0xb002, BORLAND_Delphi_dynamic_array, 0, BORLAND)
-HANDLE_DW_TAG(0xb003, BORLAND_Delphi_set, 0, BORLAND)
-HANDLE_DW_TAG(0xb004, BORLAND_Delphi_variant, 0, BORLAND)
-
-// Attributes.
-HANDLE_DW_AT(0x01, sibling, 2, DWARF)
-HANDLE_DW_AT(0x02, location, 2, DWARF)
-HANDLE_DW_AT(0x03, name, 2, DWARF)
-HANDLE_DW_AT(0x09, ordering, 2, DWARF)
-HANDLE_DW_AT(0x0b, byte_size, 2, DWARF)
-HANDLE_DW_AT(0x0c, bit_offset, 2, DWARF)
-HANDLE_DW_AT(0x0d, bit_size, 2, DWARF)
-HANDLE_DW_AT(0x10, stmt_list, 2, DWARF)
-HANDLE_DW_AT(0x11, low_pc, 2, DWARF)
-HANDLE_DW_AT(0x12, high_pc, 2, DWARF)
-HANDLE_DW_AT(0x13, language, 2, DWARF)
-HANDLE_DW_AT(0x15, discr, 2, DWARF)
-HANDLE_DW_AT(0x16, discr_value, 2, DWARF)
-HANDLE_DW_AT(0x17, visibility, 2, DWARF)
-HANDLE_DW_AT(0x18, import, 2, DWARF)
-HANDLE_DW_AT(0x19, string_length, 2, DWARF)
-HANDLE_DW_AT(0x1a, common_reference, 2, DWARF)
-HANDLE_DW_AT(0x1b, comp_dir, 2, DWARF)
-HANDLE_DW_AT(0x1c, const_value, 2, DWARF)
-HANDLE_DW_AT(0x1d, containing_type, 2, DWARF)
-HANDLE_DW_AT(0x1e, default_value, 2, DWARF)
-HANDLE_DW_AT(0x20, inline, 2, DWARF)
-HANDLE_DW_AT(0x21, is_optional, 2, DWARF)
-HANDLE_DW_AT(0x22, lower_bound, 2, DWARF)
-HANDLE_DW_AT(0x25, producer, 2, DWARF)
-HANDLE_DW_AT(0x27, prototyped, 2, DWARF)
-HANDLE_DW_AT(0x2a, return_addr, 2, DWARF)
-HANDLE_DW_AT(0x2c, start_scope, 2, DWARF)
-HANDLE_DW_AT(0x2e, bit_stride, 2, DWARF)
-HANDLE_DW_AT(0x2f, upper_bound, 2, DWARF)
-HANDLE_DW_AT(0x31, abstract_origin, 2, DWARF)
-HANDLE_DW_AT(0x32, accessibility, 2, DWARF)
-HANDLE_DW_AT(0x33, address_class, 2, DWARF)
-HANDLE_DW_AT(0x34, artificial, 2, DWARF)
-HANDLE_DW_AT(0x35, base_types, 2, DWARF)
-HANDLE_DW_AT(0x36, calling_convention, 2, DWARF)
-HANDLE_DW_AT(0x37, count, 2, DWARF)
-HANDLE_DW_AT(0x38, data_member_location, 2, DWARF)
-HANDLE_DW_AT(0x39, decl_column, 2, DWARF)
-HANDLE_DW_AT(0x3a, decl_file, 2, DWARF)
-HANDLE_DW_AT(0x3b, decl_line, 2, DWARF)
-HANDLE_DW_AT(0x3c, declaration, 2, DWARF)
-HANDLE_DW_AT(0x3d, discr_list, 2, DWARF)
-HANDLE_DW_AT(0x3e, encoding, 2, DWARF)
-HANDLE_DW_AT(0x3f, external, 2, DWARF)
-HANDLE_DW_AT(0x40, frame_base, 2, DWARF)
-HANDLE_DW_AT(0x41, friend, 2, DWARF)
-HANDLE_DW_AT(0x42, identifier_case, 2, DWARF)
-HANDLE_DW_AT(0x43, macro_info, 2, DWARF)
-HANDLE_DW_AT(0x44, namelist_item, 2, DWARF)
-HANDLE_DW_AT(0x45, priority, 2, DWARF)
-HANDLE_DW_AT(0x46, segment, 2, DWARF)
-HANDLE_DW_AT(0x47, specification, 2, DWARF)
-HANDLE_DW_AT(0x48, static_link, 2, DWARF)
-HANDLE_DW_AT(0x49, type, 2, DWARF)
-HANDLE_DW_AT(0x4a, use_location, 2, DWARF)
-HANDLE_DW_AT(0x4b, variable_parameter, 2, DWARF)
-HANDLE_DW_AT(0x4c, virtuality, 2, DWARF)
-HANDLE_DW_AT(0x4d, vtable_elem_location, 2, DWARF)
-// New in DWARF v3:
-HANDLE_DW_AT(0x4e, allocated, 3, DWARF)
-HANDLE_DW_AT(0x4f, associated, 3, DWARF)
-HANDLE_DW_AT(0x50, data_location, 3, DWARF)
-HANDLE_DW_AT(0x51, byte_stride, 3, DWARF)
-HANDLE_DW_AT(0x52, entry_pc, 3, DWARF)
-HANDLE_DW_AT(0x53, use_UTF8, 3, DWARF)
-HANDLE_DW_AT(0x54, extension, 3, DWARF)
-HANDLE_DW_AT(0x55, ranges, 3, DWARF)
-HANDLE_DW_AT(0x56, trampoline, 3, DWARF)
-HANDLE_DW_AT(0x57, call_column, 3, DWARF)
-HANDLE_DW_AT(0x58, call_file, 3, DWARF)
-HANDLE_DW_AT(0x59, call_line, 3, DWARF)
-HANDLE_DW_AT(0x5a, description, 3, DWARF)
-HANDLE_DW_AT(0x5b, binary_scale, 3, DWARF)
-HANDLE_DW_AT(0x5c, decimal_scale, 3, DWARF)
-HANDLE_DW_AT(0x5d, small, 3, DWARF)
-HANDLE_DW_AT(0x5e, decimal_sign, 3, DWARF)
-HANDLE_DW_AT(0x5f, digit_count, 3, DWARF)
-HANDLE_DW_AT(0x60, picture_string, 3, DWARF)
-HANDLE_DW_AT(0x61, mutable, 3, DWARF)
-HANDLE_DW_AT(0x62, threads_scaled, 3, DWARF)
-HANDLE_DW_AT(0x63, explicit, 3, DWARF)
-HANDLE_DW_AT(0x64, object_pointer, 3, DWARF)
-HANDLE_DW_AT(0x65, endianity, 3, DWARF)
-HANDLE_DW_AT(0x66, elemental, 3, DWARF)
-HANDLE_DW_AT(0x67, pure, 3, DWARF)
-HANDLE_DW_AT(0x68, recursive, 3, DWARF)
-// New in DWARF v4:
-HANDLE_DW_AT(0x69, signature, 4, DWARF)
-HANDLE_DW_AT(0x6a, main_subprogram, 4, DWARF)
-HANDLE_DW_AT(0x6b, data_bit_offset, 4, DWARF)
-HANDLE_DW_AT(0x6c, const_expr, 4, DWARF)
-HANDLE_DW_AT(0x6d, enum_class, 4, DWARF)
-HANDLE_DW_AT(0x6e, linkage_name, 4, DWARF)
-// New in DWARF v5:
-HANDLE_DW_AT(0x6f, string_length_bit_size, 5, DWARF)
-HANDLE_DW_AT(0x70, string_length_byte_size, 5, DWARF)
-HANDLE_DW_AT(0x71, rank, 5, DWARF)
-HANDLE_DW_AT(0x72, str_offsets_base, 5, DWARF)
-HANDLE_DW_AT(0x73, addr_base, 5, DWARF)
-HANDLE_DW_AT(0x74, rnglists_base, 5, DWARF)
-HANDLE_DW_AT(0x75, dwo_id, 0, DWARF) ///< Retracted from DWARF v5.
-HANDLE_DW_AT(0x76, dwo_name, 5, DWARF)
-HANDLE_DW_AT(0x77, reference, 5, DWARF)
-HANDLE_DW_AT(0x78, rvalue_reference, 5, DWARF)
-HANDLE_DW_AT(0x79, macros, 5, DWARF)
-HANDLE_DW_AT(0x7a, call_all_calls, 5, DWARF)
-HANDLE_DW_AT(0x7b, call_all_source_calls, 5, DWARF)
-HANDLE_DW_AT(0x7c, call_all_tail_calls, 5, DWARF)
-HANDLE_DW_AT(0x7d, call_return_pc, 5, DWARF)
-HANDLE_DW_AT(0x7e, call_value, 5, DWARF)
-HANDLE_DW_AT(0x7f, call_origin, 5, DWARF)
-HANDLE_DW_AT(0x80, call_parameter, 5, DWARF)
-HANDLE_DW_AT(0x81, call_pc, 5, DWARF)
-HANDLE_DW_AT(0x82, call_tail_call, 5, DWARF)
-HANDLE_DW_AT(0x83, call_target, 5, DWARF)
-HANDLE_DW_AT(0x84, call_target_clobbered, 5, DWARF)
-HANDLE_DW_AT(0x85, call_data_location, 5, DWARF)
-HANDLE_DW_AT(0x86, call_data_value, 5, DWARF)
-HANDLE_DW_AT(0x87, noreturn, 5, DWARF)
-HANDLE_DW_AT(0x88, alignment, 5, DWARF)
-HANDLE_DW_AT(0x89, export_symbols, 5, DWARF)
-HANDLE_DW_AT(0x8a, deleted, 5, DWARF)
-HANDLE_DW_AT(0x8b, defaulted, 5, DWARF)
-HANDLE_DW_AT(0x8c, loclists_base, 5, DWARF)
-// Vendor extensions:
-HANDLE_DW_AT(0x2002, MIPS_loop_begin, 0, MIPS)
-HANDLE_DW_AT(0x2003, MIPS_tail_loop_begin, 0, MIPS)
-HANDLE_DW_AT(0x2004, MIPS_epilog_begin, 0, MIPS)
-HANDLE_DW_AT(0x2005, MIPS_loop_unroll_factor, 0, MIPS)
-HANDLE_DW_AT(0x2006, MIPS_software_pipeline_depth, 0, MIPS)
-HANDLE_DW_AT(0x2007, MIPS_linkage_name, 0, MIPS)
-HANDLE_DW_AT(0x2008, MIPS_stride, 0, MIPS)
-HANDLE_DW_AT(0x2009, MIPS_abstract_name, 0, MIPS)
-HANDLE_DW_AT(0x200a, MIPS_clone_origin, 0, MIPS)
-HANDLE_DW_AT(0x200b, MIPS_has_inlines, 0, MIPS)
-HANDLE_DW_AT(0x200c, MIPS_stride_byte, 0, MIPS)
-HANDLE_DW_AT(0x200d, MIPS_stride_elem, 0, MIPS)
-HANDLE_DW_AT(0x200e, MIPS_ptr_dopetype, 0, MIPS)
-HANDLE_DW_AT(0x200f, MIPS_allocatable_dopetype, 0, MIPS)
-HANDLE_DW_AT(0x2010, MIPS_assumed_shape_dopetype, 0, MIPS)
-// This one appears to have only been implemented by Open64 for
-// fortran and may conflict with other extensions.
-HANDLE_DW_AT(0x2011, MIPS_assumed_size, 0, MIPS)
-// GNU extensions
-HANDLE_DW_AT(0x2101, sf_names, 0, GNU)
-HANDLE_DW_AT(0x2102, src_info, 0, GNU)
-HANDLE_DW_AT(0x2103, mac_info, 0, GNU)
-HANDLE_DW_AT(0x2104, src_coords, 0, GNU)
-HANDLE_DW_AT(0x2105, body_begin, 0, GNU)
-HANDLE_DW_AT(0x2106, body_end, 0, GNU)
-HANDLE_DW_AT(0x2107, GNU_vector, 0, GNU)
-HANDLE_DW_AT(0x2110, GNU_template_name, 0, GNU)
-HANDLE_DW_AT(0x210f, GNU_odr_signature, 0, GNU)
-HANDLE_DW_AT(0x2119, GNU_macros, 0, GNU)
-// Extensions for Fission proposal.
-HANDLE_DW_AT(0x2130, GNU_dwo_name, 0, GNU)
-HANDLE_DW_AT(0x2131, GNU_dwo_id, 0, GNU)
-HANDLE_DW_AT(0x2132, GNU_ranges_base, 0, GNU)
-HANDLE_DW_AT(0x2133, GNU_addr_base, 0, GNU)
-HANDLE_DW_AT(0x2134, GNU_pubnames, 0, GNU)
-HANDLE_DW_AT(0x2135, GNU_pubtypes, 0, GNU)
-HANDLE_DW_AT(0x2136, GNU_discriminator, 0, GNU)
-// Borland extensions.
-HANDLE_DW_AT(0x3b11, BORLAND_property_read, 0, BORLAND)
-HANDLE_DW_AT(0x3b12, BORLAND_property_write, 0, BORLAND)
-HANDLE_DW_AT(0x3b13, BORLAND_property_implements, 0, BORLAND)
-HANDLE_DW_AT(0x3b14, BORLAND_property_index, 0, BORLAND)
-HANDLE_DW_AT(0x3b15, BORLAND_property_default, 0, BORLAND)
-HANDLE_DW_AT(0x3b20, BORLAND_Delphi_unit, 0, BORLAND)
-HANDLE_DW_AT(0x3b21, BORLAND_Delphi_class, 0, BORLAND)
-HANDLE_DW_AT(0x3b22, BORLAND_Delphi_record, 0, BORLAND)
-HANDLE_DW_AT(0x3b23, BORLAND_Delphi_metaclass, 0, BORLAND)
-HANDLE_DW_AT(0x3b24, BORLAND_Delphi_constructor, 0, BORLAND)
-HANDLE_DW_AT(0x3b25, BORLAND_Delphi_destructor, 0, BORLAND)
-HANDLE_DW_AT(0x3b26, BORLAND_Delphi_anonymous_method, 0, BORLAND)
-HANDLE_DW_AT(0x3b27, BORLAND_Delphi_interface, 0, BORLAND)
-HANDLE_DW_AT(0x3b28, BORLAND_Delphi_ABI, 0, BORLAND)
-HANDLE_DW_AT(0x3b29, BORLAND_Delphi_return, 0, BORLAND)
-HANDLE_DW_AT(0x3b30, BORLAND_Delphi_frameptr, 0, BORLAND)
-HANDLE_DW_AT(0x3b31, BORLAND_closure, 0, BORLAND)
-// LLVM project extensions.
-HANDLE_DW_AT(0x3e00, LLVM_include_path, 0, LLVM)
-HANDLE_DW_AT(0x3e01, LLVM_config_macros, 0, LLVM)
-HANDLE_DW_AT(0x3e02, LLVM_isysroot, 0, LLVM)
-// Apple extensions.
-HANDLE_DW_AT(0x3fe1, APPLE_optimized, 0, APPLE)
-HANDLE_DW_AT(0x3fe2, APPLE_flags, 0, APPLE)
-HANDLE_DW_AT(0x3fe3, APPLE_isa, 0, APPLE)
-HANDLE_DW_AT(0x3fe4, APPLE_block, 0, APPLE)
-HANDLE_DW_AT(0x3fe5, APPLE_major_runtime_vers, 0, APPLE)
-HANDLE_DW_AT(0x3fe6, APPLE_runtime_class, 0, APPLE)
-HANDLE_DW_AT(0x3fe7, APPLE_omit_frame_ptr, 0, APPLE)
-HANDLE_DW_AT(0x3fe8, APPLE_property_name, 0, APPLE)
-HANDLE_DW_AT(0x3fe9, APPLE_property_getter, 0, APPLE)
-HANDLE_DW_AT(0x3fea, APPLE_property_setter, 0, APPLE)
-HANDLE_DW_AT(0x3feb, APPLE_property_attribute, 0, APPLE)
-HANDLE_DW_AT(0x3fec, APPLE_objc_complete_type, 0, APPLE)
-HANDLE_DW_AT(0x3fed, APPLE_property, 0, APPLE)
-
-// Attribute form encodings.
-HANDLE_DW_FORM(0x01, addr, 2, DWARF)
-HANDLE_DW_FORM(0x03, block2, 2, DWARF)
-HANDLE_DW_FORM(0x04, block4, 2, DWARF)
-HANDLE_DW_FORM(0x05, data2, 2, DWARF)
-HANDLE_DW_FORM(0x06, data4, 2, DWARF)
-HANDLE_DW_FORM(0x07, data8, 2, DWARF)
-HANDLE_DW_FORM(0x08, string, 2, DWARF)
-HANDLE_DW_FORM(0x09, block, 2, DWARF)
-HANDLE_DW_FORM(0x0a, block1, 2, DWARF)
-HANDLE_DW_FORM(0x0b, data1, 2, DWARF)
-HANDLE_DW_FORM(0x0c, flag, 2, DWARF)
-HANDLE_DW_FORM(0x0d, sdata, 2, DWARF)
-HANDLE_DW_FORM(0x0e, strp, 2, DWARF)
-HANDLE_DW_FORM(0x0f, udata, 2, DWARF)
-HANDLE_DW_FORM(0x10, ref_addr, 2, DWARF)
-HANDLE_DW_FORM(0x11, ref1, 2, DWARF)
-HANDLE_DW_FORM(0x12, ref2, 2, DWARF)
-HANDLE_DW_FORM(0x13, ref4, 2, DWARF)
-HANDLE_DW_FORM(0x14, ref8, 2, DWARF)
-HANDLE_DW_FORM(0x15, ref_udata, 2, DWARF)
-HANDLE_DW_FORM(0x16, indirect, 2, DWARF)
-// New in DWARF v4:
-HANDLE_DW_FORM(0x17, sec_offset, 4, DWARF)
-HANDLE_DW_FORM(0x18, exprloc, 4, DWARF)
-HANDLE_DW_FORM(0x19, flag_present, 4, DWARF)
-// This was defined out of sequence.
-HANDLE_DW_FORM(0x20, ref_sig8, 4, DWARF)
-// New in DWARF v5:
-HANDLE_DW_FORM(0x1a, strx, 5, DWARF)
-HANDLE_DW_FORM(0x1b, addrx, 5, DWARF)
-HANDLE_DW_FORM(0x1c, ref_sup4, 5, DWARF)
-HANDLE_DW_FORM(0x1d, strp_sup, 5, DWARF)
-HANDLE_DW_FORM(0x1e, data16, 5, DWARF)
-HANDLE_DW_FORM(0x1f, line_strp, 5, DWARF)
-HANDLE_DW_FORM(0x21, implicit_const, 5, DWARF)
-HANDLE_DW_FORM(0x22, loclistx, 5, DWARF)
-HANDLE_DW_FORM(0x23, rnglistx, 5, DWARF)
-HANDLE_DW_FORM(0x24, ref_sup8, 5, DWARF)
-HANDLE_DW_FORM(0x25, strx1, 5, DWARF)
-HANDLE_DW_FORM(0x26, strx2, 5, DWARF)
-HANDLE_DW_FORM(0x27, strx3, 5, DWARF)
-HANDLE_DW_FORM(0x28, strx4, 5, DWARF)
-HANDLE_DW_FORM(0x29, addrx1, 5, DWARF)
-HANDLE_DW_FORM(0x2a, addrx2, 5, DWARF)
-HANDLE_DW_FORM(0x2b, addrx3, 5, DWARF)
-HANDLE_DW_FORM(0x2c, addrx4, 5, DWARF)
-// Extensions for Fission proposal
-HANDLE_DW_FORM(0x1f01, GNU_addr_index, 0, GNU)
-HANDLE_DW_FORM(0x1f02, GNU_str_index, 0, GNU)
-// Alternate debug sections proposal (output of "dwz" tool).
-HANDLE_DW_FORM(0x1f20, GNU_ref_alt, 0, GNU)
-HANDLE_DW_FORM(0x1f21, GNU_strp_alt, 0, GNU)
-
-// DWARF Expression operators.
-HANDLE_DW_OP(0x03, addr, 2, DWARF)
-HANDLE_DW_OP(0x06, deref, 2, DWARF)
-HANDLE_DW_OP(0x08, const1u, 2, DWARF)
-HANDLE_DW_OP(0x09, const1s, 2, DWARF)
-HANDLE_DW_OP(0x0a, const2u, 2, DWARF)
-HANDLE_DW_OP(0x0b, const2s, 2, DWARF)
-HANDLE_DW_OP(0x0c, const4u, 2, DWARF)
-HANDLE_DW_OP(0x0d, const4s, 2, DWARF)
-HANDLE_DW_OP(0x0e, const8u, 2, DWARF)
-HANDLE_DW_OP(0x0f, const8s, 2, DWARF)
-HANDLE_DW_OP(0x10, constu, 2, DWARF)
-HANDLE_DW_OP(0x11, consts, 2, DWARF)
-HANDLE_DW_OP(0x12, dup, 2, DWARF)
-HANDLE_DW_OP(0x13, drop, 2, DWARF)
-HANDLE_DW_OP(0x14, over, 2, DWARF)
-HANDLE_DW_OP(0x15, pick, 2, DWARF)
-HANDLE_DW_OP(0x16, swap, 2, DWARF)
-HANDLE_DW_OP(0x17, rot, 2, DWARF)
-HANDLE_DW_OP(0x18, xderef, 2, DWARF)
-HANDLE_DW_OP(0x19, abs, 2, DWARF)
-HANDLE_DW_OP(0x1a, and, 2, DWARF)
-HANDLE_DW_OP(0x1b, div, 2, DWARF)
-HANDLE_DW_OP(0x1c, minus, 2, DWARF)
-HANDLE_DW_OP(0x1d, mod, 2, DWARF)
-HANDLE_DW_OP(0x1e, mul, 2, DWARF)
-HANDLE_DW_OP(0x1f, neg, 2, DWARF)
-HANDLE_DW_OP(0x20, not, 2, DWARF)
-HANDLE_DW_OP(0x21, or, 2, DWARF)
-HANDLE_DW_OP(0x22, plus, 2, DWARF)
-HANDLE_DW_OP(0x23, plus_uconst, 2, DWARF)
-HANDLE_DW_OP(0x24, shl, 2, DWARF)
-HANDLE_DW_OP(0x25, shr, 2, DWARF)
-HANDLE_DW_OP(0x26, shra, 2, DWARF)
-HANDLE_DW_OP(0x27, xor, 2, DWARF)
-HANDLE_DW_OP(0x28, bra, 2, DWARF)
-HANDLE_DW_OP(0x29, eq, 2, DWARF)
-HANDLE_DW_OP(0x2a, ge, 2, DWARF)
-HANDLE_DW_OP(0x2b, gt, 2, DWARF)
-HANDLE_DW_OP(0x2c, le, 2, DWARF)
-HANDLE_DW_OP(0x2d, lt, 2, DWARF)
-HANDLE_DW_OP(0x2e, ne, 2, DWARF)
-HANDLE_DW_OP(0x2f, skip, 2, DWARF)
-HANDLE_DW_OP(0x30, lit0, 2, DWARF)
-HANDLE_DW_OP(0x31, lit1, 2, DWARF)
-HANDLE_DW_OP(0x32, lit2, 2, DWARF)
-HANDLE_DW_OP(0x33, lit3, 2, DWARF)
-HANDLE_DW_OP(0x34, lit4, 2, DWARF)
-HANDLE_DW_OP(0x35, lit5, 2, DWARF)
-HANDLE_DW_OP(0x36, lit6, 2, DWARF)
-HANDLE_DW_OP(0x37, lit7, 2, DWARF)
-HANDLE_DW_OP(0x38, lit8, 2, DWARF)
-HANDLE_DW_OP(0x39, lit9, 2, DWARF)
-HANDLE_DW_OP(0x3a, lit10, 2, DWARF)
-HANDLE_DW_OP(0x3b, lit11, 2, DWARF)
-HANDLE_DW_OP(0x3c, lit12, 2, DWARF)
-HANDLE_DW_OP(0x3d, lit13, 2, DWARF)
-HANDLE_DW_OP(0x3e, lit14, 2, DWARF)
-HANDLE_DW_OP(0x3f, lit15, 2, DWARF)
-HANDLE_DW_OP(0x40, lit16, 2, DWARF)
-HANDLE_DW_OP(0x41, lit17, 2, DWARF)
-HANDLE_DW_OP(0x42, lit18, 2, DWARF)
-HANDLE_DW_OP(0x43, lit19, 2, DWARF)
-HANDLE_DW_OP(0x44, lit20, 2, DWARF)
-HANDLE_DW_OP(0x45, lit21, 2, DWARF)
-HANDLE_DW_OP(0x46, lit22, 2, DWARF)
-HANDLE_DW_OP(0x47, lit23, 2, DWARF)
-HANDLE_DW_OP(0x48, lit24, 2, DWARF)
-HANDLE_DW_OP(0x49, lit25, 2, DWARF)
-HANDLE_DW_OP(0x4a, lit26, 2, DWARF)
-HANDLE_DW_OP(0x4b, lit27, 2, DWARF)
-HANDLE_DW_OP(0x4c, lit28, 2, DWARF)
-HANDLE_DW_OP(0x4d, lit29, 2, DWARF)
-HANDLE_DW_OP(0x4e, lit30, 2, DWARF)
-HANDLE_DW_OP(0x4f, lit31, 2, DWARF)
-HANDLE_DW_OP(0x50, reg0, 2, DWARF)
-HANDLE_DW_OP(0x51, reg1, 2, DWARF)
-HANDLE_DW_OP(0x52, reg2, 2, DWARF)
-HANDLE_DW_OP(0x53, reg3, 2, DWARF)
-HANDLE_DW_OP(0x54, reg4, 2, DWARF)
-HANDLE_DW_OP(0x55, reg5, 2, DWARF)
-HANDLE_DW_OP(0x56, reg6, 2, DWARF)
-HANDLE_DW_OP(0x57, reg7, 2, DWARF)
-HANDLE_DW_OP(0x58, reg8, 2, DWARF)
-HANDLE_DW_OP(0x59, reg9, 2, DWARF)
-HANDLE_DW_OP(0x5a, reg10, 2, DWARF)
-HANDLE_DW_OP(0x5b, reg11, 2, DWARF)
-HANDLE_DW_OP(0x5c, reg12, 2, DWARF)
-HANDLE_DW_OP(0x5d, reg13, 2, DWARF)
-HANDLE_DW_OP(0x5e, reg14, 2, DWARF)
-HANDLE_DW_OP(0x5f, reg15, 2, DWARF)
-HANDLE_DW_OP(0x60, reg16, 2, DWARF)
-HANDLE_DW_OP(0x61, reg17, 2, DWARF)
-HANDLE_DW_OP(0x62, reg18, 2, DWARF)
-HANDLE_DW_OP(0x63, reg19, 2, DWARF)
-HANDLE_DW_OP(0x64, reg20, 2, DWARF)
-HANDLE_DW_OP(0x65, reg21, 2, DWARF)
-HANDLE_DW_OP(0x66, reg22, 2, DWARF)
-HANDLE_DW_OP(0x67, reg23, 2, DWARF)
-HANDLE_DW_OP(0x68, reg24, 2, DWARF)
-HANDLE_DW_OP(0x69, reg25, 2, DWARF)
-HANDLE_DW_OP(0x6a, reg26, 2, DWARF)
-HANDLE_DW_OP(0x6b, reg27, 2, DWARF)
-HANDLE_DW_OP(0x6c, reg28, 2, DWARF)
-HANDLE_DW_OP(0x6d, reg29, 2, DWARF)
-HANDLE_DW_OP(0x6e, reg30, 2, DWARF)
-HANDLE_DW_OP(0x6f, reg31, 2, DWARF)
-HANDLE_DW_OP(0x70, breg0, 2, DWARF)
-HANDLE_DW_OP(0x71, breg1, 2, DWARF)
-HANDLE_DW_OP(0x72, breg2, 2, DWARF)
-HANDLE_DW_OP(0x73, breg3, 2, DWARF)
-HANDLE_DW_OP(0x74, breg4, 2, DWARF)
-HANDLE_DW_OP(0x75, breg5, 2, DWARF)
-HANDLE_DW_OP(0x76, breg6, 2, DWARF)
-HANDLE_DW_OP(0x77, breg7, 2, DWARF)
-HANDLE_DW_OP(0x78, breg8, 2, DWARF)
-HANDLE_DW_OP(0x79, breg9, 2, DWARF)
-HANDLE_DW_OP(0x7a, breg10, 2, DWARF)
-HANDLE_DW_OP(0x7b, breg11, 2, DWARF)
-HANDLE_DW_OP(0x7c, breg12, 2, DWARF)
-HANDLE_DW_OP(0x7d, breg13, 2, DWARF)
-HANDLE_DW_OP(0x7e, breg14, 2, DWARF)
-HANDLE_DW_OP(0x7f, breg15, 2, DWARF)
-HANDLE_DW_OP(0x80, breg16, 2, DWARF)
-HANDLE_DW_OP(0x81, breg17, 2, DWARF)
-HANDLE_DW_OP(0x82, breg18, 2, DWARF)
-HANDLE_DW_OP(0x83, breg19, 2, DWARF)
-HANDLE_DW_OP(0x84, breg20, 2, DWARF)
-HANDLE_DW_OP(0x85, breg21, 2, DWARF)
-HANDLE_DW_OP(0x86, breg22, 2, DWARF)
-HANDLE_DW_OP(0x87, breg23, 2, DWARF)
-HANDLE_DW_OP(0x88, breg24, 2, DWARF)
-HANDLE_DW_OP(0x89, breg25, 2, DWARF)
-HANDLE_DW_OP(0x8a, breg26, 2, DWARF)
-HANDLE_DW_OP(0x8b, breg27, 2, DWARF)
-HANDLE_DW_OP(0x8c, breg28, 2, DWARF)
-HANDLE_DW_OP(0x8d, breg29, 2, DWARF)
-HANDLE_DW_OP(0x8e, breg30, 2, DWARF)
-HANDLE_DW_OP(0x8f, breg31, 2, DWARF)
-HANDLE_DW_OP(0x90, regx, 2, DWARF)
-HANDLE_DW_OP(0x91, fbreg, 2, DWARF)
-HANDLE_DW_OP(0x92, bregx, 2, DWARF)
-HANDLE_DW_OP(0x93, piece, 2, DWARF)
-HANDLE_DW_OP(0x94, deref_size, 2, DWARF)
-HANDLE_DW_OP(0x95, xderef_size, 2, DWARF)
-HANDLE_DW_OP(0x96, nop, 2, DWARF)
-// New in DWARF v3:
-HANDLE_DW_OP(0x97, push_object_address, 3, DWARF)
-HANDLE_DW_OP(0x98, call2, 3, DWARF)
-HANDLE_DW_OP(0x99, call4, 3, DWARF)
-HANDLE_DW_OP(0x9a, call_ref, 3, DWARF)
-HANDLE_DW_OP(0x9b, form_tls_address, 3, DWARF)
-HANDLE_DW_OP(0x9c, call_frame_cfa, 3, DWARF)
-HANDLE_DW_OP(0x9d, bit_piece, 3, DWARF)
-// New in DWARF v4:
-HANDLE_DW_OP(0x9e, implicit_value, 4, DWARF)
-HANDLE_DW_OP(0x9f, stack_value, 4, DWARF)
-// New in DWARF v5:
-HANDLE_DW_OP(0xa0, implicit_pointer, 5, DWARF)
-HANDLE_DW_OP(0xa1, addrx, 5, DWARF)
-HANDLE_DW_OP(0xa2, constx, 5, DWARF)
-HANDLE_DW_OP(0xa3, entry_value, 5, DWARF)
-HANDLE_DW_OP(0xa4, const_type, 5, DWARF)
-HANDLE_DW_OP(0xa5, regval_type, 5, DWARF)
-HANDLE_DW_OP(0xa6, deref_type, 5, DWARF)
-HANDLE_DW_OP(0xa7, xderef_type, 5, DWARF)
-HANDLE_DW_OP(0xa8, convert, 5, DWARF)
-HANDLE_DW_OP(0xa9, reinterpret, 5, DWARF)
-// Vendor extensions:
-// Extensions for GNU-style thread-local storage.
-HANDLE_DW_OP(0xe0, GNU_push_tls_address, 0, GNU)
-// Extensions for Fission proposal.
-HANDLE_DW_OP(0xfb, GNU_addr_index, 0, GNU)
-HANDLE_DW_OP(0xfc, GNU_const_index, 0, GNU)
-
-// DWARF languages.
-HANDLE_DW_LANG(0x0001, C89, 2, DWARF)
-HANDLE_DW_LANG(0x0002, C, 2, DWARF)
-HANDLE_DW_LANG(0x0003, Ada83, 2, DWARF)
-HANDLE_DW_LANG(0x0004, C_plus_plus, 2, DWARF)
-HANDLE_DW_LANG(0x0005, Cobol74, 2, DWARF)
-HANDLE_DW_LANG(0x0006, Cobol85, 2, DWARF)
-HANDLE_DW_LANG(0x0007, Fortran77, 2, DWARF)
-HANDLE_DW_LANG(0x0008, Fortran90, 2, DWARF)
-HANDLE_DW_LANG(0x0009, Pascal83, 2, DWARF)
-HANDLE_DW_LANG(0x000a, Modula2, 2, DWARF)
-// New in DWARF v3:
-HANDLE_DW_LANG(0x000b, Java, 3, DWARF)
-HANDLE_DW_LANG(0x000c, C99, 3, DWARF)
-HANDLE_DW_LANG(0x000d, Ada95, 3, DWARF)
-HANDLE_DW_LANG(0x000e, Fortran95, 3, DWARF)
-HANDLE_DW_LANG(0x000f, PLI, 3, DWARF)
-HANDLE_DW_LANG(0x0010, ObjC, 3, DWARF)
-HANDLE_DW_LANG(0x0011, ObjC_plus_plus, 3, DWARF)
-HANDLE_DW_LANG(0x0012, UPC, 3, DWARF)
-HANDLE_DW_LANG(0x0013, D, 3, DWARF)
-// New in DWARF v4:
-HANDLE_DW_LANG(0x0014, Python, 4, DWARF)
-// New in DWARF v5:
-HANDLE_DW_LANG(0x0015, OpenCL, 5, DWARF)
-HANDLE_DW_LANG(0x0016, Go, 5, DWARF)
-HANDLE_DW_LANG(0x0017, Modula3, 5, DWARF)
-HANDLE_DW_LANG(0x0018, Haskell, 5, DWARF)
-HANDLE_DW_LANG(0x0019, C_plus_plus_03, 5, DWARF)
-HANDLE_DW_LANG(0x001a, C_plus_plus_11, 5, DWARF)
-HANDLE_DW_LANG(0x001b, OCaml, 5, DWARF)
-HANDLE_DW_LANG(0x001c, Rust, 5, DWARF)
-HANDLE_DW_LANG(0x001d, C11, 5, DWARF)
-HANDLE_DW_LANG(0x001e, Swift, 5, DWARF)
-HANDLE_DW_LANG(0x001f, Julia, 5, DWARF)
-HANDLE_DW_LANG(0x0020, Dylan, 5, DWARF)
-HANDLE_DW_LANG(0x0021, C_plus_plus_14, 5, DWARF)
-HANDLE_DW_LANG(0x0022, Fortran03, 5, DWARF)
-HANDLE_DW_LANG(0x0023, Fortran08, 5, DWARF)
-HANDLE_DW_LANG(0x0024, RenderScript, 5, DWARF)
-HANDLE_DW_LANG(0x0025, BLISS, 5, DWARF)
-// Vendor extensions:
-HANDLE_DW_LANG(0x8001, Mips_Assembler, 0, MIPS)
-HANDLE_DW_LANG(0x8e57, GOOGLE_RenderScript, 0, GOOGLE)
-HANDLE_DW_LANG(0xb000, BORLAND_Delphi, 0, BORLAND)
-
-// DWARF attribute type encodings.
-HANDLE_DW_ATE(0x01, address, 2, DWARF)
-HANDLE_DW_ATE(0x02, boolean, 2, DWARF)
-HANDLE_DW_ATE(0x03, complex_float, 2, DWARF)
-HANDLE_DW_ATE(0x04, float, 2, DWARF)
-HANDLE_DW_ATE(0x05, signed, 2, DWARF)
-HANDLE_DW_ATE(0x06, signed_char, 2, DWARF)
-HANDLE_DW_ATE(0x07, unsigned, 2, DWARF)
-HANDLE_DW_ATE(0x08, unsigned_char, 2, DWARF)
-// New in DWARF v3:
-HANDLE_DW_ATE(0x09, imaginary_float, 3, DWARF)
-HANDLE_DW_ATE(0x0a, packed_decimal, 3, DWARF)
-HANDLE_DW_ATE(0x0b, numeric_string, 3, DWARF)
-HANDLE_DW_ATE(0x0c, edited, 3, DWARF)
-HANDLE_DW_ATE(0x0d, signed_fixed, 3, DWARF)
-HANDLE_DW_ATE(0x0e, unsigned_fixed, 3, DWARF)
-HANDLE_DW_ATE(0x0f, decimal_float, 3, DWARF)
-// New in DWARF v4:
-HANDLE_DW_ATE(0x10, UTF, 4, DWARF)
-// New in DWARF v5:
-HANDLE_DW_ATE(0x11, UCS, 5, DWARF)
-HANDLE_DW_ATE(0x12, ASCII, 5, DWARF)
-
-// DWARF virtuality codes.
-HANDLE_DW_VIRTUALITY(0x00, none)
-HANDLE_DW_VIRTUALITY(0x01, virtual)
-HANDLE_DW_VIRTUALITY(0x02, pure_virtual)
-
-// DWARF v5 Defaulted Member Encodings.
-HANDLE_DW_DEFAULTED(0x00, no)
-HANDLE_DW_DEFAULTED(0x01, in_class)
-HANDLE_DW_DEFAULTED(0x02, out_of_class)
-
-// DWARF calling convention codes.
-HANDLE_DW_CC(0x01, normal)
-HANDLE_DW_CC(0x02, program)
-HANDLE_DW_CC(0x03, nocall)
-// New in DWARF v5:
-HANDLE_DW_CC(0x04, pass_by_reference)
-HANDLE_DW_CC(0x05, pass_by_value)
-// Vendor extensions:
-HANDLE_DW_CC(0x41, GNU_borland_fastcall_i386)
-HANDLE_DW_CC(0xb0, BORLAND_safecall)
-HANDLE_DW_CC(0xb1, BORLAND_stdcall)
-HANDLE_DW_CC(0xb2, BORLAND_pascal)
-HANDLE_DW_CC(0xb3, BORLAND_msfastcall)
-HANDLE_DW_CC(0xb4, BORLAND_msreturn)
-HANDLE_DW_CC(0xb5, BORLAND_thiscall)
-HANDLE_DW_CC(0xb6, BORLAND_fastcall)
-HANDLE_DW_CC(0xc0, LLVM_vectorcall)
-
-// Line Number Extended Opcode Encodings
-HANDLE_DW_LNE(0x01, end_sequence)
-HANDLE_DW_LNE(0x02, set_address)
-HANDLE_DW_LNE(0x03, define_file)
-// New in DWARF v4:
-HANDLE_DW_LNE(0x04, set_discriminator)
-
-// Line Number Standard Opcode Encodings.
-HANDLE_DW_LNS(0x00, extended_op)
-HANDLE_DW_LNS(0x01, copy)
-HANDLE_DW_LNS(0x02, advance_pc)
-HANDLE_DW_LNS(0x03, advance_line)
-HANDLE_DW_LNS(0x04, set_file)
-HANDLE_DW_LNS(0x05, set_column)
-HANDLE_DW_LNS(0x06, negate_stmt)
-HANDLE_DW_LNS(0x07, set_basic_block)
-HANDLE_DW_LNS(0x08, const_add_pc)
-HANDLE_DW_LNS(0x09, fixed_advance_pc)
-// New in DWARF v3:
-HANDLE_DW_LNS(0x0a, set_prologue_end)
-HANDLE_DW_LNS(0x0b, set_epilogue_begin)
-HANDLE_DW_LNS(0x0c, set_isa)
-
-// DWARF v5 Line number header entry format.
-HANDLE_DW_LNCT(0x01, path)
-HANDLE_DW_LNCT(0x02, directory_index)
-HANDLE_DW_LNCT(0x03, timestamp)
-HANDLE_DW_LNCT(0x04, size)
-HANDLE_DW_LNCT(0x05, MD5)
-
-// DWARF v5 Macro information.
-HANDLE_DW_MACRO(0x01, define)
-HANDLE_DW_MACRO(0x02, undef)
-HANDLE_DW_MACRO(0x03, start_file)
-HANDLE_DW_MACRO(0x04, end_file)
-HANDLE_DW_MACRO(0x05, define_strp)
-HANDLE_DW_MACRO(0x06, undef_strp)
-HANDLE_DW_MACRO(0x07, import)
-HANDLE_DW_MACRO(0x08, define_sup)
-HANDLE_DW_MACRO(0x09, undef_sup)
-HANDLE_DW_MACRO(0x0a, import_sup)
-HANDLE_DW_MACRO(0x0b, define_strx)
-HANDLE_DW_MACRO(0x0c, undef_strx)
-
-// DWARF v5 Range List Entry encoding values.
-HANDLE_DW_RLE(0x00, end_of_list)
-HANDLE_DW_RLE(0x01, base_addressx)
-HANDLE_DW_RLE(0x02, startx_endx)
-HANDLE_DW_RLE(0x03, startx_length)
-HANDLE_DW_RLE(0x04, offset_pair)
-HANDLE_DW_RLE(0x05, base_address)
-HANDLE_DW_RLE(0x06, start_end)
-HANDLE_DW_RLE(0x07, start_length)
-
-// Call frame instruction encodings.
-HANDLE_DW_CFA(0x00, nop)
-HANDLE_DW_CFA(0x40, advance_loc)
-HANDLE_DW_CFA(0x80, offset)
-HANDLE_DW_CFA(0xc0, restore)
-HANDLE_DW_CFA(0x01, set_loc)
-HANDLE_DW_CFA(0x02, advance_loc1)
-HANDLE_DW_CFA(0x03, advance_loc2)
-HANDLE_DW_CFA(0x04, advance_loc4)
-HANDLE_DW_CFA(0x05, offset_extended)
-HANDLE_DW_CFA(0x06, restore_extended)
-HANDLE_DW_CFA(0x07, undefined)
-HANDLE_DW_CFA(0x08, same_value)
-HANDLE_DW_CFA(0x09, register)
-HANDLE_DW_CFA(0x0a, remember_state)
-HANDLE_DW_CFA(0x0b, restore_state)
-HANDLE_DW_CFA(0x0c, def_cfa)
-HANDLE_DW_CFA(0x0d, def_cfa_register)
-HANDLE_DW_CFA(0x0e, def_cfa_offset)
-// New in DWARF v3:
-HANDLE_DW_CFA(0x0f, def_cfa_expression)
-HANDLE_DW_CFA(0x10, expression)
-HANDLE_DW_CFA(0x11, offset_extended_sf)
-HANDLE_DW_CFA(0x12, def_cfa_sf)
-HANDLE_DW_CFA(0x13, def_cfa_offset_sf)
-HANDLE_DW_CFA(0x14, val_offset)
-HANDLE_DW_CFA(0x15, val_offset_sf)
-HANDLE_DW_CFA(0x16, val_expression)
-// Vendor extensions:
-HANDLE_DW_CFA(0x1d, MIPS_advance_loc8)
-HANDLE_DW_CFA(0x2d, GNU_window_save)
-HANDLE_DW_CFA(0x2e, GNU_args_size)
-
-// Apple Objective-C Property Attributes.
-// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
-HANDLE_DW_APPLE_PROPERTY(0x01, readonly)
-HANDLE_DW_APPLE_PROPERTY(0x02, getter)
-HANDLE_DW_APPLE_PROPERTY(0x04, assign)
-HANDLE_DW_APPLE_PROPERTY(0x08, readwrite)
-HANDLE_DW_APPLE_PROPERTY(0x10, retain)
-HANDLE_DW_APPLE_PROPERTY(0x20, copy)
-HANDLE_DW_APPLE_PROPERTY(0x40, nonatomic)
-HANDLE_DW_APPLE_PROPERTY(0x80, setter)
-HANDLE_DW_APPLE_PROPERTY(0x100, atomic)
-HANDLE_DW_APPLE_PROPERTY(0x200, weak)
-HANDLE_DW_APPLE_PROPERTY(0x400, strong)
-HANDLE_DW_APPLE_PROPERTY(0x800, unsafe_unretained)
-HANDLE_DW_APPLE_PROPERTY(0x1000, nullability)
-HANDLE_DW_APPLE_PROPERTY(0x2000, null_resettable)
-HANDLE_DW_APPLE_PROPERTY(0x4000, class)
-
-// DWARF v5 Unit Types.
-HANDLE_DW_UT(0x01, compile)
-HANDLE_DW_UT(0x02, type)
-HANDLE_DW_UT(0x03, partial)
-HANDLE_DW_UT(0x04, skeleton)
-HANDLE_DW_UT(0x05, split_compile)
-HANDLE_DW_UT(0x06, split_type)
-
-#undef HANDLE_DW_TAG
-#undef HANDLE_DW_AT
-#undef HANDLE_DW_FORM
-#undef HANDLE_DW_OP
-#undef HANDLE_DW_LANG
-#undef HANDLE_DW_ATE
-#undef HANDLE_DW_VIRTUALITY
-#undef HANDLE_DW_DEFAULTED
-#undef HANDLE_DW_CC
-#undef HANDLE_DW_LNS
-#undef HANDLE_DW_LNE
-#undef HANDLE_DW_LNCT
-#undef HANDLE_DW_MACRO
-#undef HANDLE_DW_RLE
-#undef HANDLE_DW_CFA
-#undef HANDLE_DW_APPLE_PROPERTY
-#undef HANDLE_DW_UT
Removed: llvm/trunk/include/llvm/Support/Dwarf.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Dwarf.h?rev=304863&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/Dwarf.h (original)
+++ llvm/trunk/include/llvm/Support/Dwarf.h (removed)
@@ -1,497 +0,0 @@
-//===-- llvm/Support/Dwarf.h ---Dwarf Constants------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// \file
-// \brief This file contains constants used for implementing Dwarf
-// debug support.
-//
-// For details on the Dwarf specfication see the latest DWARF Debugging
-// Information Format standard document on http://www.dwarfstd.org. This
-// file often includes support for non-released standard features.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_DWARF_H
-#define LLVM_SUPPORT_DWARF_H
-
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h"
-
-namespace llvm {
-class StringRef;
-
-namespace dwarf {
-
-//===----------------------------------------------------------------------===//
-// DWARF constants as gleaned from the DWARF Debugging Information Format V.5
-// reference manual http://www.dwarfstd.org/.
-//
-
-// Do not mix the following two enumerations sets. DW_TAG_invalid changes the
-// enumeration base type.
-
-enum LLVMConstants : uint32_t {
- // LLVM mock tags (see also llvm/Support/Dwarf.def).
- DW_TAG_invalid = ~0U, // Tag for invalid results.
- DW_VIRTUALITY_invalid = ~0U, // Virtuality for invalid results.
- DW_MACINFO_invalid = ~0U, // Macinfo type for invalid results.
-
- // Other constants.
- DWARF_VERSION = 4, // Default dwarf version we output.
- DW_PUBTYPES_VERSION = 2, // Section version number for .debug_pubtypes.
- DW_PUBNAMES_VERSION = 2, // Section version number for .debug_pubnames.
- DW_ARANGES_VERSION = 2, // Section version number for .debug_aranges.
- // Identifiers we use to distinguish vendor extensions.
- DWARF_VENDOR_DWARF = 0, // Defined in v2 or later of the DWARF standard.
- DWARF_VENDOR_APPLE = 1,
- DWARF_VENDOR_BORLAND = 2,
- DWARF_VENDOR_GNU = 3,
- DWARF_VENDOR_GOOGLE = 4,
- DWARF_VENDOR_LLVM = 5,
- DWARF_VENDOR_MIPS = 6
-};
-
-// Special ID values that distinguish a CIE from a FDE in DWARF CFI.
-// Not inside an enum because a 64-bit value is needed.
-const uint32_t DW_CIE_ID = UINT32_MAX;
-const uint64_t DW64_CIE_ID = UINT64_MAX;
-
-enum Tag : uint16_t {
-#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) DW_TAG_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_TAG_lo_user = 0x4080,
- DW_TAG_hi_user = 0xffff,
- DW_TAG_user_base = 0x1000 // Recommended base for user tags.
-};
-
-inline bool isType(Tag T) {
- switch (T) {
- case DW_TAG_array_type:
- case DW_TAG_class_type:
- case DW_TAG_interface_type:
- case DW_TAG_enumeration_type:
- case DW_TAG_pointer_type:
- case DW_TAG_reference_type:
- case DW_TAG_rvalue_reference_type:
- case DW_TAG_string_type:
- case DW_TAG_structure_type:
- case DW_TAG_subroutine_type:
- case DW_TAG_union_type:
- case DW_TAG_ptr_to_member_type:
- case DW_TAG_set_type:
- case DW_TAG_subrange_type:
- case DW_TAG_base_type:
- case DW_TAG_const_type:
- case DW_TAG_file_type:
- case DW_TAG_packed_type:
- case DW_TAG_volatile_type:
- case DW_TAG_typedef:
- return true;
- default:
- return false;
- }
-}
-
-/// Attributes.
-enum Attribute : uint16_t {
-#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) DW_AT_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_AT_lo_user = 0x2000,
- DW_AT_hi_user = 0x3fff,
-};
-
-enum Form : uint16_t {
-#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) DW_FORM_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_FORM_lo_user = 0x1f00, ///< Not specified by DWARF.
-};
-
-enum LocationAtom {
-#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) DW_OP_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_OP_lo_user = 0xe0,
- DW_OP_hi_user = 0xff,
- DW_OP_LLVM_fragment = 0x1000 ///< Only used in LLVM metadata.
-};
-
-enum TypeKind {
-#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) DW_ATE_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_ATE_lo_user = 0x80,
- DW_ATE_hi_user = 0xff
-};
-
-enum DecimalSignEncoding {
- // Decimal sign attribute values
- DW_DS_unsigned = 0x01,
- DW_DS_leading_overpunch = 0x02,
- DW_DS_trailing_overpunch = 0x03,
- DW_DS_leading_separate = 0x04,
- DW_DS_trailing_separate = 0x05
-};
-
-enum EndianityEncoding {
- // Endianity attribute values
- DW_END_default = 0x00,
- DW_END_big = 0x01,
- DW_END_little = 0x02,
- DW_END_lo_user = 0x40,
- DW_END_hi_user = 0xff
-};
-
-enum AccessAttribute {
- // Accessibility codes
- DW_ACCESS_public = 0x01,
- DW_ACCESS_protected = 0x02,
- DW_ACCESS_private = 0x03
-};
-
-enum VisibilityAttribute {
- // Visibility codes
- DW_VIS_local = 0x01,
- DW_VIS_exported = 0x02,
- DW_VIS_qualified = 0x03
-};
-
-enum VirtualityAttribute {
-#define HANDLE_DW_VIRTUALITY(ID, NAME) DW_VIRTUALITY_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_VIRTUALITY_max = 0x02
-};
-
-enum DefaultedMemberAttribute {
-#define HANDLE_DW_DEFAULTED(ID, NAME) DW_DEFAULTED_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_DEFAULTED_max = 0x02
-};
-
-enum SourceLanguage {
-#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) DW_LANG_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_LANG_lo_user = 0x8000,
- DW_LANG_hi_user = 0xffff
-};
-
-enum CaseSensitivity {
- // Identifier case codes
- DW_ID_case_sensitive = 0x00,
- DW_ID_up_case = 0x01,
- DW_ID_down_case = 0x02,
- DW_ID_case_insensitive = 0x03
-};
-
-enum CallingConvention {
- // Calling convention codes
-#define HANDLE_DW_CC(ID, NAME) DW_CC_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_CC_lo_user = 0x40,
- DW_CC_hi_user = 0xff
-};
-
-enum InlineAttribute {
- // Inline codes
- DW_INL_not_inlined = 0x00,
- DW_INL_inlined = 0x01,
- DW_INL_declared_not_inlined = 0x02,
- DW_INL_declared_inlined = 0x03
-};
-
-enum ArrayDimensionOrdering {
- // Array ordering
- DW_ORD_row_major = 0x00,
- DW_ORD_col_major = 0x01
-};
-
-enum DiscriminantList {
- // Discriminant descriptor values
- DW_DSC_label = 0x00,
- DW_DSC_range = 0x01
-};
-
-/// Line Number Standard Opcode Encodings.
-enum LineNumberOps : uint8_t {
-#define HANDLE_DW_LNS(ID, NAME) DW_LNS_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
-};
-
-/// Line Number Extended Opcode Encodings.
-enum LineNumberExtendedOps {
-#define HANDLE_DW_LNE(ID, NAME) DW_LNE_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_LNE_lo_user = 0x80,
- DW_LNE_hi_user = 0xff
-};
-
-enum LineNumberEntryFormat {
-#define HANDLE_DW_LNCT(ID, NAME) DW_LNCT_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_LNCT_lo_user = 0x2000,
- DW_LNCT_hi_user = 0x3fff,
-};
-
-enum MacinfoRecordType {
- // Macinfo Type Encodings
- DW_MACINFO_define = 0x01,
- DW_MACINFO_undef = 0x02,
- DW_MACINFO_start_file = 0x03,
- DW_MACINFO_end_file = 0x04,
- DW_MACINFO_vendor_ext = 0xff
-};
-
-/// DWARF v5 macro information entry type encodings.
-enum MacroEntryType {
-#define HANDLE_DW_MACRO(ID, NAME) DW_MACRO_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_MACRO_lo_user = 0xe0,
- DW_MACRO_hi_user = 0xff
-};
-
-/// DWARF v5 range list entry encoding values.
-enum RangeListEntries {
-#define HANDLE_DW_RLE(ID, NAME) DW_RLE_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
-};
-
-
-/// Call frame instruction encodings.
-enum CallFrameInfo {
-#define HANDLE_DW_CFA(ID, NAME) DW_CFA_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_CFA_extended = 0x00,
-
- DW_CFA_lo_user = 0x1c,
- DW_CFA_hi_user = 0x3f
-};
-
-enum Constants {
- // Children flag
- DW_CHILDREN_no = 0x00,
- DW_CHILDREN_yes = 0x01,
-
- DW_EH_PE_absptr = 0x00,
- DW_EH_PE_omit = 0xff,
- DW_EH_PE_uleb128 = 0x01,
- DW_EH_PE_udata2 = 0x02,
- DW_EH_PE_udata4 = 0x03,
- DW_EH_PE_udata8 = 0x04,
- DW_EH_PE_sleb128 = 0x09,
- DW_EH_PE_sdata2 = 0x0A,
- DW_EH_PE_sdata4 = 0x0B,
- DW_EH_PE_sdata8 = 0x0C,
- DW_EH_PE_signed = 0x08,
- DW_EH_PE_pcrel = 0x10,
- DW_EH_PE_textrel = 0x20,
- DW_EH_PE_datarel = 0x30,
- DW_EH_PE_funcrel = 0x40,
- DW_EH_PE_aligned = 0x50,
- DW_EH_PE_indirect = 0x80
-};
-
-/// Constants for location lists in DWARF v5.
-enum LocationListEntry : unsigned char {
- DW_LLE_end_of_list = 0x00,
- DW_LLE_base_addressx = 0x01,
- DW_LLE_startx_endx = 0x02,
- DW_LLE_startx_length = 0x03,
- DW_LLE_offset_pair = 0x04,
- DW_LLE_default_location = 0x05,
- DW_LLE_base_address = 0x06,
- DW_LLE_start_end = 0x07,
- DW_LLE_start_length = 0x08
-};
-
-/// Constants for the DW_APPLE_PROPERTY_attributes attribute.
-/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind!
-enum ApplePropertyAttributes {
-#define HANDLE_DW_APPLE_PROPERTY(ID, NAME) DW_APPLE_PROPERTY_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
-};
-
-/// Constants for unit types in DWARF v5.
-enum UnitType : unsigned char {
-#define HANDLE_DW_UT(ID, NAME) DW_UT_##NAME = ID,
-#include "llvm/Support/Dwarf.def"
- DW_UT_lo_user = 0x80,
- DW_UT_hi_user = 0xff
-};
-
-// Constants for the DWARF v5 Accelerator Table Proposal
-enum AcceleratorTable {
- // Data layout descriptors.
- DW_ATOM_null = 0u, // Marker as the end of a list of atoms.
- DW_ATOM_die_offset = 1u, // DIE offset in the debug_info section.
- DW_ATOM_cu_offset = 2u, // Offset of the compile unit header that contains the
- // item in question.
- DW_ATOM_die_tag = 3u, // A tag entry.
- DW_ATOM_type_flags = 4u, // Set of flags for a type.
-
- // DW_ATOM_type_flags values.
-
- // Always set for C++, only set for ObjC if this is the @implementation for a
- // class.
- DW_FLAG_type_implementation = 2u,
-
- // Hash functions.
-
- // Daniel J. Bernstein hash.
- DW_hash_function_djb = 0u
-};
-
-// Constants for the GNU pubnames/pubtypes extensions supporting gdb index.
-enum GDBIndexEntryKind {
- GIEK_NONE,
- GIEK_TYPE,
- GIEK_VARIABLE,
- GIEK_FUNCTION,
- GIEK_OTHER,
- GIEK_UNUSED5,
- GIEK_UNUSED6,
- GIEK_UNUSED7
-};
-
-enum GDBIndexEntryLinkage {
- GIEL_EXTERNAL,
- GIEL_STATIC
-};
-
-/// \defgroup DwarfConstantsDumping Dwarf constants dumping functions
-///
-/// All these functions map their argument's value back to the
-/// corresponding enumerator name or return nullptr if the value isn't
-/// known.
-///
-/// @{
-StringRef TagString(unsigned Tag);
-StringRef ChildrenString(unsigned Children);
-StringRef AttributeString(unsigned Attribute);
-StringRef FormEncodingString(unsigned Encoding);
-StringRef OperationEncodingString(unsigned Encoding);
-StringRef AttributeEncodingString(unsigned Encoding);
-StringRef DecimalSignString(unsigned Sign);
-StringRef EndianityString(unsigned Endian);
-StringRef AccessibilityString(unsigned Access);
-StringRef VisibilityString(unsigned Visibility);
-StringRef VirtualityString(unsigned Virtuality);
-StringRef LanguageString(unsigned Language);
-StringRef CaseString(unsigned Case);
-StringRef ConventionString(unsigned Convention);
-StringRef InlineCodeString(unsigned Code);
-StringRef ArrayOrderString(unsigned Order);
-StringRef DiscriminantString(unsigned Discriminant);
-StringRef LNStandardString(unsigned Standard);
-StringRef LNExtendedString(unsigned Encoding);
-StringRef MacinfoString(unsigned Encoding);
-StringRef CallFrameString(unsigned Encoding);
-StringRef ApplePropertyString(unsigned);
-StringRef UnitTypeString(unsigned);
-StringRef AtomTypeString(unsigned Atom);
-StringRef GDBIndexEntryKindString(GDBIndexEntryKind Kind);
-StringRef GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
-/// @}
-
-/// \defgroup DwarfConstantsParsing Dwarf constants parsing functions
-///
-/// These functions map their strings back to the corresponding enumeration
-/// value or return 0 if there is none, except for these exceptions:
-///
-/// \li \a getTag() returns \a DW_TAG_invalid on invalid input.
-/// \li \a getVirtuality() returns \a DW_VIRTUALITY_invalid on invalid input.
-/// \li \a getMacinfo() returns \a DW_MACINFO_invalid on invalid input.
-///
-/// @{
-unsigned getTag(StringRef TagString);
-unsigned getOperationEncoding(StringRef OperationEncodingString);
-unsigned getVirtuality(StringRef VirtualityString);
-unsigned getLanguage(StringRef LanguageString);
-unsigned getCallingConvention(StringRef LanguageString);
-unsigned getAttributeEncoding(StringRef EncodingString);
-unsigned getMacinfo(StringRef MacinfoString);
-/// @}
-
-/// \defgroup DwarfConstantsVersioning Dwarf version for constants
-///
-/// For constants defined by DWARF, returns the DWARF version when the constant
-/// was first defined. For vendor extensions, if there is a version-related
-/// policy for when to emit it, returns a version number for that policy.
-/// Otherwise returns 0.
-///
-/// @{
-unsigned TagVersion(Tag T);
-unsigned AttributeVersion(Attribute A);
-unsigned FormVersion(Form F);
-unsigned OperationVersion(LocationAtom O);
-unsigned AttributeEncodingVersion(TypeKind E);
-unsigned LanguageVersion(SourceLanguage L);
-/// @}
-
-/// \defgroup DwarfConstantsVendor Dwarf "vendor" for constants
-///
-/// These functions return an identifier describing "who" defined the constant,
-/// either the DWARF standard itself or the vendor who defined the extension.
-///
-/// @{
-unsigned TagVendor(Tag T);
-unsigned AttributeVendor(Attribute A);
-unsigned FormVendor(Form F);
-unsigned OperationVendor(LocationAtom O);
-unsigned AttributeEncodingVendor(TypeKind E);
-unsigned LanguageVendor(SourceLanguage L);
-/// @}
-
-/// Tells whether the specified form is defined in the specified version,
-/// or is an extension if extensions are allowed.
-bool isValidFormForVersion(Form F, unsigned Version, bool ExtensionsOk = true);
-
-/// \brief Returns the symbolic string representing Val when used as a value
-/// for attribute Attr.
-StringRef AttributeValueString(uint16_t Attr, unsigned Val);
-
-/// \brief Decsribes an entry of the various gnu_pub* debug sections.
-///
-/// The gnu_pub* kind looks like:
-///
-/// 0-3 reserved
-/// 4-6 symbol kind
-/// 7 0 == global, 1 == static
-///
-/// A gdb_index descriptor includes the above kind, shifted 24 bits up with the
-/// offset of the cu within the debug_info section stored in those 24 bits.
-struct PubIndexEntryDescriptor {
- GDBIndexEntryKind Kind;
- GDBIndexEntryLinkage Linkage;
- PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
- : Kind(Kind), Linkage(Linkage) {}
- /* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
- : Kind(Kind), Linkage(GIEL_EXTERNAL) {}
- explicit PubIndexEntryDescriptor(uint8_t Value)
- : Kind(static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >>
- KIND_OFFSET)),
- Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
- LINKAGE_OFFSET)) {}
- uint8_t toBits() const {
- return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET;
- }
-
-private:
- enum {
- KIND_OFFSET = 4,
- KIND_MASK = 7 << KIND_OFFSET,
- LINKAGE_OFFSET = 7,
- LINKAGE_MASK = 1 << LINKAGE_OFFSET
- };
-};
-
-/// Constants that define the DWARF format as 32 or 64 bit.
-enum DwarfFormat { DWARF32, DWARF64 };
-
-} // End of namespace dwarf
-
-} // End of namespace llvm
-
-#endif
Removed: llvm/trunk/include/llvm/Support/ELF.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/ELF.h?rev=304863&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/ELF.h (original)
+++ llvm/trunk/include/llvm/Support/ELF.h (removed)
@@ -1,1362 +0,0 @@
-//===-- llvm/Support/ELF.h - ELF constants and data structures --*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This header contains common, non-processor-specific data structures and
-// constants for the ELF file format.
-//
-// The details of the ELF32 bits in this file are largely based on the Tool
-// Interface Standard (TIS) Executable and Linking Format (ELF) Specification
-// Version 1.2, May 1995. The ELF64 stuff is based on ELF-64 Object File Format
-// Version 1.5, Draft 2, May 1998 as well as OpenBSD header files.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_ELF_H
-#define LLVM_SUPPORT_ELF_H
-
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h"
-#include <cstring>
-
-namespace llvm {
-
-namespace ELF {
-
-typedef uint32_t Elf32_Addr; // Program address
-typedef uint32_t Elf32_Off; // File offset
-typedef uint16_t Elf32_Half;
-typedef uint32_t Elf32_Word;
-typedef int32_t Elf32_Sword;
-
-typedef uint64_t Elf64_Addr;
-typedef uint64_t Elf64_Off;
-typedef uint16_t Elf64_Half;
-typedef uint32_t Elf64_Word;
-typedef int32_t Elf64_Sword;
-typedef uint64_t Elf64_Xword;
-typedef int64_t Elf64_Sxword;
-
-// Object file magic string.
-static const char ElfMagic[] = {0x7f, 'E', 'L', 'F', '\0'};
-
-// e_ident size and indices.
-enum {
- EI_MAG0 = 0, // File identification index.
- EI_MAG1 = 1, // File identification index.
- EI_MAG2 = 2, // File identification index.
- EI_MAG3 = 3, // File identification index.
- EI_CLASS = 4, // File class.
- EI_DATA = 5, // Data encoding.
- EI_VERSION = 6, // File version.
- EI_OSABI = 7, // OS/ABI identification.
- EI_ABIVERSION = 8, // ABI version.
- EI_PAD = 9, // Start of padding bytes.
- EI_NIDENT = 16 // Number of bytes in e_ident.
-};
-
-struct Elf32_Ehdr {
- unsigned char e_ident[EI_NIDENT]; // ELF Identification bytes
- Elf32_Half e_type; // Type of file (see ET_* below)
- Elf32_Half e_machine; // Required architecture for this file (see EM_*)
- Elf32_Word e_version; // Must be equal to 1
- Elf32_Addr e_entry; // Address to jump to in order to start program
- Elf32_Off e_phoff; // Program header table's file offset, in bytes
- Elf32_Off e_shoff; // Section header table's file offset, in bytes
- Elf32_Word e_flags; // Processor-specific flags
- Elf32_Half e_ehsize; // Size of ELF header, in bytes
- Elf32_Half e_phentsize; // Size of an entry in the program header table
- Elf32_Half e_phnum; // Number of entries in the program header table
- Elf32_Half e_shentsize; // Size of an entry in the section header table
- Elf32_Half e_shnum; // Number of entries in the section header table
- Elf32_Half e_shstrndx; // Sect hdr table index of sect name string table
- bool checkMagic() const {
- return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0;
- }
- unsigned char getFileClass() const { return e_ident[EI_CLASS]; }
- unsigned char getDataEncoding() const { return e_ident[EI_DATA]; }
-};
-
-// 64-bit ELF header. Fields are the same as for ELF32, but with different
-// types (see above).
-struct Elf64_Ehdr {
- unsigned char e_ident[EI_NIDENT];
- Elf64_Half e_type;
- Elf64_Half e_machine;
- Elf64_Word e_version;
- Elf64_Addr e_entry;
- Elf64_Off e_phoff;
- Elf64_Off e_shoff;
- Elf64_Word e_flags;
- Elf64_Half e_ehsize;
- Elf64_Half e_phentsize;
- Elf64_Half e_phnum;
- Elf64_Half e_shentsize;
- Elf64_Half e_shnum;
- Elf64_Half e_shstrndx;
- bool checkMagic() const {
- return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0;
- }
- unsigned char getFileClass() const { return e_ident[EI_CLASS]; }
- unsigned char getDataEncoding() const { return e_ident[EI_DATA]; }
-};
-
-// File types
-enum {
- ET_NONE = 0, // No file type
- ET_REL = 1, // Relocatable file
- ET_EXEC = 2, // Executable file
- ET_DYN = 3, // Shared object file
- ET_CORE = 4, // Core file
- ET_LOPROC = 0xff00, // Beginning of processor-specific codes
- ET_HIPROC = 0xffff // Processor-specific
-};
-
-// Versioning
-enum { EV_NONE = 0, EV_CURRENT = 1 };
-
-// Machine architectures
-// See current registered ELF machine architectures at:
-// http://www.uxsglobal.com/developers/gabi/latest/ch4.eheader.html
-enum {
- EM_NONE = 0, // No machine
- EM_M32 = 1, // AT&T WE 32100
- EM_SPARC = 2, // SPARC
- EM_386 = 3, // Intel 386
- EM_68K = 4, // Motorola 68000
- EM_88K = 5, // Motorola 88000
- EM_IAMCU = 6, // Intel MCU
- EM_860 = 7, // Intel 80860
- EM_MIPS = 8, // MIPS R3000
- EM_S370 = 9, // IBM System/370
- EM_MIPS_RS3_LE = 10, // MIPS RS3000 Little-endian
- EM_PARISC = 15, // Hewlett-Packard PA-RISC
- EM_VPP500 = 17, // Fujitsu VPP500
- EM_SPARC32PLUS = 18, // Enhanced instruction set SPARC
- EM_960 = 19, // Intel 80960
- EM_PPC = 20, // PowerPC
- EM_PPC64 = 21, // PowerPC64
- EM_S390 = 22, // IBM System/390
- EM_SPU = 23, // IBM SPU/SPC
- EM_V800 = 36, // NEC V800
- EM_FR20 = 37, // Fujitsu FR20
- EM_RH32 = 38, // TRW RH-32
- EM_RCE = 39, // Motorola RCE
- EM_ARM = 40, // ARM
- EM_ALPHA = 41, // DEC Alpha
- EM_SH = 42, // Hitachi SH
- EM_SPARCV9 = 43, // SPARC V9
- EM_TRICORE = 44, // Siemens TriCore
- EM_ARC = 45, // Argonaut RISC Core
- EM_H8_300 = 46, // Hitachi H8/300
- EM_H8_300H = 47, // Hitachi H8/300H
- EM_H8S = 48, // Hitachi H8S
- EM_H8_500 = 49, // Hitachi H8/500
- EM_IA_64 = 50, // Intel IA-64 processor architecture
- EM_MIPS_X = 51, // Stanford MIPS-X
- EM_COLDFIRE = 52, // Motorola ColdFire
- EM_68HC12 = 53, // Motorola M68HC12
- EM_MMA = 54, // Fujitsu MMA Multimedia Accelerator
- EM_PCP = 55, // Siemens PCP
- EM_NCPU = 56, // Sony nCPU embedded RISC processor
- EM_NDR1 = 57, // Denso NDR1 microprocessor
- EM_STARCORE = 58, // Motorola Star*Core processor
- EM_ME16 = 59, // Toyota ME16 processor
- EM_ST100 = 60, // STMicroelectronics ST100 processor
- EM_TINYJ = 61, // Advanced Logic Corp. TinyJ embedded processor family
- EM_X86_64 = 62, // AMD x86-64 architecture
- EM_PDSP = 63, // Sony DSP Processor
- EM_PDP10 = 64, // Digital Equipment Corp. PDP-10
- EM_PDP11 = 65, // Digital Equipment Corp. PDP-11
- EM_FX66 = 66, // Siemens FX66 microcontroller
- EM_ST9PLUS = 67, // STMicroelectronics ST9+ 8/16 bit microcontroller
- EM_ST7 = 68, // STMicroelectronics ST7 8-bit microcontroller
- EM_68HC16 = 69, // Motorola MC68HC16 Microcontroller
- EM_68HC11 = 70, // Motorola MC68HC11 Microcontroller
- EM_68HC08 = 71, // Motorola MC68HC08 Microcontroller
- EM_68HC05 = 72, // Motorola MC68HC05 Microcontroller
- EM_SVX = 73, // Silicon Graphics SVx
- EM_ST19 = 74, // STMicroelectronics ST19 8-bit microcontroller
- EM_VAX = 75, // Digital VAX
- EM_CRIS = 76, // Axis Communications 32-bit embedded processor
- EM_JAVELIN = 77, // Infineon Technologies 32-bit embedded processor
- EM_FIREPATH = 78, // Element 14 64-bit DSP Processor
- EM_ZSP = 79, // LSI Logic 16-bit DSP Processor
- EM_MMIX = 80, // Donald Knuth's educational 64-bit processor
- EM_HUANY = 81, // Harvard University machine-independent object files
- EM_PRISM = 82, // SiTera Prism
- EM_AVR = 83, // Atmel AVR 8-bit microcontroller
- EM_FR30 = 84, // Fujitsu FR30
- EM_D10V = 85, // Mitsubishi D10V
- EM_D30V = 86, // Mitsubishi D30V
- EM_V850 = 87, // NEC v850
- EM_M32R = 88, // Mitsubishi M32R
- EM_MN10300 = 89, // Matsushita MN10300
- EM_MN10200 = 90, // Matsushita MN10200
- EM_PJ = 91, // picoJava
- EM_OPENRISC = 92, // OpenRISC 32-bit embedded processor
- EM_ARC_COMPACT = 93, // ARC International ARCompact processor (old
- // spelling/synonym: EM_ARC_A5)
- EM_XTENSA = 94, // Tensilica Xtensa Architecture
- EM_VIDEOCORE = 95, // Alphamosaic VideoCore processor
- EM_TMM_GPP = 96, // Thompson Multimedia General Purpose Processor
- EM_NS32K = 97, // National Semiconductor 32000 series
- EM_TPC = 98, // Tenor Network TPC processor
- EM_SNP1K = 99, // Trebia SNP 1000 processor
- EM_ST200 = 100, // STMicroelectronics (www.st.com) ST200
- EM_IP2K = 101, // Ubicom IP2xxx microcontroller family
- EM_MAX = 102, // MAX Processor
- EM_CR = 103, // National Semiconductor CompactRISC microprocessor
- EM_F2MC16 = 104, // Fujitsu F2MC16
- EM_MSP430 = 105, // Texas Instruments embedded microcontroller msp430
- EM_BLACKFIN = 106, // Analog Devices Blackfin (DSP) processor
- EM_SE_C33 = 107, // S1C33 Family of Seiko Epson processors
- EM_SEP = 108, // Sharp embedded microprocessor
- EM_ARCA = 109, // Arca RISC Microprocessor
- EM_UNICORE = 110, // Microprocessor series from PKU-Unity Ltd. and MPRC
- // of Peking University
- EM_EXCESS = 111, // eXcess: 16/32/64-bit configurable embedded CPU
- EM_DXP = 112, // Icera Semiconductor Inc. Deep Execution Processor
- EM_ALTERA_NIOS2 = 113, // Altera Nios II soft-core processor
- EM_CRX = 114, // National Semiconductor CompactRISC CRX
- EM_XGATE = 115, // Motorola XGATE embedded processor
- EM_C166 = 116, // Infineon C16x/XC16x processor
- EM_M16C = 117, // Renesas M16C series microprocessors
- EM_DSPIC30F = 118, // Microchip Technology dsPIC30F Digital Signal
- // Controller
- EM_CE = 119, // Freescale Communication Engine RISC core
- EM_M32C = 120, // Renesas M32C series microprocessors
- EM_TSK3000 = 131, // Altium TSK3000 core
- EM_RS08 = 132, // Freescale RS08 embedded processor
- EM_SHARC = 133, // Analog Devices SHARC family of 32-bit DSP
- // processors
- EM_ECOG2 = 134, // Cyan Technology eCOG2 microprocessor
- EM_SCORE7 = 135, // Sunplus S+core7 RISC processor
- EM_DSP24 = 136, // New Japan Radio (NJR) 24-bit DSP Processor
- EM_VIDEOCORE3 = 137, // Broadcom VideoCore III processor
- EM_LATTICEMICO32 = 138, // RISC processor for Lattice FPGA architecture
- EM_SE_C17 = 139, // Seiko Epson C17 family
- EM_TI_C6000 = 140, // The Texas Instruments TMS320C6000 DSP family
- EM_TI_C2000 = 141, // The Texas Instruments TMS320C2000 DSP family
- EM_TI_C5500 = 142, // The Texas Instruments TMS320C55x DSP family
- EM_MMDSP_PLUS = 160, // STMicroelectronics 64bit VLIW Data Signal Processor
- EM_CYPRESS_M8C = 161, // Cypress M8C microprocessor
- EM_R32C = 162, // Renesas R32C series microprocessors
- EM_TRIMEDIA = 163, // NXP Semiconductors TriMedia architecture family
- EM_HEXAGON = 164, // Qualcomm Hexagon processor
- EM_8051 = 165, // Intel 8051 and variants
- EM_STXP7X = 166, // STMicroelectronics STxP7x family of configurable
- // and extensible RISC processors
- EM_NDS32 = 167, // Andes Technology compact code size embedded RISC
- // processor family
- EM_ECOG1 = 168, // Cyan Technology eCOG1X family
- EM_ECOG1X = 168, // Cyan Technology eCOG1X family
- EM_MAXQ30 = 169, // Dallas Semiconductor MAXQ30 Core Micro-controllers
- EM_XIMO16 = 170, // New Japan Radio (NJR) 16-bit DSP Processor
- EM_MANIK = 171, // M2000 Reconfigurable RISC Microprocessor
- EM_CRAYNV2 = 172, // Cray Inc. NV2 vector architecture
- EM_RX = 173, // Renesas RX family
- EM_METAG = 174, // Imagination Technologies META processor
- // architecture
- EM_MCST_ELBRUS = 175, // MCST Elbrus general purpose hardware architecture
- EM_ECOG16 = 176, // Cyan Technology eCOG16 family
- EM_CR16 = 177, // National Semiconductor CompactRISC CR16 16-bit
- // microprocessor
- EM_ETPU = 178, // Freescale Extended Time Processing Unit
- EM_SLE9X = 179, // Infineon Technologies SLE9X core
- EM_L10M = 180, // Intel L10M
- EM_K10M = 181, // Intel K10M
- EM_AARCH64 = 183, // ARM AArch64
- EM_AVR32 = 185, // Atmel Corporation 32-bit microprocessor family
- EM_STM8 = 186, // STMicroeletronics STM8 8-bit microcontroller
- EM_TILE64 = 187, // Tilera TILE64 multicore architecture family
- EM_TILEPRO = 188, // Tilera TILEPro multicore architecture family
- EM_CUDA = 190, // NVIDIA CUDA architecture
- EM_TILEGX = 191, // Tilera TILE-Gx multicore architecture family
- EM_CLOUDSHIELD = 192, // CloudShield architecture family
- EM_COREA_1ST = 193, // KIPO-KAIST Core-A 1st generation processor family
- EM_COREA_2ND = 194, // KIPO-KAIST Core-A 2nd generation processor family
- EM_ARC_COMPACT2 = 195, // Synopsys ARCompact V2
- EM_OPEN8 = 196, // Open8 8-bit RISC soft processor core
- EM_RL78 = 197, // Renesas RL78 family
- EM_VIDEOCORE5 = 198, // Broadcom VideoCore V processor
- EM_78KOR = 199, // Renesas 78KOR family
- EM_56800EX = 200, // Freescale 56800EX Digital Signal Controller (DSC)
- EM_BA1 = 201, // Beyond BA1 CPU architecture
- EM_BA2 = 202, // Beyond BA2 CPU architecture
- EM_XCORE = 203, // XMOS xCORE processor family
- EM_MCHP_PIC = 204, // Microchip 8-bit PIC(r) family
- EM_INTEL205 = 205, // Reserved by Intel
- EM_INTEL206 = 206, // Reserved by Intel
- EM_INTEL207 = 207, // Reserved by Intel
- EM_INTEL208 = 208, // Reserved by Intel
- EM_INTEL209 = 209, // Reserved by Intel
- EM_KM32 = 210, // KM211 KM32 32-bit processor
- EM_KMX32 = 211, // KM211 KMX32 32-bit processor
- EM_KMX16 = 212, // KM211 KMX16 16-bit processor
- EM_KMX8 = 213, // KM211 KMX8 8-bit processor
- EM_KVARC = 214, // KM211 KVARC processor
- EM_CDP = 215, // Paneve CDP architecture family
- EM_COGE = 216, // Cognitive Smart Memory Processor
- EM_COOL = 217, // iCelero CoolEngine
- EM_NORC = 218, // Nanoradio Optimized RISC
- EM_CSR_KALIMBA = 219, // CSR Kalimba architecture family
- EM_AMDGPU = 224, // AMD GPU architecture
- EM_RISCV = 243, // RISC-V
- EM_LANAI = 244, // Lanai 32-bit processor
- EM_BPF = 247, // Linux kernel bpf virtual machine
-
- // A request has been made to the maintainer of the official registry for
- // such numbers for an official value for WebAssembly. As soon as one is
- // allocated, this enum will be updated to use it.
- EM_WEBASSEMBLY = 0x4157, // WebAssembly architecture
-};
-
-// Object file classes.
-enum {
- ELFCLASSNONE = 0,
- ELFCLASS32 = 1, // 32-bit object file
- ELFCLASS64 = 2 // 64-bit object file
-};
-
-// Object file byte orderings.
-enum {
- ELFDATANONE = 0, // Invalid data encoding.
- ELFDATA2LSB = 1, // Little-endian object file
- ELFDATA2MSB = 2 // Big-endian object file
-};
-
-// OS ABI identification.
-enum {
- ELFOSABI_NONE = 0, // UNIX System V ABI
- ELFOSABI_HPUX = 1, // HP-UX operating system
- ELFOSABI_NETBSD = 2, // NetBSD
- ELFOSABI_GNU = 3, // GNU/Linux
- ELFOSABI_LINUX = 3, // Historical alias for ELFOSABI_GNU.
- ELFOSABI_HURD = 4, // GNU/Hurd
- ELFOSABI_SOLARIS = 6, // Solaris
- ELFOSABI_AIX = 7, // AIX
- ELFOSABI_IRIX = 8, // IRIX
- ELFOSABI_FREEBSD = 9, // FreeBSD
- ELFOSABI_TRU64 = 10, // TRU64 UNIX
- ELFOSABI_MODESTO = 11, // Novell Modesto
- ELFOSABI_OPENBSD = 12, // OpenBSD
- ELFOSABI_OPENVMS = 13, // OpenVMS
- ELFOSABI_NSK = 14, // Hewlett-Packard Non-Stop Kernel
- ELFOSABI_AROS = 15, // AROS
- ELFOSABI_FENIXOS = 16, // FenixOS
- ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
- ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000
- ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
- ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
- ELFOSABI_ARM = 97, // ARM
- ELFOSABI_STANDALONE = 255 // Standalone (embedded) application
-};
-
-#define ELF_RELOC(name, value) name = value,
-
-// X86_64 relocations.
-enum {
-#include "ELFRelocs/x86_64.def"
-};
-
-// i386 relocations.
-enum {
-#include "ELFRelocs/i386.def"
-};
-
-// ELF Relocation types for PPC32
-enum {
-#include "ELFRelocs/PowerPC.def"
-};
-
-// Specific e_flags for PPC64
-enum {
- // e_flags bits specifying ABI:
- // 1 for original ABI using function descriptors,
- // 2 for revised ABI without function descriptors,
- // 0 for unspecified or not using any features affected by the differences.
- EF_PPC64_ABI = 3
-};
-
-// Special values for the st_other field in the symbol table entry for PPC64.
-enum {
- STO_PPC64_LOCAL_BIT = 5,
- STO_PPC64_LOCAL_MASK = (7 << STO_PPC64_LOCAL_BIT)
-};
-static inline int64_t decodePPC64LocalEntryOffset(unsigned Other) {
- unsigned Val = (Other & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT;
- return ((1 << Val) >> 2) << 2;
-}
-static inline unsigned encodePPC64LocalEntryOffset(int64_t Offset) {
- unsigned Val =
- (Offset >= 4 * 4 ? (Offset >= 8 * 4 ? (Offset >= 16 * 4 ? 6 : 5) : 4)
- : (Offset >= 2 * 4 ? 3 : (Offset >= 1 * 4 ? 2 : 0)));
- return Val << STO_PPC64_LOCAL_BIT;
-}
-
-// ELF Relocation types for PPC64
-enum {
-#include "ELFRelocs/PowerPC64.def"
-};
-
-// ELF Relocation types for AArch64
-enum {
-#include "ELFRelocs/AArch64.def"
-};
-
-// ARM Specific e_flags
-enum : unsigned {
- EF_ARM_SOFT_FLOAT = 0x00000200U,
- EF_ARM_VFP_FLOAT = 0x00000400U,
- EF_ARM_EABI_UNKNOWN = 0x00000000U,
- EF_ARM_EABI_VER1 = 0x01000000U,
- EF_ARM_EABI_VER2 = 0x02000000U,
- EF_ARM_EABI_VER3 = 0x03000000U,
- EF_ARM_EABI_VER4 = 0x04000000U,
- EF_ARM_EABI_VER5 = 0x05000000U,
- EF_ARM_EABIMASK = 0xFF000000U
-};
-
-// ELF Relocation types for ARM
-enum {
-#include "ELFRelocs/ARM.def"
-};
-
-// AVR specific e_flags
-enum : unsigned {
- EF_AVR_ARCH_AVR1 = 1,
- EF_AVR_ARCH_AVR2 = 2,
- EF_AVR_ARCH_AVR25 = 25,
- EF_AVR_ARCH_AVR3 = 3,
- EF_AVR_ARCH_AVR31 = 31,
- EF_AVR_ARCH_AVR35 = 35,
- EF_AVR_ARCH_AVR4 = 4,
- EF_AVR_ARCH_AVR5 = 5,
- EF_AVR_ARCH_AVR51 = 51,
- EF_AVR_ARCH_AVR6 = 6,
- EF_AVR_ARCH_AVRTINY = 100,
- EF_AVR_ARCH_XMEGA1 = 101,
- EF_AVR_ARCH_XMEGA2 = 102,
- EF_AVR_ARCH_XMEGA3 = 103,
- EF_AVR_ARCH_XMEGA4 = 104,
- EF_AVR_ARCH_XMEGA5 = 105,
- EF_AVR_ARCH_XMEGA6 = 106,
- EF_AVR_ARCH_XMEGA7 = 107
-};
-
-// ELF Relocation types for AVR
-enum {
-#include "ELFRelocs/AVR.def"
-};
-
-// Mips Specific e_flags
-enum : unsigned {
- EF_MIPS_NOREORDER = 0x00000001, // Don't reorder instructions
- EF_MIPS_PIC = 0x00000002, // Position independent code
- EF_MIPS_CPIC = 0x00000004, // Call object with Position independent code
- EF_MIPS_ABI2 = 0x00000020, // File uses N32 ABI
- EF_MIPS_32BITMODE = 0x00000100, // Code compiled for a 64-bit machine
- // in 32-bit mode
- EF_MIPS_FP64 = 0x00000200, // Code compiled for a 32-bit machine
- // but uses 64-bit FP registers
- EF_MIPS_NAN2008 = 0x00000400, // Uses IEE 754-2008 NaN encoding
-
- // ABI flags
- EF_MIPS_ABI_O32 = 0x00001000, // This file follows the first MIPS 32 bit ABI
- EF_MIPS_ABI_O64 = 0x00002000, // O32 ABI extended for 64-bit architecture.
- EF_MIPS_ABI_EABI32 = 0x00003000, // EABI in 32 bit mode.
- EF_MIPS_ABI_EABI64 = 0x00004000, // EABI in 64 bit mode.
- EF_MIPS_ABI = 0x0000f000, // Mask for selecting EF_MIPS_ABI_ variant.
-
- // MIPS machine variant
- EF_MIPS_MACH_NONE = 0x00000000, // A standard MIPS implementation.
- EF_MIPS_MACH_3900 = 0x00810000, // Toshiba R3900
- EF_MIPS_MACH_4010 = 0x00820000, // LSI R4010
- EF_MIPS_MACH_4100 = 0x00830000, // NEC VR4100
- EF_MIPS_MACH_4650 = 0x00850000, // MIPS R4650
- EF_MIPS_MACH_4120 = 0x00870000, // NEC VR4120
- EF_MIPS_MACH_4111 = 0x00880000, // NEC VR4111/VR4181
- EF_MIPS_MACH_SB1 = 0x008a0000, // Broadcom SB-1
- EF_MIPS_MACH_OCTEON = 0x008b0000, // Cavium Networks Octeon
- EF_MIPS_MACH_XLR = 0x008c0000, // RMI Xlr
- EF_MIPS_MACH_OCTEON2 = 0x008d0000, // Cavium Networks Octeon2
- EF_MIPS_MACH_OCTEON3 = 0x008e0000, // Cavium Networks Octeon3
- EF_MIPS_MACH_5400 = 0x00910000, // NEC VR5400
- EF_MIPS_MACH_5900 = 0x00920000, // MIPS R5900
- EF_MIPS_MACH_5500 = 0x00980000, // NEC VR5500
- EF_MIPS_MACH_9000 = 0x00990000, // Unknown
- EF_MIPS_MACH_LS2E = 0x00a00000, // ST Microelectronics Loongson 2E
- EF_MIPS_MACH_LS2F = 0x00a10000, // ST Microelectronics Loongson 2F
- EF_MIPS_MACH_LS3A = 0x00a20000, // Loongson 3A
- EF_MIPS_MACH = 0x00ff0000, // EF_MIPS_MACH_xxx selection mask
-
- // ARCH_ASE
- EF_MIPS_MICROMIPS = 0x02000000, // microMIPS
- EF_MIPS_ARCH_ASE_M16 = 0x04000000, // Has Mips-16 ISA extensions
- EF_MIPS_ARCH_ASE_MDMX = 0x08000000, // Has MDMX multimedia extensions
- EF_MIPS_ARCH_ASE = 0x0f000000, // Mask for EF_MIPS_ARCH_ASE_xxx flags
-
- // ARCH
- EF_MIPS_ARCH_1 = 0x00000000, // MIPS1 instruction set
- EF_MIPS_ARCH_2 = 0x10000000, // MIPS2 instruction set
- EF_MIPS_ARCH_3 = 0x20000000, // MIPS3 instruction set
- EF_MIPS_ARCH_4 = 0x30000000, // MIPS4 instruction set
- EF_MIPS_ARCH_5 = 0x40000000, // MIPS5 instruction set
- EF_MIPS_ARCH_32 = 0x50000000, // MIPS32 instruction set per linux not elf.h
- EF_MIPS_ARCH_64 = 0x60000000, // MIPS64 instruction set per linux not elf.h
- EF_MIPS_ARCH_32R2 = 0x70000000, // mips32r2, mips32r3, mips32r5
- EF_MIPS_ARCH_64R2 = 0x80000000, // mips64r2, mips64r3, mips64r5
- EF_MIPS_ARCH_32R6 = 0x90000000, // mips32r6
- EF_MIPS_ARCH_64R6 = 0xa0000000, // mips64r6
- EF_MIPS_ARCH = 0xf0000000 // Mask for applying EF_MIPS_ARCH_ variant
-};
-
-// ELF Relocation types for Mips
-enum {
-#include "ELFRelocs/Mips.def"
-};
-
-// Special values for the st_other field in the symbol table entry for MIPS.
-enum {
- STO_MIPS_OPTIONAL = 0x04, // Symbol whose definition is optional
- STO_MIPS_PLT = 0x08, // PLT entry related dynamic table record
- STO_MIPS_PIC = 0x20, // PIC func in an object mixes PIC/non-PIC
- STO_MIPS_MICROMIPS = 0x80, // MIPS Specific ISA for MicroMips
- STO_MIPS_MIPS16 = 0xf0 // MIPS Specific ISA for Mips16
-};
-
-// .MIPS.options section descriptor kinds
-enum {
- ODK_NULL = 0, // Undefined
- ODK_REGINFO = 1, // Register usage information
- ODK_EXCEPTIONS = 2, // Exception processing options
- ODK_PAD = 3, // Section padding options
- ODK_HWPATCH = 4, // Hardware patches applied
- ODK_FILL = 5, // Linker fill value
- ODK_TAGS = 6, // Space for tool identification
- ODK_HWAND = 7, // Hardware AND patches applied
- ODK_HWOR = 8, // Hardware OR patches applied
- ODK_GP_GROUP = 9, // GP group to use for text/data sections
- ODK_IDENT = 10, // ID information
- ODK_PAGESIZE = 11 // Page size information
-};
-
-// Hexagon-specific e_flags
-enum {
- // Object processor version flags, bits[11:0]
- EF_HEXAGON_MACH_V2 = 0x00000001, // Hexagon V2
- EF_HEXAGON_MACH_V3 = 0x00000002, // Hexagon V3
- EF_HEXAGON_MACH_V4 = 0x00000003, // Hexagon V4
- EF_HEXAGON_MACH_V5 = 0x00000004, // Hexagon V5
- EF_HEXAGON_MACH_V55 = 0x00000005, // Hexagon V55
- EF_HEXAGON_MACH_V60 = 0x00000060, // Hexagon V60
- EF_HEXAGON_MACH_V62 = 0x00000062, // Hexagon V62
-
- // Highest ISA version flags
- EF_HEXAGON_ISA_MACH = 0x00000000, // Same as specified in bits[11:0]
- // of e_flags
- EF_HEXAGON_ISA_V2 = 0x00000010, // Hexagon V2 ISA
- EF_HEXAGON_ISA_V3 = 0x00000020, // Hexagon V3 ISA
- EF_HEXAGON_ISA_V4 = 0x00000030, // Hexagon V4 ISA
- EF_HEXAGON_ISA_V5 = 0x00000040, // Hexagon V5 ISA
- EF_HEXAGON_ISA_V55 = 0x00000050, // Hexagon V55 ISA
- EF_HEXAGON_ISA_V60 = 0x00000060, // Hexagon V60 ISA
- EF_HEXAGON_ISA_V62 = 0x00000062, // Hexagon V62 ISA
-};
-
-// Hexagon-specific section indexes for common small data
-enum {
- SHN_HEXAGON_SCOMMON = 0xff00, // Other access sizes
- SHN_HEXAGON_SCOMMON_1 = 0xff01, // Byte-sized access
- SHN_HEXAGON_SCOMMON_2 = 0xff02, // Half-word-sized access
- SHN_HEXAGON_SCOMMON_4 = 0xff03, // Word-sized access
- SHN_HEXAGON_SCOMMON_8 = 0xff04 // Double-word-size access
-};
-
-// ELF Relocation types for Hexagon
-enum {
-#include "ELFRelocs/Hexagon.def"
-};
-
-// ELF Relocation type for Lanai.
-enum {
-#include "ELFRelocs/Lanai.def"
-};
-
-// ELF Relocation types for RISC-V
-enum {
-#include "ELFRelocs/RISCV.def"
-};
-
-// ELF Relocation types for S390/zSeries
-enum {
-#include "ELFRelocs/SystemZ.def"
-};
-
-// ELF Relocation type for Sparc.
-enum {
-#include "ELFRelocs/Sparc.def"
-};
-
-// ELF Relocation types for WebAssembly
-enum {
-#include "ELFRelocs/WebAssembly.def"
-};
-
-// ELF Relocation types for AMDGPU
-enum {
-#include "ELFRelocs/AMDGPU.def"
-};
-
-// ELF Relocation types for BPF
-enum {
-#include "ELFRelocs/BPF.def"
-};
-
-#undef ELF_RELOC
-
-// Section header.
-struct Elf32_Shdr {
- Elf32_Word sh_name; // Section name (index into string table)
- Elf32_Word sh_type; // Section type (SHT_*)
- Elf32_Word sh_flags; // Section flags (SHF_*)
- Elf32_Addr sh_addr; // Address where section is to be loaded
- Elf32_Off sh_offset; // File offset of section data, in bytes
- Elf32_Word sh_size; // Size of section, in bytes
- Elf32_Word sh_link; // Section type-specific header table index link
- Elf32_Word sh_info; // Section type-specific extra information
- Elf32_Word sh_addralign; // Section address alignment
- Elf32_Word sh_entsize; // Size of records contained within the section
-};
-
-// Section header for ELF64 - same fields as ELF32, different types.
-struct Elf64_Shdr {
- Elf64_Word sh_name;
- Elf64_Word sh_type;
- Elf64_Xword sh_flags;
- Elf64_Addr sh_addr;
- Elf64_Off sh_offset;
- Elf64_Xword sh_size;
- Elf64_Word sh_link;
- Elf64_Word sh_info;
- Elf64_Xword sh_addralign;
- Elf64_Xword sh_entsize;
-};
-
-// Special section indices.
-enum {
- SHN_UNDEF = 0, // Undefined, missing, irrelevant, or meaningless
- SHN_LORESERVE = 0xff00, // Lowest reserved index
- SHN_LOPROC = 0xff00, // Lowest processor-specific index
- SHN_HIPROC = 0xff1f, // Highest processor-specific index
- SHN_LOOS = 0xff20, // Lowest operating system-specific index
- SHN_HIOS = 0xff3f, // Highest operating system-specific index
- SHN_ABS = 0xfff1, // Symbol has absolute value; does not need relocation
- SHN_COMMON = 0xfff2, // FORTRAN COMMON or C external global variables
- SHN_XINDEX = 0xffff, // Mark that the index is >= SHN_LORESERVE
- SHN_HIRESERVE = 0xffff // Highest reserved index
-};
-
-// Section types.
-enum : unsigned {
- SHT_NULL = 0, // No associated section (inactive entry).
- SHT_PROGBITS = 1, // Program-defined contents.
- SHT_SYMTAB = 2, // Symbol table.
- SHT_STRTAB = 3, // String table.
- SHT_RELA = 4, // Relocation entries; explicit addends.
- SHT_HASH = 5, // Symbol hash table.
- SHT_DYNAMIC = 6, // Information for dynamic linking.
- SHT_NOTE = 7, // Information about the file.
- SHT_NOBITS = 8, // Data occupies no space in the file.
- SHT_REL = 9, // Relocation entries; no explicit addends.
- SHT_SHLIB = 10, // Reserved.
- SHT_DYNSYM = 11, // Symbol table.
- SHT_INIT_ARRAY = 14, // Pointers to initialization functions.
- SHT_FINI_ARRAY = 15, // Pointers to termination functions.
- SHT_PREINIT_ARRAY = 16, // Pointers to pre-init functions.
- SHT_GROUP = 17, // Section group.
- SHT_SYMTAB_SHNDX = 18, // Indices for SHN_XINDEX entries.
- SHT_LOOS = 0x60000000, // Lowest operating system-specific type.
- SHT_GNU_ATTRIBUTES = 0x6ffffff5, // Object attributes.
- SHT_GNU_HASH = 0x6ffffff6, // GNU-style hash table.
- SHT_GNU_verdef = 0x6ffffffd, // GNU version definitions.
- SHT_GNU_verneed = 0x6ffffffe, // GNU version references.
- SHT_GNU_versym = 0x6fffffff, // GNU symbol versions table.
- SHT_HIOS = 0x6fffffff, // Highest operating system-specific type.
- SHT_LOPROC = 0x70000000, // Lowest processor arch-specific type.
- // Fixme: All this is duplicated in MCSectionELF. Why??
- // Exception Index table
- SHT_ARM_EXIDX = 0x70000001U,
- // BPABI DLL dynamic linking pre-emption map
- SHT_ARM_PREEMPTMAP = 0x70000002U,
- // Object file compatibility attributes
- SHT_ARM_ATTRIBUTES = 0x70000003U,
- SHT_ARM_DEBUGOVERLAY = 0x70000004U,
- SHT_ARM_OVERLAYSECTION = 0x70000005U,
- SHT_HEX_ORDERED = 0x70000000, // Link editor is to sort the entries in
- // this section based on their sizes
- SHT_X86_64_UNWIND = 0x70000001, // Unwind information
-
- SHT_MIPS_REGINFO = 0x70000006, // Register usage information
- SHT_MIPS_OPTIONS = 0x7000000d, // General options
- SHT_MIPS_DWARF = 0x7000001e, // DWARF debugging section.
- SHT_MIPS_ABIFLAGS = 0x7000002a, // ABI information.
-
- SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type.
- SHT_LOUSER = 0x80000000, // Lowest type reserved for applications.
- SHT_HIUSER = 0xffffffff // Highest type reserved for applications.
-};
-
-// Section flags.
-enum : unsigned {
- // Section data should be writable during execution.
- SHF_WRITE = 0x1,
-
- // Section occupies memory during program execution.
- SHF_ALLOC = 0x2,
-
- // Section contains executable machine instructions.
- SHF_EXECINSTR = 0x4,
-
- // The data in this section may be merged.
- SHF_MERGE = 0x10,
-
- // The data in this section is null-terminated strings.
- SHF_STRINGS = 0x20,
-
- // A field in this section holds a section header table index.
- SHF_INFO_LINK = 0x40U,
-
- // Adds special ordering requirements for link editors.
- SHF_LINK_ORDER = 0x80U,
-
- // This section requires special OS-specific processing to avoid incorrect
- // behavior.
- SHF_OS_NONCONFORMING = 0x100U,
-
- // This section is a member of a section group.
- SHF_GROUP = 0x200U,
-
- // This section holds Thread-Local Storage.
- SHF_TLS = 0x400U,
-
- // Identifies a section containing compressed data.
- SHF_COMPRESSED = 0x800U,
-
- // This section is excluded from the final executable or shared library.
- SHF_EXCLUDE = 0x80000000U,
-
- // Start of target-specific flags.
-
- SHF_MASKOS = 0x0ff00000,
-
- // Bits indicating processor-specific flags.
- SHF_MASKPROC = 0xf0000000,
-
- /// All sections with the "d" flag are grouped together by the linker to form
- /// the data section and the dp register is set to the start of the section by
- /// the boot code.
- XCORE_SHF_DP_SECTION = 0x10000000,
-
- /// All sections with the "c" flag are grouped together by the linker to form
- /// the constant pool and the cp register is set to the start of the constant
- /// pool by the boot code.
- XCORE_SHF_CP_SECTION = 0x20000000,
-
- // If an object file section does not have this flag set, then it may not hold
- // more than 2GB and can be freely referred to in objects using smaller code
- // models. Otherwise, only objects using larger code models can refer to them.
- // For example, a medium code model object can refer to data in a section that
- // sets this flag besides being able to refer to data in a section that does
- // not set it; likewise, a small code model object can refer only to code in a
- // section that does not set this flag.
- SHF_X86_64_LARGE = 0x10000000,
-
- // All sections with the GPREL flag are grouped into a global data area
- // for faster accesses
- SHF_HEX_GPREL = 0x10000000,
-
- // Section contains text/data which may be replicated in other sections.
- // Linker must retain only one copy.
- SHF_MIPS_NODUPES = 0x01000000,
-
- // Linker must generate implicit hidden weak names.
- SHF_MIPS_NAMES = 0x02000000,
-
- // Section data local to process.
- SHF_MIPS_LOCAL = 0x04000000,
-
- // Do not strip this section.
- SHF_MIPS_NOSTRIP = 0x08000000,
-
- // Section must be part of global data area.
- SHF_MIPS_GPREL = 0x10000000,
-
- // This section should be merged.
- SHF_MIPS_MERGE = 0x20000000,
-
- // Address size to be inferred from section entry size.
- SHF_MIPS_ADDR = 0x40000000,
-
- // Section data is string data by default.
- SHF_MIPS_STRING = 0x80000000,
-
- // Make code section unreadable when in execute-only mode
- SHF_ARM_PURECODE = 0x20000000
-};
-
-// Section Group Flags
-enum : unsigned {
- GRP_COMDAT = 0x1,
- GRP_MASKOS = 0x0ff00000,
- GRP_MASKPROC = 0xf0000000
-};
-
-// Symbol table entries for ELF32.
-struct Elf32_Sym {
- Elf32_Word st_name; // Symbol name (index into string table)
- Elf32_Addr st_value; // Value or address associated with the symbol
- Elf32_Word st_size; // Size of the symbol
- unsigned char st_info; // Symbol's type and binding attributes
- unsigned char st_other; // Must be zero; reserved
- Elf32_Half st_shndx; // Which section (header table index) it's defined in
-
- // These accessors and mutators correspond to the ELF32_ST_BIND,
- // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
- unsigned char getBinding() const { return st_info >> 4; }
- unsigned char getType() const { return st_info & 0x0f; }
- void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
- void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
- void setBindingAndType(unsigned char b, unsigned char t) {
- st_info = (b << 4) + (t & 0x0f);
- }
-};
-
-// Symbol table entries for ELF64.
-struct Elf64_Sym {
- Elf64_Word st_name; // Symbol name (index into string table)
- unsigned char st_info; // Symbol's type and binding attributes
- unsigned char st_other; // Must be zero; reserved
- Elf64_Half st_shndx; // Which section (header tbl index) it's defined in
- Elf64_Addr st_value; // Value or address associated with the symbol
- Elf64_Xword st_size; // Size of the symbol
-
- // These accessors and mutators are identical to those defined for ELF32
- // symbol table entries.
- unsigned char getBinding() const { return st_info >> 4; }
- unsigned char getType() const { return st_info & 0x0f; }
- void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
- void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
- void setBindingAndType(unsigned char b, unsigned char t) {
- st_info = (b << 4) + (t & 0x0f);
- }
-};
-
-// The size (in bytes) of symbol table entries.
-enum {
- SYMENTRY_SIZE32 = 16, // 32-bit symbol entry size
- SYMENTRY_SIZE64 = 24 // 64-bit symbol entry size.
-};
-
-// Symbol bindings.
-enum {
- STB_LOCAL = 0, // Local symbol, not visible outside obj file containing def
- STB_GLOBAL = 1, // Global symbol, visible to all object files being combined
- STB_WEAK = 2, // Weak symbol, like global but lower-precedence
- STB_GNU_UNIQUE = 10,
- STB_LOOS = 10, // Lowest operating system-specific binding type
- STB_HIOS = 12, // Highest operating system-specific binding type
- STB_LOPROC = 13, // Lowest processor-specific binding type
- STB_HIPROC = 15 // Highest processor-specific binding type
-};
-
-// Symbol types.
-enum {
- STT_NOTYPE = 0, // Symbol's type is not specified
- STT_OBJECT = 1, // Symbol is a data object (variable, array, etc.)
- STT_FUNC = 2, // Symbol is executable code (function, etc.)
- STT_SECTION = 3, // Symbol refers to a section
- STT_FILE = 4, // Local, absolute symbol that refers to a file
- STT_COMMON = 5, // An uninitialized common block
- STT_TLS = 6, // Thread local data object
- STT_GNU_IFUNC = 10, // GNU indirect function
- STT_LOOS = 10, // Lowest operating system-specific symbol type
- STT_HIOS = 12, // Highest operating system-specific symbol type
- STT_LOPROC = 13, // Lowest processor-specific symbol type
- STT_HIPROC = 15, // Highest processor-specific symbol type
-
- // AMDGPU symbol types
- STT_AMDGPU_HSA_KERNEL = 10
-};
-
-enum {
- STV_DEFAULT = 0, // Visibility is specified by binding type
- STV_INTERNAL = 1, // Defined by processor supplements
- STV_HIDDEN = 2, // Not visible to other components
- STV_PROTECTED = 3 // Visible in other components but not preemptable
-};
-
-// Symbol number.
-enum { STN_UNDEF = 0 };
-
-// Special relocation symbols used in the MIPS64 ELF relocation entries
-enum {
- RSS_UNDEF = 0, // None
- RSS_GP = 1, // Value of gp
- RSS_GP0 = 2, // Value of gp used to create object being relocated
- RSS_LOC = 3 // Address of location being relocated
-};
-
-// Relocation entry, without explicit addend.
-struct Elf32_Rel {
- Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
- Elf32_Word r_info; // Symbol table index and type of relocation to apply
-
- // These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE,
- // and ELF32_R_INFO macros defined in the ELF specification:
- Elf32_Word getSymbol() const { return (r_info >> 8); }
- unsigned char getType() const { return (unsigned char)(r_info & 0x0ff); }
- void setSymbol(Elf32_Word s) { setSymbolAndType(s, getType()); }
- void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); }
- void setSymbolAndType(Elf32_Word s, unsigned char t) {
- r_info = (s << 8) + t;
- }
-};
-
-// Relocation entry with explicit addend.
-struct Elf32_Rela {
- Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
- Elf32_Word r_info; // Symbol table index and type of relocation to apply
- Elf32_Sword r_addend; // Compute value for relocatable field by adding this
-
- // These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE,
- // and ELF32_R_INFO macros defined in the ELF specification:
- Elf32_Word getSymbol() const { return (r_info >> 8); }
- unsigned char getType() const { return (unsigned char)(r_info & 0x0ff); }
- void setSymbol(Elf32_Word s) { setSymbolAndType(s, getType()); }
- void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); }
- void setSymbolAndType(Elf32_Word s, unsigned char t) {
- r_info = (s << 8) + t;
- }
-};
-
-// Relocation entry, without explicit addend.
-struct Elf64_Rel {
- Elf64_Addr r_offset; // Location (file byte offset, or program virtual addr).
- Elf64_Xword r_info; // Symbol table index and type of relocation to apply.
-
- // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,
- // and ELF64_R_INFO macros defined in the ELF specification:
- Elf64_Word getSymbol() const { return (r_info >> 32); }
- Elf64_Word getType() const { return (Elf64_Word)(r_info & 0xffffffffL); }
- void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); }
- void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); }
- void setSymbolAndType(Elf64_Word s, Elf64_Word t) {
- r_info = ((Elf64_Xword)s << 32) + (t & 0xffffffffL);
- }
-};
-
-// Relocation entry with explicit addend.
-struct Elf64_Rela {
- Elf64_Addr r_offset; // Location (file byte offset, or program virtual addr).
- Elf64_Xword r_info; // Symbol table index and type of relocation to apply.
- Elf64_Sxword r_addend; // Compute value for relocatable field by adding this.
-
- // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,
- // and ELF64_R_INFO macros defined in the ELF specification:
- Elf64_Word getSymbol() const { return (r_info >> 32); }
- Elf64_Word getType() const { return (Elf64_Word)(r_info & 0xffffffffL); }
- void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); }
- void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); }
- void setSymbolAndType(Elf64_Word s, Elf64_Word t) {
- r_info = ((Elf64_Xword)s << 32) + (t & 0xffffffffL);
- }
-};
-
-// Program header for ELF32.
-struct Elf32_Phdr {
- Elf32_Word p_type; // Type of segment
- Elf32_Off p_offset; // File offset where segment is located, in bytes
- Elf32_Addr p_vaddr; // Virtual address of beginning of segment
- Elf32_Addr p_paddr; // Physical address of beginning of segment (OS-specific)
- Elf32_Word p_filesz; // Num. of bytes in file image of segment (may be zero)
- Elf32_Word p_memsz; // Num. of bytes in mem image of segment (may be zero)
- Elf32_Word p_flags; // Segment flags
- Elf32_Word p_align; // Segment alignment constraint
-};
-
-// Program header for ELF64.
-struct Elf64_Phdr {
- Elf64_Word p_type; // Type of segment
- Elf64_Word p_flags; // Segment flags
- Elf64_Off p_offset; // File offset where segment is located, in bytes
- Elf64_Addr p_vaddr; // Virtual address of beginning of segment
- Elf64_Addr p_paddr; // Physical addr of beginning of segment (OS-specific)
- Elf64_Xword p_filesz; // Num. of bytes in file image of segment (may be zero)
- Elf64_Xword p_memsz; // Num. of bytes in mem image of segment (may be zero)
- Elf64_Xword p_align; // Segment alignment constraint
-};
-
-// Segment types.
-enum {
- PT_NULL = 0, // Unused segment.
- PT_LOAD = 1, // Loadable segment.
- PT_DYNAMIC = 2, // Dynamic linking information.
- PT_INTERP = 3, // Interpreter pathname.
- PT_NOTE = 4, // Auxiliary information.
- PT_SHLIB = 5, // Reserved.
- PT_PHDR = 6, // The program header table itself.
- PT_TLS = 7, // The thread-local storage template.
- PT_LOOS = 0x60000000, // Lowest operating system-specific pt entry type.
- PT_HIOS = 0x6fffffff, // Highest operating system-specific pt entry type.
- PT_LOPROC = 0x70000000, // Lowest processor-specific program hdr entry type.
- PT_HIPROC = 0x7fffffff, // Highest processor-specific program hdr entry type.
-
- // x86-64 program header types.
- // These all contain stack unwind tables.
- PT_GNU_EH_FRAME = 0x6474e550,
- PT_SUNW_EH_FRAME = 0x6474e550,
- PT_SUNW_UNWIND = 0x6464e550,
-
- PT_GNU_STACK = 0x6474e551, // Indicates stack executability.
- PT_GNU_RELRO = 0x6474e552, // Read-only after relocation.
-
- PT_OPENBSD_RANDOMIZE = 0x65a3dbe6, // Fill with random data.
- PT_OPENBSD_WXNEEDED = 0x65a3dbe7, // Program does W^X violations.
- PT_OPENBSD_BOOTDATA = 0x65a41be6, // Section for boot arguments.
-
- // ARM program header types.
- PT_ARM_ARCHEXT = 0x70000000, // Platform architecture compatibility info
- // These all contain stack unwind tables.
- PT_ARM_EXIDX = 0x70000001,
- PT_ARM_UNWIND = 0x70000001,
-
- // MIPS program header types.
- PT_MIPS_REGINFO = 0x70000000, // Register usage information.
- PT_MIPS_RTPROC = 0x70000001, // Runtime procedure table.
- PT_MIPS_OPTIONS = 0x70000002, // Options segment.
- PT_MIPS_ABIFLAGS = 0x70000003, // Abiflags segment.
-
- // WebAssembly program header types.
- PT_WEBASSEMBLY_FUNCTIONS = PT_LOPROC + 0, // Function definitions.
-};
-
-// Segment flag bits.
-enum : unsigned {
- PF_X = 1, // Execute
- PF_W = 2, // Write
- PF_R = 4, // Read
- PF_MASKOS = 0x0ff00000, // Bits for operating system-specific semantics.
- PF_MASKPROC = 0xf0000000 // Bits for processor-specific semantics.
-};
-
-// Dynamic table entry for ELF32.
-struct Elf32_Dyn {
- Elf32_Sword d_tag; // Type of dynamic table entry.
- union {
- Elf32_Word d_val; // Integer value of entry.
- Elf32_Addr d_ptr; // Pointer value of entry.
- } d_un;
-};
-
-// Dynamic table entry for ELF64.
-struct Elf64_Dyn {
- Elf64_Sxword d_tag; // Type of dynamic table entry.
- union {
- Elf64_Xword d_val; // Integer value of entry.
- Elf64_Addr d_ptr; // Pointer value of entry.
- } d_un;
-};
-
-// Dynamic table entry tags.
-enum {
- DT_NULL = 0, // Marks end of dynamic array.
- DT_NEEDED = 1, // String table offset of needed library.
- DT_PLTRELSZ = 2, // Size of relocation entries in PLT.
- DT_PLTGOT = 3, // Address associated with linkage table.
- DT_HASH = 4, // Address of symbolic hash table.
- DT_STRTAB = 5, // Address of dynamic string table.
- DT_SYMTAB = 6, // Address of dynamic symbol table.
- DT_RELA = 7, // Address of relocation table (Rela entries).
- DT_RELASZ = 8, // Size of Rela relocation table.
- DT_RELAENT = 9, // Size of a Rela relocation entry.
- DT_STRSZ = 10, // Total size of the string table.
- DT_SYMENT = 11, // Size of a symbol table entry.
- DT_INIT = 12, // Address of initialization function.
- DT_FINI = 13, // Address of termination function.
- DT_SONAME = 14, // String table offset of a shared objects name.
- DT_RPATH = 15, // String table offset of library search path.
- DT_SYMBOLIC = 16, // Changes symbol resolution algorithm.
- DT_REL = 17, // Address of relocation table (Rel entries).
- DT_RELSZ = 18, // Size of Rel relocation table.
- DT_RELENT = 19, // Size of a Rel relocation entry.
- DT_PLTREL = 20, // Type of relocation entry used for linking.
- DT_DEBUG = 21, // Reserved for debugger.
- DT_TEXTREL = 22, // Relocations exist for non-writable segments.
- DT_JMPREL = 23, // Address of relocations associated with PLT.
- DT_BIND_NOW = 24, // Process all relocations before execution.
- DT_INIT_ARRAY = 25, // Pointer to array of initialization functions.
- DT_FINI_ARRAY = 26, // Pointer to array of termination functions.
- DT_INIT_ARRAYSZ = 27, // Size of DT_INIT_ARRAY.
- DT_FINI_ARRAYSZ = 28, // Size of DT_FINI_ARRAY.
- DT_RUNPATH = 29, // String table offset of lib search path.
- DT_FLAGS = 30, // Flags.
- DT_ENCODING = 32, // Values from here to DT_LOOS follow the rules
- // for the interpretation of the d_un union.
-
- DT_PREINIT_ARRAY = 32, // Pointer to array of preinit functions.
- DT_PREINIT_ARRAYSZ = 33, // Size of the DT_PREINIT_ARRAY array.
-
- DT_LOOS = 0x60000000, // Start of environment specific tags.
- DT_HIOS = 0x6FFFFFFF, // End of environment specific tags.
- DT_LOPROC = 0x70000000, // Start of processor specific tags.
- DT_HIPROC = 0x7FFFFFFF, // End of processor specific tags.
-
- DT_GNU_HASH = 0x6FFFFEF5, // Reference to the GNU hash table.
- DT_TLSDESC_PLT =
- 0x6FFFFEF6, // Location of PLT entry for TLS descriptor resolver calls.
- DT_TLSDESC_GOT = 0x6FFFFEF7, // Location of GOT entry used by TLS descriptor
- // resolver PLT entry.
- DT_RELACOUNT = 0x6FFFFFF9, // ELF32_Rela count.
- DT_RELCOUNT = 0x6FFFFFFA, // ELF32_Rel count.
-
- DT_FLAGS_1 = 0X6FFFFFFB, // Flags_1.
- DT_VERSYM = 0x6FFFFFF0, // The address of .gnu.version section.
- DT_VERDEF = 0X6FFFFFFC, // The address of the version definition table.
- DT_VERDEFNUM = 0X6FFFFFFD, // The number of entries in DT_VERDEF.
- DT_VERNEED = 0X6FFFFFFE, // The address of the version Dependency table.
- DT_VERNEEDNUM = 0X6FFFFFFF, // The number of entries in DT_VERNEED.
-
- // Hexagon specific dynamic table entries
- DT_HEXAGON_SYMSZ = 0x70000000,
- DT_HEXAGON_VER = 0x70000001,
- DT_HEXAGON_PLT = 0x70000002,
-
- // Mips specific dynamic table entry tags.
- DT_MIPS_RLD_VERSION = 0x70000001, // 32 bit version number for runtime
- // linker interface.
- DT_MIPS_TIME_STAMP = 0x70000002, // Time stamp.
- DT_MIPS_ICHECKSUM = 0x70000003, // Checksum of external strings
- // and common sizes.
- DT_MIPS_IVERSION = 0x70000004, // Index of version string
- // in string table.
- DT_MIPS_FLAGS = 0x70000005, // 32 bits of flags.
- DT_MIPS_BASE_ADDRESS = 0x70000006, // Base address of the segment.
- DT_MIPS_MSYM = 0x70000007, // Address of .msym section.
- DT_MIPS_CONFLICT = 0x70000008, // Address of .conflict section.
- DT_MIPS_LIBLIST = 0x70000009, // Address of .liblist section.
- DT_MIPS_LOCAL_GOTNO = 0x7000000a, // Number of local global offset
- // table entries.
- DT_MIPS_CONFLICTNO = 0x7000000b, // Number of entries
- // in the .conflict section.
- DT_MIPS_LIBLISTNO = 0x70000010, // Number of entries
- // in the .liblist section.
- DT_MIPS_SYMTABNO = 0x70000011, // Number of entries
- // in the .dynsym section.
- DT_MIPS_UNREFEXTNO = 0x70000012, // Index of first external dynamic symbol
- // not referenced locally.
- DT_MIPS_GOTSYM = 0x70000013, // Index of first dynamic symbol
- // in global offset table.
- DT_MIPS_HIPAGENO = 0x70000014, // Number of page table entries
- // in global offset table.
- DT_MIPS_RLD_MAP = 0x70000016, // Address of run time loader map,
- // used for debugging.
- DT_MIPS_DELTA_CLASS = 0x70000017, // Delta C++ class definition.
- DT_MIPS_DELTA_CLASS_NO = 0x70000018, // Number of entries
- // in DT_MIPS_DELTA_CLASS.
- DT_MIPS_DELTA_INSTANCE = 0x70000019, // Delta C++ class instances.
- DT_MIPS_DELTA_INSTANCE_NO = 0x7000001A, // Number of entries
- // in DT_MIPS_DELTA_INSTANCE.
- DT_MIPS_DELTA_RELOC = 0x7000001B, // Delta relocations.
- DT_MIPS_DELTA_RELOC_NO = 0x7000001C, // Number of entries
- // in DT_MIPS_DELTA_RELOC.
- DT_MIPS_DELTA_SYM = 0x7000001D, // Delta symbols that Delta
- // relocations refer to.
- DT_MIPS_DELTA_SYM_NO = 0x7000001E, // Number of entries
- // in DT_MIPS_DELTA_SYM.
- DT_MIPS_DELTA_CLASSSYM = 0x70000020, // Delta symbols that hold
- // class declarations.
- DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021, // Number of entries
- // in DT_MIPS_DELTA_CLASSSYM.
- DT_MIPS_CXX_FLAGS = 0x70000022, // Flags indicating information
- // about C++ flavor.
- DT_MIPS_PIXIE_INIT = 0x70000023, // Pixie information.
- DT_MIPS_SYMBOL_LIB = 0x70000024, // Address of .MIPS.symlib
- DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025, // The GOT index of the first PTE
- // for a segment
- DT_MIPS_LOCAL_GOTIDX = 0x70000026, // The GOT index of the first PTE
- // for a local symbol
- DT_MIPS_HIDDEN_GOTIDX = 0x70000027, // The GOT index of the first PTE
- // for a hidden symbol
- DT_MIPS_PROTECTED_GOTIDX = 0x70000028, // The GOT index of the first PTE
- // for a protected symbol
- DT_MIPS_OPTIONS = 0x70000029, // Address of `.MIPS.options'.
- DT_MIPS_INTERFACE = 0x7000002A, // Address of `.interface'.
- DT_MIPS_DYNSTR_ALIGN = 0x7000002B, // Unknown.
- DT_MIPS_INTERFACE_SIZE = 0x7000002C, // Size of the .interface section.
- DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002D, // Size of rld_text_resolve
- // function stored in the GOT.
- DT_MIPS_PERF_SUFFIX = 0x7000002E, // Default suffix of DSO to be added
- // by rld on dlopen() calls.
- DT_MIPS_COMPACT_SIZE = 0x7000002F, // Size of compact relocation
- // section (O32).
- DT_MIPS_GP_VALUE = 0x70000030, // GP value for auxiliary GOTs.
- DT_MIPS_AUX_DYNAMIC = 0x70000031, // Address of auxiliary .dynamic.
- DT_MIPS_PLTGOT = 0x70000032, // Address of the base of the PLTGOT.
- DT_MIPS_RWPLT = 0x70000034, // Points to the base
- // of a writable PLT.
- DT_MIPS_RLD_MAP_REL = 0x70000035, // Relative offset of run time loader
- // map, used for debugging.
-
- // Sun machine-independent extensions.
- DT_AUXILIARY = 0x7FFFFFFD, // Shared object to load before self
- DT_FILTER = 0x7FFFFFFF // Shared object to get values from
-};
-
-// DT_FLAGS values.
-enum {
- DF_ORIGIN = 0x01, // The object may reference $ORIGIN.
- DF_SYMBOLIC = 0x02, // Search the shared lib before searching the exe.
- DF_TEXTREL = 0x04, // Relocations may modify a non-writable segment.
- DF_BIND_NOW = 0x08, // Process all relocations on load.
- DF_STATIC_TLS = 0x10 // Reject attempts to load dynamically.
-};
-
-// State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 entry.
-enum {
- DF_1_NOW = 0x00000001, // Set RTLD_NOW for this object.
- DF_1_GLOBAL = 0x00000002, // Set RTLD_GLOBAL for this object.
- DF_1_GROUP = 0x00000004, // Set RTLD_GROUP for this object.
- DF_1_NODELETE = 0x00000008, // Set RTLD_NODELETE for this object.
- DF_1_LOADFLTR = 0x00000010, // Trigger filtee loading at runtime.
- DF_1_INITFIRST = 0x00000020, // Set RTLD_INITFIRST for this object.
- DF_1_NOOPEN = 0x00000040, // Set RTLD_NOOPEN for this object.
- DF_1_ORIGIN = 0x00000080, // $ORIGIN must be handled.
- DF_1_DIRECT = 0x00000100, // Direct binding enabled.
- DF_1_TRANS = 0x00000200,
- DF_1_INTERPOSE = 0x00000400, // Object is used to interpose.
- DF_1_NODEFLIB = 0x00000800, // Ignore default lib search path.
- DF_1_NODUMP = 0x00001000, // Object can't be dldump'ed.
- DF_1_CONFALT = 0x00002000, // Configuration alternative created.
- DF_1_ENDFILTEE = 0x00004000, // Filtee terminates filters search.
- DF_1_DISPRELDNE = 0x00008000, // Disp reloc applied at build time.
- DF_1_DISPRELPND = 0x00010000, // Disp reloc applied at run-time.
- DF_1_NODIRECT = 0x00020000, // Object has no-direct binding.
- DF_1_IGNMULDEF = 0x00040000,
- DF_1_NOKSYMS = 0x00080000,
- DF_1_NOHDR = 0x00100000,
- DF_1_EDITED = 0x00200000, // Object is modified after built.
- DF_1_NORELOC = 0x00400000,
- DF_1_SYMINTPOSE = 0x00800000, // Object has individual interposers.
- DF_1_GLOBAUDIT = 0x01000000, // Global auditing required.
- DF_1_SINGLETON = 0x02000000 // Singleton symbols are used.
-};
-
-// DT_MIPS_FLAGS values.
-enum {
- RHF_NONE = 0x00000000, // No flags.
- RHF_QUICKSTART = 0x00000001, // Uses shortcut pointers.
- RHF_NOTPOT = 0x00000002, // Hash size is not a power of two.
- RHS_NO_LIBRARY_REPLACEMENT = 0x00000004, // Ignore LD_LIBRARY_PATH.
- RHF_NO_MOVE = 0x00000008, // DSO address may not be relocated.
- RHF_SGI_ONLY = 0x00000010, // SGI specific features.
- RHF_GUARANTEE_INIT = 0x00000020, // Guarantee that .init will finish
- // executing before any non-init
- // code in DSO is called.
- RHF_DELTA_C_PLUS_PLUS = 0x00000040, // Contains Delta C++ code.
- RHF_GUARANTEE_START_INIT = 0x00000080, // Guarantee that .init will start
- // executing before any non-init
- // code in DSO is called.
- RHF_PIXIE = 0x00000100, // Generated by pixie.
- RHF_DEFAULT_DELAY_LOAD = 0x00000200, // Delay-load DSO by default.
- RHF_REQUICKSTART = 0x00000400, // Object may be requickstarted
- RHF_REQUICKSTARTED = 0x00000800, // Object has been requickstarted
- RHF_CORD = 0x00001000, // Generated by cord.
- RHF_NO_UNRES_UNDEF = 0x00002000, // Object contains no unresolved
- // undef symbols.
- RHF_RLD_ORDER_SAFE = 0x00004000 // Symbol table is in a safe order.
-};
-
-// ElfXX_VerDef structure version (GNU versioning)
-enum { VER_DEF_NONE = 0, VER_DEF_CURRENT = 1 };
-
-// VerDef Flags (ElfXX_VerDef::vd_flags)
-enum { VER_FLG_BASE = 0x1, VER_FLG_WEAK = 0x2, VER_FLG_INFO = 0x4 };
-
-// Special constants for the version table. (SHT_GNU_versym/.gnu.version)
-enum {
- VER_NDX_LOCAL = 0, // Unversioned local symbol
- VER_NDX_GLOBAL = 1, // Unversioned global symbol
- VERSYM_VERSION = 0x7fff, // Version Index mask
- VERSYM_HIDDEN = 0x8000 // Hidden bit (non-default version)
-};
-
-// ElfXX_VerNeed structure version (GNU versioning)
-enum { VER_NEED_NONE = 0, VER_NEED_CURRENT = 1 };
-
-// SHT_NOTE section types
-enum {
- NT_FREEBSD_THRMISC = 7,
- NT_FREEBSD_PROCSTAT_PROC = 8,
- NT_FREEBSD_PROCSTAT_FILES = 9,
- NT_FREEBSD_PROCSTAT_VMMAP = 10,
- NT_FREEBSD_PROCSTAT_GROUPS = 11,
- NT_FREEBSD_PROCSTAT_UMASK = 12,
- NT_FREEBSD_PROCSTAT_RLIMIT = 13,
- NT_FREEBSD_PROCSTAT_OSREL = 14,
- NT_FREEBSD_PROCSTAT_PSSTRINGS = 15,
- NT_FREEBSD_PROCSTAT_AUXV = 16,
-};
-
-enum {
- NT_GNU_ABI_TAG = 1,
- NT_GNU_HWCAP = 2,
- NT_GNU_BUILD_ID = 3,
- NT_GNU_GOLD_VERSION = 4,
-};
-
-enum {
- GNU_ABI_TAG_LINUX = 0,
- GNU_ABI_TAG_HURD = 1,
- GNU_ABI_TAG_SOLARIS = 2,
- GNU_ABI_TAG_FREEBSD = 3,
- GNU_ABI_TAG_NETBSD = 4,
- GNU_ABI_TAG_SYLLABLE = 5,
- GNU_ABI_TAG_NACL = 6,
-};
-
-// Compressed section header for ELF32.
-struct Elf32_Chdr {
- Elf32_Word ch_type;
- Elf32_Word ch_size;
- Elf32_Word ch_addralign;
-};
-
-// Compressed section header for ELF64.
-struct Elf64_Chdr {
- Elf64_Word ch_type;
- Elf64_Word ch_reserved;
- Elf64_Xword ch_size;
- Elf64_Xword ch_addralign;
-};
-
-// Legal values for ch_type field of compressed section header.
-enum {
- ELFCOMPRESS_ZLIB = 1, // ZLIB/DEFLATE algorithm.
- ELFCOMPRESS_LOOS = 0x60000000, // Start of OS-specific.
- ELFCOMPRESS_HIOS = 0x6fffffff, // End of OS-specific.
- ELFCOMPRESS_LOPROC = 0x70000000, // Start of processor-specific.
- ELFCOMPRESS_HIPROC = 0x7fffffff // End of processor-specific.
-};
-
-} // end namespace ELF
-
-} // end namespace llvm
-
-#endif
Modified: llvm/trunk/include/llvm/Support/FileSystem.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)
+++ llvm/trunk/include/llvm/Support/FileSystem.h Tue Jun 6 22:48:56 2017
@@ -233,50 +233,6 @@ public:
void permissions(perms p) { Perms = p; }
};
-/// file_magic - An "enum class" enumeration of file types based on magic (the first
-/// N bytes of the file).
-struct file_magic {
- enum Impl {
- unknown = 0, ///< Unrecognized file
- bitcode, ///< Bitcode file
- archive, ///< ar style archive file
- elf, ///< ELF Unknown type
- elf_relocatable, ///< ELF Relocatable object file
- elf_executable, ///< ELF Executable image
- elf_shared_object, ///< ELF dynamically linked shared lib
- elf_core, ///< ELF core image
- macho_object, ///< Mach-O Object file
- macho_executable, ///< Mach-O Executable
- macho_fixed_virtual_memory_shared_lib, ///< Mach-O Shared Lib, FVM
- macho_core, ///< Mach-O Core File
- macho_preload_executable, ///< Mach-O Preloaded Executable
- macho_dynamically_linked_shared_lib, ///< Mach-O dynlinked shared lib
- macho_dynamic_linker, ///< The Mach-O dynamic linker
- macho_bundle, ///< Mach-O Bundle file
- macho_dynamically_linked_shared_lib_stub, ///< Mach-O Shared lib stub
- macho_dsym_companion, ///< Mach-O dSYM companion file
- macho_kext_bundle, ///< Mach-O kext bundle file
- macho_universal_binary, ///< Mach-O universal binary
- coff_cl_gl_object, ///< Microsoft cl.exe's intermediate code file
- coff_object, ///< COFF object file
- coff_import_library, ///< COFF import library
- pecoff_executable, ///< PECOFF executable file
- windows_resource, ///< Windows compiled resource file (.res)
- wasm_object ///< WebAssembly Object file
- };
-
- bool is_object() const {
- return V != unknown;
- }
-
- file_magic() = default;
- file_magic(Impl V) : V(V) {}
- operator Impl() const { return V; }
-
-private:
- Impl V = unknown;
-};
-
/// @}
/// @name Physical Operators
/// @{
@@ -770,17 +726,6 @@ std::error_code openFileForWrite(const T
std::error_code openFileForRead(const Twine &Name, int &ResultFD,
SmallVectorImpl<char> *RealPath = nullptr);
-/// @brief Identify the type of a binary file based on how magical it is.
-file_magic identify_magic(StringRef magic);
-
-/// @brief Get and identify \a path's type based on its content.
-///
-/// @param path Input path.
-/// @param result Set to the type of file, or file_magic::unknown.
-/// @returns errc::success if result has been successfully set, otherwise a
-/// platform-specific error_code.
-std::error_code identify_magic(const Twine &path, file_magic &result);
-
std::error_code getUniqueID(const Twine Path, UniqueID &Result);
/// @brief Get disk space usage information.
Removed: llvm/trunk/include/llvm/Support/MachO.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MachO.def?rev=304863&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/MachO.def (original)
+++ llvm/trunk/include/llvm/Support/MachO.def (removed)
@@ -1,120 +0,0 @@
-//,,,-- llvm/Support/MachO.def - The MachO file definitions -----*- C++ -*-,,,//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//,,,----------------------------------------------------------------------,,,//
-//
-// Definitions for MachO files
-//
-//,,,----------------------------------------------------------------------,,,//
-
-#ifdef HANDLE_LOAD_COMMAND
-
-HANDLE_LOAD_COMMAND(LC_SEGMENT, 0x00000001u, segment_command)
-HANDLE_LOAD_COMMAND(LC_SYMTAB, 0x00000002u, symtab_command)
-// LC_SYMSEG is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_SYMSEG, 0x00000003u, symseg_command)
-HANDLE_LOAD_COMMAND(LC_THREAD, 0x00000004u, thread_command)
-HANDLE_LOAD_COMMAND(LC_UNIXTHREAD, 0x00000005u, thread_command)
-// LC_LOADFVMLIB is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_LOADFVMLIB, 0x00000006u, fvmlib_command)
-// LC_IDFVMLIB is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_IDFVMLIB, 0x00000007u, fvmlib_command)
-// LC_IDENT is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_IDENT, 0x00000008u, ident_command)
-// LC_FVMFILE is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_FVMFILE, 0x00000009u, fvmfile_command)
-// LC_PREPAGE is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_PREPAGE, 0x0000000Au, load_command)
-HANDLE_LOAD_COMMAND(LC_DYSYMTAB, 0x0000000Bu, dysymtab_command)
-HANDLE_LOAD_COMMAND(LC_LOAD_DYLIB, 0x0000000Cu, dylib_command)
-HANDLE_LOAD_COMMAND(LC_ID_DYLIB, 0x0000000Du, dylib_command)
-HANDLE_LOAD_COMMAND(LC_LOAD_DYLINKER, 0x0000000Eu, dylinker_command)
-HANDLE_LOAD_COMMAND(LC_ID_DYLINKER, 0x0000000Fu, dylinker_command)
-// LC_PREBOUND_DYLIB is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_PREBOUND_DYLIB, 0x00000010u, prebound_dylib_command)
-HANDLE_LOAD_COMMAND(LC_ROUTINES, 0x00000011u, routines_command)
-HANDLE_LOAD_COMMAND(LC_SUB_FRAMEWORK, 0x00000012u, sub_framework_command)
-HANDLE_LOAD_COMMAND(LC_SUB_UMBRELLA, 0x00000013u, sub_umbrella_command)
-HANDLE_LOAD_COMMAND(LC_SUB_CLIENT, 0x00000014u, sub_client_command)
-HANDLE_LOAD_COMMAND(LC_SUB_LIBRARY, 0x00000015u, sub_library_command)
-// LC_TWOLEVEL_HINTS is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_TWOLEVEL_HINTS, 0x00000016u, twolevel_hints_command)
-// LC_PREBIND_CKSUM is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_PREBIND_CKSUM, 0x00000017u, prebind_cksum_command)
-// LC_LOAD_WEAK_DYLIB is obsolete and no longer supported.
-HANDLE_LOAD_COMMAND(LC_LOAD_WEAK_DYLIB, 0x80000018u, dylib_command)
-HANDLE_LOAD_COMMAND(LC_SEGMENT_64, 0x00000019u, segment_command_64)
-HANDLE_LOAD_COMMAND(LC_ROUTINES_64, 0x0000001Au, routines_command_64)
-HANDLE_LOAD_COMMAND(LC_UUID, 0x0000001Bu, uuid_command)
-HANDLE_LOAD_COMMAND(LC_RPATH, 0x8000001Cu, rpath_command)
-HANDLE_LOAD_COMMAND(LC_CODE_SIGNATURE, 0x0000001Du, linkedit_data_command)
-HANDLE_LOAD_COMMAND(LC_SEGMENT_SPLIT_INFO, 0x0000001Eu, linkedit_data_command)
-HANDLE_LOAD_COMMAND(LC_REEXPORT_DYLIB, 0x8000001Fu, dylib_command)
-HANDLE_LOAD_COMMAND(LC_LAZY_LOAD_DYLIB, 0x00000020u, dylib_command)
-HANDLE_LOAD_COMMAND(LC_ENCRYPTION_INFO, 0x00000021u, encryption_info_command)
-HANDLE_LOAD_COMMAND(LC_DYLD_INFO, 0x00000022u, dyld_info_command)
-HANDLE_LOAD_COMMAND(LC_DYLD_INFO_ONLY, 0x80000022u, dyld_info_command)
-HANDLE_LOAD_COMMAND(LC_LOAD_UPWARD_DYLIB, 0x80000023u, dylib_command)
-HANDLE_LOAD_COMMAND(LC_VERSION_MIN_MACOSX, 0x00000024u, version_min_command)
-HANDLE_LOAD_COMMAND(LC_VERSION_MIN_IPHONEOS, 0x00000025u, version_min_command)
-HANDLE_LOAD_COMMAND(LC_FUNCTION_STARTS, 0x00000026u, linkedit_data_command)
-HANDLE_LOAD_COMMAND(LC_DYLD_ENVIRONMENT, 0x00000027u, dylinker_command)
-HANDLE_LOAD_COMMAND(LC_MAIN, 0x80000028u, entry_point_command)
-HANDLE_LOAD_COMMAND(LC_DATA_IN_CODE, 0x00000029u, linkedit_data_command)
-HANDLE_LOAD_COMMAND(LC_SOURCE_VERSION, 0x0000002Au, source_version_command)
-HANDLE_LOAD_COMMAND(LC_DYLIB_CODE_SIGN_DRS, 0x0000002Bu, linkedit_data_command)
-HANDLE_LOAD_COMMAND(LC_ENCRYPTION_INFO_64, 0x0000002Cu,
- encryption_info_command_64)
-HANDLE_LOAD_COMMAND(LC_LINKER_OPTION, 0x0000002Du, linker_option_command)
-HANDLE_LOAD_COMMAND(LC_LINKER_OPTIMIZATION_HINT, 0x0000002Eu, linkedit_data_command)
-HANDLE_LOAD_COMMAND(LC_VERSION_MIN_TVOS, 0x0000002Fu, version_min_command)
-HANDLE_LOAD_COMMAND(LC_VERSION_MIN_WATCHOS, 0x00000030u, version_min_command)
-HANDLE_LOAD_COMMAND(LC_NOTE, 0x00000031u, note_command)
-HANDLE_LOAD_COMMAND(LC_BUILD_VERSION, 0x00000032u, build_version_command)
-
-#endif
-
-#ifdef LOAD_COMMAND_STRUCT
-
-LOAD_COMMAND_STRUCT(dyld_info_command)
-LOAD_COMMAND_STRUCT(dylib_command)
-LOAD_COMMAND_STRUCT(dylinker_command)
-LOAD_COMMAND_STRUCT(dysymtab_command)
-LOAD_COMMAND_STRUCT(encryption_info_command)
-LOAD_COMMAND_STRUCT(encryption_info_command_64)
-LOAD_COMMAND_STRUCT(entry_point_command)
-LOAD_COMMAND_STRUCT(fvmfile_command)
-LOAD_COMMAND_STRUCT(fvmlib_command)
-LOAD_COMMAND_STRUCT(ident_command)
-LOAD_COMMAND_STRUCT(linkedit_data_command)
-LOAD_COMMAND_STRUCT(linker_option_command)
-LOAD_COMMAND_STRUCT(load_command)
-LOAD_COMMAND_STRUCT(prebind_cksum_command)
-LOAD_COMMAND_STRUCT(prebound_dylib_command)
-LOAD_COMMAND_STRUCT(routines_command)
-LOAD_COMMAND_STRUCT(routines_command_64)
-LOAD_COMMAND_STRUCT(rpath_command)
-LOAD_COMMAND_STRUCT(segment_command)
-LOAD_COMMAND_STRUCT(segment_command_64)
-LOAD_COMMAND_STRUCT(source_version_command)
-LOAD_COMMAND_STRUCT(sub_client_command)
-LOAD_COMMAND_STRUCT(sub_framework_command)
-LOAD_COMMAND_STRUCT(sub_library_command)
-LOAD_COMMAND_STRUCT(sub_umbrella_command)
-LOAD_COMMAND_STRUCT(symseg_command)
-LOAD_COMMAND_STRUCT(symtab_command)
-LOAD_COMMAND_STRUCT(thread_command)
-LOAD_COMMAND_STRUCT(twolevel_hints_command)
-LOAD_COMMAND_STRUCT(uuid_command)
-LOAD_COMMAND_STRUCT(version_min_command)
-LOAD_COMMAND_STRUCT(note_command)
-LOAD_COMMAND_STRUCT(build_version_command)
-
-#endif
-
-#undef HANDLE_LOAD_COMMAND
-#undef LOAD_COMMAND_STRUCT
Removed: llvm/trunk/include/llvm/Support/MachO.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MachO.h?rev=304863&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/MachO.h (original)
+++ llvm/trunk/include/llvm/Support/MachO.h (removed)
@@ -1,2038 +0,0 @@
-//===-- llvm/Support/MachO.h - The MachO file format ------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines manifest constants for the MachO object file format.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_MACHO_H
-#define LLVM_SUPPORT_MACHO_H
-
-#include "llvm/Support/Compiler.h"
-#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/Host.h"
-
-namespace llvm {
- namespace MachO {
- // Enums from <mach-o/loader.h>
- enum : uint32_t {
- // Constants for the "magic" field in llvm::MachO::mach_header and
- // llvm::MachO::mach_header_64
- MH_MAGIC = 0xFEEDFACEu,
- MH_CIGAM = 0xCEFAEDFEu,
- MH_MAGIC_64 = 0xFEEDFACFu,
- MH_CIGAM_64 = 0xCFFAEDFEu,
- FAT_MAGIC = 0xCAFEBABEu,
- FAT_CIGAM = 0xBEBAFECAu,
- FAT_MAGIC_64 = 0xCAFEBABFu,
- FAT_CIGAM_64 = 0xBFBAFECAu
- };
-
- enum HeaderFileType {
- // Constants for the "filetype" field in llvm::MachO::mach_header and
- // llvm::MachO::mach_header_64
- MH_OBJECT = 0x1u,
- MH_EXECUTE = 0x2u,
- MH_FVMLIB = 0x3u,
- MH_CORE = 0x4u,
- MH_PRELOAD = 0x5u,
- MH_DYLIB = 0x6u,
- MH_DYLINKER = 0x7u,
- MH_BUNDLE = 0x8u,
- MH_DYLIB_STUB = 0x9u,
- MH_DSYM = 0xAu,
- MH_KEXT_BUNDLE = 0xBu
- };
-
- enum {
- // Constant bits for the "flags" field in llvm::MachO::mach_header and
- // llvm::MachO::mach_header_64
- MH_NOUNDEFS = 0x00000001u,
- MH_INCRLINK = 0x00000002u,
- MH_DYLDLINK = 0x00000004u,
- MH_BINDATLOAD = 0x00000008u,
- MH_PREBOUND = 0x00000010u,
- MH_SPLIT_SEGS = 0x00000020u,
- MH_LAZY_INIT = 0x00000040u,
- MH_TWOLEVEL = 0x00000080u,
- MH_FORCE_FLAT = 0x00000100u,
- MH_NOMULTIDEFS = 0x00000200u,
- MH_NOFIXPREBINDING = 0x00000400u,
- MH_PREBINDABLE = 0x00000800u,
- MH_ALLMODSBOUND = 0x00001000u,
- MH_SUBSECTIONS_VIA_SYMBOLS = 0x00002000u,
- MH_CANONICAL = 0x00004000u,
- MH_WEAK_DEFINES = 0x00008000u,
- MH_BINDS_TO_WEAK = 0x00010000u,
- MH_ALLOW_STACK_EXECUTION = 0x00020000u,
- MH_ROOT_SAFE = 0x00040000u,
- MH_SETUID_SAFE = 0x00080000u,
- MH_NO_REEXPORTED_DYLIBS = 0x00100000u,
- MH_PIE = 0x00200000u,
- MH_DEAD_STRIPPABLE_DYLIB = 0x00400000u,
- MH_HAS_TLV_DESCRIPTORS = 0x00800000u,
- MH_NO_HEAP_EXECUTION = 0x01000000u,
- MH_APP_EXTENSION_SAFE = 0x02000000u
- };
-
- enum : uint32_t {
- // Flags for the "cmd" field in llvm::MachO::load_command
- LC_REQ_DYLD = 0x80000000u
- };
-
-#define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \
- LCName = LCValue,
-
- enum LoadCommandType : uint32_t {
- #include "llvm/Support/MachO.def"
- };
-
-#undef HANDLE_LOAD_COMMAND
-
- enum : uint32_t {
- // Constant bits for the "flags" field in llvm::MachO::segment_command
- SG_HIGHVM = 0x1u,
- SG_FVMLIB = 0x2u,
- SG_NORELOC = 0x4u,
- SG_PROTECTED_VERSION_1 = 0x8u,
-
- // Constant masks for the "flags" field in llvm::MachO::section and
- // llvm::MachO::section_64
- SECTION_TYPE = 0x000000ffu, // SECTION_TYPE
- SECTION_ATTRIBUTES = 0xffffff00u, // SECTION_ATTRIBUTES
- SECTION_ATTRIBUTES_USR = 0xff000000u, // SECTION_ATTRIBUTES_USR
- SECTION_ATTRIBUTES_SYS = 0x00ffff00u // SECTION_ATTRIBUTES_SYS
- };
-
- /// These are the section type and attributes fields. A MachO section can
- /// have only one Type, but can have any of the attributes specified.
- enum SectionType : uint32_t {
- // Constant masks for the "flags[7:0]" field in llvm::MachO::section and
- // llvm::MachO::section_64 (mask "flags" with SECTION_TYPE)
-
- /// S_REGULAR - Regular section.
- S_REGULAR = 0x00u,
- /// S_ZEROFILL - Zero fill on demand section.
- S_ZEROFILL = 0x01u,
- /// S_CSTRING_LITERALS - Section with literal C strings.
- S_CSTRING_LITERALS = 0x02u,
- /// S_4BYTE_LITERALS - Section with 4 byte literals.
- S_4BYTE_LITERALS = 0x03u,
- /// S_8BYTE_LITERALS - Section with 8 byte literals.
- S_8BYTE_LITERALS = 0x04u,
- /// S_LITERAL_POINTERS - Section with pointers to literals.
- S_LITERAL_POINTERS = 0x05u,
- /// S_NON_LAZY_SYMBOL_POINTERS - Section with non-lazy symbol pointers.
- S_NON_LAZY_SYMBOL_POINTERS = 0x06u,
- /// S_LAZY_SYMBOL_POINTERS - Section with lazy symbol pointers.
- S_LAZY_SYMBOL_POINTERS = 0x07u,
- /// S_SYMBOL_STUBS - Section with symbol stubs, byte size of stub in
- /// the Reserved2 field.
- S_SYMBOL_STUBS = 0x08u,
- /// S_MOD_INIT_FUNC_POINTERS - Section with only function pointers for
- /// initialization.
- S_MOD_INIT_FUNC_POINTERS = 0x09u,
- /// S_MOD_TERM_FUNC_POINTERS - Section with only function pointers for
- /// termination.
- S_MOD_TERM_FUNC_POINTERS = 0x0au,
- /// S_COALESCED - Section contains symbols that are to be coalesced.
- S_COALESCED = 0x0bu,
- /// S_GB_ZEROFILL - Zero fill on demand section (that can be larger than 4
- /// gigabytes).
- S_GB_ZEROFILL = 0x0cu,
- /// S_INTERPOSING - Section with only pairs of function pointers for
- /// interposing.
- S_INTERPOSING = 0x0du,
- /// S_16BYTE_LITERALS - Section with only 16 byte literals.
- S_16BYTE_LITERALS = 0x0eu,
- /// S_DTRACE_DOF - Section contains DTrace Object Format.
- S_DTRACE_DOF = 0x0fu,
- /// S_LAZY_DYLIB_SYMBOL_POINTERS - Section with lazy symbol pointers to
- /// lazy loaded dylibs.
- S_LAZY_DYLIB_SYMBOL_POINTERS = 0x10u,
- /// S_THREAD_LOCAL_REGULAR - Thread local data section.
- S_THREAD_LOCAL_REGULAR = 0x11u,
- /// S_THREAD_LOCAL_ZEROFILL - Thread local zerofill section.
- S_THREAD_LOCAL_ZEROFILL = 0x12u,
- /// S_THREAD_LOCAL_VARIABLES - Section with thread local variable
- /// structure data.
- S_THREAD_LOCAL_VARIABLES = 0x13u,
- /// S_THREAD_LOCAL_VARIABLE_POINTERS - Section with pointers to thread
- /// local structures.
- S_THREAD_LOCAL_VARIABLE_POINTERS = 0x14u,
- /// S_THREAD_LOCAL_INIT_FUNCTION_POINTERS - Section with thread local
- /// variable initialization pointers to functions.
- S_THREAD_LOCAL_INIT_FUNCTION_POINTERS = 0x15u,
-
- LAST_KNOWN_SECTION_TYPE = S_THREAD_LOCAL_INIT_FUNCTION_POINTERS
- };
-
- enum : uint32_t {
- // Constant masks for the "flags[31:24]" field in llvm::MachO::section and
- // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_USR)
-
- /// S_ATTR_PURE_INSTRUCTIONS - Section contains only true machine
- /// instructions.
- S_ATTR_PURE_INSTRUCTIONS = 0x80000000u,
- /// S_ATTR_NO_TOC - Section contains coalesced symbols that are not to be
- /// in a ranlib table of contents.
- S_ATTR_NO_TOC = 0x40000000u,
- /// S_ATTR_STRIP_STATIC_SYMS - Ok to strip static symbols in this section
- /// in files with the MY_DYLDLINK flag.
- S_ATTR_STRIP_STATIC_SYMS = 0x20000000u,
- /// S_ATTR_NO_DEAD_STRIP - No dead stripping.
- S_ATTR_NO_DEAD_STRIP = 0x10000000u,
- /// S_ATTR_LIVE_SUPPORT - Blocks are live if they reference live blocks.
- S_ATTR_LIVE_SUPPORT = 0x08000000u,
- /// S_ATTR_SELF_MODIFYING_CODE - Used with i386 code stubs written on by
- /// dyld.
- S_ATTR_SELF_MODIFYING_CODE = 0x04000000u,
- /// S_ATTR_DEBUG - A debug section.
- S_ATTR_DEBUG = 0x02000000u,
-
- // Constant masks for the "flags[23:8]" field in llvm::MachO::section and
- // llvm::MachO::section_64 (mask "flags" with SECTION_ATTRIBUTES_SYS)
-
- /// S_ATTR_SOME_INSTRUCTIONS - Section contains some machine instructions.
- S_ATTR_SOME_INSTRUCTIONS = 0x00000400u,
- /// S_ATTR_EXT_RELOC - Section has external relocation entries.
- S_ATTR_EXT_RELOC = 0x00000200u,
- /// S_ATTR_LOC_RELOC - Section has local relocation entries.
- S_ATTR_LOC_RELOC = 0x00000100u,
-
- // Constant masks for the value of an indirect symbol in an indirect
- // symbol table
- INDIRECT_SYMBOL_LOCAL = 0x80000000u,
- INDIRECT_SYMBOL_ABS = 0x40000000u
- };
-
- enum DataRegionType {
- // Constants for the "kind" field in a data_in_code_entry structure
- DICE_KIND_DATA = 1u,
- DICE_KIND_JUMP_TABLE8 = 2u,
- DICE_KIND_JUMP_TABLE16 = 3u,
- DICE_KIND_JUMP_TABLE32 = 4u,
- DICE_KIND_ABS_JUMP_TABLE32 = 5u
- };
-
- enum RebaseType {
- REBASE_TYPE_POINTER = 1u,
- REBASE_TYPE_TEXT_ABSOLUTE32 = 2u,
- REBASE_TYPE_TEXT_PCREL32 = 3u
- };
-
- enum {
- REBASE_OPCODE_MASK = 0xF0u,
- REBASE_IMMEDIATE_MASK = 0x0Fu
- };
-
- enum RebaseOpcode {
- REBASE_OPCODE_DONE = 0x00u,
- REBASE_OPCODE_SET_TYPE_IMM = 0x10u,
- REBASE_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x20u,
- REBASE_OPCODE_ADD_ADDR_ULEB = 0x30u,
- REBASE_OPCODE_ADD_ADDR_IMM_SCALED = 0x40u,
- REBASE_OPCODE_DO_REBASE_IMM_TIMES = 0x50u,
- REBASE_OPCODE_DO_REBASE_ULEB_TIMES = 0x60u,
- REBASE_OPCODE_DO_REBASE_ADD_ADDR_ULEB = 0x70u,
- REBASE_OPCODE_DO_REBASE_ULEB_TIMES_SKIPPING_ULEB = 0x80u
- };
-
- enum BindType {
- BIND_TYPE_POINTER = 1u,
- BIND_TYPE_TEXT_ABSOLUTE32 = 2u,
- BIND_TYPE_TEXT_PCREL32 = 3u
- };
-
- enum BindSpecialDylib {
- BIND_SPECIAL_DYLIB_SELF = 0,
- BIND_SPECIAL_DYLIB_MAIN_EXECUTABLE = -1,
- BIND_SPECIAL_DYLIB_FLAT_LOOKUP = -2
- };
-
- enum {
- BIND_SYMBOL_FLAGS_WEAK_IMPORT = 0x1u,
- BIND_SYMBOL_FLAGS_NON_WEAK_DEFINITION = 0x8u,
-
- BIND_OPCODE_MASK = 0xF0u,
- BIND_IMMEDIATE_MASK = 0x0Fu
- };
-
- enum BindOpcode {
- BIND_OPCODE_DONE = 0x00u,
- BIND_OPCODE_SET_DYLIB_ORDINAL_IMM = 0x10u,
- BIND_OPCODE_SET_DYLIB_ORDINAL_ULEB = 0x20u,
- BIND_OPCODE_SET_DYLIB_SPECIAL_IMM = 0x30u,
- BIND_OPCODE_SET_SYMBOL_TRAILING_FLAGS_IMM = 0x40u,
- BIND_OPCODE_SET_TYPE_IMM = 0x50u,
- BIND_OPCODE_SET_ADDEND_SLEB = 0x60u,
- BIND_OPCODE_SET_SEGMENT_AND_OFFSET_ULEB = 0x70u,
- BIND_OPCODE_ADD_ADDR_ULEB = 0x80u,
- BIND_OPCODE_DO_BIND = 0x90u,
- BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB = 0xA0u,
- BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED = 0xB0u,
- BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB = 0xC0u
- };
-
- enum {
- EXPORT_SYMBOL_FLAGS_KIND_MASK = 0x03u,
- EXPORT_SYMBOL_FLAGS_WEAK_DEFINITION = 0x04u,
- EXPORT_SYMBOL_FLAGS_REEXPORT = 0x08u,
- EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER = 0x10u
- };
-
- enum ExportSymbolKind {
- EXPORT_SYMBOL_FLAGS_KIND_REGULAR = 0x00u,
- EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL = 0x01u,
- EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE = 0x02u
- };
-
- enum {
- // Constant masks for the "n_type" field in llvm::MachO::nlist and
- // llvm::MachO::nlist_64
- N_STAB = 0xe0,
- N_PEXT = 0x10,
- N_TYPE = 0x0e,
- N_EXT = 0x01
- };
-
- enum NListType : uint8_t {
- // Constants for the "n_type & N_TYPE" llvm::MachO::nlist and
- // llvm::MachO::nlist_64
- N_UNDF = 0x0u,
- N_ABS = 0x2u,
- N_SECT = 0xeu,
- N_PBUD = 0xcu,
- N_INDR = 0xau
- };
-
- enum SectionOrdinal {
- // Constants for the "n_sect" field in llvm::MachO::nlist and
- // llvm::MachO::nlist_64
- NO_SECT = 0u,
- MAX_SECT = 0xffu
- };
-
- enum {
- // Constant masks for the "n_desc" field in llvm::MachO::nlist and
- // llvm::MachO::nlist_64
- // The low 3 bits are the for the REFERENCE_TYPE.
- REFERENCE_TYPE = 0x7,
- REFERENCE_FLAG_UNDEFINED_NON_LAZY = 0,
- REFERENCE_FLAG_UNDEFINED_LAZY = 1,
- REFERENCE_FLAG_DEFINED = 2,
- REFERENCE_FLAG_PRIVATE_DEFINED = 3,
- REFERENCE_FLAG_PRIVATE_UNDEFINED_NON_LAZY = 4,
- REFERENCE_FLAG_PRIVATE_UNDEFINED_LAZY = 5,
- // Flag bits (some overlap with the library ordinal bits).
- N_ARM_THUMB_DEF = 0x0008u,
- REFERENCED_DYNAMICALLY = 0x0010u,
- N_NO_DEAD_STRIP = 0x0020u,
- N_WEAK_REF = 0x0040u,
- N_WEAK_DEF = 0x0080u,
- N_SYMBOL_RESOLVER = 0x0100u,
- N_ALT_ENTRY = 0x0200u,
- // For undefined symbols coming from libraries, see GET_LIBRARY_ORDINAL()
- // as these are in the top 8 bits.
- SELF_LIBRARY_ORDINAL = 0x0,
- MAX_LIBRARY_ORDINAL = 0xfd,
- DYNAMIC_LOOKUP_ORDINAL = 0xfe,
- EXECUTABLE_ORDINAL = 0xff
- };
-
- enum StabType {
- // Constant values for the "n_type" field in llvm::MachO::nlist and
- // llvm::MachO::nlist_64 when "(n_type & N_STAB) != 0"
- N_GSYM = 0x20u,
- N_FNAME = 0x22u,
- N_FUN = 0x24u,
- N_STSYM = 0x26u,
- N_LCSYM = 0x28u,
- N_BNSYM = 0x2Eu,
- N_PC = 0x30u,
- N_AST = 0x32u,
- N_OPT = 0x3Cu,
- N_RSYM = 0x40u,
- N_SLINE = 0x44u,
- N_ENSYM = 0x4Eu,
- N_SSYM = 0x60u,
- N_SO = 0x64u,
- N_OSO = 0x66u,
- N_LSYM = 0x80u,
- N_BINCL = 0x82u,
- N_SOL = 0x84u,
- N_PARAMS = 0x86u,
- N_VERSION = 0x88u,
- N_OLEVEL = 0x8Au,
- N_PSYM = 0xA0u,
- N_EINCL = 0xA2u,
- N_ENTRY = 0xA4u,
- N_LBRAC = 0xC0u,
- N_EXCL = 0xC2u,
- N_RBRAC = 0xE0u,
- N_BCOMM = 0xE2u,
- N_ECOMM = 0xE4u,
- N_ECOML = 0xE8u,
- N_LENG = 0xFEu
- };
-
- enum : uint32_t {
- // Constant values for the r_symbolnum field in an
- // llvm::MachO::relocation_info structure when r_extern is 0.
- R_ABS = 0,
-
- // Constant bits for the r_address field in an
- // llvm::MachO::relocation_info structure.
- R_SCATTERED = 0x80000000
- };
-
- enum RelocationInfoType {
- // Constant values for the r_type field in an
- // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
- // structure.
- GENERIC_RELOC_VANILLA = 0,
- GENERIC_RELOC_PAIR = 1,
- GENERIC_RELOC_SECTDIFF = 2,
- GENERIC_RELOC_PB_LA_PTR = 3,
- GENERIC_RELOC_LOCAL_SECTDIFF = 4,
- GENERIC_RELOC_TLV = 5,
-
- // Constant values for the r_type field in a PowerPC architecture
- // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
- // structure.
- PPC_RELOC_VANILLA = GENERIC_RELOC_VANILLA,
- PPC_RELOC_PAIR = GENERIC_RELOC_PAIR,
- PPC_RELOC_BR14 = 2,
- PPC_RELOC_BR24 = 3,
- PPC_RELOC_HI16 = 4,
- PPC_RELOC_LO16 = 5,
- PPC_RELOC_HA16 = 6,
- PPC_RELOC_LO14 = 7,
- PPC_RELOC_SECTDIFF = 8,
- PPC_RELOC_PB_LA_PTR = 9,
- PPC_RELOC_HI16_SECTDIFF = 10,
- PPC_RELOC_LO16_SECTDIFF = 11,
- PPC_RELOC_HA16_SECTDIFF = 12,
- PPC_RELOC_JBSR = 13,
- PPC_RELOC_LO14_SECTDIFF = 14,
- PPC_RELOC_LOCAL_SECTDIFF = 15,
-
- // Constant values for the r_type field in an ARM architecture
- // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
- // structure.
- ARM_RELOC_VANILLA = GENERIC_RELOC_VANILLA,
- ARM_RELOC_PAIR = GENERIC_RELOC_PAIR,
- ARM_RELOC_SECTDIFF = GENERIC_RELOC_SECTDIFF,
- ARM_RELOC_LOCAL_SECTDIFF = 3,
- ARM_RELOC_PB_LA_PTR = 4,
- ARM_RELOC_BR24 = 5,
- ARM_THUMB_RELOC_BR22 = 6,
- ARM_THUMB_32BIT_BRANCH = 7, // obsolete
- ARM_RELOC_HALF = 8,
- ARM_RELOC_HALF_SECTDIFF = 9,
-
- // Constant values for the r_type field in an ARM64 architecture
- // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
- // structure.
-
- // For pointers.
- ARM64_RELOC_UNSIGNED = 0,
- // Must be followed by an ARM64_RELOC_UNSIGNED
- ARM64_RELOC_SUBTRACTOR = 1,
- // A B/BL instruction with 26-bit displacement.
- ARM64_RELOC_BRANCH26 = 2,
- // PC-rel distance to page of target.
- ARM64_RELOC_PAGE21 = 3,
- // Offset within page, scaled by r_length.
- ARM64_RELOC_PAGEOFF12 = 4,
- // PC-rel distance to page of GOT slot.
- ARM64_RELOC_GOT_LOAD_PAGE21 = 5,
- // Offset within page of GOT slot, scaled by r_length.
- ARM64_RELOC_GOT_LOAD_PAGEOFF12 = 6,
- // For pointers to GOT slots.
- ARM64_RELOC_POINTER_TO_GOT = 7,
- // PC-rel distance to page of TLVP slot.
- ARM64_RELOC_TLVP_LOAD_PAGE21 = 8,
- // Offset within page of TLVP slot, scaled by r_length.
- ARM64_RELOC_TLVP_LOAD_PAGEOFF12 = 9,
- // Must be followed by ARM64_RELOC_PAGE21 or ARM64_RELOC_PAGEOFF12.
- ARM64_RELOC_ADDEND = 10,
-
- // Constant values for the r_type field in an x86_64 architecture
- // llvm::MachO::relocation_info or llvm::MachO::scattered_relocation_info
- // structure
- X86_64_RELOC_UNSIGNED = 0,
- X86_64_RELOC_SIGNED = 1,
- X86_64_RELOC_BRANCH = 2,
- X86_64_RELOC_GOT_LOAD = 3,
- X86_64_RELOC_GOT = 4,
- X86_64_RELOC_SUBTRACTOR = 5,
- X86_64_RELOC_SIGNED_1 = 6,
- X86_64_RELOC_SIGNED_2 = 7,
- X86_64_RELOC_SIGNED_4 = 8,
- X86_64_RELOC_TLV = 9
- };
-
- // Values for segment_command.initprot.
- // From <mach/vm_prot.h>
- enum {
- VM_PROT_READ = 0x1,
- VM_PROT_WRITE = 0x2,
- VM_PROT_EXECUTE = 0x4
- };
-
- // Values for platform field in build_version_command.
- enum {
- PLATFORM_MACOS = 1,
- PLATFORM_IOS = 2,
- PLATFORM_TVOS = 3,
- PLATFORM_WATCHOS = 4,
- PLATFORM_BRIDGEOS = 5
- };
-
- // Values for tools enum in build_tool_version.
- enum {
- TOOL_CLANG = 1,
- TOOL_SWIFT = 2,
- TOOL_LD = 3
- };
-
- // Structs from <mach-o/loader.h>
-
- struct mach_header {
- uint32_t magic;
- uint32_t cputype;
- uint32_t cpusubtype;
- uint32_t filetype;
- uint32_t ncmds;
- uint32_t sizeofcmds;
- uint32_t flags;
- };
-
- struct mach_header_64 {
- uint32_t magic;
- uint32_t cputype;
- uint32_t cpusubtype;
- uint32_t filetype;
- uint32_t ncmds;
- uint32_t sizeofcmds;
- uint32_t flags;
- uint32_t reserved;
- };
-
- struct load_command {
- uint32_t cmd;
- uint32_t cmdsize;
- };
-
- struct segment_command {
- uint32_t cmd;
- uint32_t cmdsize;
- char segname[16];
- uint32_t vmaddr;
- uint32_t vmsize;
- uint32_t fileoff;
- uint32_t filesize;
- uint32_t maxprot;
- uint32_t initprot;
- uint32_t nsects;
- uint32_t flags;
- };
-
- struct segment_command_64 {
- uint32_t cmd;
- uint32_t cmdsize;
- char segname[16];
- uint64_t vmaddr;
- uint64_t vmsize;
- uint64_t fileoff;
- uint64_t filesize;
- uint32_t maxprot;
- uint32_t initprot;
- uint32_t nsects;
- uint32_t flags;
- };
-
- struct section {
- char sectname[16];
- char segname[16];
- uint32_t addr;
- uint32_t size;
- uint32_t offset;
- uint32_t align;
- uint32_t reloff;
- uint32_t nreloc;
- uint32_t flags;
- uint32_t reserved1;
- uint32_t reserved2;
- };
-
- struct section_64 {
- char sectname[16];
- char segname[16];
- uint64_t addr;
- uint64_t size;
- uint32_t offset;
- uint32_t align;
- uint32_t reloff;
- uint32_t nreloc;
- uint32_t flags;
- uint32_t reserved1;
- uint32_t reserved2;
- uint32_t reserved3;
- };
-
- struct fvmlib {
- uint32_t name;
- uint32_t minor_version;
- uint32_t header_addr;
- };
-
- // The fvmlib_command is obsolete and no longer supported.
- struct fvmlib_command {
- uint32_t cmd;
- uint32_t cmdsize;
- struct fvmlib fvmlib;
- };
-
- struct dylib {
- uint32_t name;
- uint32_t timestamp;
- uint32_t current_version;
- uint32_t compatibility_version;
- };
-
- struct dylib_command {
- uint32_t cmd;
- uint32_t cmdsize;
- struct dylib dylib;
- };
-
- struct sub_framework_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t umbrella;
- };
-
- struct sub_client_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t client;
- };
-
- struct sub_umbrella_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t sub_umbrella;
- };
-
- struct sub_library_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t sub_library;
- };
-
- // The prebound_dylib_command is obsolete and no longer supported.
- struct prebound_dylib_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t name;
- uint32_t nmodules;
- uint32_t linked_modules;
- };
-
- struct dylinker_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t name;
- };
-
- struct thread_command {
- uint32_t cmd;
- uint32_t cmdsize;
- };
-
- struct routines_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t init_address;
- uint32_t init_module;
- uint32_t reserved1;
- uint32_t reserved2;
- uint32_t reserved3;
- uint32_t reserved4;
- uint32_t reserved5;
- uint32_t reserved6;
- };
-
- struct routines_command_64 {
- uint32_t cmd;
- uint32_t cmdsize;
- uint64_t init_address;
- uint64_t init_module;
- uint64_t reserved1;
- uint64_t reserved2;
- uint64_t reserved3;
- uint64_t reserved4;
- uint64_t reserved5;
- uint64_t reserved6;
- };
-
- struct symtab_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t symoff;
- uint32_t nsyms;
- uint32_t stroff;
- uint32_t strsize;
- };
-
- struct dysymtab_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t ilocalsym;
- uint32_t nlocalsym;
- uint32_t iextdefsym;
- uint32_t nextdefsym;
- uint32_t iundefsym;
- uint32_t nundefsym;
- uint32_t tocoff;
- uint32_t ntoc;
- uint32_t modtaboff;
- uint32_t nmodtab;
- uint32_t extrefsymoff;
- uint32_t nextrefsyms;
- uint32_t indirectsymoff;
- uint32_t nindirectsyms;
- uint32_t extreloff;
- uint32_t nextrel;
- uint32_t locreloff;
- uint32_t nlocrel;
- };
-
- struct dylib_table_of_contents {
- uint32_t symbol_index;
- uint32_t module_index;
- };
-
- struct dylib_module {
- uint32_t module_name;
- uint32_t iextdefsym;
- uint32_t nextdefsym;
- uint32_t irefsym;
- uint32_t nrefsym;
- uint32_t ilocalsym;
- uint32_t nlocalsym;
- uint32_t iextrel;
- uint32_t nextrel;
- uint32_t iinit_iterm;
- uint32_t ninit_nterm;
- uint32_t objc_module_info_addr;
- uint32_t objc_module_info_size;
- };
-
- struct dylib_module_64 {
- uint32_t module_name;
- uint32_t iextdefsym;
- uint32_t nextdefsym;
- uint32_t irefsym;
- uint32_t nrefsym;
- uint32_t ilocalsym;
- uint32_t nlocalsym;
- uint32_t iextrel;
- uint32_t nextrel;
- uint32_t iinit_iterm;
- uint32_t ninit_nterm;
- uint32_t objc_module_info_size;
- uint64_t objc_module_info_addr;
- };
-
- struct dylib_reference {
- uint32_t isym:24,
- flags:8;
- };
-
- // The twolevel_hints_command is obsolete and no longer supported.
- struct twolevel_hints_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t offset;
- uint32_t nhints;
- };
-
- // The twolevel_hints_command is obsolete and no longer supported.
- struct twolevel_hint {
- uint32_t isub_image:8,
- itoc:24;
- };
-
- // The prebind_cksum_command is obsolete and no longer supported.
- struct prebind_cksum_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t cksum;
- };
-
- struct uuid_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint8_t uuid[16];
- };
-
- struct rpath_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t path;
- };
-
- struct linkedit_data_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t dataoff;
- uint32_t datasize;
- };
-
- struct data_in_code_entry {
- uint32_t offset;
- uint16_t length;
- uint16_t kind;
- };
-
- struct source_version_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint64_t version;
- };
-
- struct encryption_info_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t cryptoff;
- uint32_t cryptsize;
- uint32_t cryptid;
- };
-
- struct encryption_info_command_64 {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t cryptoff;
- uint32_t cryptsize;
- uint32_t cryptid;
- uint32_t pad;
- };
-
- struct version_min_command {
- uint32_t cmd; // LC_VERSION_MIN_MACOSX or
- // LC_VERSION_MIN_IPHONEOS
- uint32_t cmdsize; // sizeof(struct version_min_command)
- uint32_t version; // X.Y.Z is encoded in nibbles xxxx.yy.zz
- uint32_t sdk; // X.Y.Z is encoded in nibbles xxxx.yy.zz
- };
-
- struct note_command {
- uint32_t cmd; // LC_NOTE
- uint32_t cmdsize; // sizeof(struct note_command)
- char data_owner[16]; // owner name for this LC_NOTE
- uint64_t offset; // file offset of this data
- uint64_t size; // length of data region
- };
-
- struct build_tool_version {
- uint32_t tool; // enum for the tool
- uint32_t version; // version of the tool
- };
-
- struct build_version_command {
- uint32_t cmd; // LC_BUILD_VERSION
- uint32_t cmdsize; // sizeof(struct build_version_command) +
- // ntools * sizeof(struct build_tool_version)
- uint32_t platform; // platform
- uint32_t minos; // X.Y.Z is encoded in nibbles xxxx.yy.zz
- uint32_t sdk; // X.Y.Z is encoded in nibbles xxxx.yy.zz
- uint32_t ntools; // number of tool entries following this
- };
-
- struct dyld_info_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t rebase_off;
- uint32_t rebase_size;
- uint32_t bind_off;
- uint32_t bind_size;
- uint32_t weak_bind_off;
- uint32_t weak_bind_size;
- uint32_t lazy_bind_off;
- uint32_t lazy_bind_size;
- uint32_t export_off;
- uint32_t export_size;
- };
-
- struct linker_option_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t count;
- };
-
- // The symseg_command is obsolete and no longer supported.
- struct symseg_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t offset;
- uint32_t size;
- };
-
- // The ident_command is obsolete and no longer supported.
- struct ident_command {
- uint32_t cmd;
- uint32_t cmdsize;
- };
-
- // The fvmfile_command is obsolete and no longer supported.
- struct fvmfile_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint32_t name;
- uint32_t header_addr;
- };
-
- struct tlv_descriptor_32 {
- uint32_t thunk;
- uint32_t key;
- uint32_t offset;
- };
-
- struct tlv_descriptor_64 {
- uint64_t thunk;
- uint64_t key;
- uint64_t offset;
- };
-
- struct tlv_descriptor {
- uintptr_t thunk;
- uintptr_t key;
- uintptr_t offset;
- };
-
- struct entry_point_command {
- uint32_t cmd;
- uint32_t cmdsize;
- uint64_t entryoff;
- uint64_t stacksize;
- };
-
- // Structs from <mach-o/fat.h>
- struct fat_header {
- uint32_t magic;
- uint32_t nfat_arch;
- };
-
- struct fat_arch {
- uint32_t cputype;
- uint32_t cpusubtype;
- uint32_t offset;
- uint32_t size;
- uint32_t align;
- };
-
- struct fat_arch_64 {
- uint32_t cputype;
- uint32_t cpusubtype;
- uint64_t offset;
- uint64_t size;
- uint32_t align;
- uint32_t reserved;
- };
-
- // Structs from <mach-o/reloc.h>
- struct relocation_info {
- int32_t r_address;
- uint32_t r_symbolnum:24,
- r_pcrel:1,
- r_length:2,
- r_extern:1,
- r_type:4;
- };
-
- struct scattered_relocation_info {
-#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && (BYTE_ORDER == BIG_ENDIAN)
- uint32_t r_scattered:1,
- r_pcrel:1,
- r_length:2,
- r_type:4,
- r_address:24;
-#else
- uint32_t r_address:24,
- r_type:4,
- r_length:2,
- r_pcrel:1,
- r_scattered:1;
-#endif
- int32_t r_value;
- };
-
- // Structs NOT from <mach-o/reloc.h>, but that make LLVM's life easier
- struct any_relocation_info {
- uint32_t r_word0, r_word1;
- };
-
- // Structs from <mach-o/nlist.h>
- struct nlist_base {
- uint32_t n_strx;
- uint8_t n_type;
- uint8_t n_sect;
- uint16_t n_desc;
- };
-
- struct nlist {
- uint32_t n_strx;
- uint8_t n_type;
- uint8_t n_sect;
- int16_t n_desc;
- uint32_t n_value;
- };
-
- struct nlist_64 {
- uint32_t n_strx;
- uint8_t n_type;
- uint8_t n_sect;
- uint16_t n_desc;
- uint64_t n_value;
- };
-
- // Byte order swapping functions for MachO structs
-
- inline void swapStruct(fat_header &mh) {
- sys::swapByteOrder(mh.magic);
- sys::swapByteOrder(mh.nfat_arch);
- }
-
- inline void swapStruct(fat_arch &mh) {
- sys::swapByteOrder(mh.cputype);
- sys::swapByteOrder(mh.cpusubtype);
- sys::swapByteOrder(mh.offset);
- sys::swapByteOrder(mh.size);
- sys::swapByteOrder(mh.align);
- }
-
- inline void swapStruct(fat_arch_64 &mh) {
- sys::swapByteOrder(mh.cputype);
- sys::swapByteOrder(mh.cpusubtype);
- sys::swapByteOrder(mh.offset);
- sys::swapByteOrder(mh.size);
- sys::swapByteOrder(mh.align);
- sys::swapByteOrder(mh.reserved);
- }
-
- inline void swapStruct(mach_header &mh) {
- sys::swapByteOrder(mh.magic);
- sys::swapByteOrder(mh.cputype);
- sys::swapByteOrder(mh.cpusubtype);
- sys::swapByteOrder(mh.filetype);
- sys::swapByteOrder(mh.ncmds);
- sys::swapByteOrder(mh.sizeofcmds);
- sys::swapByteOrder(mh.flags);
- }
-
- inline void swapStruct(mach_header_64 &H) {
- sys::swapByteOrder(H.magic);
- sys::swapByteOrder(H.cputype);
- sys::swapByteOrder(H.cpusubtype);
- sys::swapByteOrder(H.filetype);
- sys::swapByteOrder(H.ncmds);
- sys::swapByteOrder(H.sizeofcmds);
- sys::swapByteOrder(H.flags);
- sys::swapByteOrder(H.reserved);
- }
-
- inline void swapStruct(load_command &lc) {
- sys::swapByteOrder(lc.cmd);
- sys::swapByteOrder(lc.cmdsize);
- }
-
- inline void swapStruct(symtab_command &lc) {
- sys::swapByteOrder(lc.cmd);
- sys::swapByteOrder(lc.cmdsize);
- sys::swapByteOrder(lc.symoff);
- sys::swapByteOrder(lc.nsyms);
- sys::swapByteOrder(lc.stroff);
- sys::swapByteOrder(lc.strsize);
- }
-
- inline void swapStruct(segment_command_64 &seg) {
- sys::swapByteOrder(seg.cmd);
- sys::swapByteOrder(seg.cmdsize);
- sys::swapByteOrder(seg.vmaddr);
- sys::swapByteOrder(seg.vmsize);
- sys::swapByteOrder(seg.fileoff);
- sys::swapByteOrder(seg.filesize);
- sys::swapByteOrder(seg.maxprot);
- sys::swapByteOrder(seg.initprot);
- sys::swapByteOrder(seg.nsects);
- sys::swapByteOrder(seg.flags);
- }
-
- inline void swapStruct(segment_command &seg) {
- sys::swapByteOrder(seg.cmd);
- sys::swapByteOrder(seg.cmdsize);
- sys::swapByteOrder(seg.vmaddr);
- sys::swapByteOrder(seg.vmsize);
- sys::swapByteOrder(seg.fileoff);
- sys::swapByteOrder(seg.filesize);
- sys::swapByteOrder(seg.maxprot);
- sys::swapByteOrder(seg.initprot);
- sys::swapByteOrder(seg.nsects);
- sys::swapByteOrder(seg.flags);
- }
-
- inline void swapStruct(section_64 §) {
- sys::swapByteOrder(sect.addr);
- sys::swapByteOrder(sect.size);
- sys::swapByteOrder(sect.offset);
- sys::swapByteOrder(sect.align);
- sys::swapByteOrder(sect.reloff);
- sys::swapByteOrder(sect.nreloc);
- sys::swapByteOrder(sect.flags);
- sys::swapByteOrder(sect.reserved1);
- sys::swapByteOrder(sect.reserved2);
- }
-
- inline void swapStruct(section §) {
- sys::swapByteOrder(sect.addr);
- sys::swapByteOrder(sect.size);
- sys::swapByteOrder(sect.offset);
- sys::swapByteOrder(sect.align);
- sys::swapByteOrder(sect.reloff);
- sys::swapByteOrder(sect.nreloc);
- sys::swapByteOrder(sect.flags);
- sys::swapByteOrder(sect.reserved1);
- sys::swapByteOrder(sect.reserved2);
- }
-
- inline void swapStruct(dyld_info_command &info) {
- sys::swapByteOrder(info.cmd);
- sys::swapByteOrder(info.cmdsize);
- sys::swapByteOrder(info.rebase_off);
- sys::swapByteOrder(info.rebase_size);
- sys::swapByteOrder(info.bind_off);
- sys::swapByteOrder(info.bind_size);
- sys::swapByteOrder(info.weak_bind_off);
- sys::swapByteOrder(info.weak_bind_size);
- sys::swapByteOrder(info.lazy_bind_off);
- sys::swapByteOrder(info.lazy_bind_size);
- sys::swapByteOrder(info.export_off);
- sys::swapByteOrder(info.export_size);
- }
-
- inline void swapStruct(dylib_command &d) {
- sys::swapByteOrder(d.cmd);
- sys::swapByteOrder(d.cmdsize);
- sys::swapByteOrder(d.dylib.name);
- sys::swapByteOrder(d.dylib.timestamp);
- sys::swapByteOrder(d.dylib.current_version);
- sys::swapByteOrder(d.dylib.compatibility_version);
- }
-
- inline void swapStruct(sub_framework_command &s) {
- sys::swapByteOrder(s.cmd);
- sys::swapByteOrder(s.cmdsize);
- sys::swapByteOrder(s.umbrella);
- }
-
- inline void swapStruct(sub_umbrella_command &s) {
- sys::swapByteOrder(s.cmd);
- sys::swapByteOrder(s.cmdsize);
- sys::swapByteOrder(s.sub_umbrella);
- }
-
- inline void swapStruct(sub_library_command &s) {
- sys::swapByteOrder(s.cmd);
- sys::swapByteOrder(s.cmdsize);
- sys::swapByteOrder(s.sub_library);
- }
-
- inline void swapStruct(sub_client_command &s) {
- sys::swapByteOrder(s.cmd);
- sys::swapByteOrder(s.cmdsize);
- sys::swapByteOrder(s.client);
- }
-
- inline void swapStruct(routines_command &r) {
- sys::swapByteOrder(r.cmd);
- sys::swapByteOrder(r.cmdsize);
- sys::swapByteOrder(r.init_address);
- sys::swapByteOrder(r.init_module);
- sys::swapByteOrder(r.reserved1);
- sys::swapByteOrder(r.reserved2);
- sys::swapByteOrder(r.reserved3);
- sys::swapByteOrder(r.reserved4);
- sys::swapByteOrder(r.reserved5);
- sys::swapByteOrder(r.reserved6);
- }
-
- inline void swapStruct(routines_command_64 &r) {
- sys::swapByteOrder(r.cmd);
- sys::swapByteOrder(r.cmdsize);
- sys::swapByteOrder(r.init_address);
- sys::swapByteOrder(r.init_module);
- sys::swapByteOrder(r.reserved1);
- sys::swapByteOrder(r.reserved2);
- sys::swapByteOrder(r.reserved3);
- sys::swapByteOrder(r.reserved4);
- sys::swapByteOrder(r.reserved5);
- sys::swapByteOrder(r.reserved6);
- }
-
- inline void swapStruct(thread_command &t) {
- sys::swapByteOrder(t.cmd);
- sys::swapByteOrder(t.cmdsize);
- }
-
- inline void swapStruct(dylinker_command &d) {
- sys::swapByteOrder(d.cmd);
- sys::swapByteOrder(d.cmdsize);
- sys::swapByteOrder(d.name);
- }
-
- inline void swapStruct(uuid_command &u) {
- sys::swapByteOrder(u.cmd);
- sys::swapByteOrder(u.cmdsize);
- }
-
- inline void swapStruct(rpath_command &r) {
- sys::swapByteOrder(r.cmd);
- sys::swapByteOrder(r.cmdsize);
- sys::swapByteOrder(r.path);
- }
-
- inline void swapStruct(source_version_command &s) {
- sys::swapByteOrder(s.cmd);
- sys::swapByteOrder(s.cmdsize);
- sys::swapByteOrder(s.version);
- }
-
- inline void swapStruct(entry_point_command &e) {
- sys::swapByteOrder(e.cmd);
- sys::swapByteOrder(e.cmdsize);
- sys::swapByteOrder(e.entryoff);
- sys::swapByteOrder(e.stacksize);
- }
-
- inline void swapStruct(encryption_info_command &e) {
- sys::swapByteOrder(e.cmd);
- sys::swapByteOrder(e.cmdsize);
- sys::swapByteOrder(e.cryptoff);
- sys::swapByteOrder(e.cryptsize);
- sys::swapByteOrder(e.cryptid);
- }
-
- inline void swapStruct(encryption_info_command_64 &e) {
- sys::swapByteOrder(e.cmd);
- sys::swapByteOrder(e.cmdsize);
- sys::swapByteOrder(e.cryptoff);
- sys::swapByteOrder(e.cryptsize);
- sys::swapByteOrder(e.cryptid);
- sys::swapByteOrder(e.pad);
- }
-
- inline void swapStruct(dysymtab_command &dst) {
- sys::swapByteOrder(dst.cmd);
- sys::swapByteOrder(dst.cmdsize);
- sys::swapByteOrder(dst.ilocalsym);
- sys::swapByteOrder(dst.nlocalsym);
- sys::swapByteOrder(dst.iextdefsym);
- sys::swapByteOrder(dst.nextdefsym);
- sys::swapByteOrder(dst.iundefsym);
- sys::swapByteOrder(dst.nundefsym);
- sys::swapByteOrder(dst.tocoff);
- sys::swapByteOrder(dst.ntoc);
- sys::swapByteOrder(dst.modtaboff);
- sys::swapByteOrder(dst.nmodtab);
- sys::swapByteOrder(dst.extrefsymoff);
- sys::swapByteOrder(dst.nextrefsyms);
- sys::swapByteOrder(dst.indirectsymoff);
- sys::swapByteOrder(dst.nindirectsyms);
- sys::swapByteOrder(dst.extreloff);
- sys::swapByteOrder(dst.nextrel);
- sys::swapByteOrder(dst.locreloff);
- sys::swapByteOrder(dst.nlocrel);
- }
-
- inline void swapStruct(any_relocation_info &reloc) {
- sys::swapByteOrder(reloc.r_word0);
- sys::swapByteOrder(reloc.r_word1);
- }
-
- inline void swapStruct(nlist_base &S) {
- sys::swapByteOrder(S.n_strx);
- sys::swapByteOrder(S.n_desc);
- }
-
- inline void swapStruct(nlist &sym) {
- sys::swapByteOrder(sym.n_strx);
- sys::swapByteOrder(sym.n_desc);
- sys::swapByteOrder(sym.n_value);
- }
-
- inline void swapStruct(nlist_64 &sym) {
- sys::swapByteOrder(sym.n_strx);
- sys::swapByteOrder(sym.n_desc);
- sys::swapByteOrder(sym.n_value);
- }
-
- inline void swapStruct(linkedit_data_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.dataoff);
- sys::swapByteOrder(C.datasize);
- }
-
- inline void swapStruct(linker_option_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.count);
- }
-
- inline void swapStruct(version_min_command&C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.version);
- sys::swapByteOrder(C.sdk);
- }
-
- inline void swapStruct(note_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.offset);
- sys::swapByteOrder(C.size);
- }
-
- inline void swapStruct(build_version_command&C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.platform);
- sys::swapByteOrder(C.minos);
- sys::swapByteOrder(C.sdk);
- sys::swapByteOrder(C.ntools);
- }
-
- inline void swapStruct(build_tool_version&C) {
- sys::swapByteOrder(C.tool);
- sys::swapByteOrder(C.version);
- }
-
- inline void swapStruct(data_in_code_entry &C) {
- sys::swapByteOrder(C.offset);
- sys::swapByteOrder(C.length);
- sys::swapByteOrder(C.kind);
- }
-
- inline void swapStruct(uint32_t &C) {
- sys::swapByteOrder(C);
- }
-
- // The prebind_cksum_command is obsolete and no longer supported.
- inline void swapStruct(prebind_cksum_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.cksum);
- }
-
- // The twolevel_hints_command is obsolete and no longer supported.
- inline void swapStruct(twolevel_hints_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.offset);
- sys::swapByteOrder(C.nhints);
- }
-
- // The prebound_dylib_command is obsolete and no longer supported.
- inline void swapStruct(prebound_dylib_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.name);
- sys::swapByteOrder(C.nmodules);
- sys::swapByteOrder(C.linked_modules);
- }
-
- // The fvmfile_command is obsolete and no longer supported.
- inline void swapStruct(fvmfile_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.name);
- sys::swapByteOrder(C.header_addr);
- }
-
- // The symseg_command is obsolete and no longer supported.
- inline void swapStruct(symseg_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- sys::swapByteOrder(C.offset);
- sys::swapByteOrder(C.size);
- }
-
- // The ident_command is obsolete and no longer supported.
- inline void swapStruct(ident_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- }
-
- inline void swapStruct(fvmlib &C) {
- sys::swapByteOrder(C.name);
- sys::swapByteOrder(C.minor_version);
- sys::swapByteOrder(C.header_addr);
- }
-
- // The fvmlib_command is obsolete and no longer supported.
- inline void swapStruct(fvmlib_command &C) {
- sys::swapByteOrder(C.cmd);
- sys::swapByteOrder(C.cmdsize);
- swapStruct(C.fvmlib);
- }
-
- // Get/Set functions from <mach-o/nlist.h>
-
- static inline uint16_t GET_LIBRARY_ORDINAL(uint16_t n_desc) {
- return (((n_desc) >> 8u) & 0xffu);
- }
-
- static inline void SET_LIBRARY_ORDINAL(uint16_t &n_desc, uint8_t ordinal) {
- n_desc = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8));
- }
-
- static inline uint8_t GET_COMM_ALIGN (uint16_t n_desc) {
- return (n_desc >> 8u) & 0x0fu;
- }
-
- static inline void SET_COMM_ALIGN (uint16_t &n_desc, uint8_t align) {
- n_desc = ((n_desc & 0xf0ffu) | ((align & 0x0fu) << 8u));
- }
-
- // Enums from <mach/machine.h>
- enum : uint32_t {
- // Capability bits used in the definition of cpu_type.
- CPU_ARCH_MASK = 0xff000000, // Mask for architecture bits
- CPU_ARCH_ABI64 = 0x01000000 // 64 bit ABI
- };
-
- // Constants for the cputype field.
- enum CPUType {
- CPU_TYPE_ANY = -1,
- CPU_TYPE_X86 = 7,
- CPU_TYPE_I386 = CPU_TYPE_X86,
- CPU_TYPE_X86_64 = CPU_TYPE_X86 | CPU_ARCH_ABI64,
- /* CPU_TYPE_MIPS = 8, */
- CPU_TYPE_MC98000 = 10, // Old Motorola PowerPC
- CPU_TYPE_ARM = 12,
- CPU_TYPE_ARM64 = CPU_TYPE_ARM | CPU_ARCH_ABI64,
- CPU_TYPE_SPARC = 14,
- CPU_TYPE_POWERPC = 18,
- CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC | CPU_ARCH_ABI64
- };
-
- enum : uint32_t {
- // Capability bits used in the definition of cpusubtype.
- CPU_SUBTYPE_MASK = 0xff000000, // Mask for architecture bits
- CPU_SUBTYPE_LIB64 = 0x80000000, // 64 bit libraries
-
- // Special CPU subtype constants.
- CPU_SUBTYPE_MULTIPLE = ~0u
- };
-
- // Constants for the cpusubtype field.
- enum CPUSubTypeX86 {
- CPU_SUBTYPE_I386_ALL = 3,
- CPU_SUBTYPE_386 = 3,
- CPU_SUBTYPE_486 = 4,
- CPU_SUBTYPE_486SX = 0x84,
- CPU_SUBTYPE_586 = 5,
- CPU_SUBTYPE_PENT = CPU_SUBTYPE_586,
- CPU_SUBTYPE_PENTPRO = 0x16,
- CPU_SUBTYPE_PENTII_M3 = 0x36,
- CPU_SUBTYPE_PENTII_M5 = 0x56,
- CPU_SUBTYPE_CELERON = 0x67,
- CPU_SUBTYPE_CELERON_MOBILE = 0x77,
- CPU_SUBTYPE_PENTIUM_3 = 0x08,
- CPU_SUBTYPE_PENTIUM_3_M = 0x18,
- CPU_SUBTYPE_PENTIUM_3_XEON = 0x28,
- CPU_SUBTYPE_PENTIUM_M = 0x09,
- CPU_SUBTYPE_PENTIUM_4 = 0x0a,
- CPU_SUBTYPE_PENTIUM_4_M = 0x1a,
- CPU_SUBTYPE_ITANIUM = 0x0b,
- CPU_SUBTYPE_ITANIUM_2 = 0x1b,
- CPU_SUBTYPE_XEON = 0x0c,
- CPU_SUBTYPE_XEON_MP = 0x1c,
-
- CPU_SUBTYPE_X86_ALL = 3,
- CPU_SUBTYPE_X86_64_ALL = 3,
- CPU_SUBTYPE_X86_ARCH1 = 4,
- CPU_SUBTYPE_X86_64_H = 8
- };
- static inline int CPU_SUBTYPE_INTEL(int Family, int Model) {
- return Family | (Model << 4);
- }
- static inline int CPU_SUBTYPE_INTEL_FAMILY(CPUSubTypeX86 ST) {
- return ((int)ST) & 0x0f;
- }
- static inline int CPU_SUBTYPE_INTEL_MODEL(CPUSubTypeX86 ST) {
- return ((int)ST) >> 4;
- }
- enum {
- CPU_SUBTYPE_INTEL_FAMILY_MAX = 15,
- CPU_SUBTYPE_INTEL_MODEL_ALL = 0
- };
-
- enum CPUSubTypeARM {
- CPU_SUBTYPE_ARM_ALL = 0,
- CPU_SUBTYPE_ARM_V4T = 5,
- CPU_SUBTYPE_ARM_V6 = 6,
- CPU_SUBTYPE_ARM_V5 = 7,
- CPU_SUBTYPE_ARM_V5TEJ = 7,
- CPU_SUBTYPE_ARM_XSCALE = 8,
- CPU_SUBTYPE_ARM_V7 = 9,
- // unused ARM_V7F = 10,
- CPU_SUBTYPE_ARM_V7S = 11,
- CPU_SUBTYPE_ARM_V7K = 12,
- CPU_SUBTYPE_ARM_V6M = 14,
- CPU_SUBTYPE_ARM_V7M = 15,
- CPU_SUBTYPE_ARM_V7EM = 16
- };
-
- enum CPUSubTypeARM64 {
- CPU_SUBTYPE_ARM64_ALL = 0
- };
-
- enum CPUSubTypeSPARC {
- CPU_SUBTYPE_SPARC_ALL = 0
- };
-
- enum CPUSubTypePowerPC {
- CPU_SUBTYPE_POWERPC_ALL = 0,
- CPU_SUBTYPE_POWERPC_601 = 1,
- CPU_SUBTYPE_POWERPC_602 = 2,
- CPU_SUBTYPE_POWERPC_603 = 3,
- CPU_SUBTYPE_POWERPC_603e = 4,
- CPU_SUBTYPE_POWERPC_603ev = 5,
- CPU_SUBTYPE_POWERPC_604 = 6,
- CPU_SUBTYPE_POWERPC_604e = 7,
- CPU_SUBTYPE_POWERPC_620 = 8,
- CPU_SUBTYPE_POWERPC_750 = 9,
- CPU_SUBTYPE_POWERPC_7400 = 10,
- CPU_SUBTYPE_POWERPC_7450 = 11,
- CPU_SUBTYPE_POWERPC_970 = 100,
-
- CPU_SUBTYPE_MC980000_ALL = CPU_SUBTYPE_POWERPC_ALL,
- CPU_SUBTYPE_MC98601 = CPU_SUBTYPE_POWERPC_601
- };
-
- struct x86_thread_state32_t {
- uint32_t eax;
- uint32_t ebx;
- uint32_t ecx;
- uint32_t edx;
- uint32_t edi;
- uint32_t esi;
- uint32_t ebp;
- uint32_t esp;
- uint32_t ss;
- uint32_t eflags;
- uint32_t eip;
- uint32_t cs;
- uint32_t ds;
- uint32_t es;
- uint32_t fs;
- uint32_t gs;
- };
-
- struct x86_thread_state64_t {
- uint64_t rax;
- uint64_t rbx;
- uint64_t rcx;
- uint64_t rdx;
- uint64_t rdi;
- uint64_t rsi;
- uint64_t rbp;
- uint64_t rsp;
- uint64_t r8;
- uint64_t r9;
- uint64_t r10;
- uint64_t r11;
- uint64_t r12;
- uint64_t r13;
- uint64_t r14;
- uint64_t r15;
- uint64_t rip;
- uint64_t rflags;
- uint64_t cs;
- uint64_t fs;
- uint64_t gs;
- };
-
- enum x86_fp_control_precis {
- x86_FP_PREC_24B = 0,
- x86_FP_PREC_53B = 2,
- x86_FP_PREC_64B = 3
- };
-
- enum x86_fp_control_rc {
- x86_FP_RND_NEAR = 0,
- x86_FP_RND_DOWN = 1,
- x86_FP_RND_UP = 2,
- x86_FP_CHOP = 3
- };
-
- struct fp_control_t {
- unsigned short
- invalid :1,
- denorm :1,
- zdiv :1,
- ovrfl :1,
- undfl :1,
- precis :1,
- :2,
- pc :2,
- rc :2,
- :1,
- :3;
- };
-
- struct fp_status_t {
- unsigned short
- invalid :1,
- denorm :1,
- zdiv :1,
- ovrfl :1,
- undfl :1,
- precis :1,
- stkflt :1,
- errsumm :1,
- c0 :1,
- c1 :1,
- c2 :1,
- tos :3,
- c3 :1,
- busy :1;
- };
-
- struct mmst_reg_t {
- char mmst_reg[10];
- char mmst_rsrv[6];
- };
-
- struct xmm_reg_t {
- char xmm_reg[16];
- };
-
- struct x86_float_state64_t {
- int32_t fpu_reserved[2];
- fp_control_t fpu_fcw;
- fp_status_t fpu_fsw;
- uint8_t fpu_ftw;
- uint8_t fpu_rsrv1;
- uint16_t fpu_fop;
- uint32_t fpu_ip;
- uint16_t fpu_cs;
- uint16_t fpu_rsrv2;
- uint32_t fpu_dp;
- uint16_t fpu_ds;
- uint16_t fpu_rsrv3;
- uint32_t fpu_mxcsr;
- uint32_t fpu_mxcsrmask;
- mmst_reg_t fpu_stmm0;
- mmst_reg_t fpu_stmm1;
- mmst_reg_t fpu_stmm2;
- mmst_reg_t fpu_stmm3;
- mmst_reg_t fpu_stmm4;
- mmst_reg_t fpu_stmm5;
- mmst_reg_t fpu_stmm6;
- mmst_reg_t fpu_stmm7;
- xmm_reg_t fpu_xmm0;
- xmm_reg_t fpu_xmm1;
- xmm_reg_t fpu_xmm2;
- xmm_reg_t fpu_xmm3;
- xmm_reg_t fpu_xmm4;
- xmm_reg_t fpu_xmm5;
- xmm_reg_t fpu_xmm6;
- xmm_reg_t fpu_xmm7;
- xmm_reg_t fpu_xmm8;
- xmm_reg_t fpu_xmm9;
- xmm_reg_t fpu_xmm10;
- xmm_reg_t fpu_xmm11;
- xmm_reg_t fpu_xmm12;
- xmm_reg_t fpu_xmm13;
- xmm_reg_t fpu_xmm14;
- xmm_reg_t fpu_xmm15;
- char fpu_rsrv4[6*16];
- uint32_t fpu_reserved1;
- };
-
- struct x86_exception_state64_t {
- uint16_t trapno;
- uint16_t cpu;
- uint32_t err;
- uint64_t faultvaddr;
- };
-
- inline void swapStruct(x86_thread_state32_t &x) {
- sys::swapByteOrder(x.eax);
- sys::swapByteOrder(x.ebx);
- sys::swapByteOrder(x.ecx);
- sys::swapByteOrder(x.edx);
- sys::swapByteOrder(x.edi);
- sys::swapByteOrder(x.esi);
- sys::swapByteOrder(x.ebp);
- sys::swapByteOrder(x.esp);
- sys::swapByteOrder(x.ss);
- sys::swapByteOrder(x.eflags);
- sys::swapByteOrder(x.eip);
- sys::swapByteOrder(x.cs);
- sys::swapByteOrder(x.ds);
- sys::swapByteOrder(x.es);
- sys::swapByteOrder(x.fs);
- sys::swapByteOrder(x.gs);
- }
-
- inline void swapStruct(x86_thread_state64_t &x) {
- sys::swapByteOrder(x.rax);
- sys::swapByteOrder(x.rbx);
- sys::swapByteOrder(x.rcx);
- sys::swapByteOrder(x.rdx);
- sys::swapByteOrder(x.rdi);
- sys::swapByteOrder(x.rsi);
- sys::swapByteOrder(x.rbp);
- sys::swapByteOrder(x.rsp);
- sys::swapByteOrder(x.r8);
- sys::swapByteOrder(x.r9);
- sys::swapByteOrder(x.r10);
- sys::swapByteOrder(x.r11);
- sys::swapByteOrder(x.r12);
- sys::swapByteOrder(x.r13);
- sys::swapByteOrder(x.r14);
- sys::swapByteOrder(x.r15);
- sys::swapByteOrder(x.rip);
- sys::swapByteOrder(x.rflags);
- sys::swapByteOrder(x.cs);
- sys::swapByteOrder(x.fs);
- sys::swapByteOrder(x.gs);
- }
-
- inline void swapStruct(x86_float_state64_t &x) {
- sys::swapByteOrder(x.fpu_reserved[0]);
- sys::swapByteOrder(x.fpu_reserved[1]);
- // TODO swap: fp_control_t fpu_fcw;
- // TODO swap: fp_status_t fpu_fsw;
- sys::swapByteOrder(x.fpu_fop);
- sys::swapByteOrder(x.fpu_ip);
- sys::swapByteOrder(x.fpu_cs);
- sys::swapByteOrder(x.fpu_rsrv2);
- sys::swapByteOrder(x.fpu_dp);
- sys::swapByteOrder(x.fpu_ds);
- sys::swapByteOrder(x.fpu_rsrv3);
- sys::swapByteOrder(x.fpu_mxcsr);
- sys::swapByteOrder(x.fpu_mxcsrmask);
- sys::swapByteOrder(x.fpu_reserved1);
- }
-
- inline void swapStruct(x86_exception_state64_t &x) {
- sys::swapByteOrder(x.trapno);
- sys::swapByteOrder(x.cpu);
- sys::swapByteOrder(x.err);
- sys::swapByteOrder(x.faultvaddr);
- }
-
- struct x86_state_hdr_t {
- uint32_t flavor;
- uint32_t count;
- };
-
- struct x86_thread_state_t {
- x86_state_hdr_t tsh;
- union {
- x86_thread_state64_t ts64;
- x86_thread_state32_t ts32;
- } uts;
- };
-
- struct x86_float_state_t {
- x86_state_hdr_t fsh;
- union {
- x86_float_state64_t fs64;
- } ufs;
- };
-
- struct x86_exception_state_t {
- x86_state_hdr_t esh;
- union {
- x86_exception_state64_t es64;
- } ues;
- };
-
- inline void swapStruct(x86_state_hdr_t &x) {
- sys::swapByteOrder(x.flavor);
- sys::swapByteOrder(x.count);
- }
-
- enum X86ThreadFlavors {
- x86_THREAD_STATE32 = 1,
- x86_FLOAT_STATE32 = 2,
- x86_EXCEPTION_STATE32 = 3,
- x86_THREAD_STATE64 = 4,
- x86_FLOAT_STATE64 = 5,
- x86_EXCEPTION_STATE64 = 6,
- x86_THREAD_STATE = 7,
- x86_FLOAT_STATE = 8,
- x86_EXCEPTION_STATE = 9,
- x86_DEBUG_STATE32 = 10,
- x86_DEBUG_STATE64 = 11,
- x86_DEBUG_STATE = 12
- };
-
- inline void swapStruct(x86_thread_state_t &x) {
- swapStruct(x.tsh);
- if (x.tsh.flavor == x86_THREAD_STATE64)
- swapStruct(x.uts.ts64);
- }
-
- inline void swapStruct(x86_float_state_t &x) {
- swapStruct(x.fsh);
- if (x.fsh.flavor == x86_FLOAT_STATE64)
- swapStruct(x.ufs.fs64);
- }
-
- inline void swapStruct(x86_exception_state_t &x) {
- swapStruct(x.esh);
- if (x.esh.flavor == x86_EXCEPTION_STATE64)
- swapStruct(x.ues.es64);
- }
-
- const uint32_t x86_THREAD_STATE32_COUNT =
- sizeof(x86_thread_state32_t) / sizeof(uint32_t);
-
- const uint32_t x86_THREAD_STATE64_COUNT =
- sizeof(x86_thread_state64_t) / sizeof(uint32_t);
- const uint32_t x86_FLOAT_STATE64_COUNT =
- sizeof(x86_float_state64_t) / sizeof(uint32_t);
- const uint32_t x86_EXCEPTION_STATE64_COUNT =
- sizeof(x86_exception_state64_t) / sizeof(uint32_t);
-
- const uint32_t x86_THREAD_STATE_COUNT =
- sizeof(x86_thread_state_t) / sizeof(uint32_t);
- const uint32_t x86_FLOAT_STATE_COUNT =
- sizeof(x86_float_state_t) / sizeof(uint32_t);
- const uint32_t x86_EXCEPTION_STATE_COUNT =
- sizeof(x86_exception_state_t) / sizeof(uint32_t);
-
- struct arm_thread_state32_t {
- uint32_t r[13];
- uint32_t sp;
- uint32_t lr;
- uint32_t pc;
- uint32_t cpsr;
- };
-
- inline void swapStruct(arm_thread_state32_t &x) {
- for (int i = 0; i < 13; i++)
- sys::swapByteOrder(x.r[i]);
- sys::swapByteOrder(x.sp);
- sys::swapByteOrder(x.lr);
- sys::swapByteOrder(x.pc);
- sys::swapByteOrder(x.cpsr);
- }
-
- struct arm_thread_state64_t {
- uint64_t x[29];
- uint64_t fp;
- uint64_t lr;
- uint64_t sp;
- uint64_t pc;
- uint32_t cpsr;
- uint32_t pad;
- };
-
- inline void swapStruct(arm_thread_state64_t &x) {
- for (int i = 0; i < 29; i++)
- sys::swapByteOrder(x.x[i]);
- sys::swapByteOrder(x.fp);
- sys::swapByteOrder(x.lr);
- sys::swapByteOrder(x.sp);
- sys::swapByteOrder(x.pc);
- sys::swapByteOrder(x.cpsr);
- }
-
- struct arm_state_hdr_t {
- uint32_t flavor;
- uint32_t count;
- };
-
- struct arm_thread_state_t {
- arm_state_hdr_t tsh;
- union {
- arm_thread_state32_t ts32;
- } uts;
- };
-
- inline void swapStruct(arm_state_hdr_t &x) {
- sys::swapByteOrder(x.flavor);
- sys::swapByteOrder(x.count);
- }
-
- enum ARMThreadFlavors {
- ARM_THREAD_STATE = 1,
- ARM_VFP_STATE = 2,
- ARM_EXCEPTION_STATE = 3,
- ARM_DEBUG_STATE = 4,
- ARN_THREAD_STATE_NONE = 5,
- ARM_THREAD_STATE64 = 6,
- ARM_EXCEPTION_STATE64 = 7
- };
-
- inline void swapStruct(arm_thread_state_t &x) {
- swapStruct(x.tsh);
- if (x.tsh.flavor == ARM_THREAD_STATE)
- swapStruct(x.uts.ts32);
- }
-
- const uint32_t ARM_THREAD_STATE_COUNT =
- sizeof(arm_thread_state32_t) / sizeof(uint32_t);
-
- const uint32_t ARM_THREAD_STATE64_COUNT =
- sizeof(arm_thread_state64_t) / sizeof(uint32_t);
-
- struct ppc_thread_state32_t {
- uint32_t srr0;
- uint32_t srr1;
- uint32_t r0;
- uint32_t r1;
- uint32_t r2;
- uint32_t r3;
- uint32_t r4;
- uint32_t r5;
- uint32_t r6;
- uint32_t r7;
- uint32_t r8;
- uint32_t r9;
- uint32_t r10;
- uint32_t r11;
- uint32_t r12;
- uint32_t r13;
- uint32_t r14;
- uint32_t r15;
- uint32_t r16;
- uint32_t r17;
- uint32_t r18;
- uint32_t r19;
- uint32_t r20;
- uint32_t r21;
- uint32_t r22;
- uint32_t r23;
- uint32_t r24;
- uint32_t r25;
- uint32_t r26;
- uint32_t r27;
- uint32_t r28;
- uint32_t r29;
- uint32_t r30;
- uint32_t r31;
- uint32_t ct;
- uint32_t xer;
- uint32_t lr;
- uint32_t ctr;
- uint32_t mq;
- uint32_t vrsave;
- };
-
- inline void swapStruct(ppc_thread_state32_t &x) {
- sys::swapByteOrder(x.srr0);
- sys::swapByteOrder(x.srr1);
- sys::swapByteOrder(x.r0);
- sys::swapByteOrder(x.r1);
- sys::swapByteOrder(x.r2);
- sys::swapByteOrder(x.r3);
- sys::swapByteOrder(x.r4);
- sys::swapByteOrder(x.r5);
- sys::swapByteOrder(x.r6);
- sys::swapByteOrder(x.r7);
- sys::swapByteOrder(x.r8);
- sys::swapByteOrder(x.r9);
- sys::swapByteOrder(x.r10);
- sys::swapByteOrder(x.r11);
- sys::swapByteOrder(x.r12);
- sys::swapByteOrder(x.r13);
- sys::swapByteOrder(x.r14);
- sys::swapByteOrder(x.r15);
- sys::swapByteOrder(x.r16);
- sys::swapByteOrder(x.r17);
- sys::swapByteOrder(x.r18);
- sys::swapByteOrder(x.r19);
- sys::swapByteOrder(x.r20);
- sys::swapByteOrder(x.r21);
- sys::swapByteOrder(x.r22);
- sys::swapByteOrder(x.r23);
- sys::swapByteOrder(x.r24);
- sys::swapByteOrder(x.r25);
- sys::swapByteOrder(x.r26);
- sys::swapByteOrder(x.r27);
- sys::swapByteOrder(x.r28);
- sys::swapByteOrder(x.r29);
- sys::swapByteOrder(x.r30);
- sys::swapByteOrder(x.r31);
- sys::swapByteOrder(x.ct);
- sys::swapByteOrder(x.xer);
- sys::swapByteOrder(x.lr);
- sys::swapByteOrder(x.ctr);
- sys::swapByteOrder(x.mq);
- sys::swapByteOrder(x.vrsave);
- }
-
- struct ppc_state_hdr_t {
- uint32_t flavor;
- uint32_t count;
- };
-
- struct ppc_thread_state_t {
- ppc_state_hdr_t tsh;
- union {
- ppc_thread_state32_t ts32;
- } uts;
- };
-
- inline void swapStruct(ppc_state_hdr_t &x) {
- sys::swapByteOrder(x.flavor);
- sys::swapByteOrder(x.count);
- }
-
- enum PPCThreadFlavors {
- PPC_THREAD_STATE = 1,
- PPC_FLOAT_STATE = 2,
- PPC_EXCEPTION_STATE = 3,
- PPC_VECTOR_STATE = 4,
- PPC_THREAD_STATE64 = 5,
- PPC_EXCEPTION_STATE64 = 6,
- PPC_THREAD_STATE_NONE = 7
- };
-
- inline void swapStruct(ppc_thread_state_t &x) {
- swapStruct(x.tsh);
- if (x.tsh.flavor == PPC_THREAD_STATE)
- swapStruct(x.uts.ts32);
- }
-
- const uint32_t PPC_THREAD_STATE_COUNT =
- sizeof(ppc_thread_state32_t) / sizeof(uint32_t);
-
- // Define a union of all load command structs
- #define LOAD_COMMAND_STRUCT(LCStruct) LCStruct LCStruct##_data;
-
- union macho_load_command {
- #include "llvm/Support/MachO.def"
- };
-
- } // end namespace MachO
-} // end namespace llvm
-
-#endif
Removed: llvm/trunk/include/llvm/Support/Wasm.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Wasm.h?rev=304863&view=auto
==============================================================================
--- llvm/trunk/include/llvm/Support/Wasm.h (original)
+++ llvm/trunk/include/llvm/Support/Wasm.h (removed)
@@ -1,205 +0,0 @@
-//===- Wasm.h - Wasm object file format -------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines manifest constants for the wasm object file format.
-// See: https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_WASM_H
-#define LLVM_SUPPORT_WASM_H
-
-#include "llvm/ADT/ArrayRef.h"
-
-namespace llvm {
-namespace wasm {
-
-// Object file magic string.
-const char WasmMagic[] = {'\0', 'a', 's', 'm'};
-// Wasm binary format version
-const uint32_t WasmVersion = 0x1;
-// Wasm uses a 64k page size
-const uint32_t WasmPageSize = 65536;
-
-struct WasmObjectHeader {
- StringRef Magic;
- uint32_t Version;
-};
-
-struct WasmSignature {
- std::vector<int32_t> ParamTypes;
- int32_t ReturnType;
-};
-
-struct WasmExport {
- StringRef Name;
- uint32_t Kind;
- uint32_t Index;
-};
-
-struct WasmLimits {
- uint32_t Flags;
- uint32_t Initial;
- uint32_t Maximum;
-};
-
-struct WasmTable {
- int32_t ElemType;
- WasmLimits Limits;
-};
-
-struct WasmInitExpr {
- uint8_t Opcode;
- union {
- int32_t Int32;
- int64_t Int64;
- int32_t Float32;
- int64_t Float64;
- uint32_t Global;
- } Value;
-};
-
-struct WasmGlobal {
- int32_t Type;
- bool Mutable;
- WasmInitExpr InitExpr;
-};
-
-struct WasmImport {
- StringRef Module;
- StringRef Field;
- uint32_t Kind;
- union {
- uint32_t SigIndex;
- WasmGlobal Global;
- WasmTable Table;
- WasmLimits Memory;
- };
-};
-
-struct WasmLocalDecl {
- int32_t Type;
- uint32_t Count;
-};
-
-struct WasmFunction {
- std::vector<WasmLocalDecl> Locals;
- ArrayRef<uint8_t> Body;
-};
-
-struct WasmDataSegment {
- uint32_t Index;
- WasmInitExpr Offset;
- ArrayRef<uint8_t> Content;
-};
-
-struct WasmElemSegment {
- uint32_t TableIndex;
- WasmInitExpr Offset;
- std::vector<uint32_t> Functions;
-};
-
-struct WasmRelocation {
- uint32_t Type; // The type of the relocation.
- int32_t Index; // Index into function to global index space.
- uint64_t Offset; // Offset from the start of the section.
- int64_t Addend; // A value to add to the symbol.
-};
-
-enum : unsigned {
- WASM_SEC_CUSTOM = 0, // Custom / User-defined section
- WASM_SEC_TYPE = 1, // Function signature declarations
- WASM_SEC_IMPORT = 2, // Import declarations
- WASM_SEC_FUNCTION = 3, // Function declarations
- WASM_SEC_TABLE = 4, // Indirect function table and other tables
- WASM_SEC_MEMORY = 5, // Memory attributes
- WASM_SEC_GLOBAL = 6, // Global declarations
- WASM_SEC_EXPORT = 7, // Exports
- WASM_SEC_START = 8, // Start function declaration
- WASM_SEC_ELEM = 9, // Elements section
- WASM_SEC_CODE = 10, // Function bodies (code)
- WASM_SEC_DATA = 11 // Data segments
-};
-
-// Type immediate encodings used in various contexts.
-enum {
- WASM_TYPE_I32 = -0x01,
- WASM_TYPE_I64 = -0x02,
- WASM_TYPE_F32 = -0x03,
- WASM_TYPE_F64 = -0x04,
- WASM_TYPE_ANYFUNC = -0x10,
- WASM_TYPE_FUNC = -0x20,
- WASM_TYPE_NORESULT = -0x40, // for blocks with no result values
-};
-
-// Kinds of externals (for imports and exports).
-enum : unsigned {
- WASM_EXTERNAL_FUNCTION = 0x0,
- WASM_EXTERNAL_TABLE = 0x1,
- WASM_EXTERNAL_MEMORY = 0x2,
- WASM_EXTERNAL_GLOBAL = 0x3,
-};
-
-// Opcodes used in initializer expressions.
-enum : unsigned {
- WASM_OPCODE_END = 0x0b,
- WASM_OPCODE_GET_GLOBAL = 0x23,
- WASM_OPCODE_I32_CONST = 0x41,
- WASM_OPCODE_I64_CONST = 0x42,
- WASM_OPCODE_F32_CONST = 0x43,
- WASM_OPCODE_F64_CONST = 0x44,
-};
-
-enum : unsigned {
- WASM_NAMES_FUNCTION = 0x1,
- WASM_NAMES_LOCAL = 0x2,
-};
-
-enum : unsigned {
- WASM_LIMITS_FLAG_HAS_MAX = 0x1,
-};
-
-// Subset of types that a value can have
-enum class ValType {
- I32 = WASM_TYPE_I32,
- I64 = WASM_TYPE_I64,
- F32 = WASM_TYPE_F32,
- F64 = WASM_TYPE_F64,
-};
-
-// Linking metadata kinds.
-enum : unsigned {
- WASM_STACK_POINTER = 0x1,
-};
-
-#define WASM_RELOC(name, value) name = value,
-
-enum : unsigned {
-#include "WasmRelocs/WebAssembly.def"
-};
-
-#undef WASM_RELOC
-
-struct Global {
- ValType Type;
- bool Mutable;
-
- // The initial value for this global is either the value of an imported
- // global, in which case InitialModule and InitialName specify the global
- // import, or a value, in which case InitialModule is empty and InitialValue
- // holds the value.
- StringRef InitialModule;
- StringRef InitialName;
- uint64_t InitialValue;
-};
-
-} // end namespace wasm
-} // end namespace llvm
-
-#endif
Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Tue Jun 6 22:48:56 2017
@@ -18,6 +18,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/AsmParser/SlotMapping.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/AutoUpgrade.h"
#include "llvm/IR/BasicBlock.h"
@@ -41,7 +42,6 @@
#include "llvm/IR/Value.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SaveAndRestore.h"
Added: llvm/trunk/lib/BinaryFormat/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/BinaryFormat/CMakeLists.txt?rev=304864&view=auto
==============================================================================
--- llvm/trunk/lib/BinaryFormat/CMakeLists.txt (added)
+++ llvm/trunk/lib/BinaryFormat/CMakeLists.txt Tue Jun 6 22:48:56 2017
@@ -0,0 +1,8 @@
+add_llvm_library(LLVMBinaryFormat
+ Dwarf.cpp
+ Magic.cpp
+
+ ADDITIONAL_HEADER_DIRS
+ ${LLVM_MAIN_INCLUDE_DIR}/llvm/BinaryFormat
+ )
+
\ No newline at end of file
Added: llvm/trunk/lib/BinaryFormat/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/BinaryFormat/Dwarf.cpp?rev=304864&view=auto
==============================================================================
--- llvm/trunk/lib/BinaryFormat/Dwarf.cpp (added)
+++ llvm/trunk/lib/BinaryFormat/Dwarf.cpp Tue Jun 6 22:48:56 2017
@@ -0,0 +1,577 @@
+//===-- llvm/BinaryFormat/Dwarf.cpp - Dwarf Framework ------------*- C++-*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file contains support for generic dwarf information.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Support/ErrorHandling.h"
+
+using namespace llvm;
+using namespace dwarf;
+
+StringRef llvm::dwarf::TagString(unsigned Tag) {
+ switch (Tag) {
+ default:
+ return StringRef();
+#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) \
+ case DW_TAG_##NAME: \
+ return "DW_TAG_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::getTag(StringRef TagString) {
+ return StringSwitch<unsigned>(TagString)
+#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) \
+ .Case("DW_TAG_" #NAME, DW_TAG_##NAME)
+#include "llvm/BinaryFormat/Dwarf.def"
+ .Default(DW_TAG_invalid);
+}
+
+unsigned llvm::dwarf::TagVersion(dwarf::Tag Tag) {
+ switch (Tag) {
+ default:
+ return 0;
+#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) \
+ case DW_TAG_##NAME: \
+ return VERSION;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::TagVendor(dwarf::Tag Tag) {
+ switch (Tag) {
+ default:
+ return 0;
+#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) \
+ case DW_TAG_##NAME: \
+ return DWARF_VENDOR_##VENDOR;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::ChildrenString(unsigned Children) {
+ switch (Children) {
+ case DW_CHILDREN_no:
+ return "DW_CHILDREN_no";
+ case DW_CHILDREN_yes:
+ return "DW_CHILDREN_yes";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::AttributeString(unsigned Attribute) {
+ switch (Attribute) {
+ default:
+ return StringRef();
+#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) \
+ case DW_AT_##NAME: \
+ return "DW_AT_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::AttributeVersion(dwarf::Attribute Attribute) {
+ switch (Attribute) {
+ default:
+ return 0;
+#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) \
+ case DW_AT_##NAME: \
+ return VERSION;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::AttributeVendor(dwarf::Attribute Attribute) {
+ switch (Attribute) {
+ default:
+ return 0;
+#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) \
+ case DW_AT_##NAME: \
+ return DWARF_VENDOR_##VENDOR;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::FormEncodingString(unsigned Encoding) {
+ switch (Encoding) {
+ default:
+ return StringRef();
+#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) \
+ case DW_FORM_##NAME: \
+ return "DW_FORM_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::FormVersion(dwarf::Form Form) {
+ switch (Form) {
+ default:
+ return 0;
+#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) \
+ case DW_FORM_##NAME: \
+ return VERSION;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::FormVendor(dwarf::Form Form) {
+ switch (Form) {
+ default:
+ return 0;
+#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) \
+ case DW_FORM_##NAME: \
+ return DWARF_VENDOR_##VENDOR;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::OperationEncodingString(unsigned Encoding) {
+ switch (Encoding) {
+ default:
+ return StringRef();
+#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
+ case DW_OP_##NAME: \
+ return "DW_OP_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ case DW_OP_LLVM_fragment:
+ return "DW_OP_LLVM_fragment";
+ }
+}
+
+unsigned llvm::dwarf::getOperationEncoding(StringRef OperationEncodingString) {
+ return StringSwitch<unsigned>(OperationEncodingString)
+#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
+ .Case("DW_OP_" #NAME, DW_OP_##NAME)
+#include "llvm/BinaryFormat/Dwarf.def"
+ .Case("DW_OP_LLVM_fragment", DW_OP_LLVM_fragment)
+ .Default(0);
+}
+
+unsigned llvm::dwarf::OperationVersion(dwarf::LocationAtom Op) {
+ switch (Op) {
+ default:
+ return 0;
+#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
+ case DW_OP_##NAME: \
+ return VERSION;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::OperationVendor(dwarf::LocationAtom Op) {
+ switch (Op) {
+ default:
+ return 0;
+#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
+ case DW_OP_##NAME: \
+ return DWARF_VENDOR_##VENDOR;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::AttributeEncodingString(unsigned Encoding) {
+ switch (Encoding) {
+ default:
+ return StringRef();
+#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
+ case DW_ATE_##NAME: \
+ return "DW_ATE_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::getAttributeEncoding(StringRef EncodingString) {
+ return StringSwitch<unsigned>(EncodingString)
+#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
+ .Case("DW_ATE_" #NAME, DW_ATE_##NAME)
+#include "llvm/BinaryFormat/Dwarf.def"
+ .Default(0);
+}
+
+unsigned llvm::dwarf::AttributeEncodingVersion(dwarf::TypeKind ATE) {
+ switch (ATE) {
+ default:
+ return 0;
+#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
+ case DW_ATE_##NAME: \
+ return VERSION;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::AttributeEncodingVendor(dwarf::TypeKind ATE) {
+ switch (ATE) {
+ default:
+ return 0;
+#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
+ case DW_ATE_##NAME: \
+ return DWARF_VENDOR_##VENDOR;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::DecimalSignString(unsigned Sign) {
+ switch (Sign) {
+ case DW_DS_unsigned:
+ return "DW_DS_unsigned";
+ case DW_DS_leading_overpunch:
+ return "DW_DS_leading_overpunch";
+ case DW_DS_trailing_overpunch:
+ return "DW_DS_trailing_overpunch";
+ case DW_DS_leading_separate:
+ return "DW_DS_leading_separate";
+ case DW_DS_trailing_separate:
+ return "DW_DS_trailing_separate";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::EndianityString(unsigned Endian) {
+ switch (Endian) {
+ case DW_END_default:
+ return "DW_END_default";
+ case DW_END_big:
+ return "DW_END_big";
+ case DW_END_little:
+ return "DW_END_little";
+ case DW_END_lo_user:
+ return "DW_END_lo_user";
+ case DW_END_hi_user:
+ return "DW_END_hi_user";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::AccessibilityString(unsigned Access) {
+ switch (Access) {
+ // Accessibility codes
+ case DW_ACCESS_public:
+ return "DW_ACCESS_public";
+ case DW_ACCESS_protected:
+ return "DW_ACCESS_protected";
+ case DW_ACCESS_private:
+ return "DW_ACCESS_private";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::VisibilityString(unsigned Visibility) {
+ switch (Visibility) {
+ case DW_VIS_local:
+ return "DW_VIS_local";
+ case DW_VIS_exported:
+ return "DW_VIS_exported";
+ case DW_VIS_qualified:
+ return "DW_VIS_qualified";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::VirtualityString(unsigned Virtuality) {
+ switch (Virtuality) {
+ default:
+ return StringRef();
+#define HANDLE_DW_VIRTUALITY(ID, NAME) \
+ case DW_VIRTUALITY_##NAME: \
+ return "DW_VIRTUALITY_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::getVirtuality(StringRef VirtualityString) {
+ return StringSwitch<unsigned>(VirtualityString)
+#define HANDLE_DW_VIRTUALITY(ID, NAME) \
+ .Case("DW_VIRTUALITY_" #NAME, DW_VIRTUALITY_##NAME)
+#include "llvm/BinaryFormat/Dwarf.def"
+ .Default(DW_VIRTUALITY_invalid);
+}
+
+StringRef llvm::dwarf::LanguageString(unsigned Language) {
+ switch (Language) {
+ default:
+ return StringRef();
+#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) \
+ case DW_LANG_##NAME: \
+ return "DW_LANG_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::getLanguage(StringRef LanguageString) {
+ return StringSwitch<unsigned>(LanguageString)
+#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) \
+ .Case("DW_LANG_" #NAME, DW_LANG_##NAME)
+#include "llvm/BinaryFormat/Dwarf.def"
+ .Default(0);
+}
+
+unsigned llvm::dwarf::LanguageVersion(dwarf::SourceLanguage Lang) {
+ switch (Lang) {
+ default:
+ return 0;
+#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) \
+ case DW_LANG_##NAME: \
+ return VERSION;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::LanguageVendor(dwarf::SourceLanguage Lang) {
+ switch (Lang) {
+ default:
+ return 0;
+#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) \
+ case DW_LANG_##NAME: \
+ return DWARF_VENDOR_##VENDOR;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::CaseString(unsigned Case) {
+ switch (Case) {
+ case DW_ID_case_sensitive:
+ return "DW_ID_case_sensitive";
+ case DW_ID_up_case:
+ return "DW_ID_up_case";
+ case DW_ID_down_case:
+ return "DW_ID_down_case";
+ case DW_ID_case_insensitive:
+ return "DW_ID_case_insensitive";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::ConventionString(unsigned CC) {
+ switch (CC) {
+ default:
+ return StringRef();
+#define HANDLE_DW_CC(ID, NAME) \
+ case DW_CC_##NAME: \
+ return "DW_CC_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+unsigned llvm::dwarf::getCallingConvention(StringRef CCString) {
+ return StringSwitch<unsigned>(CCString)
+#define HANDLE_DW_CC(ID, NAME) .Case("DW_CC_" #NAME, DW_CC_##NAME)
+#include "llvm/BinaryFormat/Dwarf.def"
+ .Default(0);
+}
+
+StringRef llvm::dwarf::InlineCodeString(unsigned Code) {
+ switch (Code) {
+ case DW_INL_not_inlined:
+ return "DW_INL_not_inlined";
+ case DW_INL_inlined:
+ return "DW_INL_inlined";
+ case DW_INL_declared_not_inlined:
+ return "DW_INL_declared_not_inlined";
+ case DW_INL_declared_inlined:
+ return "DW_INL_declared_inlined";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::ArrayOrderString(unsigned Order) {
+ switch (Order) {
+ case DW_ORD_row_major:
+ return "DW_ORD_row_major";
+ case DW_ORD_col_major:
+ return "DW_ORD_col_major";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::DiscriminantString(unsigned Discriminant) {
+ switch (Discriminant) {
+ case DW_DSC_label:
+ return "DW_DSC_label";
+ case DW_DSC_range:
+ return "DW_DSC_range";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::LNStandardString(unsigned Standard) {
+ switch (Standard) {
+ default:
+ return StringRef();
+#define HANDLE_DW_LNS(ID, NAME) \
+ case DW_LNS_##NAME: \
+ return "DW_LNS_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::LNExtendedString(unsigned Encoding) {
+ switch (Encoding) {
+ default:
+ return StringRef();
+#define HANDLE_DW_LNE(ID, NAME) \
+ case DW_LNE_##NAME: \
+ return "DW_LNE_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::MacinfoString(unsigned Encoding) {
+ switch (Encoding) {
+ // Macinfo Type Encodings
+ case DW_MACINFO_define:
+ return "DW_MACINFO_define";
+ case DW_MACINFO_undef:
+ return "DW_MACINFO_undef";
+ case DW_MACINFO_start_file:
+ return "DW_MACINFO_start_file";
+ case DW_MACINFO_end_file:
+ return "DW_MACINFO_end_file";
+ case DW_MACINFO_vendor_ext:
+ return "DW_MACINFO_vendor_ext";
+ case DW_MACINFO_invalid:
+ return "DW_MACINFO_invalid";
+ }
+ return StringRef();
+}
+
+unsigned llvm::dwarf::getMacinfo(StringRef MacinfoString) {
+ return StringSwitch<unsigned>(MacinfoString)
+ .Case("DW_MACINFO_define", DW_MACINFO_define)
+ .Case("DW_MACINFO_undef", DW_MACINFO_undef)
+ .Case("DW_MACINFO_start_file", DW_MACINFO_start_file)
+ .Case("DW_MACINFO_end_file", DW_MACINFO_end_file)
+ .Case("DW_MACINFO_vendor_ext", DW_MACINFO_vendor_ext)
+ .Default(DW_MACINFO_invalid);
+}
+
+StringRef llvm::dwarf::CallFrameString(unsigned Encoding) {
+ switch (Encoding) {
+ default:
+ return StringRef();
+#define HANDLE_DW_CFA(ID, NAME) \
+ case DW_CFA_##NAME: \
+ return "DW_CFA_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::ApplePropertyString(unsigned Prop) {
+ switch (Prop) {
+ default:
+ return StringRef();
+#define HANDLE_DW_APPLE_PROPERTY(ID, NAME) \
+ case DW_APPLE_PROPERTY_##NAME: \
+ return "DW_APPLE_PROPERTY_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::UnitTypeString(unsigned UT) {
+ switch (UT) {
+ default:
+ return StringRef();
+#define HANDLE_DW_UT(ID, NAME) \
+ case DW_UT_##NAME: \
+ return "DW_UT_" #NAME;
+#include "llvm/BinaryFormat/Dwarf.def"
+ }
+}
+
+StringRef llvm::dwarf::AtomTypeString(unsigned AT) {
+ switch (AT) {
+ case dwarf::DW_ATOM_null:
+ return "DW_ATOM_null";
+ case dwarf::DW_ATOM_die_offset:
+ return "DW_ATOM_die_offset";
+ case DW_ATOM_cu_offset:
+ return "DW_ATOM_cu_offset";
+ case DW_ATOM_die_tag:
+ return "DW_ATOM_die_tag";
+ case DW_ATOM_type_flags:
+ return "DW_ATOM_type_flags";
+ }
+ return StringRef();
+}
+
+StringRef llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) {
+ switch (Kind) {
+ case GIEK_NONE:
+ return "NONE";
+ case GIEK_TYPE:
+ return "TYPE";
+ case GIEK_VARIABLE:
+ return "VARIABLE";
+ case GIEK_FUNCTION:
+ return "FUNCTION";
+ case GIEK_OTHER:
+ return "OTHER";
+ case GIEK_UNUSED5:
+ return "UNUSED5";
+ case GIEK_UNUSED6:
+ return "UNUSED6";
+ case GIEK_UNUSED7:
+ return "UNUSED7";
+ }
+ llvm_unreachable("Unknown GDBIndexEntryKind value");
+}
+
+StringRef
+llvm::dwarf::GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage) {
+ switch (Linkage) {
+ case GIEL_EXTERNAL:
+ return "EXTERNAL";
+ case GIEL_STATIC:
+ return "STATIC";
+ }
+ llvm_unreachable("Unknown GDBIndexEntryLinkage value");
+}
+
+StringRef llvm::dwarf::AttributeValueString(uint16_t Attr, unsigned Val) {
+ switch (Attr) {
+ case DW_AT_accessibility:
+ return AccessibilityString(Val);
+ case DW_AT_virtuality:
+ return VirtualityString(Val);
+ case DW_AT_language:
+ return LanguageString(Val);
+ case DW_AT_encoding:
+ return AttributeEncodingString(Val);
+ case DW_AT_decimal_sign:
+ return DecimalSignString(Val);
+ case DW_AT_endianity:
+ return EndianityString(Val);
+ case DW_AT_visibility:
+ return VisibilityString(Val);
+ case DW_AT_identifier_case:
+ return CaseString(Val);
+ case DW_AT_calling_convention:
+ return ConventionString(Val);
+ case DW_AT_inline:
+ return InlineCodeString(Val);
+ case DW_AT_ordering:
+ return ArrayOrderString(Val);
+ case DW_AT_discr_value:
+ return DiscriminantString(Val);
+ }
+
+ return StringRef();
+}
+
+bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version,
+ bool ExtensionsOk) {
+ if (FormVendor(F) == DWARF_VENDOR_DWARF) {
+ unsigned FV = FormVersion(F);
+ return FV > 0 && FV <= Version;
+ }
+ return ExtensionsOk;
+}
Added: llvm/trunk/lib/BinaryFormat/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/BinaryFormat/LLVMBuild.txt?rev=304864&view=auto
==============================================================================
--- llvm/trunk/lib/BinaryFormat/LLVMBuild.txt (added)
+++ llvm/trunk/lib/BinaryFormat/LLVMBuild.txt Tue Jun 6 22:48:56 2017
@@ -0,0 +1,22 @@
+;===- ./lib/BinaryFormat/LLVMBuild.txt -------------------------*- Conf -*--===;
+;
+; The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+; http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Library
+name = BinaryFormat
+parent = Libraries
+required_libraries = Support
Added: llvm/trunk/lib/BinaryFormat/Magic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/BinaryFormat/Magic.cpp?rev=304864&view=auto
==============================================================================
--- llvm/trunk/lib/BinaryFormat/Magic.cpp (added)
+++ llvm/trunk/lib/BinaryFormat/Magic.cpp Tue Jun 6 22:48:56 2017
@@ -0,0 +1,216 @@
+//===- llvm/BinaryFormat/Magic.cpp - File magic identification --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/BinaryFormat/Magic.h"
+
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/BinaryFormat/MachO.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/FileSystem.h"
+
+#if !defined(_MSC_VER) && !defined(__MINGW32__)
+#include <unistd.h>
+#else
+#include <io.h>
+#endif
+
+using namespace llvm;
+using namespace llvm::support::endian;
+using namespace llvm::sys::fs;
+
+template <size_t N>
+static bool startswith(StringRef Magic, const char (&S)[N]) {
+ return Magic.startswith(StringRef(S, N - 1));
+}
+
+/// @brief Identify the magic in magic.
+file_magic llvm::identify_magic(StringRef Magic) {
+ if (Magic.size() < 4)
+ return file_magic::unknown;
+ switch ((unsigned char)Magic[0]) {
+ case 0x00: {
+ // COFF bigobj, CL.exe's LTO object file, or short import library file
+ if (startswith(Magic, "\0\0\xFF\xFF")) {
+ size_t MinSize =
+ offsetof(COFF::BigObjHeader, UUID) + sizeof(COFF::BigObjMagic);
+ if (Magic.size() < MinSize)
+ return file_magic::coff_import_library;
+
+ const char *Start = Magic.data() + offsetof(COFF::BigObjHeader, UUID);
+ if (memcmp(Start, COFF::BigObjMagic, sizeof(COFF::BigObjMagic)) == 0)
+ return file_magic::coff_object;
+ if (memcmp(Start, COFF::ClGlObjMagic, sizeof(COFF::BigObjMagic)) == 0)
+ return file_magic::coff_cl_gl_object;
+ return file_magic::coff_import_library;
+ }
+ // Windows resource file
+ if (startswith(Magic, "\0\0\0\0\x20\0\0\0\xFF"))
+ return file_magic::windows_resource;
+ // 0x0000 = COFF unknown machine type
+ if (Magic[1] == 0)
+ return file_magic::coff_object;
+ if (startswith(Magic, "\0asm"))
+ return file_magic::wasm_object;
+ break;
+ }
+ case 0xDE: // 0x0B17C0DE = BC wraper
+ if (startswith(Magic, "\xDE\xC0\x17\x0B"))
+ return file_magic::bitcode;
+ break;
+ case 'B':
+ if (startswith(Magic, "BC\xC0\xDE"))
+ return file_magic::bitcode;
+ break;
+ case '!':
+ if (startswith(Magic, "!<arch>\n") || startswith(Magic, "!<thin>\n"))
+ return file_magic::archive;
+ break;
+
+ case '\177':
+ if (startswith(Magic, "\177ELF") && Magic.size() >= 18) {
+ bool Data2MSB = Magic[5] == 2;
+ unsigned high = Data2MSB ? 16 : 17;
+ unsigned low = Data2MSB ? 17 : 16;
+ if (Magic[high] == 0) {
+ switch (Magic[low]) {
+ default:
+ return file_magic::elf;
+ case 1:
+ return file_magic::elf_relocatable;
+ case 2:
+ return file_magic::elf_executable;
+ case 3:
+ return file_magic::elf_shared_object;
+ case 4:
+ return file_magic::elf_core;
+ }
+ }
+ // It's still some type of ELF file.
+ return file_magic::elf;
+ }
+ break;
+
+ case 0xCA:
+ if (startswith(Magic, "\xCA\xFE\xBA\xBE") ||
+ startswith(Magic, "\xCA\xFE\xBA\xBF")) {
+ // This is complicated by an overlap with Java class files.
+ // See the Mach-O section in /usr/share/file/magic for details.
+ if (Magic.size() >= 8 && Magic[7] < 43)
+ return file_magic::macho_universal_binary;
+ }
+ break;
+
+ // The two magic numbers for mach-o are:
+ // 0xfeedface - 32-bit mach-o
+ // 0xfeedfacf - 64-bit mach-o
+ case 0xFE:
+ case 0xCE:
+ case 0xCF: {
+ uint16_t type = 0;
+ if (startswith(Magic, "\xFE\xED\xFA\xCE") ||
+ startswith(Magic, "\xFE\xED\xFA\xCF")) {
+ /* Native endian */
+ size_t MinSize;
+ if (Magic[3] == char(0xCE))
+ MinSize = sizeof(MachO::mach_header);
+ else
+ MinSize = sizeof(MachO::mach_header_64);
+ if (Magic.size() >= MinSize)
+ type = Magic[12] << 24 | Magic[13] << 12 | Magic[14] << 8 | Magic[15];
+ } else if (startswith(Magic, "\xCE\xFA\xED\xFE") ||
+ startswith(Magic, "\xCF\xFA\xED\xFE")) {
+ /* Reverse endian */
+ size_t MinSize;
+ if (Magic[0] == char(0xCE))
+ MinSize = sizeof(MachO::mach_header);
+ else
+ MinSize = sizeof(MachO::mach_header_64);
+ if (Magic.size() >= MinSize)
+ type = Magic[15] << 24 | Magic[14] << 12 | Magic[13] << 8 | Magic[12];
+ }
+ switch (type) {
+ default:
+ break;
+ case 1:
+ return file_magic::macho_object;
+ case 2:
+ return file_magic::macho_executable;
+ case 3:
+ return file_magic::macho_fixed_virtual_memory_shared_lib;
+ case 4:
+ return file_magic::macho_core;
+ case 5:
+ return file_magic::macho_preload_executable;
+ case 6:
+ return file_magic::macho_dynamically_linked_shared_lib;
+ case 7:
+ return file_magic::macho_dynamic_linker;
+ case 8:
+ return file_magic::macho_bundle;
+ case 9:
+ return file_magic::macho_dynamically_linked_shared_lib_stub;
+ case 10:
+ return file_magic::macho_dsym_companion;
+ case 11:
+ return file_magic::macho_kext_bundle;
+ }
+ break;
+ }
+ case 0xF0: // PowerPC Windows
+ case 0x83: // Alpha 32-bit
+ case 0x84: // Alpha 64-bit
+ case 0x66: // MPS R4000 Windows
+ case 0x50: // mc68K
+ case 0x4c: // 80386 Windows
+ case 0xc4: // ARMNT Windows
+ if (Magic[1] == 0x01)
+ return file_magic::coff_object;
+ LLVM_FALLTHROUGH;
+
+ case 0x90: // PA-RISC Windows
+ case 0x68: // mc68K Windows
+ if (Magic[1] == 0x02)
+ return file_magic::coff_object;
+ break;
+
+ case 'M': // Possible MS-DOS stub on Windows PE file
+ if (startswith(Magic, "MZ")) {
+ uint32_t off = read32le(Magic.data() + 0x3c);
+ // PE/COFF file, either EXE or DLL.
+ if (off < Magic.size() &&
+ memcmp(Magic.data() + off, COFF::PEMagic, sizeof(COFF::PEMagic)) == 0)
+ return file_magic::pecoff_executable;
+ }
+ break;
+
+ case 0x64: // x86-64 Windows.
+ if (Magic[1] == char(0x86))
+ return file_magic::coff_object;
+ break;
+
+ default:
+ break;
+ }
+ return file_magic::unknown;
+}
+
+std::error_code llvm::identify_magic(const Twine &Path, file_magic &Result) {
+ int FD;
+ if (std::error_code EC = openFileForRead(Path, FD))
+ return EC;
+
+ char Buffer[32];
+ int Length = read(FD, Buffer, sizeof(Buffer));
+ if (close(FD) != 0 || Length < 0)
+ return std::error_code(errno, std::generic_category());
+
+ Result = identify_magic(StringRef(Buffer, Length));
+ return std::error_code();
+}
Modified: llvm/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CMakeLists.txt?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CMakeLists.txt (original)
+++ llvm/trunk/lib/CMakeLists.txt Tue Jun 6 22:48:56 2017
@@ -4,6 +4,7 @@
add_subdirectory(IR)
add_subdirectory(IRReader)
add_subdirectory(CodeGen)
+add_subdirectory(BinaryFormat)
add_subdirectory(Bitcode)
add_subdirectory(Transforms)
add_subdirectory(Linker)
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/ARMException.cpp Tue Jun 6 22:48:56 2017
@@ -14,6 +14,7 @@
#include "DwarfException.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -27,7 +28,6 @@
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Target/TargetFrameLowering.h"
#include "llvm/Target/TargetOptions.h"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Tue Jun 6 22:48:56 2017
@@ -30,6 +30,8 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/ObjectUtils.h"
+#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/Analysis.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/GCMetadataPrinter.h"
@@ -82,8 +84,6 @@
#include "llvm/Pass.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Dwarf.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/MathExtras.h"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp Tue Jun 6 22:48:56 2017
@@ -15,6 +15,7 @@
#include "DwarfDebug.h"
#include "DwarfExpression.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -26,7 +27,6 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MachineLocation.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
#include "llvm/Target/TargetMachine.h"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp Tue Jun 6 22:48:56 2017
@@ -26,6 +26,8 @@
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/LexicalScopes.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -56,10 +58,10 @@
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
+#include "llvm/Support/BinaryByteStream.h"
+#include "llvm/Support/BinaryStreamReader.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DIEHash.cpp Tue Jun 6 22:48:56 2017
@@ -16,10 +16,10 @@
#include "DwarfDebug.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MD5.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfAccelTable.h Tue Jun 6 22:48:56 2017
@@ -16,12 +16,12 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringMap.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataTypes.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/FormattedStream.h"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCFIException.cpp Tue Jun 6 22:48:56 2017
@@ -14,6 +14,7 @@
#include "DwarfException.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -28,7 +29,6 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MachineLocation.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Target/TargetFrameLowering.h"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h Tue Jun 6 22:48:56 2017
@@ -15,8 +15,8 @@
#define LLVM_LIB_CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
#include "DwarfUnit.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/DebugInfo.h"
-#include "llvm/Support/Dwarf.h"
namespace llvm {
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Tue Jun 6 22:48:56 2017
@@ -22,6 +22,7 @@
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
@@ -38,7 +39,6 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/LEB128.h"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfExpression.cpp Tue Jun 6 22:48:56 2017
@@ -14,8 +14,8 @@
#include "DwarfExpression.h"
#include "DwarfDebug.h"
#include "llvm/ADT/SmallBitVector.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetRegisterInfo.h"
#include "llvm/Target/TargetSubtargetInfo.h"
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/GCMetadata.h"
#include "llvm/CodeGen/GCMetadataPrinter.h"
@@ -25,7 +26,6 @@
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
using namespace llvm;
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/WinException.cpp Tue Jun 6 22:48:56 2017
@@ -14,6 +14,8 @@
#include "WinException.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -29,8 +31,6 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCWin64EH.h"
-#include "llvm/Support/COFF.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Target/TargetFrameLowering.h"
Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Tue Jun 6 22:48:56 2017
@@ -18,6 +18,10 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/CodeGen/MachineModuleInfo.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/IR/Comdat.h"
@@ -46,13 +50,9 @@
#include "llvm/MC/MCValue.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/ProfileData/InstrProf.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CodeGen.h"
-#include "llvm/Support/Dwarf.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include <cassert>
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp Tue Jun 6 22:48:56 2017
@@ -8,12 +8,13 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
+
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <cstddef>
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp Tue Jun 6 22:48:56 2017
@@ -8,12 +8,13 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h"
+
#include "llvm/ADT/SmallVector.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/Support/Compiler.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <cstddef>
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp Tue Jun 6 22:48:56 2017
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
+
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
@@ -15,10 +16,10 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLine.cpp Tue Jun 6 22:48:56 2017
@@ -9,10 +9,10 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
#include "llvm/ADT/SmallString.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp Tue Jun 6 22:48:56 2017
@@ -9,9 +9,9 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp Tue Jun 6 22:48:56 2017
@@ -9,7 +9,7 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
#include "SyntaxHighlighting.h"
-#include "llvm/Support/Dwarf.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdint>
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp Tue Jun 6 22:48:56 2017
@@ -9,8 +9,8 @@
#include "llvm/DebugInfo/DWARF/DWARFDebugPubTable.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdint>
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFDie.cpp Tue Jun 6 22:48:56 2017
@@ -12,13 +12,13 @@
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFFormValue.cpp Tue Jun 6 22:48:56 2017
@@ -13,10 +13,10 @@
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/DWARF/DWARFRelocMap.h"
#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp Tue Jun 6 22:48:56 2017
@@ -10,6 +10,7 @@
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/DebugInfo/MSF/MSFCommon.h"
@@ -19,7 +20,6 @@
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Support/BinaryItemStream.h"
#include "llvm/Support/BinaryStreamWriter.h"
-#include "llvm/Support/COFF.h"
using namespace llvm;
using namespace llvm::codeview;
Modified: llvm/trunk/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp (original)
+++ llvm/trunk/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp Tue Jun 6 22:48:56 2017
@@ -10,6 +10,7 @@
#include "llvm/DebugInfo/PDB/Native/DbiStreamBuilder.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/MSF/MSFBuilder.h"
#include "llvm/DebugInfo/MSF/MappedBlockStream.h"
#include "llvm/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.h"
@@ -17,7 +18,6 @@
#include "llvm/DebugInfo/PDB/Native/RawError.h"
#include "llvm/Object/COFF.h"
#include "llvm/Support/BinaryStreamWriter.h"
-#include "llvm/Support/COFF.h"
using namespace llvm;
using namespace llvm::codeview;
Modified: llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp (original)
+++ llvm/trunk/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -15,12 +15,12 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/Symbolize/SymbolizableModule.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/SymbolSize.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/DataExtractor.h"
#include "llvm/Support/Error.h"
Modified: llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp (original)
+++ llvm/trunk/lib/DebugInfo/Symbolize/Symbolize.cpp Tue Jun 6 22:48:56 2017
@@ -16,6 +16,7 @@
#include "SymbolizableObjectFile.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Config/config.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
#include "llvm/DebugInfo/PDB/PDB.h"
@@ -24,7 +25,6 @@
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/MachO.h"
#include "llvm/Object/MachOUniversal.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/DataExtractor.h"
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp Tue Jun 6 22:48:56 2017
@@ -18,10 +18,10 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Object/ObjectFile.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/TargetRegistry.h"
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFI386.h Tue Jun 6 22:48:56 2017
@@ -15,8 +15,8 @@
#define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFFI386_H
#include "../RuntimeDyldCOFF.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Object/COFF.h"
-#include "llvm/Support/COFF.h"
#define DEBUG_TYPE "dyld"
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFThumb.h Tue Jun 6 22:48:56 2017
@@ -15,8 +15,8 @@
#define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFFTHUMB_H
#include "../RuntimeDyldCOFF.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Object/COFF.h"
-#include "llvm/Support/COFF.h"
#define DEBUG_TYPE "dyld"
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h Tue Jun 6 22:48:56 2017
@@ -15,8 +15,8 @@
#define LLVM_LIB_EXECUTIONENGINE_RUNTIMEDYLD_TARGETS_RUNTIMEDYLDCOFF86_64_H
#include "../RuntimeDyldCOFF.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Object/COFF.h"
-#include "llvm/Support/COFF.h"
#define DEBUG_TYPE "dyld"
Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldELFMips.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldELFMips.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldELFMips.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldELFMips.cpp Tue Jun 6 22:48:56 2017
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "RuntimeDyldELFMips.h"
-#include "llvm/Support/ELF.h"
+#include "llvm/BinaryFormat/ELF.h"
#define DEBUG_TYPE "dyld"
Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Tue Jun 6 22:48:56 2017
@@ -20,6 +20,7 @@
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/AssemblyAnnotationWriter.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/CFG.h"
@@ -39,7 +40,6 @@
#include "llvm/IR/UseListOrder.h"
#include "llvm/IR/ValueSymbolTable.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/FormattedStream.h"
Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Tue Jun 6 22:48:56 2017
@@ -14,12 +14,12 @@
#include "llvm/IR/DIBuilder.h"
#include "LLVMContextImpl.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/Dwarf.h"
using namespace llvm;
using namespace llvm::dwarf;
Modified: llvm/trunk/lib/IR/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMBuild.txt?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMBuild.txt (original)
+++ llvm/trunk/lib/IR/LLVMBuild.txt Tue Jun 6 22:48:56 2017
@@ -19,4 +19,4 @@
type = Library
name = Core
parent = Libraries
-required_libraries = Support
+required_libraries = BinaryFormat Support
Modified: llvm/trunk/lib/IR/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/LLVMContextImpl.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/IR/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/IR/LLVMContextImpl.h Tue Jun 6 22:48:56 2017
@@ -27,13 +27,13 @@
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringSet.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/ValueHandle.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/YAMLTraits.h"
#include <vector>
Modified: llvm/trunk/lib/IR/Verifier.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Verifier.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Verifier.cpp (original)
+++ llvm/trunk/lib/IR/Verifier.cpp Tue Jun 6 22:48:56 2017
@@ -59,6 +59,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/ilist.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/BasicBlock.h"
@@ -102,7 +103,6 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/LLVMBuild.txt?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/LLVMBuild.txt (original)
+++ llvm/trunk/lib/LLVMBuild.txt Tue Jun 6 22:48:56 2017
@@ -31,6 +31,7 @@ subdirectories =
LTO
MC
Object
+ BinaryFormat
ObjectYAML
Option
Passes
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -18,6 +18,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
@@ -36,7 +37,6 @@
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compression.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/trunk/lib/MC/MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfo.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfo.cpp Tue Jun 6 22:48:56 2017
@@ -13,10 +13,10 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCAsmInfo.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCStreamer.h"
-#include "llvm/Support/Dwarf.h"
using namespace llvm;
Modified: llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoDarwin.cpp Tue Jun 6 22:48:56 2017
@@ -13,9 +13,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCAsmInfoDarwin.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCSectionMachO.h"
-#include "llvm/Support/MachO.h"
using namespace llvm;
Modified: llvm/trunk/lib/MC/MCAsmInfoELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmInfoELF.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmInfoELF.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmInfoELF.cpp Tue Jun 6 22:48:56 2017
@@ -13,9 +13,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCAsmInfoELF.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
-#include "llvm/Support/ELF.h"
using namespace llvm;
Modified: llvm/trunk/lib/MC/MCCodeView.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCCodeView.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCCodeView.cpp (original)
+++ llvm/trunk/lib/MC/MCCodeView.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,7 @@
#include "llvm/MC/MCCodeView.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/Line.h"
#include "llvm/DebugInfo/CodeView/SymbolRecord.h"
@@ -20,7 +21,6 @@
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectStreamer.h"
#include "llvm/MC/MCValue.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/EndianStream.h"
using namespace llvm;
Modified: llvm/trunk/lib/MC/MCContext.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCContext.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCContext.cpp (original)
+++ llvm/trunk/lib/MC/MCContext.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,8 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeView.h"
#include "llvm/MC/MCDwarf.h"
@@ -31,10 +33,8 @@
#include "llvm/MC/MCSymbolMachO.h"
#include "llvm/MC/MCSymbolWasm.h"
#include "llvm/MC/SectionKind.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Signals.h"
Modified: llvm/trunk/lib/MC/MCDwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCDwarf.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCDwarf.cpp (original)
+++ llvm/trunk/lib/MC/MCDwarf.cpp Tue Jun 6 22:48:56 2017
@@ -17,6 +17,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Config/config.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
@@ -28,7 +29,6 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/EndianStream.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/trunk/lib/MC/MCELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCELFStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCELFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCELFStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -14,6 +14,7 @@
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
@@ -30,7 +31,6 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/MC/MCObjectFileInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCObjectFileInfo.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCObjectFileInfo.cpp (original)
+++ llvm/trunk/lib/MC/MCObjectFileInfo.cpp Tue Jun 6 22:48:56 2017
@@ -10,6 +10,8 @@
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSection.h"
@@ -17,8 +19,6 @@
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSectionWasm.h"
-#include "llvm/Support/COFF.h"
-#include "llvm/Support/ELF.h"
using namespace llvm;
Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Tue Jun 6 22:48:56 2017
@@ -21,6 +21,7 @@
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeView.h"
#include "llvm/MC/MCContext.h"
@@ -47,7 +48,6 @@
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/MemoryBuffer.h"
Modified: llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/COFFAsmParser.cpp Tue Jun 6 22:48:56 2017
@@ -11,6 +11,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCObjectFileInfo.h"
@@ -21,7 +22,6 @@
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/SectionKind.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/SMLoc.h"
#include <cassert>
#include <cstdint>
Modified: llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/DarwinAsmParser.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDirectives.h"
#include "llvm/MC/MCObjectFileInfo.h"
@@ -24,7 +25,6 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SMLoc.h"
#include "llvm/Support/SourceMgr.h"
Modified: llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/ELFAsmParser.cpp Tue Jun 6 22:48:56 2017
@@ -9,6 +9,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDirectives.h"
@@ -23,7 +24,6 @@
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/SectionKind.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SMLoc.h"
#include <cassert>
Modified: llvm/trunk/lib/MC/MCSectionCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionCOFF.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionCOFF.cpp Tue Jun 6 22:48:56 2017
@@ -8,8 +8,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCSectionCOFF.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
Modified: llvm/trunk/lib/MC/MCSectionELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionELF.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionELF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionELF.cpp Tue Jun 6 22:48:56 2017
@@ -9,9 +9,9 @@
#include "llvm/MC/MCSectionELF.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCExpr.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
Modified: llvm/trunk/lib/MC/MCStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -11,6 +11,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCCodeView.h"
@@ -25,7 +26,6 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCWin64EH.h"
#include "llvm/MC/MCWinEH.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
Modified: llvm/trunk/lib/MC/MCSymbolELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSymbolELF.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSymbolELF.cpp (original)
+++ llvm/trunk/lib/MC/MCSymbolELF.cpp Tue Jun 6 22:48:56 2017
@@ -8,9 +8,9 @@
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCSymbolELF.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCFixupKindInfo.h"
-#include "llvm/Support/ELF.h"
namespace llvm {
Modified: llvm/trunk/lib/MC/MCWinEH.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCWinEH.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCWinEH.cpp (original)
+++ llvm/trunk/lib/MC/MCWinEH.cpp Tue Jun 6 22:48:56 2017
@@ -9,12 +9,12 @@
#include "llvm/MC/MCWinEH.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Support/COFF.h"
namespace llvm {
namespace WinEH {
Modified: llvm/trunk/lib/MC/MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MachObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/MachObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -10,6 +10,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
@@ -27,7 +28,6 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
Modified: llvm/trunk/lib/MC/StringTableBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/StringTableBuilder.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/StringTableBuilder.cpp (original)
+++ llvm/trunk/lib/MC/StringTableBuilder.cpp Tue Jun 6 22:48:56 2017
@@ -11,7 +11,7 @@
#include "llvm/ADT/CachedHashString.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/COFF.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/MC/WasmObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WasmObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WasmObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WasmObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmLayout.h"
Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -17,6 +17,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
@@ -31,7 +32,6 @@
#include "llvm/MC/MCValue.h"
#include "llvm/MC/MCWinCOFFObjectWriter.h"
#include "llvm/MC/StringTableBuilder.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/trunk/lib/MC/WinCOFFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -15,6 +15,7 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCCodeEmitter.h"
@@ -27,7 +28,6 @@
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSymbolCOFF.h"
#include "llvm/MC/MCWinCOFFStreamer.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
Modified: llvm/trunk/lib/Object/ArchiveWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ArchiveWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ArchiveWriter.cpp (original)
+++ llvm/trunk/lib/Object/ArchiveWriter.cpp Tue Jun 6 22:48:56 2017
@@ -14,6 +14,7 @@
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Magic.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/ObjectFile.h"
@@ -290,7 +291,7 @@ writeSymbolTable(raw_fd_ostream &Out, ob
MemoryBufferRef MemberBuffer = Members[MemberNum].Buf->getMemBufferRef();
Expected<std::unique_ptr<object::SymbolicFile>> ObjOrErr =
object::SymbolicFile::createSymbolicFile(
- MemberBuffer, sys::fs::file_magic::unknown, &Context);
+ MemberBuffer, llvm::file_magic::unknown, &Context);
if (!ObjOrErr) {
// FIXME: check only for "not an object file" errors.
consumeError(ObjOrErr.takeError());
Modified: llvm/trunk/lib/Object/Binary.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Binary.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Binary.cpp (original)
+++ llvm/trunk/lib/Object/Binary.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,7 @@
#include "llvm/Object/Binary.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Object/Archive.h"
#include "llvm/Object/Error.h"
#include "llvm/Object/MachOUniversal.h"
@@ -43,41 +44,41 @@ MemoryBufferRef Binary::getMemoryBufferR
Expected<std::unique_ptr<Binary>> object::createBinary(MemoryBufferRef Buffer,
LLVMContext *Context) {
- sys::fs::file_magic Type = sys::fs::identify_magic(Buffer.getBuffer());
+ file_magic Type = identify_magic(Buffer.getBuffer());
switch (Type) {
- case sys::fs::file_magic::archive:
- return Archive::create(Buffer);
- case sys::fs::file_magic::elf:
- case sys::fs::file_magic::elf_relocatable:
- case sys::fs::file_magic::elf_executable:
- case sys::fs::file_magic::elf_shared_object:
- case sys::fs::file_magic::elf_core:
- case sys::fs::file_magic::macho_object:
- case sys::fs::file_magic::macho_executable:
- case sys::fs::file_magic::macho_fixed_virtual_memory_shared_lib:
- case sys::fs::file_magic::macho_core:
- case sys::fs::file_magic::macho_preload_executable:
- case sys::fs::file_magic::macho_dynamically_linked_shared_lib:
- case sys::fs::file_magic::macho_dynamic_linker:
- case sys::fs::file_magic::macho_bundle:
- case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
- case sys::fs::file_magic::macho_dsym_companion:
- case sys::fs::file_magic::macho_kext_bundle:
- case sys::fs::file_magic::coff_object:
- case sys::fs::file_magic::coff_import_library:
- case sys::fs::file_magic::pecoff_executable:
- case sys::fs::file_magic::bitcode:
- case sys::fs::file_magic::wasm_object:
- return ObjectFile::createSymbolicFile(Buffer, Type, Context);
- case sys::fs::file_magic::macho_universal_binary:
- return MachOUniversalBinary::create(Buffer);
- case sys::fs::file_magic::windows_resource:
- return WindowsResource::createWindowsResource(Buffer);
- case sys::fs::file_magic::unknown:
- case sys::fs::file_magic::coff_cl_gl_object:
- // Unrecognized object file format.
- return errorCodeToError(object_error::invalid_file_type);
+ case file_magic::archive:
+ return Archive::create(Buffer);
+ case file_magic::elf:
+ case file_magic::elf_relocatable:
+ case file_magic::elf_executable:
+ case file_magic::elf_shared_object:
+ case file_magic::elf_core:
+ case file_magic::macho_object:
+ case file_magic::macho_executable:
+ case file_magic::macho_fixed_virtual_memory_shared_lib:
+ case file_magic::macho_core:
+ case file_magic::macho_preload_executable:
+ case file_magic::macho_dynamically_linked_shared_lib:
+ case file_magic::macho_dynamic_linker:
+ case file_magic::macho_bundle:
+ case file_magic::macho_dynamically_linked_shared_lib_stub:
+ case file_magic::macho_dsym_companion:
+ case file_magic::macho_kext_bundle:
+ case file_magic::coff_object:
+ case file_magic::coff_import_library:
+ case file_magic::pecoff_executable:
+ case file_magic::bitcode:
+ case file_magic::wasm_object:
+ return ObjectFile::createSymbolicFile(Buffer, Type, Context);
+ case file_magic::macho_universal_binary:
+ return MachOUniversalBinary::create(Buffer);
+ case file_magic::windows_resource:
+ return WindowsResource::createWindowsResource(Buffer);
+ case file_magic::unknown:
+ case file_magic::coff_cl_gl_object:
+ // Unrecognized object file format.
+ return errorCodeToError(object_error::invalid_file_type);
}
llvm_unreachable("Unexpected Binary File Type");
}
Modified: llvm/trunk/lib/Object/COFFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/COFFObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/COFFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/COFFObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -15,12 +15,12 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/Error.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
Modified: llvm/trunk/lib/Object/Decompressor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/Decompressor.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/Decompressor.cpp (original)
+++ llvm/trunk/lib/Object/Decompressor.cpp Tue Jun 6 22:48:56 2017
@@ -8,10 +8,10 @@
//===----------------------------------------------------------------------===//
#include "llvm/Object/Decompressor.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/Support/Compression.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Endian.h"
using namespace llvm;
Modified: llvm/trunk/lib/Object/ELF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ELF.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ELF.cpp (original)
+++ llvm/trunk/lib/Object/ELF.cpp Tue Jun 6 22:48:56 2017
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Object/ELF.h"
-#include "llvm/Support/ELF.h"
+#include "llvm/BinaryFormat/ELF.h"
using namespace llvm;
using namespace object;
@@ -24,7 +24,7 @@ StringRef llvm::object::getELFRelocation
switch (Machine) {
case ELF::EM_X86_64:
switch (Type) {
-#include "llvm/Support/ELFRelocs/x86_64.def"
+#include "llvm/BinaryFormat/ELFRelocs/x86_64.def"
default:
break;
}
@@ -32,77 +32,77 @@ StringRef llvm::object::getELFRelocation
case ELF::EM_386:
case ELF::EM_IAMCU:
switch (Type) {
-#include "llvm/Support/ELFRelocs/i386.def"
+#include "llvm/BinaryFormat/ELFRelocs/i386.def"
default:
break;
}
break;
case ELF::EM_MIPS:
switch (Type) {
-#include "llvm/Support/ELFRelocs/Mips.def"
+#include "llvm/BinaryFormat/ELFRelocs/Mips.def"
default:
break;
}
break;
case ELF::EM_AARCH64:
switch (Type) {
-#include "llvm/Support/ELFRelocs/AArch64.def"
+#include "llvm/BinaryFormat/ELFRelocs/AArch64.def"
default:
break;
}
break;
case ELF::EM_ARM:
switch (Type) {
-#include "llvm/Support/ELFRelocs/ARM.def"
+#include "llvm/BinaryFormat/ELFRelocs/ARM.def"
default:
break;
}
break;
case ELF::EM_AVR:
switch (Type) {
-#include "llvm/Support/ELFRelocs/AVR.def"
+#include "llvm/BinaryFormat/ELFRelocs/AVR.def"
default:
break;
}
break;
case ELF::EM_HEXAGON:
switch (Type) {
-#include "llvm/Support/ELFRelocs/Hexagon.def"
+#include "llvm/BinaryFormat/ELFRelocs/Hexagon.def"
default:
break;
}
break;
case ELF::EM_LANAI:
switch (Type) {
-#include "llvm/Support/ELFRelocs/Lanai.def"
+#include "llvm/BinaryFormat/ELFRelocs/Lanai.def"
default:
break;
}
break;
case ELF::EM_PPC:
switch (Type) {
-#include "llvm/Support/ELFRelocs/PowerPC.def"
+#include "llvm/BinaryFormat/ELFRelocs/PowerPC.def"
default:
break;
}
break;
case ELF::EM_PPC64:
switch (Type) {
-#include "llvm/Support/ELFRelocs/PowerPC64.def"
+#include "llvm/BinaryFormat/ELFRelocs/PowerPC64.def"
default:
break;
}
break;
case ELF::EM_RISCV:
switch (Type) {
-#include "llvm/Support/ELFRelocs/RISCV.def"
+#include "llvm/BinaryFormat/ELFRelocs/RISCV.def"
default:
break;
}
break;
case ELF::EM_S390:
switch (Type) {
-#include "llvm/Support/ELFRelocs/SystemZ.def"
+#include "llvm/BinaryFormat/ELFRelocs/SystemZ.def"
default:
break;
}
@@ -111,27 +111,27 @@ StringRef llvm::object::getELFRelocation
case ELF::EM_SPARC32PLUS:
case ELF::EM_SPARCV9:
switch (Type) {
-#include "llvm/Support/ELFRelocs/Sparc.def"
+#include "llvm/BinaryFormat/ELFRelocs/Sparc.def"
default:
break;
}
break;
case ELF::EM_WEBASSEMBLY:
switch (Type) {
-#include "llvm/Support/ELFRelocs/WebAssembly.def"
+#include "llvm/BinaryFormat/ELFRelocs/WebAssembly.def"
default:
break;
}
break;
case ELF::EM_AMDGPU:
switch (Type) {
-#include "llvm/Support/ELFRelocs/AMDGPU.def"
+#include "llvm/BinaryFormat/ELFRelocs/AMDGPU.def"
default:
break;
}
case ELF::EM_BPF:
switch (Type) {
-#include "llvm/Support/ELFRelocs/BPF.def"
+#include "llvm/BinaryFormat/ELFRelocs/BPF.def"
default:
break;
}
Modified: llvm/trunk/lib/Object/ELFObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ELFObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ELFObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/ELFObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -13,13 +13,13 @@
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Object/ELF.h"
#include "llvm/Object/ELFTypes.h"
#include "llvm/Object/Error.h"
#include "llvm/Support/ARMAttributeParser.h"
#include "llvm/Support/ARMBuildAttributes.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
Modified: llvm/trunk/lib/Object/IRObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/IRObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/IRObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/IRObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -14,6 +14,7 @@
#include "llvm/Object/IRObjectFile.h"
#include "RecordStreamer.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Bitcode/BitcodeReader.h"
#include "llvm/IR/GVMaterializer.h"
#include "llvm/IR/LLVMContext.h"
@@ -95,13 +96,13 @@ ErrorOr<MemoryBufferRef> IRObjectFile::f
}
ErrorOr<MemoryBufferRef> IRObjectFile::findBitcodeInMemBuffer(MemoryBufferRef Object) {
- sys::fs::file_magic Type = sys::fs::identify_magic(Object.getBuffer());
+ file_magic Type = identify_magic(Object.getBuffer());
switch (Type) {
- case sys::fs::file_magic::bitcode:
+ case file_magic::bitcode:
return Object;
- case sys::fs::file_magic::elf_relocatable:
- case sys::fs::file_magic::macho_object:
- case sys::fs::file_magic::coff_object: {
+ case file_magic::elf_relocatable:
+ case file_magic::macho_object:
+ case file_magic::coff_object: {
Expected<std::unique_ptr<ObjectFile>> ObjFile =
ObjectFile::createObjectFile(Object, Type);
if (!ObjFile)
Modified: llvm/trunk/lib/Object/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/LLVMBuild.txt?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/LLVMBuild.txt (original)
+++ llvm/trunk/lib/Object/LLVMBuild.txt Tue Jun 6 22:48:56 2017
@@ -19,4 +19,4 @@
type = Library
name = Object
parent = Libraries
-required_libraries = BitReader Core MC MCParser Support
+required_libraries = BitReader Core MC BinaryFormat MCParser Support
Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -21,6 +21,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Object/Error.h"
#include "llvm/Object/MachO.h"
#include "llvm/Object/ObjectFile.h"
@@ -32,7 +33,6 @@
#include "llvm/Support/Format.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/LEB128.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/SwapByteOrder.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/Object/ObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/ObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/ObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/ObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,7 @@
#include "llvm/Object/ObjectFile.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/Error.h"
@@ -79,42 +80,42 @@ section_iterator ObjectFile::getRelocate
}
Expected<std::unique_ptr<ObjectFile>>
-ObjectFile::createObjectFile(MemoryBufferRef Object, sys::fs::file_magic Type) {
+ObjectFile::createObjectFile(MemoryBufferRef Object, file_magic Type) {
StringRef Data = Object.getBuffer();
- if (Type == sys::fs::file_magic::unknown)
- Type = sys::fs::identify_magic(Data);
+ if (Type == file_magic::unknown)
+ Type = identify_magic(Data);
switch (Type) {
- case sys::fs::file_magic::unknown:
- case sys::fs::file_magic::bitcode:
- case sys::fs::file_magic::coff_cl_gl_object:
- case sys::fs::file_magic::archive:
- case sys::fs::file_magic::macho_universal_binary:
- case sys::fs::file_magic::windows_resource:
+ case file_magic::unknown:
+ case file_magic::bitcode:
+ case file_magic::coff_cl_gl_object:
+ case file_magic::archive:
+ case file_magic::macho_universal_binary:
+ case file_magic::windows_resource:
return errorCodeToError(object_error::invalid_file_type);
- case sys::fs::file_magic::elf:
- case sys::fs::file_magic::elf_relocatable:
- case sys::fs::file_magic::elf_executable:
- case sys::fs::file_magic::elf_shared_object:
- case sys::fs::file_magic::elf_core:
+ case file_magic::elf:
+ case file_magic::elf_relocatable:
+ case file_magic::elf_executable:
+ case file_magic::elf_shared_object:
+ case file_magic::elf_core:
return errorOrToExpected(createELFObjectFile(Object));
- case sys::fs::file_magic::macho_object:
- case sys::fs::file_magic::macho_executable:
- case sys::fs::file_magic::macho_fixed_virtual_memory_shared_lib:
- case sys::fs::file_magic::macho_core:
- case sys::fs::file_magic::macho_preload_executable:
- case sys::fs::file_magic::macho_dynamically_linked_shared_lib:
- case sys::fs::file_magic::macho_dynamic_linker:
- case sys::fs::file_magic::macho_bundle:
- case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
- case sys::fs::file_magic::macho_dsym_companion:
- case sys::fs::file_magic::macho_kext_bundle:
+ case file_magic::macho_object:
+ case file_magic::macho_executable:
+ case file_magic::macho_fixed_virtual_memory_shared_lib:
+ case file_magic::macho_core:
+ case file_magic::macho_preload_executable:
+ case file_magic::macho_dynamically_linked_shared_lib:
+ case file_magic::macho_dynamic_linker:
+ case file_magic::macho_bundle:
+ case file_magic::macho_dynamically_linked_shared_lib_stub:
+ case file_magic::macho_dsym_companion:
+ case file_magic::macho_kext_bundle:
return createMachOObjectFile(Object);
- case sys::fs::file_magic::coff_object:
- case sys::fs::file_magic::coff_import_library:
- case sys::fs::file_magic::pecoff_executable:
+ case file_magic::coff_object:
+ case file_magic::coff_import_library:
+ case file_magic::pecoff_executable:
return errorOrToExpected(createCOFFObjectFile(Object));
- case sys::fs::file_magic::wasm_object:
+ case file_magic::wasm_object:
return createWasmObjectFile(Object);
}
llvm_unreachable("Unexpected Object File Type");
Modified: llvm/trunk/lib/Object/SymbolicFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/SymbolicFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/SymbolicFile.cpp (original)
+++ llvm/trunk/lib/Object/SymbolicFile.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,7 @@
#include "llvm/Object/SymbolicFile.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Object/COFFImportFile.h"
#include "llvm/Object/Error.h"
#include "llvm/Object/IRObjectFile.h"
@@ -34,45 +35,46 @@ SymbolicFile::SymbolicFile(unsigned int
SymbolicFile::~SymbolicFile() = default;
-Expected<std::unique_ptr<SymbolicFile>> SymbolicFile::createSymbolicFile(
- MemoryBufferRef Object, sys::fs::file_magic Type, LLVMContext *Context) {
+Expected<std::unique_ptr<SymbolicFile>>
+SymbolicFile::createSymbolicFile(MemoryBufferRef Object, file_magic Type,
+ LLVMContext *Context) {
StringRef Data = Object.getBuffer();
- if (Type == sys::fs::file_magic::unknown)
- Type = sys::fs::identify_magic(Data);
+ if (Type == file_magic::unknown)
+ Type = identify_magic(Data);
switch (Type) {
- case sys::fs::file_magic::bitcode:
+ case file_magic::bitcode:
if (Context)
return IRObjectFile::create(Object, *Context);
LLVM_FALLTHROUGH;
- case sys::fs::file_magic::unknown:
- case sys::fs::file_magic::archive:
- case sys::fs::file_magic::coff_cl_gl_object:
- case sys::fs::file_magic::macho_universal_binary:
- case sys::fs::file_magic::windows_resource:
+ case file_magic::unknown:
+ case file_magic::archive:
+ case file_magic::coff_cl_gl_object:
+ case file_magic::macho_universal_binary:
+ case file_magic::windows_resource:
return errorCodeToError(object_error::invalid_file_type);
- case sys::fs::file_magic::elf:
- case sys::fs::file_magic::elf_executable:
- case sys::fs::file_magic::elf_shared_object:
- case sys::fs::file_magic::elf_core:
- case sys::fs::file_magic::macho_executable:
- case sys::fs::file_magic::macho_fixed_virtual_memory_shared_lib:
- case sys::fs::file_magic::macho_core:
- case sys::fs::file_magic::macho_preload_executable:
- case sys::fs::file_magic::macho_dynamically_linked_shared_lib:
- case sys::fs::file_magic::macho_dynamic_linker:
- case sys::fs::file_magic::macho_bundle:
- case sys::fs::file_magic::macho_dynamically_linked_shared_lib_stub:
- case sys::fs::file_magic::macho_dsym_companion:
- case sys::fs::file_magic::macho_kext_bundle:
- case sys::fs::file_magic::pecoff_executable:
- case sys::fs::file_magic::wasm_object:
+ case file_magic::elf:
+ case file_magic::elf_executable:
+ case file_magic::elf_shared_object:
+ case file_magic::elf_core:
+ case file_magic::macho_executable:
+ case file_magic::macho_fixed_virtual_memory_shared_lib:
+ case file_magic::macho_core:
+ case file_magic::macho_preload_executable:
+ case file_magic::macho_dynamically_linked_shared_lib:
+ case file_magic::macho_dynamic_linker:
+ case file_magic::macho_bundle:
+ case file_magic::macho_dynamically_linked_shared_lib_stub:
+ case file_magic::macho_dsym_companion:
+ case file_magic::macho_kext_bundle:
+ case file_magic::pecoff_executable:
+ case file_magic::wasm_object:
return ObjectFile::createObjectFile(Object, Type);
- case sys::fs::file_magic::coff_import_library:
+ case file_magic::coff_import_library:
return std::unique_ptr<SymbolicFile>(new COFFImportFile(Object));
- case sys::fs::file_magic::elf_relocatable:
- case sys::fs::file_magic::macho_object:
- case sys::fs::file_magic::coff_object: {
+ case file_magic::elf_relocatable:
+ case file_magic::macho_object:
+ case file_magic::coff_object: {
Expected<std::unique_ptr<ObjectFile>> Obj =
ObjectFile::createObjectFile(Object, Type);
if (!Obj || !Context)
Modified: llvm/trunk/lib/Object/WasmObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/WasmObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/WasmObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/WasmObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -11,6 +11,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Object/Binary.h"
#include "llvm/Object/Error.h"
@@ -21,7 +22,6 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
-#include "llvm/Support/Wasm.h"
#include <algorithm>
#include <cassert>
#include <cstdint>
@@ -830,7 +830,7 @@ void WasmObjectFile::getRelocationTypeNa
break;
switch (Rel.Type) {
-#include "llvm/Support/WasmRelocs/WebAssembly.def"
+#include "llvm/BinaryFormat/WasmRelocs/WebAssembly.def"
}
#undef WASM_RELOC
Modified: llvm/trunk/lib/Object/WindowsResource.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/WindowsResource.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Object/WindowsResource.cpp (original)
+++ llvm/trunk/lib/Object/WindowsResource.cpp Tue Jun 6 22:48:56 2017
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Object/WindowsResource.h"
-#include "llvm/Support/COFF.h"
+#include "llvm/BinaryFormat/COFF.h"
#include <sstream>
#include <system_error>
Modified: llvm/trunk/lib/ObjectYAML/DWARFVisitor.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/DWARFVisitor.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/DWARFVisitor.h (original)
+++ llvm/trunk/lib/ObjectYAML/DWARFVisitor.h Tue Jun 6 22:48:56 2017
@@ -13,7 +13,7 @@
#define LLVM_OBJECTYAML_DWARFVISITOR_H
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/Dwarf.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/MemoryBuffer.h"
namespace llvm {
Modified: llvm/trunk/lib/ObjectYAML/ELFYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/ELFYAML.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/ELFYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/ELFYAML.cpp Tue Jun 6 22:48:56 2017
@@ -507,35 +507,35 @@ void ScalarEnumerationTraits<ELFYAML::EL
#define ELF_RELOC(X, Y) IO.enumCase(Value, #X, ELF::X);
switch (Object->Header.Machine) {
case ELF::EM_X86_64:
-#include "llvm/Support/ELFRelocs/x86_64.def"
+#include "llvm/BinaryFormat/ELFRelocs/x86_64.def"
break;
case ELF::EM_MIPS:
-#include "llvm/Support/ELFRelocs/Mips.def"
+#include "llvm/BinaryFormat/ELFRelocs/Mips.def"
break;
case ELF::EM_HEXAGON:
-#include "llvm/Support/ELFRelocs/Hexagon.def"
+#include "llvm/BinaryFormat/ELFRelocs/Hexagon.def"
break;
case ELF::EM_386:
case ELF::EM_IAMCU:
-#include "llvm/Support/ELFRelocs/i386.def"
+#include "llvm/BinaryFormat/ELFRelocs/i386.def"
break;
case ELF::EM_AARCH64:
-#include "llvm/Support/ELFRelocs/AArch64.def"
+#include "llvm/BinaryFormat/ELFRelocs/AArch64.def"
break;
case ELF::EM_ARM:
-#include "llvm/Support/ELFRelocs/ARM.def"
+#include "llvm/BinaryFormat/ELFRelocs/ARM.def"
break;
case ELF::EM_RISCV:
-#include "llvm/Support/ELFRelocs/RISCV.def"
+#include "llvm/BinaryFormat/ELFRelocs/RISCV.def"
break;
case ELF::EM_LANAI:
-#include "llvm/Support/ELFRelocs/Lanai.def"
+#include "llvm/BinaryFormat/ELFRelocs/Lanai.def"
break;
case ELF::EM_AMDGPU:
-#include "llvm/Support/ELFRelocs/AMDGPU.def"
+#include "llvm/BinaryFormat/ELFRelocs/AMDGPU.def"
break;
case ELF::EM_BPF:
-#include "llvm/Support/ELFRelocs/BPF.def"
+#include "llvm/BinaryFormat/ELFRelocs/BPF.def"
break;
default:
llvm_unreachable("Unsupported architecture");
Modified: llvm/trunk/lib/ObjectYAML/MachOYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/MachOYAML.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/MachOYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/MachOYAML.cpp Tue Jun 6 22:48:56 2017
@@ -12,10 +12,10 @@
//===----------------------------------------------------------------------===//
#include "llvm/ObjectYAML/MachOYAML.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/Host.h"
-#include "llvm/Support/MachO.h"
#include <string.h> // For memcpy, memset and strnlen.
@@ -252,7 +252,7 @@ void MappingTraits<MachOYAML::LoadComman
break;
switch (LoadCommand.Data.load_command_data.cmd) {
-#include "llvm/Support/MachO.def"
+#include "llvm/BinaryFormat/MachO.def"
}
IO.mapOptional("PayloadBytes", LoadCommand.PayloadBytes);
IO.mapOptional("ZeroPadBytes", LoadCommand.ZeroPadBytes, (uint64_t)0ull);
Modified: llvm/trunk/lib/ObjectYAML/WasmYAML.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/WasmYAML.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ObjectYAML/WasmYAML.cpp (original)
+++ llvm/trunk/lib/ObjectYAML/WasmYAML.cpp Tue Jun 6 22:48:56 2017
@@ -366,7 +366,7 @@ void ScalarEnumerationTraits<WasmYAML::T
void ScalarEnumerationTraits<WasmYAML::RelocType>::enumeration(
IO &IO, WasmYAML::RelocType &Type) {
#define WASM_RELOC(name, value) IO.enumCase(Type, #name, wasm::name);
-#include "llvm/Support/WasmRelocs/WebAssembly.def"
+#include "llvm/BinaryFormat/WasmRelocs/WebAssembly.def"
#undef WASM_RELOC
}
Modified: llvm/trunk/lib/Support/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/CMakeLists.txt?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Support/CMakeLists.txt (original)
+++ llvm/trunk/lib/Support/CMakeLists.txt Tue Jun 6 22:48:56 2017
@@ -58,7 +58,6 @@ add_llvm_library(LLVMSupport
DebugCounter.cpp
DeltaAlgorithm.cpp
DAGDeltaAlgorithm.cpp
- Dwarf.cpp
Error.cpp
ErrorHandling.cpp
FileUtilities.cpp
Removed: llvm/trunk/lib/Support/Dwarf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Dwarf.cpp?rev=304863&view=auto
==============================================================================
--- llvm/trunk/lib/Support/Dwarf.cpp (original)
+++ llvm/trunk/lib/Support/Dwarf.cpp (removed)
@@ -1,541 +0,0 @@
-//===-- llvm/Support/Dwarf.cpp - Dwarf Framework ----------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file contains support for generic dwarf information.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/Dwarf.h"
-#include "llvm/ADT/StringSwitch.h"
-#include "llvm/Support/ErrorHandling.h"
-
-using namespace llvm;
-using namespace dwarf;
-
-StringRef llvm::dwarf::TagString(unsigned Tag) {
- switch (Tag) {
- default:
- return StringRef();
-#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) \
- case DW_TAG_##NAME: \
- return "DW_TAG_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::getTag(StringRef TagString) {
- return StringSwitch<unsigned>(TagString)
-#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) \
- .Case("DW_TAG_" #NAME, DW_TAG_##NAME)
-#include "llvm/Support/Dwarf.def"
- .Default(DW_TAG_invalid);
-}
-
-unsigned llvm::dwarf::TagVersion(dwarf::Tag Tag) {
- switch (Tag) {
- default:
- return 0;
-#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) \
- case DW_TAG_##NAME: \
- return VERSION;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::TagVendor(dwarf::Tag Tag) {
- switch (Tag) {
- default:
- return 0;
-#define HANDLE_DW_TAG(ID, NAME, VERSION, VENDOR) \
- case DW_TAG_##NAME: \
- return DWARF_VENDOR_##VENDOR;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::ChildrenString(unsigned Children) {
- switch (Children) {
- case DW_CHILDREN_no: return "DW_CHILDREN_no";
- case DW_CHILDREN_yes: return "DW_CHILDREN_yes";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::AttributeString(unsigned Attribute) {
- switch (Attribute) {
- default:
- return StringRef();
-#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) \
- case DW_AT_##NAME: \
- return "DW_AT_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::AttributeVersion(dwarf::Attribute Attribute) {
- switch (Attribute) {
- default:
- return 0;
-#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) \
- case DW_AT_##NAME: \
- return VERSION;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::AttributeVendor(dwarf::Attribute Attribute) {
- switch (Attribute) {
- default:
- return 0;
-#define HANDLE_DW_AT(ID, NAME, VERSION, VENDOR) \
- case DW_AT_##NAME: \
- return DWARF_VENDOR_##VENDOR;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::FormEncodingString(unsigned Encoding) {
- switch (Encoding) {
- default:
- return StringRef();
-#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) \
- case DW_FORM_##NAME: \
- return "DW_FORM_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::FormVersion(dwarf::Form Form) {
- switch (Form) {
- default:
- return 0;
-#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) \
- case DW_FORM_##NAME: \
- return VERSION;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::FormVendor(dwarf::Form Form) {
- switch (Form) {
- default:
- return 0;
-#define HANDLE_DW_FORM(ID, NAME, VERSION, VENDOR) \
- case DW_FORM_##NAME: \
- return DWARF_VENDOR_##VENDOR;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::OperationEncodingString(unsigned Encoding) {
- switch (Encoding) {
- default:
- return StringRef();
-#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
- case DW_OP_##NAME: \
- return "DW_OP_" #NAME;
-#include "llvm/Support/Dwarf.def"
- case DW_OP_LLVM_fragment:
- return "DW_OP_LLVM_fragment";
- }
-}
-
-unsigned llvm::dwarf::getOperationEncoding(StringRef OperationEncodingString) {
- return StringSwitch<unsigned>(OperationEncodingString)
-#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
- .Case("DW_OP_" #NAME, DW_OP_##NAME)
-#include "llvm/Support/Dwarf.def"
- .Case("DW_OP_LLVM_fragment", DW_OP_LLVM_fragment)
- .Default(0);
-}
-
-unsigned llvm::dwarf::OperationVersion(dwarf::LocationAtom Op) {
- switch (Op) {
- default:
- return 0;
-#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
- case DW_OP_##NAME: \
- return VERSION;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::OperationVendor(dwarf::LocationAtom Op) {
- switch (Op) {
- default:
- return 0;
-#define HANDLE_DW_OP(ID, NAME, VERSION, VENDOR) \
- case DW_OP_##NAME: \
- return DWARF_VENDOR_##VENDOR;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::AttributeEncodingString(unsigned Encoding) {
- switch (Encoding) {
- default:
- return StringRef();
-#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
- case DW_ATE_##NAME: \
- return "DW_ATE_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::getAttributeEncoding(StringRef EncodingString) {
- return StringSwitch<unsigned>(EncodingString)
-#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
- .Case("DW_ATE_" #NAME, DW_ATE_##NAME)
-#include "llvm/Support/Dwarf.def"
- .Default(0);
-}
-
-unsigned llvm::dwarf::AttributeEncodingVersion(dwarf::TypeKind ATE) {
- switch (ATE) {
- default:
- return 0;
-#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
- case DW_ATE_##NAME: \
- return VERSION;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::AttributeEncodingVendor(dwarf::TypeKind ATE) {
- switch (ATE) {
- default:
- return 0;
-#define HANDLE_DW_ATE(ID, NAME, VERSION, VENDOR) \
- case DW_ATE_##NAME: \
- return DWARF_VENDOR_##VENDOR;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::DecimalSignString(unsigned Sign) {
- switch (Sign) {
- case DW_DS_unsigned: return "DW_DS_unsigned";
- case DW_DS_leading_overpunch: return "DW_DS_leading_overpunch";
- case DW_DS_trailing_overpunch: return "DW_DS_trailing_overpunch";
- case DW_DS_leading_separate: return "DW_DS_leading_separate";
- case DW_DS_trailing_separate: return "DW_DS_trailing_separate";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::EndianityString(unsigned Endian) {
- switch (Endian) {
- case DW_END_default: return "DW_END_default";
- case DW_END_big: return "DW_END_big";
- case DW_END_little: return "DW_END_little";
- case DW_END_lo_user: return "DW_END_lo_user";
- case DW_END_hi_user: return "DW_END_hi_user";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::AccessibilityString(unsigned Access) {
- switch (Access) {
- // Accessibility codes
- case DW_ACCESS_public: return "DW_ACCESS_public";
- case DW_ACCESS_protected: return "DW_ACCESS_protected";
- case DW_ACCESS_private: return "DW_ACCESS_private";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::VisibilityString(unsigned Visibility) {
- switch (Visibility) {
- case DW_VIS_local: return "DW_VIS_local";
- case DW_VIS_exported: return "DW_VIS_exported";
- case DW_VIS_qualified: return "DW_VIS_qualified";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::VirtualityString(unsigned Virtuality) {
- switch (Virtuality) {
- default:
- return StringRef();
-#define HANDLE_DW_VIRTUALITY(ID, NAME) \
- case DW_VIRTUALITY_##NAME: \
- return "DW_VIRTUALITY_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::getVirtuality(StringRef VirtualityString) {
- return StringSwitch<unsigned>(VirtualityString)
-#define HANDLE_DW_VIRTUALITY(ID, NAME) \
- .Case("DW_VIRTUALITY_" #NAME, DW_VIRTUALITY_##NAME)
-#include "llvm/Support/Dwarf.def"
- .Default(DW_VIRTUALITY_invalid);
-}
-
-StringRef llvm::dwarf::LanguageString(unsigned Language) {
- switch (Language) {
- default:
- return StringRef();
-#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) \
- case DW_LANG_##NAME: \
- return "DW_LANG_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::getLanguage(StringRef LanguageString) {
- return StringSwitch<unsigned>(LanguageString)
-#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) \
- .Case("DW_LANG_" #NAME, DW_LANG_##NAME)
-#include "llvm/Support/Dwarf.def"
- .Default(0);
-}
-
-unsigned llvm::dwarf::LanguageVersion(dwarf::SourceLanguage Lang) {
- switch (Lang) {
- default:
- return 0;
-#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) \
- case DW_LANG_##NAME: \
- return VERSION;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::LanguageVendor(dwarf::SourceLanguage Lang) {
- switch (Lang) {
- default:
- return 0;
-#define HANDLE_DW_LANG(ID, NAME, VERSION, VENDOR) \
- case DW_LANG_##NAME: \
- return DWARF_VENDOR_##VENDOR;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::CaseString(unsigned Case) {
- switch (Case) {
- case DW_ID_case_sensitive: return "DW_ID_case_sensitive";
- case DW_ID_up_case: return "DW_ID_up_case";
- case DW_ID_down_case: return "DW_ID_down_case";
- case DW_ID_case_insensitive: return "DW_ID_case_insensitive";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::ConventionString(unsigned CC) {
- switch (CC) {
- default:
- return StringRef();
-#define HANDLE_DW_CC(ID, NAME) \
- case DW_CC_##NAME: \
- return "DW_CC_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-unsigned llvm::dwarf::getCallingConvention(StringRef CCString) {
- return StringSwitch<unsigned>(CCString)
-#define HANDLE_DW_CC(ID, NAME) .Case("DW_CC_" #NAME, DW_CC_##NAME)
-#include "llvm/Support/Dwarf.def"
- .Default(0);
-}
-
-StringRef llvm::dwarf::InlineCodeString(unsigned Code) {
- switch (Code) {
- case DW_INL_not_inlined: return "DW_INL_not_inlined";
- case DW_INL_inlined: return "DW_INL_inlined";
- case DW_INL_declared_not_inlined: return "DW_INL_declared_not_inlined";
- case DW_INL_declared_inlined: return "DW_INL_declared_inlined";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::ArrayOrderString(unsigned Order) {
- switch (Order) {
- case DW_ORD_row_major: return "DW_ORD_row_major";
- case DW_ORD_col_major: return "DW_ORD_col_major";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::DiscriminantString(unsigned Discriminant) {
- switch (Discriminant) {
- case DW_DSC_label: return "DW_DSC_label";
- case DW_DSC_range: return "DW_DSC_range";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::LNStandardString(unsigned Standard) {
- switch (Standard) {
- default:
- return StringRef();
-#define HANDLE_DW_LNS(ID, NAME) \
- case DW_LNS_##NAME: \
- return "DW_LNS_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::LNExtendedString(unsigned Encoding) {
- switch (Encoding) {
- default:
- return StringRef();
-#define HANDLE_DW_LNE(ID, NAME) \
- case DW_LNE_##NAME: \
- return "DW_LNE_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::MacinfoString(unsigned Encoding) {
- switch (Encoding) {
- // Macinfo Type Encodings
- case DW_MACINFO_define: return "DW_MACINFO_define";
- case DW_MACINFO_undef: return "DW_MACINFO_undef";
- case DW_MACINFO_start_file: return "DW_MACINFO_start_file";
- case DW_MACINFO_end_file: return "DW_MACINFO_end_file";
- case DW_MACINFO_vendor_ext: return "DW_MACINFO_vendor_ext";
- case DW_MACINFO_invalid: return "DW_MACINFO_invalid";
- }
- return StringRef();
-}
-
-unsigned llvm::dwarf::getMacinfo(StringRef MacinfoString) {
- return StringSwitch<unsigned>(MacinfoString)
- .Case("DW_MACINFO_define", DW_MACINFO_define)
- .Case("DW_MACINFO_undef", DW_MACINFO_undef)
- .Case("DW_MACINFO_start_file", DW_MACINFO_start_file)
- .Case("DW_MACINFO_end_file", DW_MACINFO_end_file)
- .Case("DW_MACINFO_vendor_ext", DW_MACINFO_vendor_ext)
- .Default(DW_MACINFO_invalid);
-}
-
-StringRef llvm::dwarf::CallFrameString(unsigned Encoding) {
- switch (Encoding) {
- default:
- return StringRef();
-#define HANDLE_DW_CFA(ID, NAME) \
- case DW_CFA_##NAME: \
- return "DW_CFA_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::ApplePropertyString(unsigned Prop) {
- switch (Prop) {
- default:
- return StringRef();
-#define HANDLE_DW_APPLE_PROPERTY(ID, NAME) \
- case DW_APPLE_PROPERTY_##NAME: \
- return "DW_APPLE_PROPERTY_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::UnitTypeString(unsigned UT) {
- switch (UT) {
- default:
- return StringRef();
-#define HANDLE_DW_UT(ID, NAME) \
- case DW_UT_##NAME: \
- return "DW_UT_" #NAME;
-#include "llvm/Support/Dwarf.def"
- }
-}
-
-StringRef llvm::dwarf::AtomTypeString(unsigned AT) {
- switch (AT) {
- case dwarf::DW_ATOM_null:
- return "DW_ATOM_null";
- case dwarf::DW_ATOM_die_offset:
- return "DW_ATOM_die_offset";
- case DW_ATOM_cu_offset:
- return "DW_ATOM_cu_offset";
- case DW_ATOM_die_tag:
- return "DW_ATOM_die_tag";
- case DW_ATOM_type_flags:
- return "DW_ATOM_type_flags";
- }
- return StringRef();
-}
-
-StringRef llvm::dwarf::GDBIndexEntryKindString(GDBIndexEntryKind Kind) {
- switch (Kind) {
- case GIEK_NONE:
- return "NONE";
- case GIEK_TYPE:
- return "TYPE";
- case GIEK_VARIABLE:
- return "VARIABLE";
- case GIEK_FUNCTION:
- return "FUNCTION";
- case GIEK_OTHER:
- return "OTHER";
- case GIEK_UNUSED5:
- return "UNUSED5";
- case GIEK_UNUSED6:
- return "UNUSED6";
- case GIEK_UNUSED7:
- return "UNUSED7";
- }
- llvm_unreachable("Unknown GDBIndexEntryKind value");
-}
-
-StringRef
-llvm::dwarf::GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage) {
- switch (Linkage) {
- case GIEL_EXTERNAL:
- return "EXTERNAL";
- case GIEL_STATIC:
- return "STATIC";
- }
- llvm_unreachable("Unknown GDBIndexEntryLinkage value");
-}
-
-StringRef llvm::dwarf::AttributeValueString(uint16_t Attr, unsigned Val) {
- switch (Attr) {
- case DW_AT_accessibility:
- return AccessibilityString(Val);
- case DW_AT_virtuality:
- return VirtualityString(Val);
- case DW_AT_language:
- return LanguageString(Val);
- case DW_AT_encoding:
- return AttributeEncodingString(Val);
- case DW_AT_decimal_sign:
- return DecimalSignString(Val);
- case DW_AT_endianity:
- return EndianityString(Val);
- case DW_AT_visibility:
- return VisibilityString(Val);
- case DW_AT_identifier_case:
- return CaseString(Val);
- case DW_AT_calling_convention:
- return ConventionString(Val);
- case DW_AT_inline:
- return InlineCodeString(Val);
- case DW_AT_ordering:
- return ArrayOrderString(Val);
- case DW_AT_discr_value:
- return DiscriminantString(Val);
- }
-
- return StringRef();
-}
-
-bool llvm::dwarf::isValidFormForVersion(Form F, unsigned Version,
- bool ExtensionsOk) {
- if (FormVendor(F) == DWARF_VENDOR_DWARF) {
- unsigned FV = FormVersion(F);
- return FV > 0 && FV <= Version;
- }
- return ExtensionsOk;
-}
Modified: llvm/trunk/lib/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Path.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Path.cpp (original)
+++ llvm/trunk/lib/Support/Path.cpp Tue Jun 6 22:48:56 2017
@@ -13,12 +13,12 @@
#include "llvm/Support/Path.h"
#include "llvm/ADT/ArrayRef.h"
-#include "llvm/Support/COFF.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/Process.h"
#include <cctype>
#include <cstring>
@@ -1027,178 +1027,6 @@ void directory_entry::replace_filename(c
Status = st;
}
-template <size_t N>
-static bool startswith(StringRef Magic, const char (&S)[N]) {
- return Magic.startswith(StringRef(S, N - 1));
-}
-
-/// @brief Identify the magic in magic.
-file_magic identify_magic(StringRef Magic) {
- if (Magic.size() < 4)
- return file_magic::unknown;
- switch ((unsigned char)Magic[0]) {
- case 0x00: {
- // COFF bigobj, CL.exe's LTO object file, or short import library file
- if (startswith(Magic, "\0\0\xFF\xFF")) {
- size_t MinSize = offsetof(COFF::BigObjHeader, UUID) + sizeof(COFF::BigObjMagic);
- if (Magic.size() < MinSize)
- return file_magic::coff_import_library;
-
- const char *Start = Magic.data() + offsetof(COFF::BigObjHeader, UUID);
- if (memcmp(Start, COFF::BigObjMagic, sizeof(COFF::BigObjMagic)) == 0)
- return file_magic::coff_object;
- if (memcmp(Start, COFF::ClGlObjMagic, sizeof(COFF::BigObjMagic)) == 0)
- return file_magic::coff_cl_gl_object;
- return file_magic::coff_import_library;
- }
- // Windows resource file
- if (startswith(Magic, "\0\0\0\0\x20\0\0\0\xFF"))
- return file_magic::windows_resource;
- // 0x0000 = COFF unknown machine type
- if (Magic[1] == 0)
- return file_magic::coff_object;
- if (startswith(Magic, "\0asm"))
- return file_magic::wasm_object;
- break;
- }
- case 0xDE: // 0x0B17C0DE = BC wraper
- if (startswith(Magic, "\xDE\xC0\x17\x0B"))
- return file_magic::bitcode;
- break;
- case 'B':
- if (startswith(Magic, "BC\xC0\xDE"))
- return file_magic::bitcode;
- break;
- case '!':
- if (startswith(Magic, "!<arch>\n") || startswith(Magic, "!<thin>\n"))
- return file_magic::archive;
- break;
-
- case '\177':
- if (startswith(Magic, "\177ELF") && Magic.size() >= 18) {
- bool Data2MSB = Magic[5] == 2;
- unsigned high = Data2MSB ? 16 : 17;
- unsigned low = Data2MSB ? 17 : 16;
- if (Magic[high] == 0) {
- switch (Magic[low]) {
- default: return file_magic::elf;
- case 1: return file_magic::elf_relocatable;
- case 2: return file_magic::elf_executable;
- case 3: return file_magic::elf_shared_object;
- case 4: return file_magic::elf_core;
- }
- }
- // It's still some type of ELF file.
- return file_magic::elf;
- }
- break;
-
- case 0xCA:
- if (startswith(Magic, "\xCA\xFE\xBA\xBE") ||
- startswith(Magic, "\xCA\xFE\xBA\xBF")) {
- // This is complicated by an overlap with Java class files.
- // See the Mach-O section in /usr/share/file/magic for details.
- if (Magic.size() >= 8 && Magic[7] < 43)
- return file_magic::macho_universal_binary;
- }
- break;
-
- // The two magic numbers for mach-o are:
- // 0xfeedface - 32-bit mach-o
- // 0xfeedfacf - 64-bit mach-o
- case 0xFE:
- case 0xCE:
- case 0xCF: {
- uint16_t type = 0;
- if (startswith(Magic, "\xFE\xED\xFA\xCE") ||
- startswith(Magic, "\xFE\xED\xFA\xCF")) {
- /* Native endian */
- size_t MinSize;
- if (Magic[3] == char(0xCE))
- MinSize = sizeof(MachO::mach_header);
- else
- MinSize = sizeof(MachO::mach_header_64);
- if (Magic.size() >= MinSize)
- type = Magic[12] << 24 | Magic[13] << 12 | Magic[14] << 8 | Magic[15];
- } else if (startswith(Magic, "\xCE\xFA\xED\xFE") ||
- startswith(Magic, "\xCF\xFA\xED\xFE")) {
- /* Reverse endian */
- size_t MinSize;
- if (Magic[0] == char(0xCE))
- MinSize = sizeof(MachO::mach_header);
- else
- MinSize = sizeof(MachO::mach_header_64);
- if (Magic.size() >= MinSize)
- type = Magic[15] << 24 | Magic[14] << 12 |Magic[13] << 8 | Magic[12];
- }
- switch (type) {
- default: break;
- case 1: return file_magic::macho_object;
- case 2: return file_magic::macho_executable;
- case 3: return file_magic::macho_fixed_virtual_memory_shared_lib;
- case 4: return file_magic::macho_core;
- case 5: return file_magic::macho_preload_executable;
- case 6: return file_magic::macho_dynamically_linked_shared_lib;
- case 7: return file_magic::macho_dynamic_linker;
- case 8: return file_magic::macho_bundle;
- case 9: return file_magic::macho_dynamically_linked_shared_lib_stub;
- case 10: return file_magic::macho_dsym_companion;
- case 11: return file_magic::macho_kext_bundle;
- }
- break;
- }
- case 0xF0: // PowerPC Windows
- case 0x83: // Alpha 32-bit
- case 0x84: // Alpha 64-bit
- case 0x66: // MPS R4000 Windows
- case 0x50: // mc68K
- case 0x4c: // 80386 Windows
- case 0xc4: // ARMNT Windows
- if (Magic[1] == 0x01)
- return file_magic::coff_object;
- LLVM_FALLTHROUGH;
-
- case 0x90: // PA-RISC Windows
- case 0x68: // mc68K Windows
- if (Magic[1] == 0x02)
- return file_magic::coff_object;
- break;
-
- case 'M': // Possible MS-DOS stub on Windows PE file
- if (startswith(Magic, "MZ")) {
- uint32_t off = read32le(Magic.data() + 0x3c);
- // PE/COFF file, either EXE or DLL.
- if (off < Magic.size() &&
- memcmp(Magic.data()+off, COFF::PEMagic, sizeof(COFF::PEMagic)) == 0)
- return file_magic::pecoff_executable;
- }
- break;
-
- case 0x64: // x86-64 Windows.
- if (Magic[1] == char(0x86))
- return file_magic::coff_object;
- break;
-
- default:
- break;
- }
- return file_magic::unknown;
-}
-
-std::error_code identify_magic(const Twine &Path, file_magic &Result) {
- int FD;
- if (std::error_code EC = openFileForRead(Path, FD))
- return EC;
-
- char Buffer[32];
- int Length = read(FD, Buffer, sizeof(Buffer));
- if (close(FD) != 0 || Length < 0)
- return std::error_code(errno, std::generic_category());
-
- Result = identify_magic(StringRef(Buffer, Length));
- return std::error_code();
-}
-
std::error_code directory_entry::status(file_status &result) const {
return fs::status(Path, result, FollowSymlinks);
}
Modified: llvm/trunk/lib/Target/AArch64/AArch64TargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64TargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64TargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64TargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -9,12 +9,12 @@
#include "AArch64TargetObjectFile.h"
#include "AArch64TargetMachine.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Mangler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCValue.h"
-#include "llvm/Support/Dwarf.h"
using namespace llvm;
using namespace dwarf;
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp Tue Jun 6 22:48:56 2017
@@ -11,6 +11,7 @@
#include "AArch64RegisterInfo.h"
#include "MCTargetDesc/AArch64FixupKinds.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
@@ -22,7 +23,6 @@
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/MachO.h"
using namespace llvm;
namespace {
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -15,11 +15,11 @@
#include "MCTargetDesc/AArch64FixupKinds.h"
#include "MCTargetDesc/AArch64MCExpr.h"
#include "MCTargetDesc/AArch64MCTargetDesc.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCValue.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <cstdint>
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64ELFStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -18,6 +18,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCCodeEmitter.h"
@@ -30,7 +31,6 @@
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -10,6 +10,7 @@
#include "MCTargetDesc/AArch64FixupKinds.h"
#include "MCTargetDesc/AArch64MCTargetDesc.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
@@ -23,7 +24,6 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
#include <cstdint>
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp Tue Jun 6 22:48:56 2017
@@ -30,12 +30,12 @@
#include "SIMachineFunctionInfo.h"
#include "SIRegisterInfo.h"
#include "Utils/AMDGPUBaseInfo.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUTargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -11,9 +11,9 @@
#include "AMDGPU.h"
#include "AMDGPUTargetMachine.h"
#include "Utils/AMDGPUBaseInfo.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
-#include "llvm/Support/ELF.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp Tue Jun 6 22:48:56 2017
@@ -23,6 +23,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/MachineValueType.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
@@ -40,7 +41,6 @@
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SMLoc.h"
Modified: llvm/trunk/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp Tue Jun 6 22:48:56 2017
@@ -24,13 +24,13 @@
#include "SIDefines.h"
#include "Utils/AMDGPUBaseInfo.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCFixedLenDisassembler.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/TargetRegistry.h"
Modified: llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -8,12 +8,12 @@
//===----------------------------------------------------------------------===//
#include "AMDGPUMCTargetDesc.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCValue.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -17,6 +17,7 @@
#include "Utils/AMDGPUBaseInfo.h"
#include "Utils/AMDKernelCodeTUtils.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Metadata.h"
@@ -25,7 +26,6 @@
#include "llvm/MC/MCELFStreamer.h"
#include "llvm/MC/MCObjectFileInfo.h"
#include "llvm/MC/MCSectionELF.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/FormattedStream.h"
namespace llvm {
Modified: llvm/trunk/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp Tue Jun 6 22:48:56 2017
@@ -12,6 +12,7 @@
#include "SIDefines.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/Constants.h"
@@ -27,7 +28,6 @@
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/SubtargetFeature.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
Modified: llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMAsmPrinter.cpp Tue Jun 6 22:48:56 2017
@@ -23,6 +23,8 @@
#include "MCTargetDesc/ARMMCExpr.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallString.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
@@ -43,9 +45,7 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/ARMBuildAttributes.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/TargetParser.h"
#include "llvm/Support/TargetRegistry.h"
Modified: llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMTargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -10,14 +10,14 @@
#include "ARMTargetObjectFile.h"
#include "ARMSubtarget.h"
#include "ARMTargetMachine.h"
+#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCTargetOptions.h"
#include "llvm/MC/SectionKind.h"
-#include "llvm/Support/Dwarf.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Target/TargetMachine.h"
#include <cassert>
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Tue Jun 6 22:48:56 2017
@@ -17,6 +17,8 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
@@ -39,10 +41,8 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/ARMEHABI.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TargetParser.h"
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp Tue Jun 6 22:48:56 2017
@@ -16,6 +16,8 @@
#include "MCTargetDesc/ARMFixupKinds.h"
#include "MCTargetDesc/ARMMCTargetDesc.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
@@ -31,10 +33,8 @@
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/TargetParser.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMAsmBackendDarwin.h Tue Jun 6 22:48:56 2017
@@ -11,7 +11,7 @@
#define LLVM_LIB_TARGET_ARM_ARMASMBACKENDDARWIN_H
#include "ARMAsmBackend.h"
-#include "llvm/Support/MachO.h"
+#include "llvm/BinaryFormat/MachO.h"
namespace llvm {
class ARMAsmBackendDarwin : public ARMAsmBackend {
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -9,12 +9,12 @@
#include "MCTargetDesc/ARMFixupKinds.h"
#include "MCTargetDesc/ARMMCTargetDesc.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCValue.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cstdint>
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMELFStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -21,6 +21,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
@@ -43,7 +44,6 @@
#include "llvm/Support/ARMBuildAttributes.h"
#include "llvm/Support/ARMEHABI.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/LEB128.h"
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -11,6 +11,7 @@
#include "MCTargetDesc/ARMFixupKinds.h"
#include "MCTargetDesc/ARMMCTargetDesc.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
@@ -21,7 +22,6 @@
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/MachO.h"
using namespace llvm;
namespace {
Modified: llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -9,13 +9,13 @@
#include "MCTargetDesc/ARMFixupKinds.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCFixupKindInfo.h"
#include "llvm/MC/MCValue.h"
#include "llvm/MC/MCWinCOFFObjectWriter.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
Modified: llvm/trunk/lib/Target/AVR/AVRSubtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/AVRSubtarget.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/AVRSubtarget.cpp (original)
+++ llvm/trunk/lib/Target/AVR/AVRSubtarget.cpp Tue Jun 6 22:48:56 2017
@@ -13,7 +13,7 @@
#include "AVRSubtarget.h"
-#include "llvm/Support/ELF.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Support/TargetRegistry.h"
#include "AVR.h"
Modified: llvm/trunk/lib/Target/AVR/AVRTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/AVRTargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/AVRTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/AVR/AVRTargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -9,12 +9,12 @@
#include "AVRTargetObjectFile.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Mangler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
-#include "llvm/Support/ELF.h"
#include "AVR.h"
Modified: llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/AVR/MCTargetDesc/AVRELFStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -1,8 +1,8 @@
#include "AVRELFStreamer.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/SubtargetFeature.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/FormattedStream.h"
#include "AVRMCTargetDesc.h"
Modified: llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -8,9 +8,9 @@
//===----------------------------------------------------------------------===//
#include "MCTargetDesc/BPFMCTargetDesc.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCFixup.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include <cstdint>
Modified: llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp Tue Jun 6 22:48:56 2017
@@ -22,6 +22,7 @@
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDirectives.h"
@@ -42,7 +43,6 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/MathExtras.h"
Modified: llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonAsmPrinter.cpp Tue Jun 6 22:48:56 2017
@@ -23,6 +23,7 @@
#include "MCTargetDesc/HexagonMCShuffler.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Analysis/ConstantFolding.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineInstr.h"
@@ -43,7 +44,6 @@
#include "llvm/MC/MCSymbol.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/TargetRegistry.h"
Modified: llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonTargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -17,6 +17,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalObject.h"
@@ -28,7 +29,6 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -17,6 +17,7 @@
#include "MCTargetDesc/HexagonMCInstrInfo.h"
#include "MCTargetDesc/HexagonMCShuffler.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
@@ -29,7 +30,6 @@
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include <cassert>
Modified: llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp Tue Jun 6 22:48:56 2017
@@ -19,6 +19,7 @@
#include "MCTargetDesc/HexagonMCELFStreamer.h"
#include "MCTargetDesc/HexagonMCInstrInfo.h"
#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCELFStreamer.h"
@@ -27,7 +28,6 @@
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSubtargetInfo.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/LanaiTargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -10,13 +10,13 @@
#include "LanaiSubtarget.h"
#include "LanaiTargetMachine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -9,8 +9,8 @@
#include "MCTargetDesc/LanaiBaseInfo.h"
#include "MCTargetDesc/LanaiFixupKinds.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCELFObjectWriter.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/Mips/AsmParser/MipsAsmParser.cpp Tue Jun 6 22:48:56 2017
@@ -20,6 +20,7 @@
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCInst.h"
@@ -40,7 +41,6 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/SMLoc.h"
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -10,13 +10,13 @@
#include "MCTargetDesc/MipsFixupKinds.h"
#include "MCTargetDesc/MipsMCTargetDesc.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsELFStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -10,12 +10,12 @@
#include "MipsELFStreamer.h"
#include "MipsOptionRecord.h"
#include "MipsTargetStreamer.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCInst.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsMCExpr.cpp Tue Jun 6 22:48:56 2017
@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "MipsMCExpr.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
@@ -15,7 +16,6 @@
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/MCValue.h"
#include "llvm/Support/Casting.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp Tue Jun 6 22:48:56 2017
@@ -11,11 +11,11 @@
#include "MipsABIInfo.h"
#include "MipsELFStreamer.h"
#include "MipsTargetStreamer.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSectionELF.h"
-#include "llvm/Support/ELF.h"
#include <cassert>
using namespace llvm;
Modified: llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp Tue Jun 6 22:48:56 2017
@@ -18,12 +18,12 @@
#include "MipsMCExpr.h"
#include "MipsMCTargetDesc.h"
#include "MipsTargetObjectFile.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
Modified: llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsAsmPrinter.cpp Tue Jun 6 22:48:56 2017
@@ -23,6 +23,7 @@
#include "MipsTargetStreamer.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
@@ -43,7 +44,6 @@
#include "llvm/MC/MCSection.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSymbolELF.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
Modified: llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/Mips/MipsTargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -10,13 +10,13 @@
#include "MipsTargetObjectFile.h"
#include "MipsSubtarget.h"
#include "MipsTargetMachine.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp Tue Jun 6 22:48:56 2017
@@ -9,6 +9,8 @@
#include "MCTargetDesc/PPCFixupKinds.h"
#include "MCTargetDesc/PPCMCTargetDesc.h"
+#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCELFObjectWriter.h"
@@ -18,9 +20,7 @@
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/MC/MCValue.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/TargetRegistry.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMCTargetDesc.cpp Tue Jun 6 22:48:56 2017
@@ -17,6 +17,7 @@
#include "PPCTargetStreamer.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
@@ -30,7 +31,6 @@
#include "llvm/MC/MCSymbolELF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CodeGen.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/TargetRegistry.h"
Modified: llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -10,6 +10,7 @@
#include "MCTargetDesc/PPCFixupKinds.h"
#include "MCTargetDesc/PPCMCTargetDesc.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
#include "llvm/MC/MCContext.h"
@@ -18,7 +19,6 @@
#include "llvm/MC/MCValue.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
-#include "llvm/Support/MachO.h"
using namespace llvm;
@@ -151,7 +151,7 @@ static void makeRelocationInfo(MachO::an
// The bitfield offsets that work (as determined by trial-and-error)
// are different than what is documented in the mach-o manuals.
// This appears to be an endianness issue; reversing the order of the
- // documented bitfields in <llvm/Support/MachO.h> fixes this (but
+ // documented bitfields in <llvm/BinaryFormat/MachO.h> fixes this (but
// breaks x86/ARM assembly).
MRE.r_word1 = ((Index << 8) | // was << 0
(IsPCRel << 7) | // was << 24
@@ -222,7 +222,7 @@ bool PPCMachObjectWriter::recordScattere
report_fatal_error("symbol '" + B->getSymbol().getName() +
"' can not be undefined in a subtraction expression");
- // FIXME: is Type correct? see include/llvm/Support/MachO.h
+ // FIXME: is Type correct? see include/llvm/BinaryFormat/MachO.h
Value2 = Writer->getSymbolAddress(B->getSymbol(), Layout);
FixedValue -= Writer->getSectionAddress(SB->getFragment()->getParent());
}
Modified: llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/PowerPC/PPCAsmPrinter.cpp Tue Jun 6 22:48:56 2017
@@ -29,6 +29,8 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
@@ -55,9 +57,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
Modified: llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/MCTargetDesc/SparcMCAsmInfo.cpp Tue Jun 6 22:48:56 2017
@@ -14,10 +14,10 @@
#include "SparcMCAsmInfo.h"
#include "SparcMCExpr.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCTargetOptions.h"
-#include "llvm/Support/Dwarf.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/Sparc/SparcTargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -9,8 +9,8 @@
#include "SparcTargetObjectFile.h"
#include "MCTargetDesc/SparcMCExpr.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Target/TargetLowering.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -9,11 +9,11 @@
#include "MCTargetDesc/SystemZMCFixups.h"
#include "MCTargetDesc/SystemZMCTargetDesc.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCValue.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <cstdint>
Modified: llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/TargetLoweringObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Target/TargetLoweringObjectFile.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
@@ -24,7 +25,6 @@
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLowering.h"
Modified: llvm/trunk/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.h (original)
+++ llvm/trunk/lib/Target/WebAssembly/InstPrinter/WebAssemblyInstPrinter.h Tue Jun 6 22:48:56 2017
@@ -16,9 +16,9 @@
#define LLVM_LIB_TARGET_WEBASSEMBLY_INSTPRINTER_WEBASSEMBLYINSTPRINTER_H
#include "llvm/ADT/SmallVector.h"
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/CodeGen/MachineValueType.h"
#include "llvm/MC/MCInstPrinter.h"
-#include "llvm/Support/Wasm.h"
namespace llvm {
Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h (original)
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h Tue Jun 6 22:48:56 2017
@@ -15,9 +15,9 @@
#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYMCTARGETDESC_H
#define LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYMCTARGETDESC_H
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/MC/MCInstrDesc.h"
#include "llvm/Support/DataTypes.h"
-#include "llvm/Support/Wasm.h"
namespace llvm {
Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h (original)
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h Tue Jun 6 22:48:56 2017
@@ -16,9 +16,9 @@
#ifndef LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYTARGETSTREAMER_H
#define LLVM_LIB_TARGET_WEBASSEMBLY_MCTARGETDESC_WEBASSEMBLYTARGETSTREAMER_H
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/CodeGen/MachineValueType.h"
#include "llvm/MC/MCStreamer.h"
-#include "llvm/Support/Wasm.h"
namespace llvm {
Modified: llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -15,12 +15,12 @@
#include "MCTargetDesc/WebAssemblyFixupKinds.h"
#include "MCTargetDesc/WebAssemblyMCTargetDesc.h"
+#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCSymbolWasm.h"
#include "llvm/MC/MCWasmObjectWriter.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/Wasm.h"
using namespace llvm;
namespace {
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp Tue Jun 6 22:48:56 2017
@@ -10,6 +10,8 @@
#include "MCTargetDesc/X86BaseInfo.h"
#include "MCTargetDesc/X86FixupKinds.h"
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/BinaryFormat/ELF.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCExpr.h"
@@ -22,9 +24,7 @@
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCSubtargetInfo.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -9,13 +9,13 @@
#include "MCTargetDesc/X86FixupKinds.h"
#include "MCTargetDesc/X86MCTargetDesc.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCELFObjectWriter.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCValue.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <cstdint>
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp Tue Jun 6 22:48:56 2017
@@ -13,12 +13,12 @@
#include "X86MCAsmInfo.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/ELF.h"
using namespace llvm;
enum AsmWriterFlavorTy {
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -10,6 +10,7 @@
#include "MCTargetDesc/X86FixupKinds.h"
#include "MCTargetDesc/X86MCTargetDesc.h"
#include "llvm/ADT/Twine.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCAsmLayout.h"
#include "llvm/MC/MCAssembler.h"
@@ -19,7 +20,6 @@
#include "llvm/MC/MCValue.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/Format.h"
-#include "llvm/Support/MachO.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp Tue Jun 6 22:48:56 2017
@@ -9,11 +9,11 @@
#include "MCTargetDesc/X86FixupKinds.h"
#include "MCTargetDesc/X86MCTargetDesc.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/MC/MCExpr.h"
#include "llvm/MC/MCFixup.h"
#include "llvm/MC/MCValue.h"
#include "llvm/MC/MCWinCOFFObjectWriter.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp Tue Jun 6 22:48:56 2017
@@ -17,6 +17,7 @@
#include "MCTargetDesc/X86BaseInfo.h"
#include "X86InstrInfo.h"
#include "X86MachineFunctionInfo.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
#include "llvm/CodeGen/MachineValueType.h"
@@ -34,7 +35,6 @@
#include "llvm/MC/MCSectionMachO.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/TargetRegistry.h"
Modified: llvm/trunk/lib/Target/X86/X86MCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86MCInstLower.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86MCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86MCInstLower.cpp Tue Jun 6 22:48:56 2017
@@ -22,6 +22,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/iterator_range.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineModuleInfoImpls.h"
@@ -43,7 +44,6 @@
#include "llvm/MC/MCStreamer.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/MC/MCSymbolELF.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Target/TargetLoweringObjectFile.h"
Modified: llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86TargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -9,6 +9,8 @@
#include "X86TargetObjectFile.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/BinaryFormat/COFF.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/Mangler.h"
#include "llvm/IR/Operator.h"
#include "llvm/MC/MCContext.h"
@@ -16,8 +18,6 @@
#include "llvm/MC/MCSectionCOFF.h"
#include "llvm/MC/MCSectionELF.h"
#include "llvm/MC/MCValue.h"
-#include "llvm/Support/COFF.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Target/TargetLowering.h"
using namespace llvm;
Modified: llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp (original)
+++ llvm/trunk/lib/Target/XCore/XCoreTargetObjectFile.cpp Tue Jun 6 22:48:56 2017
@@ -9,10 +9,10 @@
#include "XCoreTargetObjectFile.h"
#include "XCoreSubtarget.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCSectionELF.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Target/TargetMachine.h"
using namespace llvm;
Modified: llvm/trunk/lib/ToolDrivers/llvm-lib/LibDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ToolDrivers/llvm-lib/LibDriver.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/ToolDrivers/llvm-lib/LibDriver.cpp (original)
+++ llvm/trunk/lib/ToolDrivers/llvm-lib/LibDriver.cpp Tue Jun 6 22:48:56 2017
@@ -14,6 +14,7 @@
#include "llvm/ToolDrivers/llvm-lib/LibDriver.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Object/ArchiveWriter.h"
#include "llvm/Option/Arg.h"
#include "llvm/Option/ArgList.h"
@@ -143,11 +144,10 @@ int llvm::libDriverMain(llvm::ArrayRef<c
});
return 1;
}
- sys::fs::file_magic Magic =
- sys::fs::identify_magic(MOrErr->Buf->getBuffer());
- if (Magic != sys::fs::file_magic::coff_object &&
- Magic != sys::fs::file_magic::bitcode &&
- Magic != sys::fs::file_magic::windows_resource) {
+ llvm::file_magic Magic = llvm::identify_magic(MOrErr->Buf->getBuffer());
+ if (Magic != llvm::file_magic::coff_object &&
+ Magic != llvm::file_magic::bitcode &&
+ Magic != llvm::file_magic::windows_resource) {
llvm::errs() << Arg->getValue()
<< ": not a COFF object, bitcode or resource file\n";
return 1;
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineInternal.h Tue Jun 6 22:48:56 2017
@@ -21,6 +21,7 @@
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/TargetFolder.h"
#include "llvm/Analysis/ValueTracking.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/IR/DIBuilder.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
@@ -29,7 +30,6 @@
#include "llvm/IR/Operator.h"
#include "llvm/IR/PatternMatch.h"
#include "llvm/Pass.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/KnownBits.h"
#include "llvm/Transforms/InstCombine/InstCombineWorklist.h"
#include "llvm/Transforms/Utils/Local.h"
Modified: llvm/trunk/tools/dsymutil/DwarfLinker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/dsymutil/DwarfLinker.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/dsymutil/DwarfLinker.cpp (original)
+++ llvm/trunk/tools/dsymutil/DwarfLinker.cpp Tue Jun 6 22:48:56 2017
@@ -6,15 +6,15 @@
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#include "DebugMap.h"
#include "BinaryHolder.h"
#include "DebugMap.h"
-#include "dsymutil.h"
#include "MachOUtils.h"
#include "NonRelocatableStringpool.h"
+#include "dsymutil.h"
#include "llvm/ADT/IntervalMap.h"
-#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/Config/config.h"
@@ -23,8 +23,8 @@
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/MC/MCAsmBackend.h"
#include "llvm/MC/MCAsmInfo.h"
-#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCCodeEmitter.h"
+#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCObjectFileInfo.h"
@@ -33,7 +33,6 @@
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCTargetOptionsCommandFlags.h"
#include "llvm/Object/MachO.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Target/TargetMachine.h"
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Tue Jun 6 22:48:56 2017
@@ -17,6 +17,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/ADT/StringSwitch.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/GlobalVariable.h"
@@ -31,7 +32,6 @@
#include "llvm/Object/MachOUniversal.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Object/Wasm.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Tue Jun 6 22:48:56 2017
@@ -11,12 +11,12 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Object/MachO.h"
#include "llvm-objdump.h"
#include "llvm-c/Disassembler.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/Config/config.h"
#include "llvm/DebugInfo/DIContext.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
@@ -30,6 +30,7 @@
#include "llvm/MC/MCInstrInfo.h"
#include "llvm/MC/MCRegisterInfo.h"
#include "llvm/MC/MCSubtargetInfo.h"
+#include "llvm/Object/MachO.h"
#include "llvm/Object/MachOUniversal.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
@@ -39,7 +40,6 @@
#include "llvm/Support/FormattedStream.h"
#include "llvm/Support/GraphWriter.h"
#include "llvm/Support/LEB128.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
@@ -2594,7 +2594,8 @@ static const char *get_symbol_32(uint32_
// These are structs in the Objective-C meta data and read to produce the
// comments for disassembly. While these are part of the ABI they are no
-// public defintions. So the are here not in include/llvm/Support/MachO.h .
+// public defintions. So the are here not in include/llvm/BinaryFormat/MachO.h
+// .
// The cfstring object in a 64-bit Mach-O file.
struct cfstring64_t {
Modified: llvm/trunk/tools/llvm-readobj/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/CMakeLists.txt?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-readobj/CMakeLists.txt Tue Jun 6 22:48:56 2017
@@ -1,6 +1,7 @@
set(LLVM_LINK_COMPONENTS
DebugInfoCodeView
Object
+ BinaryFormat
Support
DebugInfoCodeView
DebugInfoMSF
Modified: llvm/trunk/tools/llvm-readobj/COFFDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFDumper.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFDumper.cpp Tue Jun 6 22:48:56 2017
@@ -21,6 +21,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/DebugInfo/CodeView/CVTypeVisitor.h"
#include "llvm/DebugInfo/CodeView/CodeView.h"
#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
@@ -45,7 +46,6 @@
#include "llvm/Object/COFF.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/COFF.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ConvertUTF.h"
Modified: llvm/trunk/tools/llvm-readobj/COFFImportDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/COFFImportDumper.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/COFFImportDumper.cpp (original)
+++ llvm/trunk/tools/llvm-readobj/COFFImportDumper.cpp Tue Jun 6 22:48:56 2017
@@ -15,9 +15,9 @@
#include "Error.h"
#include "ObjDumper.h"
#include "llvm-readobj.h"
+#include "llvm/BinaryFormat/COFF.h"
#include "llvm/Object/COFF.h"
#include "llvm/Object/COFFImportFile.h"
-#include "llvm/Support/COFF.h"
using namespace llvm::object;
Modified: llvm/trunk/tools/llvm-readobj/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-readobj/LLVMBuild.txt?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-readobj/LLVMBuild.txt (original)
+++ llvm/trunk/tools/llvm-readobj/LLVMBuild.txt Tue Jun 6 22:48:56 2017
@@ -19,4 +19,4 @@
type = Tool
name = llvm-readobj
parent = Tools
-required_libraries = all-targets BitReader Object DebugInfoCodeView DebugInfoPDB DebugInfoMSF
+required_libraries = all-targets BitReader Object BinaryFormat DebugInfoCodeView DebugInfoPDB DebugInfoMSF
Modified: llvm/trunk/tools/llvm-xray/xray-extract.cc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-xray/xray-extract.cc?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-xray/xray-extract.cc (original)
+++ llvm/trunk/tools/llvm-xray/xray-extract.cc Tue Jun 6 22:48:56 2017
@@ -18,11 +18,11 @@
#include "func-id-helper.h"
#include "xray-registry.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/Object/ELF.h"
#include "llvm/Object/ObjectFile.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/DataExtractor.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Format.h"
Modified: llvm/trunk/tools/obj2yaml/macho2yaml.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/obj2yaml/macho2yaml.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/obj2yaml/macho2yaml.cpp (original)
+++ llvm/trunk/tools/obj2yaml/macho2yaml.cpp Tue Jun 6 22:48:56 2017
@@ -216,7 +216,7 @@ void MachODumper::dumpLoadCommands(std::
MachO::swapStruct(LC.Data.load_command_data);
EndPtr = processLoadCommandData<MachO::load_command>(LC, LoadCmd);
break;
-#include "llvm/Support/MachO.def"
+#include "llvm/BinaryFormat/MachO.def"
}
auto RemainingBytes = LoadCmd.C.cmdsize - (EndPtr - LoadCmd.Ptr);
if (!std::all_of(EndPtr, &EndPtr[RemainingBytes],
Modified: llvm/trunk/tools/yaml2obj/yaml2elf.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2elf.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/yaml2obj/yaml2elf.cpp (original)
+++ llvm/trunk/tools/yaml2obj/yaml2elf.cpp Tue Jun 6 22:48:56 2017
@@ -14,10 +14,10 @@
#include "yaml2obj.h"
#include "llvm/ADT/ArrayRef.h"
+#include "llvm/BinaryFormat/ELF.h"
#include "llvm/MC/StringTableBuilder.h"
#include "llvm/Object/ELFObjectFile.h"
#include "llvm/ObjectYAML/ELFYAML.h"
-#include "llvm/Support/ELF.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/tools/yaml2obj/yaml2macho.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2macho.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/tools/yaml2obj/yaml2macho.cpp (original)
+++ llvm/trunk/tools/yaml2obj/yaml2macho.cpp Tue Jun 6 22:48:56 2017
@@ -13,11 +13,11 @@
//===----------------------------------------------------------------------===//
#include "yaml2obj.h"
-#include "llvm/ObjectYAML/ObjectYAML.h"
+#include "llvm/BinaryFormat/MachO.h"
#include "llvm/ObjectYAML/DWARFEmitter.h"
+#include "llvm/ObjectYAML/ObjectYAML.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/LEB128.h"
-#include "llvm/Support/MachO.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
@@ -239,7 +239,7 @@ Error MachOWriter::writeLoadCommands(raw
BytesWritten +=
writeLoadCommandData<MachO::load_command>(LC, OS, Obj.IsLittleEndian);
break;
-#include "llvm/Support/MachO.def"
+#include "llvm/BinaryFormat/MachO.def"
}
if (LC.PayloadBytes.size() > 0) {
Added: llvm/trunk/unittests/BinaryFormat/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/BinaryFormat/CMakeLists.txt?rev=304864&view=auto
==============================================================================
--- llvm/trunk/unittests/BinaryFormat/CMakeLists.txt (added)
+++ llvm/trunk/unittests/BinaryFormat/CMakeLists.txt Tue Jun 6 22:48:56 2017
@@ -0,0 +1,9 @@
+set(LLVM_LINK_COMPONENTS
+ BinaryFormat
+ )
+
+add_llvm_unittest(BinaryFormatTests
+ DwarfTest.cpp
+ TestFileMagic.cpp
+ )
+
Added: llvm/trunk/unittests/BinaryFormat/DwarfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/BinaryFormat/DwarfTest.cpp?rev=304864&view=auto
==============================================================================
--- llvm/trunk/unittests/BinaryFormat/DwarfTest.cpp (added)
+++ llvm/trunk/unittests/BinaryFormat/DwarfTest.cpp Tue Jun 6 22:48:56 2017
@@ -0,0 +1,142 @@
+//===- unittest/BinaryFormat/DwarfTest.cpp - Dwarf support tests ----------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/BinaryFormat/Dwarf.h"
+#include "llvm/ADT/StringRef.h"
+#include "gtest/gtest.h"
+
+using namespace llvm;
+using namespace llvm::dwarf;
+
+namespace {
+
+TEST(DwarfTest, TagStringOnInvalid) {
+ // This is invalid, so it shouldn't be stringified.
+ EXPECT_EQ(StringRef(), TagString(DW_TAG_invalid));
+
+ // These aren't really tags: they describe ranges within tags. They
+ // shouldn't be stringified either.
+ EXPECT_EQ(StringRef(), TagString(DW_TAG_lo_user));
+ EXPECT_EQ(StringRef(), TagString(DW_TAG_hi_user));
+ EXPECT_EQ(StringRef(), TagString(DW_TAG_user_base));
+}
+
+TEST(DwarfTest, getTag) {
+ // A couple of valid tags.
+ EXPECT_EQ(DW_TAG_array_type, getTag("DW_TAG_array_type"));
+ EXPECT_EQ(DW_TAG_module, getTag("DW_TAG_module"));
+
+ // Invalid tags.
+ EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_invalid"));
+ EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_madeuptag"));
+ EXPECT_EQ(DW_TAG_invalid, getTag("something else"));
+
+ // Tag range markers should not be recognized.
+ EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_lo_user"));
+ EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_hi_user"));
+ EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_user_base"));
+}
+
+TEST(DwarfTest, getOperationEncoding) {
+ // Some valid ops.
+ EXPECT_EQ(DW_OP_deref, getOperationEncoding("DW_OP_deref"));
+ EXPECT_EQ(DW_OP_bit_piece, getOperationEncoding("DW_OP_bit_piece"));
+
+ // Invalid ops.
+ EXPECT_EQ(0u, getOperationEncoding("DW_OP_otherthings"));
+ EXPECT_EQ(0u, getOperationEncoding("other"));
+
+ // Markers shouldn't be recognized.
+ EXPECT_EQ(0u, getOperationEncoding("DW_OP_lo_user"));
+ EXPECT_EQ(0u, getOperationEncoding("DW_OP_hi_user"));
+}
+
+TEST(DwarfTest, LanguageStringOnInvalid) {
+ // This is invalid, so it shouldn't be stringified.
+ EXPECT_EQ(StringRef(), LanguageString(0));
+
+ // These aren't really tags: they describe ranges within tags. They
+ // shouldn't be stringified either.
+ EXPECT_EQ(StringRef(), LanguageString(DW_LANG_lo_user));
+ EXPECT_EQ(StringRef(), LanguageString(DW_LANG_hi_user));
+}
+
+TEST(DwarfTest, getLanguage) {
+ // A couple of valid languages.
+ EXPECT_EQ(DW_LANG_C89, getLanguage("DW_LANG_C89"));
+ EXPECT_EQ(DW_LANG_C_plus_plus_11, getLanguage("DW_LANG_C_plus_plus_11"));
+ EXPECT_EQ(DW_LANG_OCaml, getLanguage("DW_LANG_OCaml"));
+ EXPECT_EQ(DW_LANG_Mips_Assembler, getLanguage("DW_LANG_Mips_Assembler"));
+
+ // Invalid languages.
+ EXPECT_EQ(0u, getLanguage("DW_LANG_invalid"));
+ EXPECT_EQ(0u, getLanguage("DW_TAG_array_type"));
+ EXPECT_EQ(0u, getLanguage("something else"));
+
+ // Language range markers should not be recognized.
+ EXPECT_EQ(0u, getLanguage("DW_LANG_lo_user"));
+ EXPECT_EQ(0u, getLanguage("DW_LANG_hi_user"));
+}
+
+TEST(DwarfTest, AttributeEncodingStringOnInvalid) {
+ // This is invalid, so it shouldn't be stringified.
+ EXPECT_EQ(StringRef(), AttributeEncodingString(0));
+
+ // These aren't really tags: they describe ranges within tags. They
+ // shouldn't be stringified either.
+ EXPECT_EQ(StringRef(), AttributeEncodingString(DW_ATE_lo_user));
+ EXPECT_EQ(StringRef(), AttributeEncodingString(DW_ATE_hi_user));
+}
+
+TEST(DwarfTest, getAttributeEncoding) {
+ // A couple of valid languages.
+ EXPECT_EQ(DW_ATE_boolean, getAttributeEncoding("DW_ATE_boolean"));
+ EXPECT_EQ(DW_ATE_imaginary_float,
+ getAttributeEncoding("DW_ATE_imaginary_float"));
+
+ // Invalid languages.
+ EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_invalid"));
+ EXPECT_EQ(0u, getAttributeEncoding("DW_TAG_array_type"));
+ EXPECT_EQ(0u, getAttributeEncoding("something else"));
+
+ // AttributeEncoding range markers should not be recognized.
+ EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_lo_user"));
+ EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_hi_user"));
+}
+
+TEST(DwarfTest, VirtualityString) {
+ EXPECT_EQ(StringRef("DW_VIRTUALITY_none"),
+ VirtualityString(DW_VIRTUALITY_none));
+ EXPECT_EQ(StringRef("DW_VIRTUALITY_virtual"),
+ VirtualityString(DW_VIRTUALITY_virtual));
+ EXPECT_EQ(StringRef("DW_VIRTUALITY_pure_virtual"),
+ VirtualityString(DW_VIRTUALITY_pure_virtual));
+
+ // DW_VIRTUALITY_max should be pure virtual.
+ EXPECT_EQ(StringRef("DW_VIRTUALITY_pure_virtual"),
+ VirtualityString(DW_VIRTUALITY_max));
+
+ // Invalid numbers shouldn't be stringified.
+ EXPECT_EQ(StringRef(), VirtualityString(DW_VIRTUALITY_max + 1));
+ EXPECT_EQ(StringRef(), VirtualityString(DW_VIRTUALITY_max + 77));
+}
+
+TEST(DwarfTest, getVirtuality) {
+ EXPECT_EQ(DW_VIRTUALITY_none, getVirtuality("DW_VIRTUALITY_none"));
+ EXPECT_EQ(DW_VIRTUALITY_virtual, getVirtuality("DW_VIRTUALITY_virtual"));
+ EXPECT_EQ(DW_VIRTUALITY_pure_virtual,
+ getVirtuality("DW_VIRTUALITY_pure_virtual"));
+
+ // Invalid strings.
+ EXPECT_EQ(DW_VIRTUALITY_invalid, getVirtuality("DW_VIRTUALITY_invalid"));
+ EXPECT_EQ(DW_VIRTUALITY_invalid, getVirtuality("DW_VIRTUALITY_max"));
+ EXPECT_EQ(DW_VIRTUALITY_invalid, getVirtuality("something else"));
+}
+
+} // end namespace
Added: llvm/trunk/unittests/BinaryFormat/TestFileMagic.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/BinaryFormat/TestFileMagic.cpp?rev=304864&view=auto
==============================================================================
--- llvm/trunk/unittests/BinaryFormat/TestFileMagic.cpp (added)
+++ llvm/trunk/unittests/BinaryFormat/TestFileMagic.cpp Tue Jun 6 22:48:56 2017
@@ -0,0 +1,128 @@
+//===- llvm/unittest/BinaryFormat/TestFileMagic.cpp - File magic tests ----===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/ADT/SmallString.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/BinaryFormat/Magic.h"
+#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
+
+#include "gtest/gtest.h"
+
+using namespace llvm;
+namespace fs = llvm::sys::fs;
+
+#define ASSERT_NO_ERROR(x) \
+ if (std::error_code ASSERT_NO_ERROR_ec = x) { \
+ SmallString<128> MessageStorage; \
+ raw_svector_ostream Message(MessageStorage); \
+ Message << #x ": did not return errc::success.\n" \
+ << "error number: " << ASSERT_NO_ERROR_ec.value() << "\n" \
+ << "error message: " << ASSERT_NO_ERROR_ec.message() << "\n"; \
+ GTEST_FATAL_FAILURE_(MessageStorage.c_str()); \
+ } else { \
+ }
+
+class MagicTest : public testing::Test {
+protected:
+ /// Unique temporary directory in which all created filesystem entities must
+ /// be placed. It is removed at the end of each test (must be empty).
+ SmallString<128> TestDirectory;
+
+ void SetUp() override {
+ ASSERT_NO_ERROR(
+ fs::createUniqueDirectory("file-system-test", TestDirectory));
+ // We don't care about this specific file.
+ errs() << "Test Directory: " << TestDirectory << '\n';
+ errs().flush();
+ }
+
+ void TearDown() override { ASSERT_NO_ERROR(fs::remove(TestDirectory.str())); }
+};
+
+const char archive[] = "!<arch>\x0A";
+const char bitcode[] = "\xde\xc0\x17\x0b";
+const char coff_object[] = "\x00\x00......";
+const char coff_bigobj[] =
+ "\x00\x00\xff\xff\x00\x02......"
+ "\xc7\xa1\xba\xd1\xee\xba\xa9\x4b\xaf\x20\xfa\xf6\x6a\xa4\xdc\xb8";
+const char coff_import_library[] = "\x00\x00\xff\xff....";
+const char elf_relocatable[] = {0x7f, 'E', 'L', 'F', 1, 2, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 1};
+const char macho_universal_binary[] = "\xca\xfe\xba\xbe...\x00";
+const char macho_object[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x01............";
+const char macho_executable[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x02............";
+const char macho_fixed_virtual_memory_shared_lib[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x03............";
+const char macho_core[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x04............";
+const char macho_preload_executable[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x05............";
+const char macho_dynamically_linked_shared_lib[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x06............";
+const char macho_dynamic_linker[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x07............";
+const char macho_bundle[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x08............";
+const char macho_dsym_companion[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x0a............";
+const char macho_kext_bundle[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x0b............";
+const char windows_resource[] = "\x00\x00\x00\x00\x020\x00\x00\x00\xff";
+const char macho_dynamically_linked_shared_lib_stub[] =
+ "\xfe\xed\xfa\xce........\x00\x00\x00\x09............";
+
+TEST_F(MagicTest, Magic) {
+ struct type {
+ const char *filename;
+ const char *magic_str;
+ size_t magic_str_len;
+ file_magic magic;
+ } types[] = {
+#define DEFINE(magic) {#magic, magic, sizeof(magic), file_magic::magic}
+ DEFINE(archive),
+ DEFINE(bitcode),
+ DEFINE(coff_object),
+ {"coff_bigobj", coff_bigobj, sizeof(coff_bigobj),
+ file_magic::coff_object},
+ DEFINE(coff_import_library),
+ DEFINE(elf_relocatable),
+ DEFINE(macho_universal_binary),
+ DEFINE(macho_object),
+ DEFINE(macho_executable),
+ DEFINE(macho_fixed_virtual_memory_shared_lib),
+ DEFINE(macho_core),
+ DEFINE(macho_preload_executable),
+ DEFINE(macho_dynamically_linked_shared_lib),
+ DEFINE(macho_dynamic_linker),
+ DEFINE(macho_bundle),
+ DEFINE(macho_dynamically_linked_shared_lib_stub),
+ DEFINE(macho_dsym_companion),
+ DEFINE(macho_kext_bundle),
+ DEFINE(windows_resource)
+#undef DEFINE
+ };
+
+ // Create some files filled with magic.
+ for (type *i = types, *e = types + (sizeof(types) / sizeof(type)); i != e;
+ ++i) {
+ SmallString<128> file_pathname(TestDirectory);
+ llvm::sys::path::append(file_pathname, i->filename);
+ std::error_code EC;
+ raw_fd_ostream file(file_pathname, EC, sys::fs::F_None);
+ ASSERT_FALSE(file.has_error());
+ StringRef magic(i->magic_str, i->magic_str_len);
+ file << magic;
+ file.close();
+ EXPECT_EQ(i->magic, identify_magic(magic));
+ ASSERT_NO_ERROR(fs::remove(Twine(file_pathname)));
+ }
+}
Modified: llvm/trunk/unittests/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CMakeLists.txt?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/unittests/CMakeLists.txt (original)
+++ llvm/trunk/unittests/CMakeLists.txt Tue Jun 6 22:48:56 2017
@@ -18,6 +18,7 @@ add_subdirectory(Linker)
add_subdirectory(MC)
add_subdirectory(MI)
add_subdirectory(Object)
+add_subdirectory(BinaryFormat)
add_subdirectory(ObjectYAML)
add_subdirectory(Option)
add_subdirectory(ProfileData)
Modified: llvm/trunk/unittests/CodeGen/DIEHashTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/CodeGen/DIEHashTest.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/unittests/CodeGen/DIEHashTest.cpp (original)
+++ llvm/trunk/unittests/CodeGen/DIEHashTest.cpp Tue Jun 6 22:48:56 2017
@@ -9,10 +9,10 @@
#include "../lib/CodeGen/AsmPrinter/DIEHash.h"
#include "llvm/ADT/STLExtras.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/CodeGen/DwarfStringPoolEntry.h"
#include "llvm/Support/Debug.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Format.h"
#include "gtest/gtest.h"
Modified: llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp Tue Jun 6 22:48:56 2017
@@ -13,6 +13,7 @@
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
@@ -21,7 +22,6 @@
#include "llvm/Object/ObjectFile.h"
#include "llvm/ObjectYAML/DWARFEmitter.h"
#include "llvm/ObjectYAML/DWARFYAML.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/TargetSelect.h"
Modified: llvm/trunk/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/DWARF/DWARFFormValueTest.cpp Tue Jun 6 22:48:56 2017
@@ -10,7 +10,7 @@
#include "llvm/DebugInfo/DWARF/DWARFFormValue.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallString.h"
-#include "llvm/Support/Dwarf.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/Support/Host.h"
#include "llvm/Support/LEB128.h"
#include "gtest/gtest.h"
Modified: llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/DWARF/DwarfGenerator.cpp Tue Jun 6 22:48:56 2017
@@ -10,6 +10,7 @@
#include "DwarfGenerator.h"
#include "../lib/CodeGen/AsmPrinter/DwarfStringPool.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/DIE.h"
#include "llvm/DebugInfo/DWARF/DWARFContext.h"
@@ -28,7 +29,6 @@
#include "llvm/MC/MCSubtargetInfo.h"
#include "llvm/MC/MCTargetOptionsCommandFlags.h"
#include "llvm/PassAnalysisSupport.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/raw_ostream.h"
Modified: llvm/trunk/unittests/MC/DwarfLineTables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/MC/DwarfLineTables.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/unittests/MC/DwarfLineTables.cpp (original)
+++ llvm/trunk/unittests/MC/DwarfLineTables.cpp Tue Jun 6 22:48:56 2017
@@ -8,11 +8,11 @@
//===----------------------------------------------------------------------===//
#include "llvm/ADT/STLExtras.h"
+#include "llvm/BinaryFormat/Dwarf.h"
#include "llvm/MC/MCAsmInfo.h"
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCDwarf.h"
#include "llvm/MC/MCRegisterInfo.h"
-#include "llvm/Support/Dwarf.h"
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "gtest/gtest.h"
Modified: llvm/trunk/unittests/Support/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/CMakeLists.txt?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/CMakeLists.txt (original)
+++ llvm/trunk/unittests/Support/CMakeLists.txt Tue Jun 6 22:48:56 2017
@@ -19,7 +19,6 @@ add_llvm_unittest(SupportTests
ConvertUTFTest.cpp
DataExtractorTest.cpp
DebugTest.cpp
- DwarfTest.cpp
EndianStreamTest.cpp
EndianTest.cpp
ErrorOrTest.cpp
Removed: llvm/trunk/unittests/Support/DwarfTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/DwarfTest.cpp?rev=304863&view=auto
==============================================================================
--- llvm/trunk/unittests/Support/DwarfTest.cpp (original)
+++ llvm/trunk/unittests/Support/DwarfTest.cpp (removed)
@@ -1,141 +0,0 @@
-//===- unittest/Support/DwarfTest.cpp - Dwarf support tests ---------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/Support/Dwarf.h"
-#include "gtest/gtest.h"
-
-using namespace llvm;
-using namespace llvm::dwarf;
-
-namespace {
-
-TEST(DwarfTest, TagStringOnInvalid) {
- // This is invalid, so it shouldn't be stringified.
- EXPECT_EQ(StringRef(), TagString(DW_TAG_invalid));
-
- // These aren't really tags: they describe ranges within tags. They
- // shouldn't be stringified either.
- EXPECT_EQ(StringRef(), TagString(DW_TAG_lo_user));
- EXPECT_EQ(StringRef(), TagString(DW_TAG_hi_user));
- EXPECT_EQ(StringRef(), TagString(DW_TAG_user_base));
-}
-
-TEST(DwarfTest, getTag) {
- // A couple of valid tags.
- EXPECT_EQ(DW_TAG_array_type, getTag("DW_TAG_array_type"));
- EXPECT_EQ(DW_TAG_module, getTag("DW_TAG_module"));
-
- // Invalid tags.
- EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_invalid"));
- EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_madeuptag"));
- EXPECT_EQ(DW_TAG_invalid, getTag("something else"));
-
- // Tag range markers should not be recognized.
- EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_lo_user"));
- EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_hi_user"));
- EXPECT_EQ(DW_TAG_invalid, getTag("DW_TAG_user_base"));
-}
-
-TEST(DwarfTest, getOperationEncoding) {
- // Some valid ops.
- EXPECT_EQ(DW_OP_deref, getOperationEncoding("DW_OP_deref"));
- EXPECT_EQ(DW_OP_bit_piece, getOperationEncoding("DW_OP_bit_piece"));
-
- // Invalid ops.
- EXPECT_EQ(0u, getOperationEncoding("DW_OP_otherthings"));
- EXPECT_EQ(0u, getOperationEncoding("other"));
-
- // Markers shouldn't be recognized.
- EXPECT_EQ(0u, getOperationEncoding("DW_OP_lo_user"));
- EXPECT_EQ(0u, getOperationEncoding("DW_OP_hi_user"));
-}
-
-TEST(DwarfTest, LanguageStringOnInvalid) {
- // This is invalid, so it shouldn't be stringified.
- EXPECT_EQ(StringRef(), LanguageString(0));
-
- // These aren't really tags: they describe ranges within tags. They
- // shouldn't be stringified either.
- EXPECT_EQ(StringRef(), LanguageString(DW_LANG_lo_user));
- EXPECT_EQ(StringRef(), LanguageString(DW_LANG_hi_user));
-}
-
-TEST(DwarfTest, getLanguage) {
- // A couple of valid languages.
- EXPECT_EQ(DW_LANG_C89, getLanguage("DW_LANG_C89"));
- EXPECT_EQ(DW_LANG_C_plus_plus_11, getLanguage("DW_LANG_C_plus_plus_11"));
- EXPECT_EQ(DW_LANG_OCaml, getLanguage("DW_LANG_OCaml"));
- EXPECT_EQ(DW_LANG_Mips_Assembler, getLanguage("DW_LANG_Mips_Assembler"));
-
- // Invalid languages.
- EXPECT_EQ(0u, getLanguage("DW_LANG_invalid"));
- EXPECT_EQ(0u, getLanguage("DW_TAG_array_type"));
- EXPECT_EQ(0u, getLanguage("something else"));
-
- // Language range markers should not be recognized.
- EXPECT_EQ(0u, getLanguage("DW_LANG_lo_user"));
- EXPECT_EQ(0u, getLanguage("DW_LANG_hi_user"));
-}
-
-TEST(DwarfTest, AttributeEncodingStringOnInvalid) {
- // This is invalid, so it shouldn't be stringified.
- EXPECT_EQ(StringRef(), AttributeEncodingString(0));
-
- // These aren't really tags: they describe ranges within tags. They
- // shouldn't be stringified either.
- EXPECT_EQ(StringRef(), AttributeEncodingString(DW_ATE_lo_user));
- EXPECT_EQ(StringRef(), AttributeEncodingString(DW_ATE_hi_user));
-}
-
-TEST(DwarfTest, getAttributeEncoding) {
- // A couple of valid languages.
- EXPECT_EQ(DW_ATE_boolean, getAttributeEncoding("DW_ATE_boolean"));
- EXPECT_EQ(DW_ATE_imaginary_float,
- getAttributeEncoding("DW_ATE_imaginary_float"));
-
- // Invalid languages.
- EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_invalid"));
- EXPECT_EQ(0u, getAttributeEncoding("DW_TAG_array_type"));
- EXPECT_EQ(0u, getAttributeEncoding("something else"));
-
- // AttributeEncoding range markers should not be recognized.
- EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_lo_user"));
- EXPECT_EQ(0u, getAttributeEncoding("DW_ATE_hi_user"));
-}
-
-TEST(DwarfTest, VirtualityString) {
- EXPECT_EQ(StringRef("DW_VIRTUALITY_none"),
- VirtualityString(DW_VIRTUALITY_none));
- EXPECT_EQ(StringRef("DW_VIRTUALITY_virtual"),
- VirtualityString(DW_VIRTUALITY_virtual));
- EXPECT_EQ(StringRef("DW_VIRTUALITY_pure_virtual"),
- VirtualityString(DW_VIRTUALITY_pure_virtual));
-
- // DW_VIRTUALITY_max should be pure virtual.
- EXPECT_EQ(StringRef("DW_VIRTUALITY_pure_virtual"),
- VirtualityString(DW_VIRTUALITY_max));
-
- // Invalid numbers shouldn't be stringified.
- EXPECT_EQ(StringRef(), VirtualityString(DW_VIRTUALITY_max + 1));
- EXPECT_EQ(StringRef(), VirtualityString(DW_VIRTUALITY_max + 77));
-}
-
-TEST(DwarfTest, getVirtuality) {
- EXPECT_EQ(DW_VIRTUALITY_none, getVirtuality("DW_VIRTUALITY_none"));
- EXPECT_EQ(DW_VIRTUALITY_virtual, getVirtuality("DW_VIRTUALITY_virtual"));
- EXPECT_EQ(DW_VIRTUALITY_pure_virtual,
- getVirtuality("DW_VIRTUALITY_pure_virtual"));
-
- // Invalid strings.
- EXPECT_EQ(DW_VIRTUALITY_invalid, getVirtuality("DW_VIRTUALITY_invalid"));
- EXPECT_EQ(DW_VIRTUALITY_invalid, getVirtuality("DW_VIRTUALITY_max"));
- EXPECT_EQ(DW_VIRTUALITY_invalid, getVirtuality("something else"));
-}
-
-} // end namespace
Modified: llvm/trunk/unittests/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/Path.cpp?rev=304864&r1=304863&r2=304864&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/Path.cpp (original)
+++ llvm/trunk/unittests/Support/Path.cpp Tue Jun 6 22:48:56 2017
@@ -11,6 +11,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Triple.h"
+#include "llvm/BinaryFormat/Magic.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/ErrorHandling.h"
@@ -919,86 +920,6 @@ TEST_F(FileSystemTest, Remove) {
ASSERT_FALSE(fs::exists(BaseDir));
}
-const char archive[] = "!<arch>\x0A";
-const char bitcode[] = "\xde\xc0\x17\x0b";
-const char coff_object[] = "\x00\x00......";
-const char coff_bigobj[] = "\x00\x00\xff\xff\x00\x02......"
- "\xc7\xa1\xba\xd1\xee\xba\xa9\x4b\xaf\x20\xfa\xf6\x6a\xa4\xdc\xb8";
-const char coff_import_library[] = "\x00\x00\xff\xff....";
-const char elf_relocatable[] = { 0x7f, 'E', 'L', 'F', 1, 2, 1, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1 };
-const char macho_universal_binary[] = "\xca\xfe\xba\xbe...\x00";
-const char macho_object[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x01............";
-const char macho_executable[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x02............";
-const char macho_fixed_virtual_memory_shared_lib[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x03............";
-const char macho_core[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x04............";
-const char macho_preload_executable[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x05............";
-const char macho_dynamically_linked_shared_lib[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x06............";
-const char macho_dynamic_linker[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x07............";
-const char macho_bundle[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x08............";
-const char macho_dsym_companion[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x0a............";
-const char macho_kext_bundle[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x0b............";
-const char windows_resource[] = "\x00\x00\x00\x00\x020\x00\x00\x00\xff";
-const char macho_dynamically_linked_shared_lib_stub[] =
- "\xfe\xed\xfa\xce........\x00\x00\x00\x09............";
-
-TEST_F(FileSystemTest, Magic) {
- struct type {
- const char *filename;
- const char *magic_str;
- size_t magic_str_len;
- fs::file_magic magic;
- } types[] = {
-#define DEFINE(magic) \
- { #magic, magic, sizeof(magic), fs::file_magic::magic }
- DEFINE(archive),
- DEFINE(bitcode),
- DEFINE(coff_object),
- { "coff_bigobj", coff_bigobj, sizeof(coff_bigobj), fs::file_magic::coff_object },
- DEFINE(coff_import_library),
- DEFINE(elf_relocatable),
- DEFINE(macho_universal_binary),
- DEFINE(macho_object),
- DEFINE(macho_executable),
- DEFINE(macho_fixed_virtual_memory_shared_lib),
- DEFINE(macho_core),
- DEFINE(macho_preload_executable),
- DEFINE(macho_dynamically_linked_shared_lib),
- DEFINE(macho_dynamic_linker),
- DEFINE(macho_bundle),
- DEFINE(macho_dynamically_linked_shared_lib_stub),
- DEFINE(macho_dsym_companion),
- DEFINE(macho_kext_bundle),
- DEFINE(windows_resource)
-#undef DEFINE
- };
-
- // Create some files filled with magic.
- for (type *i = types, *e = types + (sizeof(types) / sizeof(type)); i != e;
- ++i) {
- SmallString<128> file_pathname(TestDirectory);
- path::append(file_pathname, i->filename);
- std::error_code EC;
- raw_fd_ostream file(file_pathname, EC, sys::fs::F_None);
- ASSERT_FALSE(file.has_error());
- StringRef magic(i->magic_str, i->magic_str_len);
- file << magic;
- file.close();
- EXPECT_EQ(i->magic, fs::identify_magic(magic));
- ASSERT_NO_ERROR(fs::remove(Twine(file_pathname)));
- }
-}
-
#ifdef LLVM_ON_WIN32
TEST_F(FileSystemTest, CarriageReturn) {
SmallString<128> FilePathname(TestDirectory);
More information about the llvm-commits
mailing list