diff options
author | Eric Beckmann <ecbeckmann@google.com> | 2017-06-26 17:43:30 +0000 |
---|---|---|
committer | Eric Beckmann <ecbeckmann@google.com> | 2017-06-26 17:43:30 +0000 |
commit | 2a81089116a96fb77a838fca95c9bb09f43455fb (patch) | |
tree | 628a735227d97f4388ebc7b15e05f6b07bb68766 /llvm/lib/BinaryFormat | |
parent | 393b55ffe2b56ea2e44828edc79db3f14e1e10f1 (diff) | |
download | bcm5719-llvm-2a81089116a96fb77a838fca95c9bb09f43455fb.tar.gz bcm5719-llvm-2a81089116a96fb77a838fca95c9bb09f43455fb.zip |
Replace trivial use of external rc.exe by writing our own .res file.
This patch removes the dependency on the external rc.exe tool by writing
a simple .res file using our own library. In this patch I also added an
explicit definition for the .res file magic. Furthermore, I added a
unittest for embeded manifests and fixed a bug exposed by the test.
llvm-svn: 306311
Diffstat (limited to 'llvm/lib/BinaryFormat')
-rw-r--r-- | llvm/lib/BinaryFormat/Magic.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/BinaryFormat/Magic.cpp b/llvm/lib/BinaryFormat/Magic.cpp index ca4d93f99d9..f24f22c88a8 100644 --- a/llvm/lib/BinaryFormat/Magic.cpp +++ b/llvm/lib/BinaryFormat/Magic.cpp @@ -51,7 +51,8 @@ file_magic llvm::identify_magic(StringRef Magic) { return file_magic::coff_import_library; } // Windows resource file - if (startswith(Magic, "\0\0\0\0\x20\0\0\0\xFF")) + if (Magic.size() >= sizeof(COFF::WinResMagic) && + memcmp(Magic.data(), COFF::WinResMagic, sizeof(COFF::WinResMagic)) == 0) return file_magic::windows_resource; // 0x0000 = COFF unknown machine type if (Magic[1] == 0) |