mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
gold plugin: Fix handling of corrupted bitcode files.
We should still claim them and tell gold about the error. llvm-svn: 214214
This commit is contained in:
parent
6ff3f85013
commit
959d066783
BIN
test/tools/gold/Inputs/invalid.bc
Normal file
BIN
test/tools/gold/Inputs/invalid.bc
Normal file
Binary file not shown.
7
test/tools/gold/invalid.ll
Normal file
7
test/tools/gold/invalid.ll
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
; RUN: not ld -plugin %llvmshlibdir/LLVMgold.so \
|
||||||
|
; RUN: %p/Inputs/invalid.bc -o %t2 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
; test that only one error gets printed
|
||||||
|
|
||||||
|
; CHECK: error: LLVM gold plugin has failed to create LTO module: Malformed block
|
||||||
|
; CHECK-NOT: error
|
@ -291,6 +291,8 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
if (!LTOModule::isBitcodeFile(view, file->filesize))
|
if (!LTOModule::isBitcodeFile(view, file->filesize))
|
||||||
return LDPS_OK;
|
return LDPS_OK;
|
||||||
|
|
||||||
|
*claimed = 1;
|
||||||
|
|
||||||
std::string Error;
|
std::string Error;
|
||||||
LTOModule *M =
|
LTOModule *M =
|
||||||
LTOModule::createFromBuffer(view, file->filesize, TargetOpts, Error);
|
LTOModule::createFromBuffer(view, file->filesize, TargetOpts, Error);
|
||||||
@ -298,10 +300,9 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
(*message)(LDPL_ERROR,
|
(*message)(LDPL_ERROR,
|
||||||
"LLVM gold plugin has failed to create LTO module: %s",
|
"LLVM gold plugin has failed to create LTO module: %s",
|
||||||
Error.c_str());
|
Error.c_str());
|
||||||
return LDPS_OK;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
*claimed = 1;
|
|
||||||
Modules.resize(Modules.size() + 1);
|
Modules.resize(Modules.size() + 1);
|
||||||
claimed_file &cf = Modules.back();
|
claimed_file &cf = Modules.back();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user