[llvm-bugs] [Bug 34904] New: Linking fails on C programs with xray instrumentation enabled

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 10 11:53:55 PDT 2017


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

            Bug ID: 34904
           Summary: Linking fails on C programs with xray instrumentation
                    enabled
           Product: clang
           Version: trunk
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jbulow-llvm at jongel.net
                CC: llvm-bugs at lists.llvm.org

According to documentation it should be possible to use xray instrumentation on
C program by specifying the flags -fxray-instrument.

Linking fails when compiling the following program:

----8<----- (minimal.c)
int main ()
{
  return 0;
}
----8<-----
$ clang --version
clang version 6.0.0 (trunk 315272)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jonasbu/local/bin

$ clang -fxray-instrument minimal.c                                             
/home/jonasbu/local/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o):
In function `getGlobalFd()':
/home/jonasbu/llvm-clang/llvm/projects/compiler-rt/lib/xray/xray_inmemory_log.cc:123:
undefined reference to `__cxa_guard_acquire'
/home/jonasbu/llvm-clang/llvm/projects/compiler-rt/lib/xray/xray_inmemory_log.cc:123:
undefined reference to `__cxa_guard_release'
/home/jonasbu/local/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o):
In function `__xray_InMemoryRawLog<__xray_InMemoryEmulateTSC(int32_t,
XRayEntryType)::<lambda(uint8_t&)> >':
/home/jonasbu/llvm-clang/llvm/projects/compiler-rt/lib/xray/xray_inmemory_log.cc:136:
undefined reference to `__cxa_thread_atexit'
/home/jonasbu/local/lib/clang/6.0.0/lib/linux/libclang_rt.xray-x86_64.a(xray_inmemory_log.cc.o):
In function `__xray_OpenLogFile':
/home/jonasbu/llvm-clang/llvm/projects/compiler-rt/lib/xray/xray_inmemory_log.cc:85:
undefined reference to `__cxa_guard_acquire'
/home/jonasbu/llvm-clang/llvm/projects/compiler-rt/lib/xray/xray_inmemory_log.cc:85:
undefined reference to `__cxa_guard_release'
/home/jonasbu/llvm-clang/llvm/projects/compiler-rt/lib/xray/xray_inmemory_log.cc:87:
undefined reference to `__cxa_guard_acquire'
/home/jonasbu/llvm-clang/llvm/projects/compiler-rt/lib/xray/xray_inmemory_log.cc:87:
undefined reference to `__cxa_guard_release'
...
...
...

As expected, the same program compiles and links fine as a C++ program:

$ clang++ -xc++ -fxray-instrument minimal.c
<no output>
$

-- 
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/20171010/782e3b05/attachment.html>


More information about the llvm-bugs mailing list