llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: None (UmeshKalappa0)

<details>
<summary>Changes</summary>

For kernel modules (where -fno-pic  and no-pie is implicit ) having 
"R_X86_64_REX_GOTPCRELX " relocs burden the kernel loader to handle the same 
like https://godbolt.org/z/hhh7ozojz.

Solution : Mark the OpenMP internal variables with dso_local conditionally for 
no-pic and no-pie ,then

1. reset the dso_local for thread_local and weak linkage internal vars.

---
Full diff: https://github.com/llvm/llvm-project/pull/75564.diff


1 Files Affected:

- (added) clang/test/OpenMP/gomp_critical_dso_local_var.c (+23) 


``````````diff
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);
+}
+

``````````

</details>


https://github.com/llvm/llvm-project/pull/75564
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to