Skip to content

Commit c24b9ca

Browse files
authored
[OpenMP] Provide __kmp_unnamed_critical_addr on SPARC (llvm#138517)
`libomp.so` currently fails to link on SPARC, both Solaris/sparcv9 and Linux/sparc64: ``` Undefined first referenced symbol in file __kmp_unnamed_critical_addr projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_gsupport.cpp.o ld: fatal: symbol referencing errors ``` This patch provides the necessary definition. While at it, I noticed that on non-x86 targets the symbol wasn't marked as `@object`, which this patch corrects, too. Tested on `sparcv9-sun-solaris2.11`, `sparc64-unknown-linux-gnu`, `amd64-pc-solaris2.11`, and `x86_64-pc-linux-gnu`.
1 parent 30ec488 commit c24b9ca

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

openmp/runtime/src/z_Linux_asm.S

+6-4
Original file line numberDiff line numberDiff line change
@@ -2470,7 +2470,7 @@ __kmp_invoke_microtask:
24702470

24712471
#endif /* KMP_ARCH_S390X */
24722472

2473-
#if KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_PPC || KMP_ARCH_AARCH64_32
2473+
#if KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_PPC || KMP_ARCH_AARCH64_32 || KMP_ARCH_SPARC32
24742474
#ifndef KMP_PREFIX_UNDERSCORE
24752475
# define KMP_PREFIX_UNDERSCORE(x) x
24762476
#endif
@@ -2482,13 +2482,14 @@ __kmp_invoke_microtask:
24822482
KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr):
24832483
.4byte .gomp_critical_user_
24842484
#ifdef __ELF__
2485+
.type KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr),@object
24852486
.size KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr),4
24862487
#endif
2487-
#endif /* KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_AARCH64_32 */
2488+
#endif /* KMP_ARCH_ARM || KMP_ARCH_MIPS || KMP_ARCH_AARCH64_32 || KMP_ARCH_SPARC32 */
24882489

24892490
#if KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 || \
24902491
KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 || KMP_ARCH_VE || \
2491-
KMP_ARCH_S390X
2492+
KMP_ARCH_S390X || KMP_ARCH_SPARC64
24922493
#ifndef KMP_PREFIX_UNDERSCORE
24932494
# define KMP_PREFIX_UNDERSCORE(x) x
24942495
#endif
@@ -2500,11 +2501,12 @@ KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr):
25002501
KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr):
25012502
.8byte .gomp_critical_user_
25022503
#ifdef __ELF__
2504+
.type KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr),@object
25032505
.size KMP_PREFIX_UNDERSCORE(__kmp_unnamed_critical_addr),8
25042506
#endif
25052507
#endif /* KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 ||
25062508
KMP_ARCH_RISCV64 || KMP_ARCH_LOONGARCH64 || KMP_ARCH_VE ||
2507-
KMP_ARCH_S390X */
2509+
KMP_ARCH_S390X || KMP_ARCH_SPARC64 */
25082510

25092511
#if KMP_OS_LINUX
25102512
# if KMP_ARCH_ARM || KMP_ARCH_AARCH64

0 commit comments

Comments
 (0)