Commit Graph
82 Commits
Author SHA1 Message Date
Martin Storsjö 7ff4a34668 Revert "build-libcxx: Build with -ffunction-sections -fdata-sections"
This reverts commit bd9e16f732.

It turns out this actually isn't needed; since switching to
building via the llvm-project/runtimes directory (in
7b1d05f545), the cmake build
pulls in HandleLLVMOptions.cmake, which checks for and adds
-ffunction-sections and -fdata-sections if supported. Therefore,
we don't need to specify it manually at all.
2022-03-10 13:48:08 +02:00
Martin Storsjö bd9e16f732 build-libcxx: Build with -ffunction-sections -fdata-sections
This allows shrinking binaries somewhat, if linking the runtimes
statically and using the -Wl,--gc-sections option.
2022-02-09 14:02:20 +02:00
Martin Storsjö 7b1d05f545 build-libcxx: Build libunwind+libcxxabi+libcxx with one single cmake build
This simplifies their interdependencies quite a bit.
2022-02-09 14:02:20 +02:00
Martin Storsjö 89af3e6a71 Remove the workaround with the initial, dummy empty libunwind.a
This reverts parts of commit e35ef3b7d7.

This is now handled better upstream, since
7af584ed87cc6eddb6adbc451c90fb8867469e06 in llvm-project
(November 5th 2021).
2022-02-09 14:02:20 +02:00
Martin Storsjö 73f7c4ceca build-libcxx: Stop hardcoding LIBCXX_HAS_WIN32_THREAD_API
Since a8d15a926689c126c4d316788786e0160cfc1d5d in llvm-project
(October 5th), libcxx stopped autodetecting pthreads on mingw,
making pthreads opt-in instead of opt-out.
2022-02-09 14:02:20 +02:00
Martin Storsjö 4b34c42cbc build-libcxx: Set CMAKE_CXX_COMPILER_TARGET when building
LLVM's default host detection doesn't always work (cmake doesn't
detect and provide the target architecture, but it provides the
bitness, thus LLVM's GetHostTriple.cmake guesses on the same
architecture as running the build), thus pass it manually.

This didn't use to matter, as the tests for whether --target=<target>
works used to fail, as the toolchain isn't complete at that point.

But since 7af584ed87cc6eddb6adbc451c90fb8867469e06 in llvm-project
(November 5th 2021), the libunwind cmake tests for --target do
succeed (without noticing that linking actually will fail), and thus
can end up using the incorrectly guessed compiler target.

Thus, this fixes building the runtimes with current git main
versions of llvm-project.
2021-11-05 14:38:38 +02:00
Martin Storsjö 13d48841a0 build-libcxx: Stop specifying a number of build settings that are set to their defaults 2021-10-14 12:33:22 +03:00
Martin Storsjö 0adff0df7d build-libcxx: Stop manually specifying -lunwind
Specifying -lunwind isn't needed if building a version of libcxx
after 5f9be2c3e37c0428ba56876dd84af04b8d9d8915 (Feb 2021); then
libcxx is built with -nostdlib++ which keeps automatically linking
in -lunwind if -unwindlib=libunwind is used.
2021-10-01 12:32:47 +03:00
Martin Storsjö e35ef3b7d7 Use -unwindlib=libunwind instead of merging libunwind into libc++
This makes the build of libcxx a bit cleaner, and simplifies later
building and testing of libcxx.
2021-10-01 12:31:51 +03:00
Martin Storsjö 169455ed6b build-libcxx: Stop setting LIBCXXABI_TARGET_TRIPLE
It doesn't seem to be strictly necessary right now, in the current
configuration.
2021-08-11 11:19:17 +03:00
Martin Storsjö 13e065bf1a build-libcxx: Don't manually install libunwind.dll
libunwind installs the built DLL since
39ad160468e2b6acaa0b2b1ab353079eca4a3b03 (March 2021).
2021-08-09 12:08:16 +03:00
Martin Storsjö bd9c8df3b8 build-libcxx: Don't manually install libc++.dll
libcxx installs the built DLL since
97d6fcce4ec6765c0e77db29c87e8083137c443d in llvm-project (July 2019)
when doing "ninja install".
2021-06-16 14:29:27 +03:00
Martin Storsjö 4951f6f682 build-libcxx: Stop setting -Wno-dll-attribute-no-redeclaration when building libunwind
This is set by libunwind itself since
df6d2e8ab1a4212284e4763724a2211df2c7394a in llvm-project.
2021-06-16 14:15:37 +03:00
Martin Storsjö 14098d92bc build-libcxx: Remove some unused cmake defines
These don't seem to be necessary in practice at the moment.

If building on top of a stripped llvm install, while there's an
older version of llvm (providing llvm-config) installed system
wide, we currently still manage to build things correctly.

(If llvm-config from LLVM 6.0 is available, build-compiler-rt.sh
fails though, but that's unaffected by this change. In current
git versions of compiler-rt, it first and foremost looks inside
the monorepo checkout instead of looking for a potentially
unrelated llvm-config binary.)
2021-06-16 14:04:45 +03:00
Martin Storsjö 59121bc4a0 build-libcxx: Don't manually undefine _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS
Instead set the cmake defines that indicate that libcxx is going
to be linked dynamically and going to link in libcxxabi statically,
so that libcxxabi is built statically but with dllexport attributes.
2021-06-16 12:08:54 +03:00
Martin Storsjö 1843f12515 build-libcxx: Stop setting one unnecessary visibility define
Since libcxx includes libcxxabi with
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS defined, the libcxxabi
declarations contain neither dllimport nor dllexport.

Earlier, we didn't use to include the libcxxabi headers with
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS defined, but defining
_LIBCXXABI_BUILDING_LIBRARY instead. This caused libcxxabi
declarations to be marked dllexport. If any such functions would
end up emitted as part of the libcxx object files, this would
have been necessary to get them properly exported.

In practice libcxxabi functions aren't generated while included
in libcxx (they aren't templates and/or header inline functions),
_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS gets defined by the cmake
files, so we don't need to set this at all any longer.
2021-06-16 12:05:58 +03:00
Martin Storsjö b37483cec5 build-libcxx: Stop manually defining _LIBCPP_BUILDING_LIBRARY
Since before the LLVM 12.x branch, these aren't necessary any
longer.

(9c30bafd59bf1078bbe1c235c7c25bf7e278e2e9 and
8a73aa8c4c3ee82e7d650c6a957937713a4a9ab4 in llvm-project)

Since 9c30bafd59bf1078bbe1c235c7c25bf7e278e2e9 in llvm-project,
libcxxabi unconditionally defines _LIBCPP_BUILDING_LIBRARY while
building.

Since 8a73aa8c4c3ee82e7d650c6a957937713a4a9ab4 in llvm-project,
libcxx defines _LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS if
LIBCXX_ENABLE_STATIC_ABI_LIBRARY is set.
2021-06-16 11:59:02 +03:00
Martin Storsjö e45fe5b5f6 build-libcxx: Switch to have libcxxabi provide new/delete operators
This matches how it is set by default in current master versions.

This requires building a version that includes
https://reviews.llvm.org/D89863, otherwise the new/delete operators
aren't properly weak.
2021-04-15 11:36:20 +03:00
Martin Storsjö 87648b3ada build-libcxx: Remove superfluous cmake settings 2020-11-11 12:21:11 +02:00
Martin Storsjö 92bb096468 build-libcxx: Avoid warnings when building latest libcxxabi 2020-11-11 10:57:39 +02:00
Martin Storsjö 10ac7a59dd build-libcxx: Don't explicitly disable libc++ std::filesystem
It's currently disabled by default for windows targets; rely on this.
If it's enabled automatically upstream later, take it into use.
2020-11-11 10:57:40 +02:00
Martin Storsjö f231314da7 build-libcxx: Remove some hardcoded flags for libcxxabi
These are included properly from libcxx's __config (or __config_site)
now.
2020-10-23 13:13:02 +03:00
Martin Storsjö ea3ff51d2c build-libcxx: Configure libcxx and generate headers before building libcxxabi
This fixes building with the latest versions, where the headers
strictly need __config_site to be available.
2020-10-23 12:22:13 +03:00
Martin Storsjö f91258a722 build-libcxx: Explicitly enable LIBCXX_ENABLE_NEW_DELETE_DEFINITIONS
This used to be the default before, but has changed in the
latest master version of libcxx.

Previously, both libcxx and libcxxabi enabled it by default, but
we used to explicitly disable it on the libcxxabi side (and rely
on the default for libcxx). Instead explicitly set the intended
configuration state for both parts.
2020-10-20 23:01:13 +03:00
Martin Storsjö 0fc16eb24d build-libcxx: Set LLVM_PATH when building libcxx
This is necessary since 8bc62db27244803 (Jun 26, 2020) in llvm-project.

Also setting it for libcxxabi and libunwind, in case it becomes
needed there as well.
2020-07-02 00:01:30 +03:00
Martin Storsjö 8b7d3bab1c build-libcxx: Remove a leftover variable
It became unused in 7c891a036.
2020-06-27 10:03:07 +03:00
Martin Storsjö 8e461131cf Clean the build dirs before building, if the env var CLEAN is set 2020-03-25 23:24:31 +02:00
Martin Storsjö 36fc0f6432 build-compiler-rt, build-libcxx: Use ninja for building, if available 2020-03-25 00:29:07 +02:00
Martin Storsjö c1882530c3 Add copyright and license headers to all shell script files, for clarity 2020-03-05 11:31:31 +02:00
Martin Storsjö 64d39428b6 Quote uses of $PREFIX in the build script, to improve support for installing into a path that contains spaces
For build-mingw-w64.sh to succeed when installing to such a path,
the mingw-w64 version has to be updated to the latest git master.

build-mingw-w64-libraries.sh still fails in this case, as libtool
fails to properly quote $LD in a test for whether the linker is GNU ld.
2019-12-03 21:49:53 +02:00
Martin Storsjö ee555b9013 Fix building when $PATH contains spaces 2019-11-30 10:37:19 +02:00
Martin Storsjö 4a4cc16393 build-libcxx: Stop manually linking to -lpsapi
Since the default _WIN32_WINNT now is for Windows 7, psapi.h
redirects to PSAPI version 2, which is available in kernel32.dll
with a "K32" prefix on the function names (K32EnumProcessModules).
2019-11-26 12:17:51 +02:00
Martin Storsjö 0f9d9f1986 Check out llvm sources using the new llvm git monorepo
This updates compiler-rt, libunwind, libcxxabi and libcxx to a newer
version, matching the compiler.

This will be the official, canonical repo in the future.

For the non-dev Dockerfile build, this means that all the llvm based
subprojects need to be built in one RUN to avoid storing the llvm
checkout in the docker layers.
2019-09-12 13:14:19 +03:00
Martin Storsjö a8829aeebb build-libcxx: Remove cmake flag overrides that no longer are necessary 2019-05-09 09:22:26 +03:00
Martin Storsjö 56ef08dadc Build libcxx without --export-all-symbols
With the latest clang and libcxx, this workaround no longer is
necessary.
2019-05-04 07:55:04 +03:00
Martin Storsjö b4256fea44 Update libcxx to the latest version
This version fixes dllexport handling of template instantiations for
mingw.
2019-05-04 07:55:04 +03:00
Martin Storsjö db663db2b8 Fix building libunwind/libcxxabi with an unstripped llvm after SVN r357899 2019-04-09 11:33:46 +03:00
Martin Storsjö b3ff7b278d Update libcxx to the 8.0 release version
libunwind and libcxxabi are kept at the previously pinned versions, past
the 8.0 branch.
2019-03-19 09:40:46 +02:00
Martin Storsjö 25c3bd8593 Set LLVM_COMPILER_CHECKED when bootstrapping libunwind/libcxxabi/libcxx
The checks behind LLVM_COMPILER_CHECKED fail if there's no libc++
available for linking.

This fixes building libunwind/libcxxabi/libcxx with newer versions
of llvm, if the llvm installation isn't stripped.
2019-03-15 23:53:20 +02:00
Martin Storsjö 7c891a036d Don't point libunwind to the libcxx include directory
This is no longer necessary.
2019-01-30 09:19:47 +02:00
Martin Storsjö 2ccb0d5975 Update libunwind to the latest version
This version drops the dependency on standard C++ library headers.
2019-01-30 09:19:38 +02:00
Martin Storsjö 6cab2bca42 Update libunwind to the latest version
This version fixes restoring of float registers for armv7, when using
dwarf exceptions (which we use by default).
2019-01-29 11:01:10 +02:00
Martin Storsjö 56506a5c6e Avoid warnings when building libcxxabi due to redefining _LIBCPP_BUILDING_LIBRARY
Some libcxxabi source files define _LIBCPP_BUILDING_LIBRARY themselves.

A "#define FOO" in a file defines it to "", while "-DFOO" on the command
line defines it to "1". Define it on the command line using "-DFOO=" to
make it match the #define within the source files.
2019-01-24 11:12:17 +02:00
Martin Storsjö a0d10c51cc Build libunwind with -Wno-dll-attribute-on-redeclaration
libunwind doesn't have the dllexport attributes on the original
declarations of functions, and clang normally warns about this.
2019-01-24 11:12:09 +02:00
Martin Storsjö 371f002680 Revert "Suppress compiler warnings in libunwind/libcxxabi if llvm cmake files are unavailable"
This reverts commit 92f301f775.

With the latest versions of libunwind and libcxxabi, the -w option
for suppressing compiler warnings isn't added any longer when building
with the llvm cmake files available.
2019-01-24 11:11:40 +02:00
Martin Storsjö bc4dde7cd1 Update libunwind and libcxxabi to the latest versions
These versions no longer disable warnings when llvm cmake files
are available, and have got a lot of warnings silenced within the
code.
2019-01-24 11:11:36 +02:00
Martin Storsjö da00a0662e Update libunwind to the latest version
This version makes libunwind actually make the SjLj context properly
thread local.
2019-01-18 22:39:26 +02:00
Martin Storsjö b9eb66bc1f Set LIBCXX_INCLUDE_TESTS=FALSE when building libcxx
The DLL build fails since we stopped setting LIBCXX_ABI_UNSTABLE=TRUE,
if the tests are enabled (which they are if building against a
non-stripped llvm installation).
2018-12-21 09:42:38 +02:00
Martin Storsjö 585c767ee4 Use llvm-ar with the flag 'L' instead of a helper MRI script for merging archives 2018-12-20 12:11:10 +02:00
Martin Storsjö 52fc6c5c06 Update libunwind to the latest version
This version supports SEH unwinding on aarch64.
2018-12-20 12:10:15 +02:00