summaryrefslogtreecommitdiffstats
path: root/libunwind/cmake
Commit message (Collapse)AuthorAgeFilesLines
* [unwind] Don't link libpthread and libdl on FuchsiaPetr Hosek2019-12-171-4/+9
| | | | This is a follow up to D71135.
* Reland "Enable `-funwind-tables` flag when building libunwind"Sergej Jaskiewicz2019-12-111-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | Summary: Relands https://reviews.llvm.org/D70815. The original commit set `CMAKE_TRY_COMPILE_TARGET_TYPE` to `STATIC_LIBRARY` globally in libunwind/CMakeLists.txt, which effectively disabled the linking step in CMake checks. This broke some builds (see 938c70b86c7d2165f8c28d5700e9c1ac1263307e). Here we set CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY only when checking for presence of the `-funwind-tables` flag, and then set it back to the original value so it doesn't affect other checks. Reviewers: mstorsjo, jfb Subscribers: mgorny, christof, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D71117
* Revert "Enable `-funwind-tables` flag when building libunwind"Martin Storsjö2019-12-041-11/+0
| | | | | | | | | | | | | | | | | This reverts commit b3fdf33ba6aa7ef80621696f74aaf2f6f8e1d1de. This change broke building libunwind for Windows/MinGW, and broke on aspect of the CMake tests in libunwind in general. After set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY), CMake skips the linking step in tests, but cmake/config-ix.cmake also does a few checks for functions in libraries (looking for whether -lc provides fopen and whether -ldl provides dladdr). As CMake only tests building a static library, these tests incorrectly succeed and CMake concludes "Looking for fopen in c - found" and "Looking for dladdr in dl - found", while building then fails at the end with errors about unable to find -lc and -ldl.
* Enable `-funwind-tables` flag when building libunwindSergej Jaskiewicz2019-12-041-0/+11
| | | | | | | | | | | | | | | | | | | | | Summary: Or, rather, don't accidentally forget to pass it. This is aimed to solve the problem discussed in [this thread](http://lists.llvm.org/pipermail/llvm-dev/2019-November/136890.html), and to fix [a year-old bug](https://bugs.llvm.org/show_bug.cgi?id=38468). TL;DR: when building libunwind for ARM Linux, we **need** libunwind to be built with the `-funwind-tables` flag, because, well ARM EHABI needs unwind info produced by this flag. Without the flag all the procedures in libunwind are marked `.cantunwind`, which causes all sorts of bad things. From `_Unwind_Backtrace` not working, to C++ exceptions not being caught (which is the aforementioned bug is about). Previously, this flag was not added because the CMake check `add_compile_flags_if_supported(-funwind-tables)` produced a false negative. Why? With this flag, the compiler generates calls to the `__aeabi_unwind_cpp_pr0` symbol, which is defined in libunwind itself and obviously is not available at configure time, before libunwind is built. This led to failure at link time during the CMake check. We handle this by disabling the linker for CMake checks in linbunwind. Also, this patch introduces a lit feature `libunwind-arm-ehabi`, which is used to mark the `signal_frame.pass.cpp` test as unsupported (as was advised by @miyuki in D70397). Reviewers: peter.smith, phosek, EricWF, compnerd, jroelofs, saugustine, miyuki, jfb Subscribers: mgorny, kristof.beyls, christof, libcxx-commits, miyuki Tags: #libc Differential Revision: https://reviews.llvm.org/D70815
* [libunwind] Refactor CMake flag checks to match libc++ and libc++abiPetr Hosek2019-10-112-37/+274
| | | | | | | | | | | | | | | | | libunwind was using its own set of macros/functions for flag checking which was similar but different from libc++ and libc++abi. This made it difficult to replicate the same checks across projects, in fact there were some checks that appear to have been copy & pasted from another project and that were broken in the standalone libunwind build. This change refactors flag checks to match libc++ and libc++abi using a copy of HandleLibunwindFlags.cmake which is derived from the versions used by the other projects. This also paves a road to deduplicating and unifying HandleLibunwindFlags.cmake, HandleLibcxxabiFlags.cmake and HandleLibcxxFlags.cmake post monorepo switch. Differential Revision: https://reviews.llvm.org/D68855 llvm-svn: 374606
* [runtimes] Use -Wunknown-pragmas for the pragma checkPetr Hosek2019-05-301-0/+4
| | | | | | | This is a follow up to r362055, we need -Wunknown-pragmas otherwise the check is going to succeed it the pragma isn't supported. llvm-svn: 362057
* [runtimes] Check if pragma comment(lib, ...) is supported firstPetr Hosek2019-05-301-2/+9
| | | | | | | | | This fixes the issue introduced by r362048 where we always use pragma comment(lib, ...) for dependent libraries when the compiler is Clang, but older Clang versions don't support this pragma so we need to check first if it's supported before using it. llvm-svn: 362055
* Revert "[CMake] Use __libc_start_main rather than fopen when checking for C ↵Petr Hosek2019-01-281-1/+1
| | | | | | | | | library" This reverts commit r352341: it broke the build on macOS which doesn't seem to provide __libc_start_main in its C library. llvm-svn: 352411
* [CMake] Use __libc_start_main rather than fopen when checking for C libraryPetr Hosek2019-01-281-1/+1
| | | | | | | | | | | | | | | | | | The check_library_exists CMake uses a custom symbol definition. This is a problem when checking for C library symbols because Clang recognizes many of them as builtins, and returns the -Wbuiltin-requires-header (or -Wincompatible-library-redeclaration) error. When building with -Werror which is the default, this causes the check_library_exists check fail making the build think that C library isn't available. To avoid this issue, we should use a symbol that isn't recognized by Clang and wouldn't cause the same issue. __libc_start_main seems like reasonable choice that fits the bill. Differential Revision: https://reviews.llvm.org/D57142 llvm-svn: 352341
* [CMake] Passthrough CFLAGS when checking the compiler-rt pathPetr Hosek2018-11-141-0/+3
| | | | | | | | | | This is needed when cross-compiling for a different target since CFLAGS may contain additional flags like -resource-dir which change the location in which compiler-rt builtins are found. Differential Revision: https://reviews.llvm.org/D54371 llvm-svn: 346820
* [CMake] Link to compiler-rt if LIBUNWIND_USE_COMPILER_RT is ON.Charles Davis2018-10-081-2/+8
| | | | | | | | | | | | | | | | | | Summary: If `-nodefaultlibs` is given, we weren't actually linking to it. This was true irrespective of passing `-rtlib=compiler-rt` (see previous patch). Now we explicitly link it to handle that case. I wonder if we should be linking these libraries only if we're using `-nodefaultlibs`... Reviewers: beanz Subscribers: dberris, mgorny, christof, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D51657 llvm-svn: 343990
* [CMake] Don't use -rtlib=compiler-rt with -nodefaultlibs.Charles Davis2018-09-041-1/+0
| | | | | | | | | | | | | | | Summary: This switch only has an effect at link time. It changes the default compiler support library to `compiler-rt`. With `-nodefaultlibs`, this library won't get linked anyway; Clang actually warns about that. Reviewers: mstorsjo, rnk Subscribers: dberris, mgorny, christof, cfe-commits Differential Revision: https://reviews.llvm.org/D51645 llvm-svn: 341404
* [CMake] Convert paths to the right form in standalone builds on WindowsMartin Storsjo2018-06-201-0/+3
| | | | | | | | | | | | | The paths output from llvm-config --cmakedir and from clang --print-libgcc-file-name can contain backslashes, while CMake can't handle the paths in this form. This matches what compiler-rt already does (since SVN r203789 and r293195). Differential Revision: https://reviews.llvm.org/D48353 llvm-svn: 335169
* build: use POSITION_INDEPENDENT_CODE instead of -fPICSaleem Abdulrasool2017-10-031-1/+0
| | | | | | | | Rather than hardcode the flag and check if the compiler supports it, use the CMake property to get the right flag spelling for the compiler. This makes it generally more portable. llvm-svn: 314834
* Add CMake support for building for MinGWMartin Storsjo2017-10-021-0/+13
| | | | | | | | This section is similar to what already exists in libcxx and libcxxabi. Differential Revision: https://reviews.llvm.org/D38380 llvm-svn: 314716
* [CMake][libunwind] Fix the -target and -gcc-toolchain flag handlingPetr Hosek2017-04-161-1/+1
| | | | | | | | | | | | | CMake has the problem with the single dash variant because of the space, so use the double dash with equal sign version. The compile flag handling had a typo which caused these flag not to be properly include. We also don't have to pass the target triple when checking for compiler-rt since that flag is already included in compile flags now. Differential Revision: https://reviews.llvm.org/D32071 llvm-svn: 300419
* Reland "[CMake][libunwind] Use -nodefaultlibs for CMake checks"Petr Hosek2017-04-122-2/+92
| | | | | | | | | | | | | This is a reland of commit r299796. Turned out that we need gcc_s or compiler-rt on ARM when checking the support for -funwind-tables which creates a dependency on __aeabi_unwind_cpp_pr0 symbol that's provided by the compiler runtime. Differential Revision: https://reviews.llvm.org/D31858 llvm-svn: 300020
* Revert "[CMake][libunwind] Use -nodefaultlibs for CMake checks"Petr Hosek2017-04-071-23/+2
| | | | | | This reverts commit r299796. llvm-svn: 299798
* [CMake][libunwind] Use -nodefaultlibs for CMake checksPetr Hosek2017-04-071-2/+23
| | | | | | | | | | | | Since libunwind is built with -nodefaultlibs, we should be using this option even for CMake checks to avoid any inconsistency and also to avoid dependency on a working C++ standard library just for the setting up the build itself. The implementation is largely similar to the one used by libc++. Differential Revision: https://reviews.llvm.org/D31640 llvm-svn: 299796
* [CMake] Get libunwind building under LLVM/runtimesPetr Hosek2016-11-081-0/+5
| | | | | | | | | | | | | | | The new LLVM runtimes directory requires the same conventions to be followed across the runtime projects. These changes make libunwind build under the runtimes subdirectory. This patch contains the following changes: * Rename LLVM_CONFIG to LLVM_CONFIG_PATH * Check if compiler supports C++11 (required by libunwind) Differential Revision: https://reviews.llvm.org/D26360 llvm-svn: 286308
* Replace cmake check for printf with a check for fopen.Evgeniy Stepanov2015-12-101-1/+1
| | | | | | | Printf is a builtin, and the check fails with -Werror because of a clang warning about an incompatible redeclaration. llvm-svn: 255188
* libunwind: add new build logicSaleem Abdulrasool2015-04-251-0/+45
This replicates most of the build infrastructure from libc++abi ported to libunwind. This allows building libunwind without requiring libc++abi. llvm-svn: 235795
OpenPOWER on IntegriCloud