| 1 |
; RUN: opt -passes=lower-global-dtors -S < %s | FileCheck %s |
| 2 |
|
| 3 |
; Test we do not crash when reusing a pre-existing @__dso_handle global with a |
| 4 |
; type other than i8, instead make sure we cast it. |
| 5 |
|
| 6 |
%struct.mach_header = type { i32, i32, i32, i32, i32, i32, i32 } |
| 7 |
@__dso_handle = external global %struct.mach_header |
| 8 |
|
| 9 |
declare void @foo() |
| 10 |
|
| 11 |
@llvm.global_dtors = appending global [1 x { i32, ptr, ptr }] [ |
| 12 |
{ i32, ptr, ptr } { i32 0, ptr @foo, ptr null } |
| 13 |
] |
| 14 |
|
| 15 |
; CHECK: call i32 @__cxa_atexit(ptr @call_dtors.0, ptr null, ptr @__dso_handle) |