mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-21 18:22:53 +01:00
[SystemZ][z/OS] Add GOFF support to file magic identification
- This patch adds in the GOFF format to the file magic identification logic in LLVM - Currently, for the object file support, GOFF is marked as having as an error - However, this is only temporary until https://reviews.llvm.org/D98437 is merged in Reviewed By: abhina.sreeskantharajan Differential Revision: https://reviews.llvm.org/D105993
This commit is contained in:
parent
41db4b6343
commit
0dda2de3a7
@ -27,6 +27,7 @@ struct file_magic {
|
||||
elf_executable, ///< ELF Executable image
|
||||
elf_shared_object, ///< ELF dynamically linked shared lib
|
||||
elf_core, ///< ELF core image
|
||||
goff_object, ///< GOFF object file
|
||||
macho_object, ///< Mach-O Object file
|
||||
macho_executable, ///< Mach-O Executable
|
||||
macho_fixed_virtual_memory_shared_lib, ///< Mach-O Shared Lib, FVM
|
||||
|
@ -71,6 +71,11 @@ file_magic llvm::identify_magic(StringRef Magic) {
|
||||
return file_magic::xcoff_object_64;
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
if (startswith(Magic, "\x03\xF0\x00"))
|
||||
return file_magic::goff_object;
|
||||
break;
|
||||
|
||||
case 0xDE: // 0x0B17C0DE = BC wraper
|
||||
if (startswith(Magic, "\xDE\xC0\x17\x0B"))
|
||||
return file_magic::bitcode;
|
||||
|
@ -56,6 +56,7 @@ Expected<std::unique_ptr<Binary>> object::createBinary(MemoryBufferRef Buffer,
|
||||
case file_magic::elf_executable:
|
||||
case file_magic::elf_shared_object:
|
||||
case file_magic::elf_core:
|
||||
case file_magic::goff_object:
|
||||
case file_magic::macho_object:
|
||||
case file_magic::macho_executable:
|
||||
case file_magic::macho_fixed_virtual_memory_shared_lib:
|
||||
|
@ -145,6 +145,7 @@ ObjectFile::createObjectFile(MemoryBufferRef Object, file_magic Type,
|
||||
case file_magic::windows_resource:
|
||||
case file_magic::pdb:
|
||||
case file_magic::minidump:
|
||||
case file_magic::goff_object:
|
||||
return errorCodeToError(object_error::invalid_file_type);
|
||||
case file_magic::tapi_file:
|
||||
return errorCodeToError(object_error::invalid_file_type);
|
||||
|
@ -53,6 +53,7 @@ SymbolicFile::createSymbolicFile(MemoryBufferRef Object, file_magic Type,
|
||||
case file_magic::elf_executable:
|
||||
case file_magic::elf_shared_object:
|
||||
case file_magic::elf_core:
|
||||
case file_magic::goff_object:
|
||||
case file_magic::macho_executable:
|
||||
case file_magic::macho_fixed_virtual_memory_shared_lib:
|
||||
case file_magic::macho_core:
|
||||
@ -102,6 +103,7 @@ bool SymbolicFile::isSymbolicFile(file_magic Type, const LLVMContext *Context) {
|
||||
case file_magic::elf_executable:
|
||||
case file_magic::elf_shared_object:
|
||||
case file_magic::elf_core:
|
||||
case file_magic::goff_object:
|
||||
case file_magic::macho_executable:
|
||||
case file_magic::macho_fixed_virtual_memory_shared_lib:
|
||||
case file_magic::macho_core:
|
||||
|
@ -54,6 +54,8 @@ const char coff_bigobj[] =
|
||||
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 goff_object[] = "\x03\xF0\x00";
|
||||
const char macho_universal_binary[] = "\xca\xfe\xba\xbe...\x00";
|
||||
const char macho_object[] =
|
||||
"\xfe\xed\xfa\xce........\x00\x00\x00\x01............";
|
||||
@ -100,6 +102,7 @@ TEST_F(MagicTest, Magic) {
|
||||
file_magic::coff_object},
|
||||
DEFINE(coff_import_library),
|
||||
DEFINE(elf_relocatable),
|
||||
DEFINE(goff_object),
|
||||
DEFINE(macho_universal_binary),
|
||||
DEFINE(macho_object),
|
||||
DEFINE(macho_executable),
|
||||
|
Loading…
Reference in New Issue
Block a user