diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-21 18:13:02 +0000 |
| commit | 54db30ce18663e6c2991958f3b5d18362e8e93c4 (patch) | |
| tree | 4aa6442802570767398cc83ba484e97b1309bdc2 /contrib/llvm/lib/BinaryFormat/Magic.cpp | |
| parent | 35284c22e9c8348159b7ce032ea45f2cdeb65298 (diff) | |
| parent | e6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/lib/BinaryFormat/Magic.cpp')
| -rw-r--r-- | contrib/llvm/lib/BinaryFormat/Magic.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/contrib/llvm/lib/BinaryFormat/Magic.cpp b/contrib/llvm/lib/BinaryFormat/Magic.cpp index 78efa6ec87be..7dfe23690a50 100644 --- a/contrib/llvm/lib/BinaryFormat/Magic.cpp +++ b/contrib/llvm/lib/BinaryFormat/Magic.cpp @@ -1,9 +1,8 @@ //===- 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. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -62,6 +61,15 @@ file_magic llvm::identify_magic(StringRef Magic) { return file_magic::wasm_object; break; } + + case 0x01: + // XCOFF format + if (startswith(Magic, "\x01\xDF")) + return file_magic::xcoff_object_32; + if (startswith(Magic, "\x01\xF7")) + return file_magic::xcoff_object_64; + break; + case 0xDE: // 0x0B17C0DE = BC wraper if (startswith(Magic, "\xDE\xC0\x17\x0B")) return file_magic::bitcode; @@ -182,7 +190,8 @@ file_magic llvm::identify_magic(StringRef Magic) { return file_magic::coff_object; break; - case 'M': // Possible MS-DOS stub on Windows PE file or MSF/PDB file. + case 'M': // Possible MS-DOS stub on Windows PE file, MSF/PDB file or a + // Minidump file. if (startswith(Magic, "MZ") && Magic.size() >= 0x3c + 4) { uint32_t off = read32le(Magic.data() + 0x3c); // PE/COFF file, either EXE or DLL. @@ -192,6 +201,8 @@ file_magic llvm::identify_magic(StringRef Magic) { } if (Magic.startswith("Microsoft C/C++ MSF 7.00\r\n")) return file_magic::pdb; + if (startswith(Magic, "MDMP")) + return file_magic::minidump; break; case 0x64: // x86-64 or ARM64 Windows. |
