Skip to content

Commit df273d6

Browse files
committed
[IRGen] Fix copy/paste error.
The schemas for the coro frame de/alloc functions were incorrectly not being assigned and instead the non-frame de/alloc functions were being assigned twice. Fix that and add more tests. rdar://163330882
1 parent 8ae717a commit df273d6

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

lib/IRGen/IRGen.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,11 +1094,11 @@ static void setPointerAuthOptions(PointerAuthOptions &opts,
10941094
codeKey, /*address*/ false, Discrimination::Constant,
10951095
SpecialPointerAuthDiscriminators::CoroDeallocationFunction);
10961096

1097-
opts.CoroAllocationFunction = PointerAuthSchema(
1097+
opts.CoroFrameAllocationFunction = PointerAuthSchema(
10981098
codeKey, /*address*/ false, Discrimination::Constant,
10991099
SpecialPointerAuthDiscriminators::CoroFrameAllocationFunction);
11001100

1101-
opts.CoroDeallocationFunction = PointerAuthSchema(
1101+
opts.CoroFrameDeallocationFunction = PointerAuthSchema(
11021102
codeKey, /*address*/ false, Discrimination::Constant,
11031103
SpecialPointerAuthDiscriminators::CoroFrameDeallocationFunction);
11041104
}

test/IRGen/coroutine_accessors.swift

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,30 @@
3737
// CHECK-arm64e-SAME: i64 40879 },
3838
// CHECK-arm64e-SAME: section "llvm.ptrauth",
3939
// CHECK-arm64e-SAME: align 8
40+
// CHECK-arm64e-LABEL: _swift_coro_malloc.ptrauth.1 = private constant {
41+
// CHECK-arm64e-SAME: ptr @_swift_coro_malloc,
42+
// CHECK-arm64e-SAME: i32 0,
43+
// CHECK-arm64e-SAME: i64 0,
44+
// CHECK-arm64e-SAME: i64 53841 }
45+
// CHECK-arm64e-SAME: section "llvm.ptrauth"
46+
// CHECK-arm64e-SAME: align 8
47+
// CHECK-arm64e-LABEL: _swift_coro_free.ptrauth.2 = private constant {
48+
// CHECK-arm64e-SAME: ptr @_swift_coro_free,
49+
// CHECK-arm64e-SAME: i32 0,
50+
// CHECK-arm64e-SAME: i64 0,
51+
// CHECK-arm64e-SAME: i64 23464 },
52+
// CHECK-arm64e-SAME: section "llvm.ptrauth",
53+
// CHECK-arm64e-SAME: align 8
4054
// CHECK-LABEL: _swift_coro_malloc_allocator = linkonce_odr hidden constant %swift.coro_allocator {
4155
// CHECK-SAME: i32 258,
42-
// CHECK-SAME: malloc
43-
// CHECK-SAME: free
56+
// CHECK-SAME: _swift_coro_malloc
57+
// CHECK-ar64e-SAME: .ptrauth
58+
// CHECK-SAME: _swift_coro_free
59+
// CHECK-ar64e-SAME: .ptrauth
60+
// CHECK-SAME: _swift_coro_malloc
61+
// CHECK-ar64e-SAME: .ptrauth.1
62+
// CHECK-SAME: _swift_coro_free
63+
// CHECK-ar64e-SAME: .ptrauth.2
4464
// CHECK-SAME: }
4565
// CHECK-arm64e-LABEL: _swift_coro_task_alloc.ptrauth = private constant {
4666
// CHECK-arm64e-SAME: ptr @_swift_coro_task_alloc,
@@ -56,10 +76,30 @@
5676
// CHECK-arm64e-SAME: i64 40879 },
5777
// CHECK-arm64e-SAME: section "llvm.ptrauth",
5878
// CHECK-arm64e-SAME: align 8
79+
// CHECK-arm64e-LABEL: _swift_coro_task_alloc.ptrauth.3 = private constant {
80+
// CHECK-arm64e-SAME: ptr @_swift_coro_task_alloc,
81+
// CHECK-arm64e-SAME: i32 0,
82+
// CHECK-arm64e-SAME: i64 0,
83+
// CHECK-arm64e-SAME: i64 53841 }
84+
// CHECK-arm64e-SAME: section "llvm.ptrauth"
85+
// CHECK-arm64e-SAME: align 8
86+
// CHECK-arm64e-LABEL: @_swift_coro_task_dealloc.ptrauth.4 = private constant {
87+
// CHECK-arm64e-SAME: ptr @_swift_coro_task_dealloc,
88+
// CHECK-arm64e-SAME: i32 0,
89+
// CHECK-arm64e-SAME: i64 0,
90+
// CHECK-arm64e-SAME: i64 23464 },
91+
// CHECK-arm64e-SAME: section "llvm.ptrauth",
92+
// CHECK-arm64e-SAME: align 8
5993
// CHECK-LABEL: _swift_coro_async_allocator = linkonce_odr hidden constant %swift.coro_allocator {
6094
// CHECK-SAME: i32 1,
6195
// CHECK-SAME: _swift_coro_task_alloc
96+
// CHECK-ar64e-SAME: .ptrauth
97+
// CHECK-SAME: _swift_coro_task_dealloc
98+
// CHECK-ar64e-SAME: .ptrauth
99+
// CHECK-SAME: _swift_coro_task_alloc
100+
// CHECK-ar64e-SAME: .ptrauth.3
62101
// CHECK-SAME: _swift_coro_task_dealloc
102+
// CHECK-ar64e-SAME: .ptrauth.4
63103
// CHECK-SAME: }
64104

65105
// CHECK-LABEL: @_swift_coro_alloc(

0 commit comments

Comments
 (0)