[llvm-bugs] [Bug 38026] New: Link error about __atomic_* when -fopenmp enabled

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 2 19:15:26 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38026

            Bug ID: 38026
           Summary: Link error about __atomic_* when -fopenmp enabled
           Product: libraries
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: m-takahiro at jp.fujitsu.com
                CC: llvm-bugs at lists.llvm.org

When a following code is compiled with -fopenmp for x86 and aarch64 targets,
link error occurs.

------ complex.c --------
#include <complex.h>
void foo() {
  double _Complex x, v, expr;
#pragma omp atomic write
  x = 1 + I * 1.0;
#pragma omp atomic read
  expr = x;
#pragma omp atomic update
  x = x + expr;
#pragma omp atomic capture
  {
    v = x;
    x = x + expr;
  }
#pragma omp atomic capture
  {
    x = x + expr;
    v = x;
  }
}
-------------------------

For x86 target:

$ clang -O0 complex.c -fopenmp
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function
`_start':
(.text+0x20): undefined reference to `main'
/tmp/complex-eb77c9.o: In function `foo':
complex.c:(.text+0x2f): undefined reference to `__atomic_store'
complex.c:(.text+0x45): undefined reference to `__atomic_load'
complex.c:(.text+0x89): undefined reference to `__atomic_load'
complex.c:(.text+0xd5): undefined reference to `__atomic_compare_exchange'
complex.c:(.text+0x112): undefined reference to `__atomic_load'
complex.c:(.text+0x17d): undefined reference to `__atomic_compare_exchange'
complex.c:(.text+0x1d7): undefined reference to `__atomic_load'
complex.c:(.text+0x245): undefined reference to `__atomic_compare_exchange'

For aarch64 target:

$ clang -fopenmp complex.c
/usr/lib/gcc/aarch64-redhat-linux/4.8.5/../../../../lib64/crt1.o: In function
`_start':
(.text+0x30): undefined reference to `main'
/tmp/complex-b0efaa.o: In function `foo':
complex.c:(.text+0x68): undefined reference to `__atomic_store'
complex.c:(.text+0x7c): undefined reference to `__atomic_load'
complex.c:(.text+0xbc): undefined reference to `__atomic_load'
complex.c:(.text+0x10c): undefined reference to `__atomic_compare_exchange'
complex.c:(.text+0x13c): undefined reference to `__atomic_load'
complex.c:(.text+0x194): undefined reference to `__atomic_compare_exchange'
complex.c:(.text+0x1e0): undefined reference to `__atomic_load'
complex.c:(.text+0x238): undefined reference to `__atomic_compare_exchange'

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180703/120b7c4f/attachment.html>


More information about the llvm-bugs mailing list