Commit Graph

67 Commits

Author SHA1 Message Date
Petr Hosek e3250b0c40 [libunwind] Fix issues introduced in r374606
There are few differences in compile flags introduced in r374606
which are causing libcxx-libcxxabi-libunwind-armv8-linux to fail.
This change should address all of those, I've compared the generated
build file from before r374606 and with this change and the set of
flags is the same modulo order.

llvm-svn: 374624
2019-10-12 01:50:57 +00:00
Petr Hosek 20da3bdb96 [libunwind] Refactor CMake flag checks to match libc++ and libc++abi
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
2019-10-11 22:22:29 +00:00
Hans Wennborg 8f5b44aead Bump the trunk version to 10.0.0svn
and clear the release notes.

llvm-svn: 366427
2019-07-18 11:51:05 +00:00
Petr Hosek 433a191683 [CMake] Use find_package(LLVM) instead of LLVMConfig
This addresses an issues introduced in r362047.

Differential Revision: https://reviews.llvm.org/D62640

llvm-svn: 362065
2019-05-30 07:34:39 +00:00
Petr Hosek 789b7f0828 [runtimes] Check if pragma comment(lib, ...) is supported first
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
2019-05-30 04:40:21 +00:00
Petr Hosek 81f433b48c [runtimes] Move libunwind, libc++abi and libc++ to lib/$target/c++ and include/c++
This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory. Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/$target/c++ and include/c++ directories, leaving resource directory
only for compiler-rt runtimes and Clang builtin headers.

Differential Revision: https://reviews.llvm.org/D59168

llvm-svn: 361432
2019-05-22 21:08:33 +00:00
Sterling Augustine 7981a28d9d Add a new LIBUNWIND_WEAK_PTHREAD Cmake option to force
calls into the pthread library use weak symbols.

This option allows libpthread to be a weak dependency rather
than a hard one.

Differential Revision: https://reviews.llvm.org/D60285

llvm-svn: 360610
2019-05-13 18:45:03 +00:00
Matthew Voss 1262e52e16 Revert "[runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/"
This broke the windows bots.

This reverts commit 28302c66d2.

llvm-svn: 355725
2019-03-08 20:33:55 +00:00
Petr Hosek 28302c66d2 [runtimes] Move libunwind, libc++abi and libc++ to lib/ and include/
This change is a consequence of the discussion in "RFC: Place libs in
Clang-dedicated directories", specifically the suggestion that
libunwind, libc++abi and libc++ shouldn't be using Clang resource
directory.  Tools like clangd make this assumption, but this is
currently not true for the LLVM_ENABLE_PER_TARGET_RUNTIME_DIR build.
This change addresses that by moving the output of these libraries to
lib/<target> and include/ directories, leaving resource directory only
for compiler-rt runtimes and Clang builtin headers.

Differential Revision: https://reviews.llvm.org/D59013

llvm-svn: 355665
2019-03-08 05:35:22 +00:00
Petr Hosek dc1b8e9f44 [CMake][libunwind] Define add_target_flags which is missing
It's use was introduced in r353084 but its definition is missing.

Differential Revision: https://reviews.llvm.org/D58745

llvm-svn: 355142
2019-02-28 21:38:59 +00:00
Petr Hosek d2f3882def [CMake] Don't cache LLVM_MAIN_SRC_DIR
If we're not in a standalone build, this variable should be already
set, so there's no need to set it again or to cache it.

Differential Revision: https://reviews.llvm.org/D57993

llvm-svn: 353915
2019-02-13 07:09:26 +00:00
Petr Hosek 6fd4e7fe02 [CMake] Support CMake variables for setting target, sysroot and toolchain
CMake has a standard way of setting target triple, sysroot and external
toolchain through CMAKE_<LANG>_COMPILER_TARGET, CMAKE_SYSROOT and
CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN. These are turned into
corresponding --target=, --sysroot= and --gcc-toolchain= variables add
included appended to CMAKE_<LANG>_FLAGS.

libunwind, libc++abi, libc++ provides their own mechanism through
<PROJECT>_TARGET_TRIPLE, <PROJECT>_SYSROOT and <PROJECT>_GCC_TOOLCHAIN
variables. These are also passed to lit via lit.site.cfg, and lit config
uses these to set the corresponding compiler flags when building tessts.

This means that there are two different ways of setting target, sysroot
and toolchain, but only one is properly supported in lit. This change
extends CMake build for libunwind, libc++abi and libc++ to also support
the CMake variables in addition to project specific ones in lit.

Differential Revision: https://reviews.llvm.org/D57670

llvm-svn: 353084
2019-02-04 20:02:26 +00:00
Petr Hosek 3cfc55cf9c [libunwind] Support building hermetic static library
This is useful when the static libunwind library is being linked into
shared libraries that may be used in with other shared libraries that
use different unwinder. We want to avoid avoid exporting libunwind
symbols in those cases. This achieved by a new CMake option which can be
enabled by libunwind vendors as needed.

The same CMake option has already been added to libc++ and libc++abi in
D55404 and D56026.

Differential Revision: https://reviews.llvm.org/D57107

llvm-svn: 352559
2019-01-29 23:01:08 +00:00
Petr Hosek 7fac51724f Drop the dependency on <algorithm>, add placement new inline
We haven't eliminated C++ library dependency altogether in D57251,
UnwindCursor.hpp had an unused dependency on <algorithm> which was
pulling in other C++ headers. Removing that dependency also revealed
(correctly) that we need our own global placement new declaration. Now
libunwind should be independent of the C++ library.

Differential Revision: https://reviews.llvm.org/D57262

llvm-svn: 352553
2019-01-29 22:26:18 +00:00
Petr Hosek 4ecdb70424 Revert "[libunwind] Drop the dependency on <algorithm>, add placement new inline"
This reverts commit r352384: this broke on ARM as UnwindCursor.hpp
still has some C++ library dependencies.

llvm-svn: 352427
2019-01-28 20:55:12 +00:00
Petr Hosek 91a606e6c4 [libunwind] Drop the dependency on <algorithm>, add placement new inline
We haven't eliminated C++ library dependency altogether in D57251,
UnwindCursor.hpp had an unused dependency on <algorithm> which was
pulling in other C++ headers. Removing that dependency also revealed
(correctly) that we need our own global placement new declaration. Now
libunwind should be independent of the C++ library.

Differential Revision: https://reviews.llvm.org/D57262

llvm-svn: 352384
2019-01-28 16:44:56 +00:00
Martin Storsjo 495c3d3c90 Enable LLVM_ENABLE_WARNINGS when building standalone out of tree
When built within the llvm runtimes directory, the runtimes
CMakeLists.txt adds the same.

Differential Revision: https://reviews.llvm.org/D56981

llvm-svn: 351875
2019-01-22 20:50:33 +00:00
Hans Wennborg 1fe469ae6c Bump the trunk version to 9.0.0svn
llvm-svn: 351320
2019-01-16 10:57:02 +00:00
Michal Gorny c790632437 [cmake] Rename append_if to avoid collision with LLVM
Rename the 'append_if' macro used in libunwind to 'unwind_append_if'.
Otherwise, when used in a combined LLVM+libunwind build, it overrides
the *incompatible* 'append_if' function from LLVM and breaks projects
following libunwind, e.g. OpenMP.

Differential Revision: https://reviews.llvm.org/D55476

llvm-svn: 348852
2018-12-11 15:30:04 +00:00
Charles Davis 4c08654b17 [CMake] Don't use -rtlib=compiler-rt with -nodefaultlibs.
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
2018-09-04 20:57:50 +00:00
Martin Storsjo 5d108d260f [CMake] Allow building standalone without any llvm-config available
This is the same as libcxxabi/libcxx do.

Differential Revision: https://reviews.llvm.org/D50135

llvm-svn: 338819
2018-08-03 05:51:31 +00:00
Hans Wennborg d541521225 Bump version number to 8.0.0svn
llvm-svn: 338570
2018-08-01 15:22:27 +00:00
Petr Hosek 641a29df6d [CMake] Include CMakeDependentOption in libunwind
This should resolve the breakage introduced in r337867 which introduced
the use of cmake_dependent_option without include the necessary file.

llvm-svn: 337868
2018-07-24 23:42:51 +00:00
Petr Hosek 4a1e14ea78 [CMake] Option to control whether shared/static library is installed
Currently it's only possible to control whether shared or static library
build of libc++, libc++abi and libunwind is enabled or disabled and
whether to install everything we've built or not. However, it'd be
useful to have more fine grained control, e.g. when static libraries are
merged together into libc++.a we don't need to install libc++abi.a and
libunwind.a. This change adds this option.

Differential Revision: https://reviews.llvm.org/D49573

llvm-svn: 337867
2018-07-24 23:27:51 +00:00
Petr Hosek 6aae861e0e [CMake] Set per-runtime library directory suffix in runtimes build
Do not use LLVM_RUNTIMES_LIBDIR_SUFFIX variable which is an internal
variable used by the runtimes build from individual runtimes, instead
set per-runtime librarhy directory suffix variable which is necessary
for the sanitized runtimes build to install libraries into correct
location.

Differential Revision: https://reviews.llvm.org/D49121

llvm-svn: 336713
2018-07-10 19:13:33 +00:00
Eric Christopher 45a05a5457 Revert "Revert "Support for multiarch runtimes layout""
This reverts commit r336005 that was accidentally committed.

llvm-svn: 336012
2018-06-29 20:27:40 +00:00
Jordan Rupprecht 2ee550c6b3 Revert "Support for multiarch runtimes layout"
This reverts commit 0c7cea3c0c6338b99e30c13201365a3dd4edc6f4.

llvm-svn: 336005
2018-06-29 19:05:20 +00:00
Petr Hosek 887f26d470 Support for multiarch runtimes layout
This change adds a support for multiarch style runtimes layout, so in
addition to the existing layout where runtimes get installed to:

lib/clang/$version/lib/$os

Clang now allows runtimes to be installed to:

lib/clang/$version/$target/lib

This also includes libc++, libc++abi and libunwind; today those are
assumed to be in Clang library directory built for host, with the
new layout it is possible to install libc++, libc++abi and libunwind
into the runtime directory built for different targets.

The use of new layout is enabled by setting the
LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both
projects and runtimes layouts. The runtimes CMake build has been further
modified to use the new layout when building runtimes for multiple
targets.

Differential Revision: https://reviews.llvm.org/D45604

llvm-svn: 335809
2018-06-28 03:11:52 +00:00
Martin Storsjo faf9589fae [CMake] Convert paths to the right form in standalone builds on Windows
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
2018-06-20 20:53:19 +00:00
Petr Hosek 2dcd1d0989 [CMake] Support for monorepo layout
Support finding libcxx sources in monorepo style layout.

Differential Revision: https://reviews.llvm.org/D45270

llvm-svn: 329212
2018-04-04 17:57:15 +00:00
John Baldwin e3e433b038 [libunwind] Permit additional compiler and linker flags to be passed to tests.
Summary:
This is done via new LIBUNWIND_TEST_COMPILER_FLAGS and
LIBUNWIND_TEST_LINKER_FLAGS variables.

Reviewed By: sdardis

Differential Revision: https://reviews.llvm.org/D43585

llvm-svn: 326223
2018-02-27 18:40:04 +00:00
Don Hinton 82c5878575 [cmake] [libunwind] Fix find_path() problems when cross compiling
When CMAKE_SYSROOT or CMAKE_FIND_ROOT_PATH is set, cmake
recommends setting CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
globally which means find_path() always prepends CMAKE_SYSROOT or
CMAKE_FIND_ROOT_PATH to all paths used in the search.

However, this find_path() invocation is looking for a path in the
libcxx project on the host system, not the target system,
which can be done by passing NO_CMAKE_FIND_ROOT_PATH.

Differential Revision: https://reviews.llvm.org/D41621

llvm-svn: 323141
2018-01-22 19:15:06 +00:00
Hans Wennborg 70dfbf2b2b Update PACKAGE_VERSION to 7.0.0svn
llvm-svn: 321743
2018-01-03 16:59:48 +00:00
Petr Hosek 27d887878d [libunwind][CMake] Set TARGET_TRIPLE if LIBUNWND_TARGET_TRIPLE is set
This follows the setup used by other runtimes and is expected by
the lit configuration.

Differential Revision: https://reviews.llvm.org/D40820

llvm-svn: 319830
2017-12-05 20:48:05 +00:00
Martin Storsjo 5a546f99ec Support building libunwind as a DLL
Differential Revision: https://reviews.llvm.org/D40483

llvm-svn: 319300
2017-11-29 08:21:12 +00:00
Petr Hosek b74f98c4e4 [libunwind][CMake] Provide option to disable instalation of the library
This is useful in cases where we only build static library and
libunwind.a is combined with libc++abi.a into a single archive in which
case we don't want to have libunwind.a installed separately. The same
option is already provided by libcxx CMake build.

This change also adds the install-unwind target for consistency with the
libcxxabi and libcxx CMake build.

Differential Revision: https://reviews.llvm.org/D40195

llvm-svn: 318569
2017-11-17 23:29:46 +00:00
Petr Hosek 7ec1a56baf [CMake] Allow overriding lib dir suffix independently from LLVM
This matches the options already supported by libc++ and libc++abi.

Differential Revision: https://reviews.llvm.org/D36383

llvm-svn: 310327
2017-08-08 00:37:59 +00:00
Petr Hosek 4158131512 [CMake] Set library dir to be LLVM's intermediate output dir
This matches the behavior of libc++abi and libc++ and ensures that
we get a working toolchain when building libunwind as part of LLVM.

Differential Revision: https://reviews.llvm.org/D34375

llvm-svn: 308380
2017-07-18 21:30:18 +00:00
Petr Hosek 8bb0f6ec88 [libunwind][CMake] Add install path variable to allow overriding the destination
This is going to be used by the runtime build in the multi-target
setup to allow using different install prefix for each target.

Differential Revision: https://reviews.llvm.org/D33760

llvm-svn: 307606
2017-07-11 01:12:09 +00:00
Jonathan Roelofs 6e50d93afc Add a test harness
Mostly cargo-culted from libcxxabi, since the unwinder was forked from there in
the first place. There may still be cruft that's only applicable to libcxxabi,
but that can be addressed in-tree.

https://reviews.llvm.org/D35038

llvm-svn: 307266
2017-07-06 15:20:12 +00:00
Petr Hosek 9ad496b2c8 [CMake][libunwind] Fix the -target and -gcc-toolchain flag handling
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
2017-04-16 06:08:44 +00:00
Petr Hosek 57d49236cc Reland "[CMake][libunwind] Use -nodefaultlibs for CMake checks"
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
2017-04-12 02:28:07 +00:00
Jonathan Roelofs af9d03aafa [libunwind] Add sphinx docs
https://reviews.llvm.org/D31375

llvm-svn: 298922
2017-03-28 15:21:43 +00:00
Petr Hosek 63524f56f1 [libunwind][CMake] Use libc++ headers when available
libunwind depends on C++ library headers. When building libunwind
as part of LLVM and libc++ is available, use its headers.

Differential Revision: https://reviews.llvm.org/D29997

llvm-svn: 295285
2017-02-16 05:18:08 +00:00
Petr Hosek ce47cf3532 Revert "[libunwind][CMake] Use libc++ headers when available"
This causing build failure on sanitizer bots because of the unused
argument '-nostdinc++' during linking of libunwind.

This reverts commit 0e14fd1a1d37b9c6d55a2d3bc7649e5b39ce74d3.

llvm-svn: 295202
2017-02-15 17:15:41 +00:00
Petr Hosek 9eff8a336b [libunwind][CMake] Use libc++ headers when available
libunwind depends on C++ library headers. When building libunwind
as part of LLVM and libc++ is available, use its headers.

Differential Revision: https://reviews.llvm.org/D29800

llvm-svn: 295153
2017-02-15 06:41:57 +00:00
Petr Hosek 50b1a33211 Revert "[libunwind][CMake] Use libc++ headers when available"
This is causing build failure when building libc++abi with libunwind.

This reverts commit 42bf29501dfa79f211841de060386d539933e811.

llvm-svn: 294556
2017-02-09 03:56:47 +00:00
Petr Hosek 34f63ccc40 [libunwind][CMake] Use libc++ headers when available
libunwind depends on C++ library headers. When building libunwind
as part of LLVM and libc++ is available, use its headers.

Differential Revision: https://reviews.llvm.org/D29573

llvm-svn: 294554
2017-02-09 02:20:25 +00:00
Eric Fiselier b703fd32d6 Don't dump llvm-config --cmakedir output if command fails.
This patch adjusts the out-of-tree CMake configuration so that
the stderr output is ignored when an old llvm-config is found
that doesn't support --cmakedir.

llvm-svn: 291992
2017-01-14 03:46:05 +00:00
Hans Wennborg f501d07dbf Bump version to 5.0.0svn
llvm-svn: 291830
2017-01-12 21:37:55 +00:00