Commit Graph
818 Commits
Author SHA1 Message Date
Martin Storsjö 2f8b90b583 wrappers: Reorder some lines in clang-target-wrapper.sh for consistency 2022-10-01 13:28:02 +03:00
Martin Storsjö 56fec2622f wrappers: For UWP, pass the default -lwindowsapp after user specified options
This matches how the compiler driver normally includes default
linked libraries; the user provided -l flags are passed first,
followed by the compiler's default ones. That allows a user
specified library to override the default ones.

This makes sure that if a user provides -lwindowsappcompat, it
gets linked before -lwindowsapp, which makes a difference for
symbols that are provided in both (such as e.g. LoadLibraryW).
2022-10-01 13:28:02 +03:00
Alvin Wong e76e935c7d Enable CFGuard for scheduled builds which uses latest llvm and mingw-w64 2022-10-01 13:25:52 +03:00
Alvin Wong 039ee72a68 Add CFGuard test 2022-10-01 13:25:52 +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ö f92b90133d Revert "run-lldb-tests: Skip the detailed backtrace/variable checks for i686+pdb"
Since d4514b155337f013022c6e989d3e6b7183a8b80e in llvm-project
(Sep 20th), the pdb reading regression has been fixed.

This reverts commit 13a788dc62.
2022-09-21 16:57:40 +03:00
Martin Storsjö 13a788dc62 run-lldb-tests: Skip the detailed backtrace/variable checks for i686+pdb
This seems to have regressed in git main, while it worked
correctly still in the 15.0.0 release; see
https://github.com/llvm/llvm-project/issues/57799 for details.
2022-09-17 17:36:15 +03:00
Martin Storsjö 299f03fd45 run-lldb-tests: Allow overriding the individual tools used 2022-09-17 14:46:37 +03:00
Martin Storsjö b434132e04 run-lldb-tests: Clarify the placeholder for the script argument 2022-09-17 14:45:43 +03:00
Martin Storsjö b78082449e github: Run the lldb smoke tests as part of the test-toolchain stage
Run this for both i686 and x86_64, as we only test lldb with the
native architecture of the lldb executable (which is assumed to
be the same as the default architecture of the clang executable).
2022-09-17 00:20:52 +03:00
Martin Storsjö 6dbfbec8ff test: Add a script for running smoke tests of lldb 2022-09-16 20:25:08 +03:00
Martin Storsjö f4f25e241b run-tests: Verify that sanitizers and buffer/stack protections work as they should 2022-09-16 20:23:32 +03:00
Martin Storsjö 516c9779fb test: stacksmash: Make sure to change the value of the written byte
If the low byte of the stack cookie happens to be zero, we
previously wouldn't trigger any error.

This avoids accidentally failing to trigger the stack protector
once per 256 runs, roughly.
2022-09-16 20:23:32 +03:00
Martin Storsjö b395a2f26b run-tests: Build and run crt-test with fortification 2022-09-16 20:23:32 +03:00
Martin Storsjö 83422b6be4 test: crt-test: Add tests for a bunch of string functions
These are functions that, when built with "-D_FORTIFY_SOURCE=2 -O2",
can end up calling the corresponding __<func>_chk functions - thus,
this can be used for testing those functions.
2022-09-16 19:44:32 +03:00
Martin Storsjö 1d8c107d49 test: crt-test: Skip a test for cos(-NAN) == -NAN when optimizing
Both GCC and Clang fail this test if optimizations are enabled.
2022-09-16 19:43:40 +03:00
Martin Storsjö 4c29469eac test: Add a test for fortification of string functions
We currently only run the testcase where it doesn't trigger the
failed checks though.
2022-09-16 19:43:40 +03:00
Martin Storsjö 2013c9c165 run-tests: Swap the nesting of a loop/condition
There's no point in running the whole loop if each iteration is
going to be skipped.
2022-09-16 19:43:40 +03:00
Martin Storsjö 332193b7ec run-tests: Build the ubsan test case with -fno-sanitize-recover=all
This allows easier programmatic checking that the sanitizer actually
caught the tested issue, when triggering the issue.
2022-09-16 19:42:21 +03:00
Martin Storsjö fa02f14aea run-tests: Actually try to run the asan-instrumented test binaries
Previously we would just run the plain version of them.
2022-09-15 13:55:15 +03:00
Martin Storsjö 5456a77fe3 run-tests: Wipe out an older libunwind.dll in the same way as libc++.dll
Ideally we'd wipe the whole test/<arch> directory before running
the tests (we do that if CLEAN is set), but here we only wipe out
the specific ones that can affect how new tests are built and linked.
2022-09-15 13:54:51 +03:00
Martin Storsjö b6429b6632 run-tests: Move resetting of the TESTS_EXTRA variable earlier in the loop
A test that was added to TESTS_EXTRA in
e934c04ef4 wasn't actually ever
executed; this makes it be executed as expected.
2022-09-14 10:03:36 +03:00
Martin Storsjö 263431c101 github: Fix a comment in a printed message
This was missed in 982e43d9c3.
2022-09-12 10:38:23 +03:00
Martin Storsjö 0a980a4f1c build-llvm: Bump to the final 15.0.0 release
Notable changes are:
- Require strict matches for defines for precompiled headers in GCC
  style PCH directories. This fixes some cases of building DLLs and
  static libraries at the same time with libtool, with PCH.
- Support for the new embedded -exclude-symbols: directive in LLD
- Fix LLD crashes if including object files containing export directives
  via the --undefined/-u option
2022-09-06 11:43:45 +03:00
Martin Storsjö 506664a49f build-mingw-w64: Bump to the current version from September 6th
Notable changes:
- Fixed using the strtof() function from UCRT instead of accidentally
  using a wrapper that internally calls strtod()
- Range/accuracy improvements for complex trigonometry functions
- Fixed the callback declaration for the EnumPageFiles API
- Fixed the declaration of the addrinfoex structs
- The usual assorted API updates
2022-09-06 11:38:48 +03:00
Martin Storsjö 55db22d242 github: Update the environment used for doing msys2 builds
This should get a patched host compiler for the clang64 environment,
supporting symbol visibility, avoiding exporting too many symbols
from the dylibs.

For the mingw64 build (with GCC, which doesn't support symbol
visibility on Windows), the number of exported symbols
seems to be slightly lower, so we don't hit the limit of exported
symbols quite yet.
2022-09-02 11:38:26 +03:00
Martin Storsjö b6dd40540d github: Install the diffutils package when building on msys2
The configure script of winpthreads tries to execute the "cmp"
command (pulled in via the libtool macros), visible as errors in
the build logs. (The issue doesn't seem to make any practical
difference though.)
2022-09-02 11:34:26 +03:00
Martin Storsjö 982e43d9c3 github: Build two linux toolchains, one with and one without assertions, in scheduled builds
Use the one without assertions for cross-building toolchains, as the
one with assertions is too slow. In practice, one or more of the cross
toolchain builds end up timing out (exceeding the 6 h limit) almost
every day in the scheduled builds, requiring reruns (sometimes
multiple reruns) to complete successfully in time.

(There seems to be a big variation in what actual runner the jobs
end up using; some runners complete the cross builds in around 4 h,
while some are much slower, and seem to require 5-6 hours or more.)

In practice, during the 2 months that I've had scheduled jobs
running on Github Actions, there haven't been any failed asserts
triggered and caught in the cross builds (but once in the cross builds
of ffmpeg, which still keep using a toolchain with asserts enabled).
2022-08-24 13:24: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ö 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