[llvm-bugs] [Bug 43927] New: Crash on exit when compiling with ThinLTO

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 6 17:55:16 PST 2019


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

            Bug ID: 43927
           Summary: Crash on exit when compiling with ThinLTO
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Runtime Library
          Assignee: unassignedbugs at nondot.org
          Reporter: aaronpuchert at alice-dsl.net
                CC: llvm-bugs at lists.llvm.org

When building with

    -DLLVM_ENABLE_PROJECTS="clang;openmp" \
    -DLLVM_ENABLE_LTO=Thin \
    -DLLVM_USE_LINKER=gold

programs using libomp.so crash on exit in a call from _dl_fini in glibc. That
is because

$ readelf -d libomp.so

Dynamic section at offset 0xeec80 contains 32 entries:
  Tag        Type                         Name/Value
 [...]
 0x000000000000000c (INIT)               0x1af00
 0x000000000000000d (FINI)               0x0
 [...]

So it calls into offset 0x0 of the binary, which has to go wrong. Now why does
that happen? In openmp/runtime/cmake/LibompHandleFlags.cmake,

     -Wl,-fini=__kmp_internal_end_fini

is added to LDFLAGS. Now

    readelf -s llvm/lib/libomp.so | grep __kmp_internal_end_fini

indicates that this function isn't there. That is probably because LTO sees
that the function is unused and not exported, so it can be removed.

I don't know if this is a bug in LTO (i.e. the argument to -fini should be
kept) or if we need to export this function.

-- 
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/20191107/33ed255d/attachment.html>


More information about the llvm-bugs mailing list