[PATCH] D113819: [llvm-obcopy][MachO] Add error for MH_PRELOAD
Keith Smiley via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 12 17:59:45 PST 2021
keith updated this revision to Diff 386991.
keith marked 2 inline comments as done.
keith added a comment.
Improve test, change error code
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113819/new/
https://reviews.llvm.org/D113819
Files:
llvm/test/tools/llvm-objcopy/MachO/mh-preload-unsupported.yaml
llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
Index: llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
===================================================================
--- llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
+++ llvm/tools/llvm-objcopy/MachO/MachOObjcopy.cpp
@@ -392,6 +392,11 @@
if (!O)
return createFileError(Config.InputFilename, O.takeError());
+ if (O->get()->Header.FileType == MachO::HeaderFileType::MH_PRELOAD)
+ return createStringError(std::errc::not_supported,
+ "%s: MH_PRELOAD files are not supported",
+ Config.InputFilename.str().c_str());
+
if (Error E = handleArgs(Config, MachOConfig, **O))
return createFileError(Config.InputFilename, std::move(E));
Index: llvm/test/tools/llvm-objcopy/MachO/mh-preload-unsupported.yaml
===================================================================
--- /dev/null
+++ llvm/test/tools/llvm-objcopy/MachO/mh-preload-unsupported.yaml
@@ -0,0 +1,16 @@
+--- !mach-o
+FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x100000C
+ cpusubtype: 0x0
+ filetype: 0x5
+ ncmds: 0
+ sizeofcmds: 0
+ flags: 0x1
+ reserved: 0x0
+...
+
+# RUN: yaml2obj %s > %t
+# RUN: not llvm-objcopy %t 2>&1 | FileCheck %s -DFILE=%t
+#
+# CHECK: error: [[FILE]]: MH_PRELOAD files are not supported
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D113819.386991.patch
Type: text/x-patch
Size: 1332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211113/cf3a9064/attachment.bin>
More information about the llvm-commits
mailing list