https://github.com/UmeshKalappa0 created https://github.com/llvm/llvm-project/pull/75564
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. >From 4125e4a709c594562fa6c52f045ba7442e3cb523 Mon Sep 17 00:00:00 2001 From: Umesh Kalappa <umesh.kala...@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); +} + _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits