forked from OSchip/llvm-project
[LTO] Don't crash on a BitcodeFile without DataLayout.
Emit an error instead. llvm-svn: 266504
This commit is contained in:
parent
f0d73f95c1
commit
493b683f79
|
@ -82,6 +82,8 @@ void BitcodeCompiler::add(BitcodeFile &F) {
|
|||
ArrayRef<SymbolBody *> Bodies = F.getSymbols();
|
||||
|
||||
Module &M = Obj->getModule();
|
||||
if (M.getDataLayoutStr().empty())
|
||||
fatal("invalid bitcode file: " + F.getName() + " has no datalayout");
|
||||
|
||||
// If a symbol appears in @llvm.used, the linker is required
|
||||
// to treat the symbol as there is a reference to the symbol
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
; REQUIRES: x86
|
||||
; RUN: llvm-as %s -o %t.o
|
||||
; RUN: not ld.lld -m elf_x86_64 %t.o 2>&1 | FileCheck %s
|
||||
|
||||
; CHECK: invalid bitcode file:
|
||||
|
||||
; This bitcode file has no datalayout.
|
||||
target triple = "x86_64-unknown-linux-gnu"
|
||||
|
||||
define void @_start() {
|
||||
ret void
|
||||
}
|
Loading…
Reference in New Issue