Commit Graph

467 Commits

Author SHA1 Message Date
Vedant Kumar 7669679e82 [ubsan-minimal] Enable on Darwin
Testing: check-ubsan-minimal

Differential Revision: https://reviews.llvm.org/D37646

llvm-svn: 312959
2017-09-11 21:37:53 +00:00
Vedant Kumar b6d2fe5c88 [cmake] Work around more -Wunused-driver-argument warnings
add_compiler_rt_object_libraries should strip out the -msse3 option on
non-macOS Apple platforms.

llvm-svn: 312688
2017-09-07 01:36:47 +00:00
Vedant Kumar f5addb18f2 [cmake] Remove accidentally committed warning messages
llvm-svn: 312393
2017-09-01 23:49:22 +00:00
Vedant Kumar 6b1de0e673 [cmake] Work around -Wunused-driver-argument warnings
Fix the Darwin logic so that -msse3 is only used on macOS, and
-fomit-frame-pointer is not used on armv7/armv7k/armv7s.

llvm-svn: 312390
2017-09-01 23:23:59 +00:00
Martin Storsjo 376cce2ec8 [cmake] Fix the list of arm32 architectures
This was accidentally changed in SVN r311924, which was only
supposed to change the behaviour for x86.

llvm-svn: 312230
2017-08-31 10:01:36 +00:00
Kamil Rytarowski 8da2722a9f Add preliminary NetBSD support in libfuzzer
Summary:
This code already works and passes some number of tests.

There is need to finish remaining sanitizers to get better coverage.

Many tests fail due to overly long file names of executables (>31).
This is a current shortcoming of the NetBSD 8(beta) kernel, as
certain functions can fail (like retrieving file name of executable).

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, kcc, vitalybuka, george.karpenkov

Reviewed By: kcc

Subscribers: mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D37304

llvm-svn: 312183
2017-08-30 22:44:11 +00:00
Francis Ricci e3b018f6e5 [builtins] Prevent duplicate definitions for overridden functions
Summary:
Some architecture-specific function overrides (for example, i386/ashrdi3.S)
duplicate generic functions (in that case, ashrdi3.c). Prevent duplicate definitions
by filtering out the generic files before compiling.

Reviewers: compnerd, beanz

Subscribers: llvm-commits, mgorny

Differential Revision: https://reviews.llvm.org/D37166

llvm-svn: 312140
2017-08-30 17:12:57 +00:00
Evgeniy Stepanov c6daf73c72 Restore clang_rt library name on i686-android.
Summary:
Recent changes canonicalized clang_rt library names to refer to
"i386" on all x86 targets. Android historically uses i686.

This change adds a special case to keep i686 in all clang_rt
libraries when targeting Android.

Reviewers: hans, mgorny, beanz

Subscribers: srhines, cfe-commits, llvm-commits

Differential Revision: https://reviews.llvm.org/D37278

llvm-svn: 312048
2017-08-29 22:12:31 +00:00
Evgeniy Stepanov 3bafa546d0 Disable ubsan-minimal on Darwin.
Should un-break this bot:
http://green.lab.llvm.org/green//job/clang-stage1-configure-RA_build/38264/consoleFull

llvm-svn: 312036
2017-08-29 21:15:08 +00:00
Evgeniy Stepanov 6d2b6f0a5f Minimal runtime for UBSan.
Summary:
An implementation of ubsan runtime library suitable for use in production.

Minimal attack surface.
* No stack traces.
* Definitely no C++ demangling.
* No UBSAN_OPTIONS=log_file=/path (very suid-unfriendly). And no UBSAN_OPTIONS in general.
* as simple as possible

Minimal CPU and RAM overhead.
* Source locations unnecessary in the presence of (split) debug info.
* Values and types (as in A+B overflows T) can be reconstructed from register/stack dumps, once you know what type of error you are looking at.
* above two items save 3% binary size.

When UBSan is used with -ftrap-function=abort, sometimes it is hard to reason about failures. This library replaces abort with a slightly more informative message without much extra overhead. Since ubsan interface in not stable, this code must reside in compiler-rt.

Reviewers: pcc, kcc

Subscribers: srhines, mgorny, aprantl, krytarowski, llvm-commits

Differential Revision: https://reviews.llvm.org/D36810

llvm-svn: 312029
2017-08-29 20:03:51 +00:00
Michal Gorny 0e52de05db Reland r311842 - [cmake] Remove i686 target that is duplicate to i386
Remove the explicit i686 target that is completely duplicate to
the i386 target, with the latter being used more commonly.

1. The runtime built for i686 will be identical to the one built for
i386.

2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion
on the clang end which has to expect either of them.

3. The checks are based on wrong assumption that __i686__ is defined for
all newer x86 CPUs. In fact, it is only declared when -march=i686 is
explicitly used. It is not available when a more specific (or newer)
-march is used.

Curious enough, if CFLAGS contain -march=i686, the runtime will be built
both for i386 and i686. For any other value, only i386 variant will be
built.

Differential Revision: https://reviews.llvm.org/D26764

llvm-svn: 311924
2017-08-28 20:30:12 +00:00
George Karpenkov 16a05f2dfe Proper dependency check for clang in compiler_rt.
- Not having a dependency does not work in standalone build, as Clang does not exist.
 - if (TARGET clang) check is useless, as it is order-dependent,
   and Clang may not be registered yet.

Differential Revision: https://reviews.llvm.org/D37228

llvm-svn: 311911
2017-08-28 19:39:05 +00:00
Michal Gorny 7298595a2c Revert r311842 - [cmake] Remove i686 target that is duplicate to i386
The required change in clang is being reverted because of the Android
build bot failure.

llvm-svn: 311859
2017-08-27 20:37:06 +00:00
Michal Gorny 34ca7168ae [cmake] Remove i686 target that is duplicate to i386
Remove the explicit i686 target that is completely duplicate to
the i386 target, with the latter being used more commonly.

1. The runtime built for i686 will be identical to the one built for
i386.

2. Supporting both -i386 and -i686 suffixes causes unnecessary confusion
on the clang end which has to expect either of them.

3. The checks are based on wrong assumption that __i686__ is defined for
all newer x86 CPUs. In fact, it is only declared when -march=i686 is
explicitly used. It is not available when a more specific (or newer)
-march is used.

Curious enough, if CFLAGS contain -march=i686, the runtime will be built
both for i386 and i686. For any other value, only i386 variant will be
built.

Differential Revision: https://reviews.llvm.org/D26764

llvm-svn: 311842
2017-08-27 07:44:41 +00:00
Evgeniy Stepanov c28cedcfe8 Automatically pick up new sanitizers in cmake.
Change the default of COMPILER_RT_SANITIZERS_TO_BUILD to "all" in
order to automatically pick up new sanitizers in existing build
trees.

llvm-svn: 311824
2017-08-26 01:13:33 +00:00
Adrian Prantl 1d6ae01d4c Revert "Add Clang dependency to the check for Clang C++ headers."
This temporarily reverts commit r311733, because of bot breakage.
http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_build/38139/consoleFull#-256426522e9a0fee5-ebcc-4238-a641-c5aa112c323e

llvm-svn: 311757
2017-08-25 02:36:36 +00:00
George Karpenkov cdb8341e62 Add Clang dependency to the check for Clang C++ headers.
The problem is that CMake is mostly imperative and the result of
processing "if (TARGET blah)" checks depends on the order of import of
CMake files.
In this case, "projects" folder is registered before "tools",
and calling "CheckClangHeaders" [renamed to have a better name]
errors out without even giving Clang a chance to be built.

This, in turn, leads to libFuzzer bot failures in some circumstances on
some machines (depends on whether LIT or UNIT tests are scheduled
first).

Differential Revision: https://reviews.llvm.org/D37126

llvm-svn: 311733
2017-08-24 23:43:17 +00:00
George Karpenkov 6bb45f793f [libFuzzer] Move check for thread_local back into libFuzzer's CMake,
as it breaks builtin standalone build on some bots.

llvm-svn: 311482
2017-08-22 18:34:28 +00:00
George Karpenkov 10ab2ace13 Move libFuzzer to compiler_rt.
Resulting library binaries will be named libclang_rt.fuzzer*, and will
be placed in Clang toolchain, allowing redistribution.

Differential Revision: https://reviews.llvm.org/D36908

llvm-svn: 311407
2017-08-21 23:25:50 +00:00
George Karpenkov 93e9e8a0d3 [NFC CMake] Do not relink test targets every time in compiler-rt
CMake's add_custom_target is considered to be *always* out of date.
This patch changes it to a combination of add_custom_target and
add_custom_command which actually tracks dependencies' timestamps.

On my machine this reliably saves 6-7 seconds on each test group.
This can be a large difference when debugging small tests.

Differential Revision: https://reviews.llvm.org/D36912

llvm-svn: 311384
2017-08-21 21:19:13 +00:00
George Karpenkov 4c26922662 Quickfix to the refactoring commit: typo in the link flags variable
name.

llvm-svn: 310973
2017-08-15 23:22:52 +00:00
George Karpenkov 769124dc5e [sanitizers CMake] NFC Refactor the logic for compiling and generating tests
into a function.

Most CMake configuration under compiler-rt/lib/*/tests have
almost-the-same-but-not-quite functions of the form add_X_[unit]tests
for compiling and running the tests.
Much of the logic is duplicated with minor variations across different
sub-folders.
This can harm productivity for multiple reasons:

For newcomers, resulting CMake files are very large, hard to understand,
and hide the intention of the code.
Changes for enabling certain architectures end up being unnecessarily
large, as they get duplicated across multiple folders.
Adding new sub-projects requires more effort than it should, as a
developer has to again copy-n-paste the configuration, and it's not even
clear from which sub-project it should be copy-n-pasted.
With this change the logic of compile-and-generate-a-set-of-tests is
extracted into a function, which hopefully makes writing and reading
CMake much easier.

Differential Revision: https://reviews.llvm.org/D36116

llvm-svn: 310971
2017-08-15 22:56:10 +00:00
George Karpenkov 83ea28116e [CMake compiler-rt] NFC: Minor CMake refactoring.
Detect ObjC files in `clang_compile` and pass an appropriate flag to a
compiler, also change `clang_compile` to a function.

Differential Revision: https://reviews.llvm.org/D36727

llvm-svn: 310945
2017-08-15 18:38:14 +00:00
George Karpenkov cb6be4dd90 [compiler-rt CMake] NFC: Minor CMake refactoring.
Change macro to a function, and use a generic variable instead of
branching for handling multi-output build with
CMAKE_CONFIGURATION_TYPES.

Differential Revision: https://reviews.llvm.org/D36725

llvm-svn: 310944
2017-08-15 18:35:02 +00:00
George Karpenkov d46f17db06 [compiler-rt CMake] CMake refactoring: create directories in helper func.
Change macro to a function, move creating test directory into
`add_compiler_rt_test`.

Differential Revision: https://reviews.llvm.org/D36724

llvm-svn: 310943
2017-08-15 18:32:28 +00:00
Kamil Rytarowski d341194d68 Revert: Enable profile on NetBSD
Requested by V.Kumar.

Not all tests pass.

llvm-svn: 310912
2017-08-15 09:56:47 +00:00
Kamil Rytarowski c4edc0705c Enable profile on NetBSD
Summary:
make check-profile:

Failing Tests (2):
    Profile-i386 :: instrprof-dlopen.test
    Profile-x86_64 :: instrprof-dlopen.test

  Expected Passes    : 64
  Unsupported Tests  : 42
  Unexpected Failures: 2

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc, filcab, fjricci

Reviewed By: vitalybuka

Subscribers: vsk, llvm-commits, srhines, mgorny, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36603

llvm-svn: 310800
2017-08-13 20:18:15 +00:00
Kamil Rytarowski 7a6b680622 Enable ASAN on NetBSD
Summary:
This enables also static runtime option.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, filcab, kcc, fjricci

Reviewed By: vitalybuka

Subscribers: mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36490

llvm-svn: 310651
2017-08-10 19:08:39 +00:00
Kamil Rytarowski fbd51b954d Enable SafeStack on NetBSD
Summary:
make check-safestack:

-- Testing: 8 tests, 8 threads --
Testing: 0 .. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
Testing Time: 0.44s
  Expected Passes    : 7
  Unsupported Tests  : 1

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc, fjricci, filcab

Reviewed By: vitalybuka

Subscribers: mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36542

llvm-svn: 310646
2017-08-10 18:40:09 +00:00
Kamil Rytarowski c9bcc8dc9d Enable ubsan on NetBSD
Summary:
Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, kcc, filcab, fjricci

Reviewed By: fjricci

Subscribers: srhines, kubamracek, mgorny, llvm-commits, #sanitizers

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36483

llvm-svn: 310412
2017-08-08 20:49:20 +00:00
Kamil Rytarowski 741d21f958 Enable COMPILER_RT_HAS_SANITIZER_COMMON on NetBSD
Summary:
Temporarily keep disabled COMPILER_RT_HAS_ASAN on NetBSD.

Part of the code inspired by the original work on libsanitizer in GCC 5.4 by Christos Zoulas.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, filcab, kcc, vitalybuka

Reviewed By: vitalybuka

Subscribers: srhines, mgorny, #sanitizers, llvm-commits

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36312

llvm-svn: 310370
2017-08-08 15:25:26 +00:00
Vitaly Buka 5d960ec420 [sanitizer_common] Fuchsia OS support code
Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: cryptoad, srhines, kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36031

llvm-svn: 309756
2017-08-01 22:22:25 +00:00
Vitaly Buka 6886061dab [ubsan] Enable UBSan build for Fuchsia
Submitted on behalf of Roland McGrath.

Reviewers: vitalybuka, alekseyshl, kcc

Reviewed By: vitalybuka

Subscribers: srhines, kubamracek, mgorny, phosek, filcab, llvm-commits

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D36033

llvm-svn: 309742
2017-08-01 20:48:36 +00:00
Sterling Augustine f6b2e770ea Revert rL309634 until upstream buildbots have upgraded libc.
llvm-svn: 309704
2017-08-01 17:16:05 +00:00
Petr Hosek a14a2cc5ce [sanitizer] Fix the sanitizer build on Android
Android uses libgcc name even for shared library unlike other platforms
which use libgcc_s. Furthemore, Android libstdc++ has a dependency on
libdl. These need to be handled while performing CMake checks.

Differential Revision: https://reviews.llvm.org/D36035

llvm-svn: 309638
2017-07-31 22:46:43 +00:00
Sterling Augustine 81fd449238 Add powerpc64 to compiler-rt build infrastructure.
Summary: Add powerpc64 to compiler-rt build infrastructure.

Reviewers: timshen

Reviewed By: timshen

Subscribers: nemanjai, dberris, mgorny, aheejin, cfe-commits

Differential Revision: https://reviews.llvm.org/D36108

llvm-svn: 309634
2017-07-31 22:23:17 +00:00
George Karpenkov 831875b4bf [sanitizer tests CMake] Factor out CMake logic for compiling sanitizer tests
Currently there's a large amount of CMake logic duplication for
compiling sanitizer tests.
If we add more sanitizers, the duplication will get even worse.

This change factors out common compilation commands into a macro
available to all sanitizers.

llvm-svn: 309405
2017-07-28 17:32:37 +00:00
Petr Hosek 2bbb6ad217 Support compiler-rt builtins
This change adds support for compiler-rt builtins as an alternative
compiler runtime to libgcc.

Differential Revision: https://reviews.llvm.org/D35165

llvm-svn: 309361
2017-07-28 03:39:38 +00:00
George Karpenkov 50dd3fe903 [sanitizers] Sanitizer tests CMake clean up: try #2
This patch addresses two issues:

Most of the time, hacks with `if/else` in order to get support for
multi-configuration builds are superfluous.
The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it
expands to `.`  on all single-configuration builds, and to a configuration
name otherwise.
The `if/else` hacks for the library name generation should also not be
done, as CMake has `TARGET_FILE` generator expression precisely for this
purpose, as it expands to the exact filename of the resulting target.

Differential Revision: https://reviews.llvm.org/D35952

llvm-svn: 309341
2017-07-28 00:50:56 +00:00
George Karpenkov 1bf535daae Revert "[sanitizers] Sanitizer tests CMake clean up"
This reverts commit 0ab44db2aa1cd3710355ad79b04f954ce68c0b3a.

Fails on some bots, reverting until I can fix it.

llvm-svn: 309318
2017-07-27 20:44:33 +00:00
George Karpenkov 165a1edc85 [sanitizers] Sanitizer tests CMake clean up
This patch addresses two issues:

Most of the time, hacks with `if/else` in order to get support for
multi-configuration builds are superfluous.
The variable `CMAKE_CFG_INTDIR` was created precisely for this purpose: it
expands to `.`  on all single-configuration builds, and to a configuration
name otherwise.
The `if/else` hacks for the library name generation should also not be
done, as CMake has `TARGET_FILE` generator expression precisely for this
purpose, as it expands to the exact filename of the resulting target.

Differential Revision: https://reviews.llvm.org/D35952

llvm-svn: 309306
2017-07-27 18:40:38 +00:00
Petr Hosek 3243a13f0a Revert "[sanitizer] Support compiler-rt builtins"
This reverts commit fd63314d6770e0da62572a3fea2c41c4cc0fc58a.

llvm-svn: 309083
2017-07-26 06:46:11 +00:00
Petr Hosek b1305ce038 [sanitizer] Support compiler-rt builtins
This change adds support for compiler-rt builtins as an alternative
compiler runtime to libgcc.

Differential Revision: https://reviews.llvm.org/D35165

llvm-svn: 309060
2017-07-25 23:38:25 +00:00
Kuba Mracek 4c4ea1d1ba On Darwin, start building the TSan iOS dylib by default.
llvm-svn: 307839
2017-07-12 20:25:14 +00:00
Kuba Mracek 46f2b8485a On Darwin, start building the TSan dylib for the iOS simulator.
llvm-svn: 307816
2017-07-12 17:30:54 +00:00
Kuba Mracek 476c3e9ba0 Fix the declaration of DARWIN_PREFER_PUBLIC_SDK cmake variable (move before the return).
llvm-svn: 307815
2017-07-12 17:11:53 +00:00
Kuba Mracek 7a493393b3 [cmake] Cache results of find_darwin_sdk_dir
This improves find_darwin_sdk_dir to cache the results of executing xcodebuild to find the SDK. Should significantly reduce the CMake re-configure time.

Differential Revision: https://reviews.llvm.org/D34736

llvm-svn: 307344
2017-07-07 01:06:20 +00:00
Kuba Mracek 935243486c [cmake] Add an option to prefer public SDK in find_darwin_sdk_dir
Adds a CMake option DARWIN_PREFER_PUBLIC_SDK, off by default. When on, this prefers to use the public SDK, even when an internal one is present. With this, it's easy to emulate a build that the public buildbots are doing.

Differential Revision: https://reviews.llvm.org/D35071

llvm-svn: 307330
2017-07-06 23:09:16 +00:00
Sagar Thakur 6478d14a0d [scudo] Enabling MIPS support for Scudo
Adding MIPS 32-bit and 64-bit support for Scudo.

Reviewed by cryptoad, sdardis.
Differential: D31803

llvm-svn: 305682
2017-06-19 11:28:59 +00:00
Jonathan Roelofs 3c8f953f61 Allow builds to set COMPILER_RT_OS_DIR differently from CMAKE_SYSTEM_NAME
llvm-svn: 303817
2017-05-24 22:41:49 +00:00