Commit Graph
842 Commits
Author SHA1 Message Date
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
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