<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Runtime library not exposing some _Unwind symbols."
   href="https://llvm.org/bugs/show_bug.cgi?id=28681">28681</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Runtime library not exposing some _Unwind symbols.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.9
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>krejzi@email.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Currently, compiler-rt isn't exposing some _Unwind symbols exposed by
libgcc_s.so, which makes it unsuitable replacement for libgcc_s.so.

While building clang with another clang that uses compiler-rt as its runtime
lib, on Linux x86_64, I get the following error:

../../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.x86_64.dir/sanitizer_unwind_linux_libcdep.cc.o:
In function `__sanitizer::BufferedStackTrace::SlowUnwindStack(unsigned long,
unsigned int)':
/sources/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:125:
undefined reference to `_Unwind_Backtrace'
../../sanitizer_common/CMakeFiles/RTSanitizerCommonLibc.x86_64.dir/sanitizer_unwind_linux_libcdep.cc.o:
In function `SlowUnwindStack':
/sources/llvm/projects/compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc:125:
undefined reference to `_Unwind_Backtrace'
clang-3.9: error: linker command failed with exit code 1 (use -v to see
invocation)

Grepping for _Unwind on libgcc_s.so, I get the following:

# strings libgcc_s.so.1 | grep Unwind
_Unwind_GetGR
_Unwind_GetCFA
_Unwind_SetGR
_Unwind_GetIP
_Unwind_GetIPInfo
_Unwind_SetIP
_Unwind_GetLanguageSpecificData
_Unwind_GetRegionStart
_Unwind_FindEnclosingFunction
_Unwind_Find_FDE
_Unwind_GetDataRelBase
_Unwind_GetTextRelBase
_Unwind_RaiseException
_Unwind_ForcedUnwind
_Unwind_Resume
_Unwind_Resume_or_Rethrow
_Unwind_DeleteException
_Unwind_Backtrace

Doing the same for clang runtime:

# strings libclang_rt.builtins-x86_64.a | grep Unwind
_Unwind_GetLanguageSpecificData
_Unwind_GetIP
_Unwind_GetRegionStart
_Unwind_SetGR
_Unwind_SetIP

The rest of the functions seems to be exposed by llvm's libunwind. The solution
is to either link libunwind statically to the runtime or explicitly specify it
at linker command line when adding compiler-rt runtime libs (it seemed to work
manually).</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>