mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[WebAssembly] Fix crash when @llvm.global_dtors is external
Reviewers: aheejin Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D58799 llvm-svn: 355157
This commit is contained in:
parent
f84f2517d5
commit
24389ccbc7
@ -61,7 +61,7 @@ bool LowerGlobalDtors::runOnModule(Module &M) {
|
||||
LLVM_DEBUG(dbgs() << "********** Lower Global Destructors **********\n");
|
||||
|
||||
GlobalVariable *GV = M.getGlobalVariable("llvm.global_dtors");
|
||||
if (!GV)
|
||||
if (!GV || !GV->hasInitializer())
|
||||
return false;
|
||||
|
||||
const ConstantArray *InitList = dyn_cast<ConstantArray>(GV->getInitializer());
|
||||
|
9
test/CodeGen/WebAssembly/global_dtors.ll
Normal file
9
test/CodeGen/WebAssembly/global_dtors.ll
Normal file
@ -0,0 +1,9 @@
|
||||
; RUN: llc < %s
|
||||
|
||||
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
||||
target triple = "wasm32-unknown-unknown"
|
||||
|
||||
; Check that we do not crash when attempting to lower away
|
||||
; global_dtors without a definition.
|
||||
|
||||
@llvm.global_dtors = external global [2 x { i32, void ()*, i8* }]
|
Loading…
x
Reference in New Issue
Block a user