Skip to content

Commit 0e4ef64

Browse files
iii-izahiraam
authored andcommitted
[OpenMP][SystemZ] Compile __kmpc_omp_task_begin_if0() with backchain (llvm#71834)
OpenMP runtime fails to build on SystemZ with clang with the following error message: LLVM ERROR: Unsupported stack frame traversal count __kmpc_omp_task_begin_if0() uses OMPT_GET_FRAME_ADDRESS(1), which delegates to __builtin_frame_address(), which in turn works with nonzero values on SystemZ only if backchain is in use. If backchain is not in use, the above error is emitted. Compile __kmpc_omp_task_begin_if0() with backchain. Note that this only resolves the build error. If at runtime its caller is compiled without backchain, __builtin_frame_address() will produce an incorrect value, but will not cause a crash. Since the value is relevant only for OMPT, this is acceptable.
1 parent 4621327 commit 0e4ef64

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

openmp/runtime/src/kmp_tasking.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,14 @@ static void __kmpc_omp_task_begin_if0_ompt(ident_t *loc_ref, kmp_int32 gtid,
839839
// loc_ref: source location information; points to beginning of task block.
840840
// gtid: global thread number.
841841
// task: task thunk for the started task.
842+
#ifdef __s390x__
843+
// This is required for OMPT_GET_FRAME_ADDRESS(1) to compile on s390x.
844+
// In order for it to work correctly, the caller also needs to be compiled with
845+
// backchain. If a caller is compiled without backchain,
846+
// OMPT_GET_FRAME_ADDRESS(1) will produce an incorrect value, but will not
847+
// crash.
848+
__attribute__((target("backchain")))
849+
#endif
842850
void __kmpc_omp_task_begin_if0(ident_t *loc_ref, kmp_int32 gtid,
843851
kmp_task_t *task) {
844852
#if OMPT_SUPPORT

0 commit comments

Comments
 (0)