aboutsummaryrefslogtreecommitdiff
path: root/lib/Object
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2017-06-07 03:48:56 +0000
committerZachary Turner <zturner@google.com>2017-06-07 03:48:56 +0000
commit19ca2b0f9daed883c21730285d7f04424e5f5f88 (patch)
tree5e77ef06dd21990dee01c04e7a9b037bb96f244a /lib/Object
parentd05a5f282dcf32f7055e68fa0a4f01ddc7bd147e (diff)
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304864 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Object')
-rw-r--r--lib/Object/ArchiveWriter.cpp3
-rw-r--r--lib/Object/Binary.cpp67
-rw-r--r--lib/Object/COFFObjectFile.cpp2
-rw-r--r--lib/Object/Decompressor.cpp2
-rw-r--r--lib/Object/ELF.cpp34
-rw-r--r--lib/Object/ELFObjectFile.cpp2
-rw-r--r--lib/Object/IRObjectFile.cpp11
-rw-r--r--lib/Object/LLVMBuild.txt2
-rw-r--r--lib/Object/MachOObjectFile.cpp2
-rw-r--r--lib/Object/ObjectFile.cpp59
-rw-r--r--lib/Object/SymbolicFile.cpp62
-rw-r--r--lib/Object/WasmObjectFile.cpp4
-rw-r--r--lib/Object/WindowsResource.cpp2
13 files changed, 129 insertions, 123 deletions
diff --git a/lib/Object/ArchiveWriter.cpp b/lib/Object/ArchiveWriter.cpp
index 5b233aab201..e1c35ed6a6a 100644
--- a/lib/Object/ArchiveWriter.cpp
+++ b/lib/Object/ArchiveWriter.cpp
@@ -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, object::Archive::Kind Kind,
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());
diff --git a/lib/Object/Binary.cpp b/lib/Object/Binary.cpp
index 7b707a9e405..c4565db459e 100644
--- a/lib/Object/Binary.cpp
+++ b/lib/Object/Binary.cpp
@@ -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::getMemoryBufferRef() const { return Data; }
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");
}
diff --git a/lib/Object/COFFObjectFile.cpp b/lib/Object/COFFObjectFile.cpp
index 7372f24cb9a..579c8dde366 100644
--- a/lib/Object/COFFObjectFile.cpp
+++ b/lib/Object/COFFObjectFile.cpp
@@ -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"
diff --git a/lib/Object/Decompressor.cpp b/lib/Object/Decompressor.cpp
index cbc76903291..53f084d7620 100644
--- a/lib/Object/Decompressor.cpp
+++ b/lib/Object/Decompressor.cpp
@@ -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;
diff --git a/lib/Object/ELF.cpp b/lib/Object/ELF.cpp
index 5798a3540f5..9bc28dc14a2 100644
--- a/lib/Object/ELF.cpp
+++ b/lib/Object/ELF.cpp
@@ -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::getELFRelocationTypeName(uint32_t Machine,
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::getELFRelocationTypeName(uint32_t Machine,
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::getELFRelocationTypeName(uint32_t Machine,
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;
}
diff --git a/lib/Object/ELFObjectFile.cpp b/lib/Object/ELFObjectFile.cpp
index b01c1e74141..fa136d782b5 100644
--- a/lib/Object/ELFObjectFile.cpp
+++ b/lib/Object/ELFObjectFile.cpp
@@ -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"
diff --git a/lib/Object/IRObjectFile.cpp b/lib/Object/IRObjectFile.cpp
index adbf0de6d1b..bcaee029ce5 100644
--- a/lib/Object/IRObjectFile.cpp
+++ b/lib/Object/IRObjectFile.cpp
@@ -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::findBitcodeInObject(const ObjectFile &Obj
}
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)
diff --git a/lib/Object/LLVMBuild.txt b/lib/Object/LLVMBuild.txt
index bae578c76f7..687713bab6a 100644
--- a/lib/Object/LLVMBuild.txt
+++ b/lib/Object/LLVMBuild.txt
@@ -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
diff --git a/lib/Object/MachOObjectFile.cpp b/lib/Object/MachOObjectFile.cpp
index accb67f707d..7804bbe06f8 100644
--- a/lib/Object/MachOObjectFile.cpp
+++ b/lib/Object/MachOObjectFile.cpp
@@ -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"
diff --git a/lib/Object/ObjectFile.cpp b/lib/Object/ObjectFile.cpp
index e9c2ce9e210..8377dd0d73f 100644
--- a/lib/Object/ObjectFile.cpp
+++ b/lib/Object/ObjectFile.cpp
@@ -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::getRelocatedSection(DataRefImpl Sec) const {
}
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");
diff --git a/lib/Object/SymbolicFile.cpp b/lib/Object/SymbolicFile.cpp
index 9ebe243001d..1042d29d235 100644
--- a/lib/Object/SymbolicFile.cpp
+++ b/lib/Object/SymbolicFile.cpp
@@ -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 Type, MemoryBufferRef Source)
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)
diff --git a/lib/Object/WasmObjectFile.cpp b/lib/Object/WasmObjectFile.cpp
index f565d7a33e5..2304098c1dc 100644
--- a/lib/Object/WasmObjectFile.cpp
+++ b/lib/Object/WasmObjectFile.cpp
@@ -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::getRelocationTypeName(
break;
switch (Rel.Type) {
-#include "llvm/Support/WasmRelocs/WebAssembly.def"
+#include "llvm/BinaryFormat/WasmRelocs/WebAssembly.def"
}
#undef WASM_RELOC
diff --git a/lib/Object/WindowsResource.cpp b/lib/Object/WindowsResource.cpp
index e46d38e466a..4ed39fad014 100644
--- a/lib/Object/WindowsResource.cpp
+++ b/lib/Object/WindowsResource.cpp
@@ -12,7 +12,7 @@
//===----------------------------------------------------------------------===//
#include "llvm/Object/WindowsResource.h"
-#include "llvm/Support/COFF.h"
+#include "llvm/BinaryFormat/COFF.h"
#include <sstream>
#include <system_error>