Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Untangle libunwind from libc++abi and compiler-rt #23738

Closed
rengolin opened this issue Apr 28, 2015 · 14 comments
Closed

Untangle libunwind from libc++abi and compiler-rt #23738

rengolin opened this issue Apr 28, 2015 · 14 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Comments

@rengolin
Copy link
Member

Bugzilla Link 23364
Resolution FIXED
Resolved on Jul 27, 2015 11:15
Version unspecified
OS Linux
CC @emaste,@ismail,@mclow,@rengolin

Extended Description

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.

@rengolin
Copy link
Member Author

assigned to @compnerd

@ismail
Copy link
Contributor

ismail commented May 7, 2015

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=, actions=,
exceptionClass=, unwind_exception=,
context=)
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

::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.

@compnerd
Copy link
Member

compnerd commented May 8, 2015

Were those running against libunwind previously? Or is that what is now causing this to show up?

@ismail
Copy link
Contributor

ismail commented May 8, 2015

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.

@compnerd
Copy link
Member

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.

@llvmbot
Copy link
Collaborator

llvmbot commented May 11, 2015

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

@ismail
Copy link
Contributor

ismail commented May 12, 2015

With r237099 all tests pass as expected again. I'll keep an eye on this and let you know if it fails again.

@llvmbot
Copy link
Collaborator

llvmbot commented May 16, 2015

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

@rengolin
Copy link
Member Author

Can we mark this one fixed?

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 26, 2015

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.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 24, 2015

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

@rengolin
Copy link
Member Author

Hi Logan,

Can we close this, then?

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 27, 2015

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.

@llvmbot
Copy link
Collaborator

llvmbot commented Jul 27, 2015

Hi Logan,

Can we close this, then?

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

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 10, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

No branches or pull requests

4 participants