Importing rustc-1.38.0
diff --git a/src/llvm-project/llvm/lib/BinaryFormat/Magic.cpp b/src/llvm-project/llvm/lib/BinaryFormat/Magic.cpp
index 78efa6e..7dfe236 100644
--- a/src/llvm-project/llvm/lib/BinaryFormat/Magic.cpp
+++ b/src/llvm-project/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 @@
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 @@
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 @@
}
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.