Commit Graph
788 Commits
Author SHA1 Message Date
Martin Storsjö 1b216b6fdf github: Disable building lldb-mi in the scheduled cross builds
Latest git llvm-project has switched to requiring C++17, while
lldb-mi still is built in C++14 mode. This makes the scheduled builds
fail. Therefore, disable building lldb-mi for now in the scheduled
builds, until this has been fixed in the latest git main versions
of lldb-mi.
2022-08-12 00:51:56 +03:00
Martin Storsjö 6c2d158270 build-cross-tools: Allow skipping building lldb-mi 2022-08-12 00:48:46 +03:00
Martin Storsjö 11e7485306 build-all: Allow skipping building lldb-mi 2022-08-12 00:48:46 +03:00
Martin Storsjö d2941f58ab build-cross-tools: Generalize the variable with options to build-llvm.sh
This eases future adjustments if we want to pass more options
onwards to build-llvm.sh.
2022-08-12 00:48:46 +03:00
Martin Storsjö f6bad1b607 build-cross-tools: Factorize the option handling, to ease handling more options 2022-08-12 00:48:46 +03:00
Martin Storsjö c9d406e44a strip-llvm: Remove all libLLVM*.a
46efff459a regressed this aspect,
where libLLVM-<version>.{so,dylib,dll} was meant to be kept, but
also ended up keeping libLLVM<name>.a. (This only matters if trying
to strip a build done with --full-llvm.)
2022-08-11 16:00:13 +03:00
Martin Storsjö eccf5de7e7 strip-llvm: Remove more files from full builds 2022-08-11 16:00:13 +03:00
Martin Storsjö 7060e41fc1 Stop manually setting CMAKE_CROSSCOMPILING
This is set implicitly when CMAKE_SYSTEM_NAME is set. According to
the docs, the user isn't supposed to set it manually.
2022-08-03 22:45:24 +03:00
Martin Storsjö 2ea2e1476d build-libcxx: Stop disabling libc++experimental
Since LLVM 15, libc++experimental should work fine with libc++
configured for shared linking, and libc++experimental is enabled
unconditionally, and LIBCXX_ENABLE_EXPERIMENTAL_LIBRARY is
ignored now.
2022-08-03 22:45:24 +03:00
Martin Storsjö c49f3a5953 build-llvm: Reuse the clang-tidy-confusable-chars-gen executable
This avoids needing to run the cmake configure for the nested
native build.

This tool (part of clang-tools-extra) is new in LLVM 15.0.0
(and the cmake setting for specifying the binary was backported
after the 15.x branch was made, but before rc1 was tagged).
2022-08-03 10:06:49 +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ö f2ebd644ae build-llvm: Stop setting -DCROSS_TOOLCHAIN_FLAGS_NATIVE=
Since 93010544a813dfbfa64dd7cee68785f572f974d1 in llvm-project
(Jun 22nd), this no longer is needed for being able to build
native tools with a nested cmake in a cross build. (If building in
the same tree as a previous native build, build-llvm tries to pick
up the tblgen tools from there, so in such cases, this doesn't
make any difference and the nested native cmake invocation never
was executed.)
2022-07-31 01:08:30 +03:00
Martin Storsjö c6c5b137ed build-llvm: Use a precompiled clang-pseudo-gen tool when cross compiling
This avoids needing to run the cmake configure for the nested
native build.

This tool (part of clang-tools-extra) is new in LLVM 15.0.0.
2022-07-31 01:08:30 +03:00
Martin Storsjö 5ecaf6ce2c wrappers: Update the comment about what unwind method is used on armv7
Since fcb784db496137fa29a11b7e106efe89c7550e11 in llvm-project
(Jun 6th), the armv7 target uses SEH.
2022-07-31 01:08:30 +03:00
Martin Storsjö 6b9e0b1dbd build-libcxx: Build both static and shared libc++ in one single cmake build
Since bedf657d0f4c54ffe9ef4303382657a74296b544 in llvm-project
(May 18th), a static libc++ built at the same time as a shared one
no longer contain dllexport directives, making that library actually
usable.

Since dfa88927ae1411ccc3b248b7e624f2acf623d947 (Jun 6th), the
libc++ headers no longer have dllimport attributes, making the headers
installed from a build containing a shared library usable both
for the shared and static library, without the user having to set
any specific defines.

These two changes allow removing the manual build workarounds of
building the libraries in separate CMake invocations in a specific
order.
2022-07-31 01:08:30 +03:00
Martin Storsjö 5cc13adcc3 build-llvm: Update to llvm 15.0.0 RC1
Notable changes are:
- Fix stripping Rust executables with .rmeta sections
- Implemented support for SEH unwind info on the armv7 target
- Fix compiling files specified with an absolute \\?\C:\... style path
- Implemented support for the --disable-reloc-section option in lld
- Lots of improvements in LLDB on Windows (thanks to Alvin Wong!)
 - Support for GNU debuglink
 - Fix loading DLLs from a ramdisk
 - Fix starting executables without including the '.exe' suffix
 - Fixed crashes on getting nested exceptions
 - Use the right C++ ABI for mingw environments

Other changes that simplify how to build the toolchain:
- Improvements to how libcxx/libcxxabi/libunwind are built for Windows
  (and in particular mingw), allowing building both shared and static
  libraries in the same cmake build
- Avoids needing to set an empty CROSS_TOOLCHAIN_FLAGS_NATIVE when
  cross compiling LLVM
2022-07-31 01:08:30 +03:00
Martin Storsjö 9daf8a9b84 build-python: Update to the latest version of cpython-mingw 3.10.5 2022-07-31 01:08:30 +03:00
Martin Storsjö fffe23a549 build-mingw-w64: Update to a newer version
Notable changes are:
- Fix building for armv7 with SEH enabled
- Implement _set_com_error_handler and _com_raise_error in comdef.h
- Add import libraries for older msvcrXX.dll versions
- Redirect access() to __mingw_access() on UCRT
- Assorted updates to Windows APIs
2022-07-31 01:08:27 +03:00
Martin Storsjö 62914fcd2d build-llvm: Set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY when cross compiling
This avoids picking up a host cmake config file for zstd, in the github
actions CI, in the current git main version of llvm.
2022-07-21 21:53:07 +03:00
Martin Storsjö badbd89806 github: Disable zstd in the macos github actions build
Zstd is available and gets autodetected, but it's only available in
native form, not in arm64 form.

Also, for the existing workaround, instead of entirely disabling lldb,
one could pass -DLLDB_ENABLE_PYTHON=OFF instead.
2022-07-21 21:52:22 +03:00
Martin Storsjö bc1691262b build-llvm: Allow prepopulating CMAKEFLAGS
This allows passing options without proper command line flags.
2022-07-21 21:48:56 +03:00
Martin Storsjö 98f3380bec build-python: Bump to cpython-mingw 3.10.5
This is the version that msys2 currently ships.
2022-06-19 23:10:14 +03:00
Martin Storsjö 577e25b821 build-llvm: Avoid hardcoding the python version number in this script
This eases updating the build to a newer version of python.
2022-06-19 23:10:14 +03:00
Scr3amer 9c002a9e1b Fix typo in help of build-all.sh 2022-06-19 21:37:37 +03:00
Martin Storsjö ca2bc90bf3 github: Fix a typo in the workflows file 2022-06-18 23:05:04 +03:00
Martin Storsjö 24b8efd236 Add GitHub Actions builds
Test building the toolchain on all supported platforms for building
it (linux, macOS, msys2). Produce cross-built standalone toolchains
that run on Windows for all 4 supported architectures.

Run scheduled builds (daily), built with the latest git versions of
most components. For scheduled builds, the linux toolchain is built
with assertions enabled, as latest git version of llvm occasionally
can have regressions, and many such are caught by having assertions
enabled and building enough code that exercise many code generation
cases.
2022-06-16 10:36:10 +03:00
Martin Storsjö 050b4ef701 build-all: Allow passing many common build-llvm/build-mingw-w64 options via this script 2022-06-15 17:25:32 +03:00
Martin Storsjö e56fb975e9 build-all: Move a call to strip-llvm.sh into build-all.sh
This is the usual build configuration that most people would use.
2022-06-12 23:06:53 +03:00
Martin Storsjö eac1db1c0d prepare-cross-toolchain: Simplify code using "clang --print-resource-dir" 2022-06-12 23:06: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ö 4b8ef36d94 install-wrappers: Don't install cross-prefixed cc/c99/c11 tools
A regular GCC install doesn't provide tools like <triple>-{cc,c99,c11},
so there's probably not much need to include them.

Some distributions of tools may provide tools with the names "cc",
"c99" and "c11" though, as custom frontends or symlinks to the
regular compiler. Therefore, keep the unprefixed tools with these
names.
2022-06-08 23:12:40 +03:00
Martin Storsjö 52d7bee3a8 wrappers: Set the right -std= arguments when invoked as c99/c11 2022-06-08 23:11:40 +03:00
Martin Storsjö 966f88e3da build-llvm: Improve code for checking for preexisting native tools when cross compiling
Check for the prescence of the llvm-tblgen binary in addition to just
checking whether the llvm/build or llvm/build-asserts directories
exist.

In cases where having multiple build directories around, where some
are older than others, it's now possible to clarify which one to use
for tools by just removing the llvm-tblgen binary from the other ones.

Also check for the prescenece of each individual tool before setting
it; this fixes builds where the native build might not have all
components enable as as enabled in the cross build.
2022-06-07 00:53:03 +03:00
Martin Storsjö 83d84ab79b build-mingw-w64: Fix installing COPYING files on macOS
The install(1) tool on macOS doesn't support the -D option for
creating directories at the same time while installing files.
Therefore, run a separate step for creating directories. Doing that
with "mkdir -p", even if install(1) also could do that with the -d
option (likewise with a separate command).

Also stop specifying the destination file name, when it's equal to
the source files, now that we know that the destination directory
already exists.
2022-04-08 13:13:56 +03:00
Martin Storsjö 192a734b71 build-llvm: Stop looking for a build directory called build-noasserts
We stopped creating such a directory in 2018 in
81864b3883.
2022-04-08 09:44:56 +03:00
Martin Storsjö 00abcdbe6a run-tests: Remove is-ucrt.c after testing 2022-04-08 09:44:56 +03:00
Matthew "strager" Glazar 306f5d7209 build-mingw-w64: Install COPYING files
Install copyright notices into the final package. This makes LLVM MinGW
comply with many of the licenses (which require attribution), and also
makes it easier for users of LLVM MinGW to audit licenses of software
they use.
2022-04-08 09:44:38 +03:00
Martin Storsjö 0a23956f1a strip-llvm: Keep the lldb-vscode tool 2022-03-24 13:22:31 +02:00
Martin Storsjö 8009a236b8 build-llvm: Bump to the final 14.0.0 release
Compared with RC2, the only notable change for mingw targets is
that sections named .debug_* are sorted to the very end of the
image, after any other discardable sections, avoiding leaving gaps
if stripping such executables. (This can affect rust binaries with
a .rmeta section.)
2022-03-23 13:07:39 +02:00
Martin Storsjö 3debb07f0f build-python: Bump to the latest version on the mingw-v3.9.10 branch 2022-03-23 13:07:39 +02:00
Martin Storsjö 222e4bff34 build-mingw-w64: Bump to the current version from March 23rd
This fixes the v*scanf functions when using msvcrt.dll, if using more
than 30 format conversions, fixes error handling in the btowc
function in libmingwex, and adds a missing (void) in a function
prototype in winpthreads, adds the fwpuclnt import library for aarch64,
plus other assorted header/interface updates.
2022-03-23 13:07:39 +02:00
Martin Storsjö 5ae5b1aa37 build-llvm: Build clang-tools-extra
This installs a bunch of new tools in the bin dir, namely the following:
clang-apply-replacements
clang-change-namespace
clang-doc
clang-include-fixer
clang-move
clang-query
clang-reorder-fields
clang-tidy
clangd
find-all-symbols
modularize
pp-trace
run-clang-tidy

These are stripped out by strip-llvm, but clangd and clang-tidy
are kept.
2022-03-23 13:07:39 +02:00
Martin Storsjö 0dbd9baba3 build-llvm: Allow disabling building lldb
While lldb can be used as a cross debugger, it's probably mostly
used when run on the same target as the code is executed on.
Since it's a mostly optional component in the toolchain, allow
passing --disable-lldb to build-llvm.sh to skip it.
2022-03-23 13:07:39 +02:00
Martin Storsjö b3f63b4ac8 build-llvm: Default to using LLVM_ENABLE_PROJECTS even on unix
Allow setting up the projects with symlinks by passing --symlink-projects
to the build script.

The setup with symlinks is mostly useful in development setups, where
one wants to share ccache across multiple checkouts.
2022-03-23 13:07:39 +02:00
Martin Storsjö 0cffa112e0 build-llvm: Avoid unnecessary repeated git fetches if SYNC=1 is set
If the SYNC variable is set when running build-all.sh, all the
individual scripts will try to check out the intended version
before building. All scripts that build projects from llvm-project
(build-libcxx.sh, build-compiler-rt.sh, build-openmp.sh) call
build-llvm.sh with CHECKOUT_ONLY=1 to make sure the right version
is checked out (as one can call the scripts individually too).

If the llvm-project directory was a full (non-shallow) checkout,
the repeated fetch was quick as git knew that it had the fetched
reference already. But in a shallow clone, a new shallow fetch
would refetch the whole object tree for the targeted reference.

Using "git cat-file -e" we can check whether a specific object
exists in the local checkout, avoiding needlessly refetching
everything.

However, when fetching a tag using shallow fetch (git fetch
--depth 1 origin "$LLVM_VERSION"), it would only fetch the
commit object for that tag, not the tag itself. By specifying
'tag "$LLVM_VERSION"' in this case, we get the tag object itself,
so that we later can check whether "$LLVM_VERSION" exists in the
local checkout. But this requires guessing whether a specific
"$LLVM_VERSION" is a tag or a commit.
2022-03-23 13:07:39 +02:00
Martin Storsjö 58cfd46b25 build-llvm: Remove a special case, allow using lld for stage2 builds on macOS
In the currently targeted version of LLVM, lld is usable enough
for targeting macOS.
2022-03-23 13:07:38 +02:00
Martin Storsjö 67b61cfb22 release-macos: Remove a leftover listing of a nonexistent argument 2022-03-23 11:30:18 +02:00
Martin Storsjö 3fa0e8906b license: Fix a typo 2022-03-14 22:54:12 +02:00
Martin Storsjö e9e53d581d test: Remove a workaround for an old clang version 2022-03-14 11:36:32 +02:00
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