mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +00:00
LibDriver: Reject inputs that are not COFF objects or bitcode files.
Fixes PR31372. Differential Revision: https://reviews.llvm.org/D27776 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289726 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ca0bb7af02
commit
f87c88ec75
@ -143,6 +143,13 @@ int llvm::libDriverMain(llvm::ArrayRef<const char*> ArgsArr) {
|
||||
});
|
||||
return 1;
|
||||
}
|
||||
sys::fs::file_magic Magic =
|
||||
sys::fs::identify_magic(MOrErr->Buf->getBuffer());
|
||||
if (Magic != sys::fs::file_magic::coff_object &&
|
||||
Magic != sys::fs::file_magic::bitcode) {
|
||||
llvm::errs() << Arg->getValue() << ": not a COFF object or bitcode file\n";
|
||||
return 1;
|
||||
}
|
||||
Members.emplace_back(std::move(*MOrErr));
|
||||
}
|
||||
|
||||
|
BIN
test/LibDriver/Inputs/cl-gl.obj
Executable file
BIN
test/LibDriver/Inputs/cl-gl.obj
Executable file
Binary file not shown.
2
test/LibDriver/invalid.test
Normal file
2
test/LibDriver/invalid.test
Normal file
@ -0,0 +1,2 @@
|
||||
RUN: not llvm-lib %S/Inputs/cl-gl.obj 2>&1 | FileCheck %s
|
||||
CHECK: not a COFF object or bitcode file
|
@ -1,4 +1,4 @@
|
||||
RUN: echo foo > %t
|
||||
RUN: llvm-mc -triple=x86_64-pc-windows-msvc -filetype=obj -o %t %S/Inputs/a.s
|
||||
|
||||
RUN: llvm-lib -out:%t.a %t
|
||||
RUN: FileCheck --check-prefix=FAT %s < %t.a
|
||||
|
Loading…
Reference in New Issue
Block a user