-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't emit relax relocs like R_X86_64_REX_GOTPCRELX on X86 target for OPENMP internal vars. #75564
Conversation
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.
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-clang Author: None (UmeshKalappa0) ChangesFor 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
Full diff: https://github.com/llvm/llvm-project/pull/75564.diff 1 Files Affected:
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);
+}
+
|
Scattering around |
@efriedma-quic ,thank you for the suggestions and was not sure about adding dso_local for openmp weak linkage vars ,but from the weak semantics point ,its ok to add the dso_local for no-pic /no-pie code ,so updated changes accordingly . |
Hi @UmeshKalappa0 why did you close this? This is still needed for us internally. |
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