LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 23364 - Untangle libunwind from libc++abi and compiler-rt
Summary: Untangle libunwind from libc++abi and compiler-rt
Status: RESOLVED FIXED
Alias: None
Product: libc++abi
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Saleem Abdulrasool
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-28 04:41 PDT by Renato Golin
Modified: 2015-07-27 11:15 PDT (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Renato Golin 2015-04-28 04:41:24 PDT
Now that we moved libunwind to its own repository, and have made it compile and run on buildbots around, we need to make sure we get all dependencies correct:

1. No hard-coded dependencies on any other component. Most relevant are compiler-rt and libc++abi.

2. No cyclic dependency between all three low-level libraries, with both compiler-rt and libc++abi using libunwind and not each other.

3. Build systems / CMake files need to be aware of the existence, so libunwind can be used inside LLVM (projects/libunwind) and be used directly by compiler-rt/libc+abi in case CMake options allow for this.

4. Different systems will have different defaults. For example, it's perfectly valid for GNU systems to rely on libgcc / libgcc_s by default and BSD systems to rely on compiler-rt / libunwind. There should be CMake settings for either to change their behaviour.

5. All tests must pass in the targets they were passing before, namely x86_64/ARM on linux/darwin.
Comment 1 İsmail Dönmez 2015-05-07 07:31:56 PDT
Just to note also here, looks like some libc++ tests like std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp started to fail with libunwind:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007ffff73d00ce in unw_get_proc_info (cursor=0x7fffffffd940,
info=0x7fffffffd520)
    at ../projects/libunwind/src/libunwind.cpp:237
#2  0x00007ffff73d4b83 in _Unwind_GetLanguageSpecificData
(context=0x7fffffffd940)
    at ../projects/libunwind/src/UnwindLevel1.c:417
#3  0x00007ffff7bd2cc8 in __cxxabiv1::scan_eh_tab (results=...,
actions=_UA_CLEANUP_PHASE, native_exception=true,
    unwind_exception=0x60b1e8, context=0x7fffffffd940) at
../projects/libcxxabi/src/cxa_personality.cpp:591
#4  0x00007ffff7bd2b0a in __gxx_personality_v0 (version=<optimized
out>, actions=<optimized out>,
    exceptionClass=<optimized out>, unwind_exception=<optimized out>,
context=<optimized out>)
    at ../projects/libcxxabi/src/cxa_personality.cpp:1005
#5  0x00000000004056a3 in _Unwind_RaiseException_Phase2
(exc=exc@entry=0x60b1e8, context=context@entry=0x7fffffffd940)
    at ../../../libgcc/unwind.inc:62
#6  0x0000000000405e97 in _Unwind_Resume (exc=0x60b1e8) at
../../../libgcc/unwind.inc:230
#7  0x00000000004030e8 in std::__1::list<int, std::__1::allocator<int>
>::insert<int*> ()
#8  0x0000000000401da2 in main ()
(gdb) frame 1
#1  0x00007ffff73d00ce in unw_get_proc_info (cursor=0x7fffffffd940,
info=0x7fffffffd520)
    at ../projects/libunwind/src/libunwind.cpp:237
237       co->getInfo(info);
(gdb) print info
$1 = (unw_proc_info_t *) 0x7fffffffd520
(gdb) print *info
$2 = {start_ip = 140737343503848, end_ip = 140733193388033, lsda =
4223808, handler = 140737488344512, gp = 0,
  flags = 140737354131160, format = 4194368, unwind_info_size = 0,
unwind_info = 9, extra = 8}

This is on Linux x86-64.
Comment 2 Saleem Abdulrasool 2015-05-07 20:12:54 PDT
Were those running against libunwind previously?  Or is that what is now causing this to show up?
Comment 3 İsmail Dönmez 2015-05-08 03:04:24 PDT
(In reply to comment #2)
> Were those running against libunwind previously?  Or is that what is now
> causing this to show up?

My builds was using libunwind since forever, and even after libunwind moved to its own toplevel project it was fine. But it seems to be failing for the last 2-3 days or so.
Comment 4 Saleem Abdulrasool 2015-05-09 17:51:58 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > Were those running against libunwind previously?  Or is that what is now
> > causing this to show up?
> 
> My builds was using libunwind since forever, and even after libunwind moved
> to its own toplevel project it was fine. But it seems to be failing for the
> last 2-3 days or so.

Hmm.. that at least means that the changes causing the new failures is pretty limited: SVN r236585, SVN r236154.

Could you check if reverting either makes those tests pass again?  If I get a chance, Ill see if I can test locally.
Comment 5 Logan Chien 2015-05-11 08:33:23 PDT
(In reply to comment #1)
> Just to note also here, looks like some libc++ tests like
> std/containers/sequences/list/list.modifiers/insert_iter_iter_iter.pass.cpp
> started to fail with libunwind:
>
> This is on Linux x86-64.

Hi Ismail,

May you provide more details on your environment, e.g. distribution, compiler toolchain, and etc?  I can't reproduce your crash report on Ubuntu 14.04 LTS (x86-64.)  Here is my attempt to reproduce the problem:

#!/bin/bash -e

## 0. Setup environment variable

export ROOT="$(pwd)"
export NUM_JOBS=20

## 1. Checkout the source code:

git clone http://llvm.org/git/llvm.git
cd llvm
git checkout c7c44fa

cd "${ROOT}/llvm/tools"
git clone http://llvm.org/git/clang.git
cd clang
git checkout 9b03bac

## 2. Build bootstrap clang

cd "${ROOT}"
mkdir llvm-bootstrap-build
cd llvm-bootstrap-build

cmake -G Ninja "${ROOT}/llvm" \
  -DCMAKE_INSTALL_PREFIX="${ROOT}/llvm-bootstrap" \
  -DCMAKE_BUILD_TYPE="Release" \
  -DCMAKE_C_COMPILER="gcc" \
  -DCMAKE_CXX_COMPILER="g++" \
  -DLLVM_ENABLE_ASSERTIONS=1

ninja -j${NUM_JOBS} && ninja -j${NUM_JOBS} install

## 3. Checkout libc++, libc++abi, libunwind, compiler-rt

cd "${ROOT}/llvm/projects"
git clone http://llvm.org/git/compiler-rt.git
cd compiler-rt
git checkout dc32e4a

cd "${ROOT}/llvm/projects"
git clone http://llvm.org/git/libcxx.git
cd libcxx
git checkout 0ad232a

cd "${ROOT}/llvm/projects"
git clone http://llvm.org/git/libcxxabi.git
cd libcxxabi
git checkout f662666

cd "${ROOT}/llvm/projects"
git clone http://llvm.org/git/libunwind.git
cd libunwind
git checkout 7e9c948

## 4. Rebuild LLVM/Clang with the bootstrap clang

cd "${ROOT}"
mkdir llvm-build
cd llvm-build

export PATH="${ROOT}/llvm-bootstrap/bin:${PATH}"

cmake -G Ninja "${ROOT}/llvm" \
  -DCMAKE_INSTALL_PREFIX="${ROOT}/llvm-install" \
  -DCMAKE_BUILD_TYPE="Release" \
  -DCMAKE_C_COMPILER="clang" \
  -DCMAKE_CXX_COMPILER="clang++" \
  -DLLVM_ENABLE_ASSERTIONS=1 \
  -DLIBCXXABI_USE_LLVM_UNWINDER=1 \
  -DLIBCXXABI_LIBUNWIND_INCLUDES="${ROOT}/llvm/projects/libunwind/include" \
  -DLIBCXXABI_LIBUNWIND_SOURCES="${ROOT}/llvm/projects/libunwind/src"

ninja -j${NUM_JOBS} && ninja -j${NUM_JOBS} install
ninja -j${NUM_JOBS} check-all

./bin/llvm-lit projects/libcxx/test  # this should pass all tests
Comment 6 İsmail Dönmez 2015-05-12 06:02:16 PDT
With r237099 all tests pass as expected again. I'll keep an eye on this and let you know if it fails again.
Comment 7 Logan Chien 2015-05-16 08:51:04 PDT
The ARM build bot libcxx-libcxxabi-arm-linux has been fixed by:
http://reviews.llvm.org/rL237518

build log: http://lab.llvm.org:8011/builders/libcxx-libcxxabi-arm-linux/builds/419
Comment 8 Renato Golin 2015-06-26 07:46:08 PDT
Can we mark this one fixed?
Comment 9 Logan Chien 2015-06-26 07:48:15 PDT
(In reply to comment #8)
> Can we mark this one fixed?

No.  I don't think so.  The libc++abi + libgcc build is still broken for ARM.  I will fix the problem before the creation of 3.7 release branch.
Comment 10 Logan Chien 2015-07-23 19:21:55 PDT
(In reply to comment #9)
> (In reply to comment #8)
> > Can we mark this one fixed?
> 
> No.  I don't think so.  The libc++abi + libgcc build is still broken for
> ARM.  I will fix the problem before the creation of 3.7 release branch.

Fixed in rL243073.

http://reviews.llvm.org/rL243073
Comment 11 Renato Golin 2015-07-27 08:32:02 PDT
Hi Logan,

Can we close this, then?
Comment 12 Logan Chien 2015-07-27 11:14:29 PDT
This issue has been resolved.

1. The buildbot is running without problems.
2. The circular dependency between libc++abi and libunwind has been fixed.
3. The libc++abi/libgcc build has been fixed.
Comment 13 Logan Chien 2015-07-27 11:15:31 PDT
(In reply to comment #11)
> Hi Logan,
> 
> Can we close this, then?

Sure.  I have just closed this issue.  Feel free to re-open if I have missed anything.)