Commit Graph
44 Commits
Author SHA1 Message Date
Martin Storsjö 486dcf3227 build-compiler-rt: Avoid finding an unrelated LLVMConfig.cmake
Since 23c665371a98c7a16765d12bf2db19b0626b7181 in llvm-project
(Nov 2, 2022), compiler-rt uses CMake's find_package() for
finding potentially installed LLVM files, instead of using
llvm-config.

If the surrounding distribution does have an unrelated install
of LLVM packages, compiler-rt's CMake files would find this, and
add include directories from it into the include paths used
when building compiler-rt.

The ORC runtimes include libc++ headers, and those error out
on these unexpected include topologies (when libc++'s cstddef
includes stddef.h and expects to get libc++'s stddef.h, but ends
up getting a different stddef.h included). (Without this,
it wouldn't have been noticed that the build ends up using a
mismatched sysroot's headers.)

This fixes building in msys2 in the clang64 environment, where
the base toolchain packages end up including LLVM packages,
including LLVMConfig.cmake.

This fixes the same issue as
3b96433cdf did, for the new form of
compiler-rt cmake files.
2022-11-03 11:49:05 +02:00
Martin Storsjö 972b3b2725 Wipe the cmake cache before rerunning cmake
When rebuilding in an already built directory, cmake does use
the cache file, containing what variables were set to previously.
When changing build configuration (building with a different prefix,
or changing build configurations) this can often result in failed
cmake runs.

Wipe the cache (and the rest of the cmake temp files) by default.
This makes sure that the full cmake configuration is run each time
when running the build scripts, just like it does the first time.
(This doesn't remove the build artifacts; if nothing of significance
has changed, ninja would still reuse old built files.)

By setting the env variable NO_RECONF, this behaviour can be skipped,
rerunning cmake without wiping the cache inbetween. (For cases where
the user knows that the configuration hasn't changed since the last
build, this can speed up the cmake execution time a bit.)
2022-10-01 13:29:15 +03:00
Alvin Wong e9401c8bfe Add CFGuard options to build scripts (disabled by default) 2022-10-01 13:25:52 +03:00
Alvin Wong 0af177bf4f build-compiler-rt: Don't rebuild builtins when building sanitizers 2022-10-01 13:25:52 +03:00
Martin Storsjö 3b96433cdf build-compiler-rt: Make sure that compiler-rt doesn't pick up an external llvm-config
We normally don't install all tools (including llvm-config), or we might
have stripped them out, but the system distro might have installed a copy
of llvm-config (for a different unrelated installation of llvm).

Some compiler-rt runtimes (such as xray and orc) use this for finding
the main llvm headers.

When building compiler-rt, we really don't want it to pick up any random
version of llvm headers found on the system, but keep using the matching
headers from the monorepo instead.

Adding the include directory of a system provided set of llvm headers
is especially fatal if that directory isn't a subdirectory containing
only llvm headers, but contains other system headers too.

In particular, on msys2, the include directory (pointed at by "llvm-config
--includedir", and also set by including LLVMConfig.cmake which is
pointed at by "llvm-config --cmakedir") is the main system include
directory. Including this can also get headers for a system install
of libc++ headers (for the clang64 msys2 distro) - and using libc++
headers with a second set of libc++ headers in the include path is
fatal (due to include_next not finding the plain C header but finding
a second libc++ header).

Just try to make sure that we don't pick up any unintended headers.
2022-08-15 00:31:28 +03:00
Martin Storsjö 3d4e36806a Avoid using the nonstandard "which" command
This command isn't a standard tool; different distributions have
different implementations, and e.g. Fedora doesn't ship it by
default.

Settle on using "command -v $tool >/dev/null" for tests about whether
a tool is available. (We could also use "hash $tool 2>/dev/null" as we
already had in build-all.sh, but settling on using "command -v"
everywhere, for consistency and simplicity.)
2022-08-02 15:17:24 +03:00
Martin Storsjö eb365d8eee build-compiler-rt: Simplify referring to the clang resource directory 2022-06-12 23:06:14 +03: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ö 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ö 86630da230 build-compiler-rt: Stop creating an i386-w64-mingw32 sysroot symlink
This shouldn't be needed any longer since
8bd2722f65cfd7883ed9769f7bad3ff50e4c6905 in llvm-project (March 2021).
2021-08-09 12:08:16 +03:00
Martin Storsjö 056cb22fb5 build-compiler-rt: Stop setting CMAKE_*_COMPILER_WORKS
Since 8368e4d54c459fe173d76277f17c632478e91add in llvm-project (pushed
on March 11 2021), the lib/builtins CMakeLists.txt sets
CMAKE_TRY_COMPILE_TARGET_TYPE to STATIC_LIBRARY, which makes the
compiler tests pass before the toolchain is fully functional, by not
doing linking tests.
2021-08-09 12:08:16 +03:00
Martin Storsjö 98583d7bd9 build-compiler-rt: Do a plain "ninja install" instead of manually copying files
This still requires manually moving the dll files to the arch specific
runtime directory.

This requires building a version of llvm past
8e11bede3a6ac11ebcc05c82fac39899feaf9534 (March 18th 2021)
2021-08-09 12:08:16 +03:00
Martin Storsjö 84fc501cf8 build-compiler-rt: Tolerate cases where the output libs already have normalized arch names
This is needed since 8bd2722f65cfd7883ed9769f7bad3ff50e4c6905
(and 8e11bede3a6ac11ebcc05c82fac39899feaf9534) in llvm-project
(past the 12.x release branch), which will allow us to get rid of the
whole arch renaming part (once we can assume we're building a version
newer than that).
2021-03-22 14:06:11 +02:00
Martin Storsjö fcafcacc58 build-compiler-rt: Signal that sanitizers should use libc++ for the cxxabi parts
This fixes building with the latest master version of compiler-rt,
that uses the itanium cxxabi bits for resolving type info.
2020-11-03 11:16:38 +02: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ö 92f5caa918 build-compiler-rt: Move CMake generator selection further out in the script 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ö bcfb883687 build-compiler-rt.sh: Don't make the i386-w64-mingw32 symlink if not building i686 2019-12-03 23:31:08 +02:00
Martin Storsjö af1099048a Fix building only certain architectures when building on windows
On windows, we rename clang.exe to clang-$MAJOR.exe, and later
install clang.exe as a wrapper for the default architecture. But
if only building certain architectures, and the host architecture
isn't one of them, we shouldn't install any unprefixed clang.exe at
all.
2019-12-03 23:31:01 +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ö 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ö 0933a30500 Avoid printing an error when rerunning build-compiler-rt.sh on msys2 2019-06-28 00:14:32 +03:00
Martin Storsjö 13d73ee670 Update compiler-rt to a new version
This version fixes undefined symbols in the profiling library.
2019-03-29 23:07:57 +02:00
Martin Storsjö f39d45162e Update compiler-rt to the 8.0 release version
This doesn't fix any particular known issue, but the release branch
should generally be a safe version.
2019-03-19 09:34:19 +02:00
Martin Storsjö a8064cfdb5 Install the sanitizer headers 2019-02-22 22:34:54 +02:00
Martin Storsjö e45e9ab98e Update compiler-rt to a newer version
This fixes building sanitizers natively on windows/msys.
2018-11-30 12:03:09 +02:00
Martin Storsjö fdd0a116ae Try to set "MSYS Makefiles" as cmake generator in mingw environments 2018-11-30 12:03:09 +02:00
Martin Storsjö 53db1c3a4c Resolve $PREFIX to an absolute path at the start of shell scripts
This fixes building/installing into a relative path.
2018-11-23 13:51:05 +02:00
Martin Storsjö 99e2fefc9d Use nproc and sysctl -n hw.cpu for default initializing CORES
This avoids having to pass --build-arg CORES=n when building the
docker images.
2018-11-09 22:20:34 +02:00
Martin Storsjö c1fe94fcef Update compiler-rt to the latest version
This fixes using ubsan with mingw targets.
2018-10-17 22:45:54 +03:00
Martin Storsjö a38e52fff5 Build address sanitizer 2018-10-02 14:53:53 +03:00
Martin Storsjö e26ab372bf Update compiler-rt to the latest version
This version supports building address sanitizer for mingw.
2018-10-02 14:53:53 +03:00
Martin Storsjö 2739421564 Update compiler-rt/libuwnind/libcxxabi/libcxx to the latest version
For compiler-rt and libunwind, this makes them build successfully even
if llvm-config and the llvm cmake files aren't available.

For libcxxabi, this brings in support for using SEH exceptions.

For libcxx, this removes a few build time warnings.
2018-08-03 10:56:49 +03:00
Martin Storsjö 4631869407 Update compiler-rt to the latest version
This adds __chkstk, needed for Windows Store apps for armv7.
2018-07-17 22:22:52 +03:00
Martin Storsjö 6e4478b778 Fix overwriting symlinks to directories
This avoids extra misplaced symlinks if rerunning the build scripts.
2018-07-16 23:02:38 +03:00
Martin Storsjö 3506c70451 Remove a stray unicode nbsp 2018-06-20 00:20:23 +03:00
Martin Storsjö 9990dc49f1 Don't error out if unable to create the i386->i686 symlink in build-compiler-rt.sh
If running in MSYS2, this symlink will fail unless the i686-w64-mingw32
directory actually exists.
2018-06-19 09:31:45 +03:00
Martin Storsjö 17ce2b2a05 Update compiler-rt to the latest version
This version fixes the __clear_cache function on aarch64 windows.
2018-01-19 09:36:41 +02:00
Martin Storsjö 592495bb7b Build compiler-rt with optimization enabled 2018-01-18 10:00:05 +02:00
Martin Storsjö 098f6750d7 Automatically extract the clang version number when installing compiler-rt 2018-01-18 10:00:01 +02:00
Martin Storsjö 8c15cb4544 Allow syncing the source to the pinned version by setting SYNC=1 when running the build scripts
This should allow updating an existing build to the desired, pinned
version.
2018-01-15 10:31:50 +02:00
Martin Storsjö e56a519fdc Split the building of the toolchain into individual shellscripts
This simplifies building the toolchain outside of docker.
2018-01-10 10:24:48 +02:00