Skip to content

Commit b00d0b2

Browse files
committed
Fix build and tests for upstream
1 parent 4b92c4a commit b00d0b2

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

clang/lib/CodeGen/CGDeclCXX.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ void CodeGenFunction::registerGlobalDtorWithLLVM(const VarDecl &VD,
338338
llvm::FunctionCallee Dtor,
339339
llvm::Constant *Addr) {
340340
// Create a function which calls the destructor.
341-
llvm::Function *dtorStub = createAtExitStub(VD, Dtor, Addr);
341+
llvm::Function *dtorStub =
342+
cast<llvm::Function>(createAtExitStub(VD, Dtor, Addr));
342343
CGM.AddGlobalDtor(dtorStub);
343344
}
344345

clang/lib/CodeGen/ItaniumCXXABI.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4915,7 +4915,8 @@ void XLCXXABI::registerGlobalDtor(CodeGenFunction &CGF, const VarDecl &D,
49154915
}
49164916

49174917
// Create __dtor function for the var decl.
4918-
llvm::Function *DtorStub = CGF.createAtExitStub(D, Dtor, Addr);
4918+
llvm::Function *DtorStub =
4919+
cast<llvm::Function>(CGF.createAtExitStub(D, Dtor, Addr));
49194920

49204921
// Register above __dtor with atexit().
49214922
CGF.registerGlobalDtorWithAtExit(DtorStub);

clang/test/CodeGenCXX/ptrauth-static-destructors.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@ class Foo {
1313

1414
Foo global;
1515

16-
// CXAATEXIT: @_ZN3FooD1Ev.ptrauth = private constant { i8*, i32, i64, i64 } { i8* bitcast (%class.Foo* (%class.Foo*)* @_ZN3FooD1Ev to i8*), i32 0, i64 0, i64 0 }, section "llvm.ptrauth", align 8
1716
// CXAATEXIT: define internal void @__cxx_global_var_init()
18-
// CXAATEXIT: call i32 @__cxa_atexit(void (i8*)* bitcast ({ i8*, i32, i64, i64 }* @_ZN3FooD1Ev.ptrauth to void (i8*)*), i8* getelementptr inbounds (%class.Foo, %class.Foo* @global, i32 0, i32 0), i8* @__dso_handle)
17+
// CXAATEXIT: call i32 @__cxa_atexit(ptr ptrauth (ptr @_ZN3FooD1Ev, i32 0), ptr @global, ptr @__dso_handle)
1918

2019

21-
// ATEXIT: @__dtor_global.ptrauth = private constant { i8*, i32, i64, i64 } { i8* bitcast (void ()* @__dtor_global to i8*), i32 0, i64 0, i64 0 }, section "llvm.ptrauth", align 8
2220
// ATEXIT: define internal void @__cxx_global_var_init()
23-
// ATEXIT: %{{.*}} = call i32 @atexit(void ()* bitcast ({ i8*, i32, i64, i64 }* @__dtor_global.ptrauth to void ()*))
21+
// ATEXIT: %{{.*}} = call i32 @atexit(ptr ptrauth (ptr @__dtor_global, i32 0))
2422

2523
// ATEXIT: define internal void @__dtor_global() {{.*}} section "__TEXT,__StaticInit,regular,pure_instructions" {
26-
// ATEXIT: %{{.*}} = call %class.Foo* @_ZN3FooD1Ev(%class.Foo* @global)
24+
// ATEXIT: %{{.*}} = call ptr @_ZN3FooD1Ev(ptr @global)

0 commit comments

Comments
 (0)