[llvm-bugs] [Bug 40579] New: clang's -nodefaultlibs breaks XRay instrumentation

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 3 05:43:17 PST 2019


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

            Bug ID: 40579
           Summary: clang's -nodefaultlibs breaks XRay instrumentation
           Product: XRay
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang
          Assignee: dberris at google.com
          Reporter: lebedev.ri at gmail.com
                CC: llvm-bugs at lists.llvm.org

I have just tried to build LLVM with xray instrumentation, and it fails with

CMake Warning at /build/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake:52
(message):
  Host compiler appears to require libatomic, but cannot find it.
Call Stack (most recent call first):
  /build/libcxx/cmake/config-ix.cmake:63 (include)
  /build/libcxx/CMakeLists.txt:471 (include)


CMake Error at /build/libcxx/CMakeLists.txt:526 (message):
  C++11 or greater is required but the compiler does not support c++11


Configuring incomplete, errors occurred!


I have digged, and:

$ cat /tmp/test.cpp 
int main(int argc, char* argv[]) {
  return 0;
}
$ clang++ -fxray-instrument -fxray-instruction-threshold=0 -nodefaultlibs
/tmp/test.cpp 
ld: error: undefined symbol: __libc_csu_fini
>>> referenced by /usr/lib64/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crt1.o:(_start)

ld: error: undefined symbol: __libc_csu_init
>>> referenced by /usr/lib64/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crt1.o:(_start)

ld: error: undefined symbol: __libc_start_main
>>> referenced by /usr/lib64/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/crt1.o:(_start)

ld: error: undefined symbol: __errno_location
>>> referenced by sanitizer_allocator_checks.cc.o:(__sanitizer::SetErrnoToENOMEM()) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: sigaction
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::internal_sigaction(int, void const*, void*)) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: getrlimit
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*)) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: pthread_attr_init
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*)) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: pthread_self
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*)) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: pthread_getattr_np
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*)) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: pthread_attr_destroy
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::GetThreadStackTopAndBottom(bool, unsigned long*, unsigned long*)) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: dlsym
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::SetEnv(char const*, char const*)) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: dlsym
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::InitTlsSize()) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: confstr
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::ThreadDescriptorSize()) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: dl_iterate_phdr
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::ListOfModules::init()) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: getrusage
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::GetRSS()) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: sched_getaffinity
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::GetNumberOfCPUs()) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: __sched_cpucount
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::GetNumberOfCPUs()) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: syslog
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::WriteOneLineToSyslog(char const*)) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: clock_gettime
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::MonotonicNanoTime()) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: undefined symbol: getauxval
>>> referenced by sanitizer_linux_libcdep.cc.o:(__sanitizer::ReExec()) in archive /usr/lib/llvm-9/lib/clang/9.0.0/lib/linux/libclang_rt.xray-x86_64.a

ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all
errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ clang++ -fxray-instrument -fxray-instruction-threshold=0 /tmp/test.cpp 
$ # so it is -nodefaultlibs that is the culprit.

-- 
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/20190203/d35ac24e/attachment-0001.html>


More information about the llvm-bugs mailing list