[libcxx-commits] [clang-tools-extra] [llvm] [compiler-rt] [clang] [flang] [libcxx] [libc] Don't emit relax relocs like R_X86_64_REX_GOTPCRELX on X86 target for OPENMP internal vars. (PR #75564)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Dec 14 23:16:25 PST 2023
https://github.com/UmeshKalappa0 updated https://github.com/llvm/llvm-project/pull/75564
>From 4125e4a709c594562fa6c52f045ba7442e3cb523 Mon Sep 17 00:00:00 2001
From: Umesh Kalappa <Umesh.Kalappa at amd.com>
Date: Fri, 15 Dec 2023 11:52:52 +0530
Subject: [PATCH] Problem :For Kernel Modules ,emitting the relocs like
R_X86_64_REX_GOTPCRELX for the OPENMP internal vars like
https://godbolt.org/z/hhh7ozojz.
Solution : Mark the OpenMP internal variables with dso_local
conditionally for no-pic and no-pie ,then
a)reset the dso_local for thread_local and weak linkage vars.
---
.../test/OpenMP/gomp_critical_dso_local_var.c | 23 +++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 clang/test/OpenMP/gomp_critical_dso_local_var.c
diff --git a/clang/test/OpenMP/gomp_critical_dso_local_var.c b/clang/test/OpenMP/gomp_critical_dso_local_var.c
new file mode 100644
index 00000000000000..915f6773bf67bf
--- /dev/null
+++ b/clang/test/OpenMP/gomp_critical_dso_local_var.c
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -fopenmp -x c -emit-llvm %s -o - | FileCheck %s --check-prefix=DSO_LOCAL
+
+// DSO_LOCAL-DAG: @.gomp_critical_user_.var = common dso_local global [8 x i32] zeroinitializer, align 8
+int omp_critical_test()
+{
+ int sum;
+ int known_sum;
+
+ sum=0;
+#pragma omp parallel
+ {
+ int mysum=0;
+ int i;
+#pragma omp for
+ for (i = 0; i < 1000; i++)
+ mysum = mysum + i;
+#pragma omp critical
+ sum = mysum +sum;
+ }
+ known_sum = 999 * 1000 / 2;
+ return (known_sum == sum);
+}
+
More information about the libcxx-commits
mailing list