Commit Graph
1053 Commits
Author SHA1 Message Date
Martin Storsjö 01597c1d72 github: Include the version file in the cross-built toolchains too 2022-11-14 00:26:44 +02:00
Martin Storsjö a5a6488198 github: Test a known-good version of ffmpeg
The latest version in git might have some tests failing occasionally
(like it does currently).
2022-11-07 23:10:21 +02:00
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ö e934cba58e test: Include the runtime DLLs even if not running tests
This makes the produced binaries ready for running separately
afterwards, which was regressed in
e16ba0772f.
2022-11-02 10:37:58 +02:00
Martin Storsjö e16ba0772f run-tests: Split out building and running of tests into a Makefile
This allows building and running the tests in parallel.
2022-10-29 23:22:56 +03:00
Martin Storsjö 710f2f055a run-tests: Rename HAS_CFGUARD to HAVE_CFGUARD
This picks a different naming style for flags like this.
2022-10-29 23:22:56 +03:00
Martin Storsjö 0d1f6acfdc prepare-cross-toolchain: Copy the share subdirectory in the cross roots
This makes the cross built two-stage toolchains match the single-stage
cross toolchains in this aspect.
2022-10-29 23:16:37 +03:00
Martin Storsjö a7130b4396 github: Set a ulimit timeout when cross-building ffmpeg 2022-10-29 23:07:43 +03:00
Martin Storsjö 5e0fd8fe82 prepare-cross-toolchain: Copy all runtime DLLs to the main bin directory
We used to copy libc++ and libunwind, since those were needed
to actually run the toolchain - but others, like the asan runtime,
may be needed for the user to be able to run the executables that
are built. If this bin directory is in the user's $PATH, they should
be picked up automatically.

For distribution, and for architectures other than the default,
the user still needs to use the binaries from the arch specific
directories.
2022-10-27 22:17:04 +03:00
Martin Storsjö 9750d128ad Revert "github: Update the environment used for doing msys2 builds"
This reverts commit 55db22d242.

The base tarball for setup-msys2 should now be new enough to
include the patched compiler in the clang64 environment, so this
no longer requires updating the environment on each build.
2022-10-27 22:17:04 +03:00
Martin Storsjö 64dffd28a5 run-tests: Merge TESTS_CPP_LOAD_DLL back into TESTS_CPP
This was split in 591a5c2ddc since
we couldn't/shouldn't test these for UWP targets.

When the testing for UWP targets was reduced in
551b046498, there was no longer any
distinction between TESTS_CPP_LOAD_DLL and TESTS_CPP, so merge
them back.
2022-10-27 00:40:06 +03:00
Martin Storsjö c541aa87b8 run-tests: Fix a missed rename/split of RUN_X86
This was missed in 3eb7f64593.
2022-10-27 00:40:06 +03:00
Martin Storsjö 3eb7f64593 run-tests: Allow overriding the command for running separately for i686 and x86_64 2022-10-25 11:09:38 +03:00
Martin Storsjö 5c375afc11 prepare-cross-toolchain: Include other compiler-rt files too (headers and auxillary files) 2022-10-21 18:00:21 +03:00
Martin Storsjö 36c3834a4b prepare-cross-toolchain: Add comments explaining what is done 2022-10-21 18:00:21 +03:00
Martin Storsjö c915fc9212 build-cross-tools: Check for required tools
This matches what's checked in build-all.sh.
2022-10-21 18:00:20 +03:00
Martin Storsjö aa5216db99 build-all: Allow building only tools, but no runtimes 2022-10-21 18:00:20 +03:00
Martin Storsjö 349877296b Allow overriding what archs to build for, or what version to target, for MACOS_REDIST builds 2022-10-21 18:00:20 +03:00
Martin Storsjö 53e803c424 github: Update use of actions/checkout and actions/upload-artifact from v2 to v3
The use of actions/download-artifact was already at v3.

This should avoid warnings about use of Node 12 which now is
deprecated.
2022-10-21 18:00:20 +03:00
Martin Storsjö 7c66ebe60d release-macos: Avoid picking up libzstd from e.g. homebrew
As macOS itself doesn't ship with libzstd, avoid picking it up from
third party intallations.

CMake even looks for things in directories outside of $PATH;
for Darwin targets, CMake includes /opt/homebrew in
CMAKE_SYSTEM_PREFIX_PATH which gets searched automatically.
2022-10-19 13:04:27 +03:00
Martin Storsjö 71b3bcb278 crt-test: Wrap parameters to tested string functions to avoid optimizing them
When some of the parameters to standard C functions are known
constants, the compiler can optimize out the call to the actual
function.

When built with fortification enabled, the compiler previously
didn't actually end up calling the __<func>_chk functions in
most cases, as it could optimize out much of the calls. Now all
tested function calls should end up emitted as intended, making
this actually do functional testing of the __<func>_chk function
implementations.
2022-10-14 14:34:02 +03:00
Martin Storsjö c81a93e86c crt-test: Fix tests with MSVC after changing the F() macro
The literal NAN in MSVC is a negative NAN, while it is a positive one
in other environments. (strtod("NAN", NULL) did return a positive NAN
though.) In most tests where we test that NANs are preserved, the exact
sign doesn't matter much as long as it matches, but for some tests, it
does matter. Change to using variables with known representation
in the tests where it matters.

Also add a LL suffix to make a tricky constant more correct.
In MSVC, the variable initialization
    long long i = -2147483648;
actually sets the variable to the positive value 2147483648 (both
in MSVC 2019 and 2022).
2022-10-14 14:33:57 +03:00
Martin Storsjö 9be66e9d22 crt-test: Fix the macros for avoiding compiler optimizations
The macros F() and L() etc were meant for providing constants for
the tests, without the compiler seeing them as constants, to
avoid optimizing out the entire functions that are to be tested.

However in practice, the compiler is also able to optimize out
e.g. a call to strtol("42", NULL, 0), so this didn't have the
intended effect.

Instead make the macros wrap through a no-op function, but which
is indirected via a global function pointer. The compiler can't
reason about global variables keeping their values (they could be
modified by e.g. a constructor in a different object file, before
running the main function). This avoids needing to pass all values
through strtod/strtol etc.

Change some constants like 123456789012345, which are seen by
the compiler as integer constants (which aren't exactly representable
in floating point form) into 123456789012345.0, which the compiler
won't complain about being inexact.
2022-10-14 14:33:51 +03:00
Martin Storsjö c076463631 readme: Prefer the -Wl,--pdb= and -Wl,--pdb=<filename> forms for PDB output
Using two dashes for this option name is more idiomatic for
long GNU options (using only one dash only is supported for options
where it doesn't conflict with single-character options; it does
work for "-pdb" but "--pdb" is more correct).

Stop documenting the separate argument form "-Wl,--pdb,<filename>".
If noone would use this form, one could consider switching the tools
over to interpret "-Wl,--pdb" as a boolean option (optional_argument
instead of required_argument in getopt_long) as a less awkward syntax
for "-Wl,--pdb=".
2022-10-12 15:28:45 +03:00
Martin Storsjö 22b1ff128b Consistently use the --pdb= form in scripts
Stop using the separate argument form (-Wl,-pdb,<filename>), and
prefer using the option form with an implicit output name.
2022-10-12 15:28:45 +03:00
Martin Storsjö 21d1cf6f18 readme: Remove the note about PDB output not working for armv7/aarch64
PDB output now does work for armv7 (earlier it used to error out),
and the PDB output does work properly on aarch64.

(The recently added tests in run-lldb-tests.sh passes successfully on
aarch64. Debugging on armv7 with LLDB has got a few known issues though,
both with DWARF and with PDB, while WinDbg and/or Visual Studio might
work better.)
2022-10-12 15:27:48 +03:00
Martin Storsjö a291ea689e build-cross-tools: Add options for disabling various parts of the build 2022-10-05 00:09:05 +03:00
Martin Storsjö 9a1a99fdbd build-llvm: Disable building the local debugserver in macOS builds
This silences a cmake warning about the lldb_codesign code signing identity
not being found.
2022-10-04 13:08:13 +03:00
Martin Storsjö 7980cb83ee build-llvm: Only set macOS specific lldb config options if needed 2022-10-04 13:08:13 +03:00
Martin Storsjö dcd92f6146 github: Print the chosen versions in the get-versions job
They are printed in the later jobs that use them already though,
but print them here too, for clarity.
2022-10-04 11:51:22 +03:00
Martin Storsjö 04edd84e9d test: Return 0 if cfguard-test is executed without arguments
This simplifies bare-bones testing of just executing all built
executables without an argument.
2022-10-04 11:51:12 +03:00
Martin Storsjö 5ad257fed0 Add comments about the missing $CFGUARD_ARGS when building sanitizers 2022-10-02 10:17:05 +03: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
Martin Storsjö d57de8ba8b install-wrappers: Install wrappers named <target>-llvm-ar and <target>-llvm-ranlib
This is necessary for CMake to detect working IPO (LTO); if the
compiler is named <target>-{gcc,clang}, CMake expects to find
matching tools named <target>-llvm-{ar,ranlib} too. (The CMake
module CheckIPOSupported and function check_ipo_supported expects
to have CMAKE_LANG_COMPILER_AR and ..._RANLIB set to working tools;
the Clang-FindBinUtils.cmake module looks for tools named
llvm-ar/llvm-ranlib with the same prefix as the compiler.)
2022-10-01 13:28:41 +03:00
Martin Storsjö 087255e28a wrappers: Handle tools named [<target>-]llvm-<tool>
Normally, we'd split the string at the last dash. However if the
tool name is "llvm-<tool>", make sure to include "llvm-" in the
tool name part when splitting the executable name.

In llvm-wrapper, don't add a duplicate "llvm-" prefix for the tool
name in these cases.
2022-10-01 13:28:41 +03:00
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