Commit Graph

16083 Commits

Author SHA1 Message Date
Gulfem Savrun Yeniceri da594649fe [InstrProf] Add version into llvm-profdata
This patch adds support of printing profile version
into llvm-profdata which was proposed in:
https://discourse.llvm.org/t/llvm-profdata-failure-guarantees-for-code-coverage/64924

Differential Revision: https://reviews.llvm.org/D135317
2022-10-06 17:02:16 +00:00
Alex Brachet a672b7a7d7 [InstrProf] Make __llvm_profile_counter_bias_default hidden
This symbol shouldn't have default visibility.

Differential Revision: https://reviews.llvm.org/D135346
2022-10-06 06:16:22 +00:00
Vitaly Buka 68f4ceaf9b Revert "[compiler-rt][test] Heed COMPILER_RT_DEBUG when compiling unittests"
Breaks some bots, details in https://reviews.llvm.org/D91620

This reverts commit 93b1256e38.
2022-10-05 09:59:25 -07:00
Rainer Orth 93b1256e38 [compiler-rt][test] Heed COMPILER_RT_DEBUG when compiling unittests
When trying to debug some `compiler-rt` unittests, I initially had a hard
time because

- even in a `Debug` build one needs to set `COMPILER_RT_DEBUG` to get
  debugging info for some of the code and
- even so the unittests used a hardcoded `-O2` which often makes debugging
  impossible.

This patch addresses this by instead using `-O0` if `COMPILER_RT_DEBUG`.
Two tests in `sanitizer_type_traits_test.cpp` need to be disabled since
they have undefined references to `__sanitizer::integral_constant<bool,
true>::value`.

Tested on `sparcv9-sun-solaris2.11`, `amd64-pc-solaris2.11`, and
`x86_64-pc-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D91620
2022-10-05 09:53:26 +02:00
Hans Wennborg 20a269cf77 Revert "[CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI"
It casued some runtimes builds to fail with cmake error

  No target "libcxx-abi-static"

see code review.

> When in-tree libcxx is selected as the sanitizer C++ ABI, use
> libcxx-abi-* targets rather than libcxxabi and libunwind directly.
>
> Differential Revision: https://reviews.llvm.org/D134855

This reverts commit 414f9b7d2f.
2022-10-03 14:56:07 +02:00
Fangrui Song 6f46ff3765 [test] Make Linux/sem_init_glibc.cpp robust
and fix it for 32-bit ports defining sem_init@GLIBC_2.0 (i386, mips32, powerpc32) for glibc>=2.36.

Fix https://github.com/llvm/llvm-project/issues/58079

Reviewed By: mgorny

Differential Revision: https://reviews.llvm.org/D135023
2022-10-02 00:47:10 -07:00
Petr Hosek 414f9b7d2f [CMake] Use libcxx-abi-* targets for in-tree sanitizer C++ ABI
When in-tree libcxx is selected as the sanitizer C++ ABI, use
libcxx-abi-* targets rather than libcxxabi and libunwind directly.

Differential Revision: https://reviews.llvm.org/D134855
2022-09-30 20:32:10 +00:00
Vitaly Buka 8c5f66a3af [NFC][sanitizer] Simplify symbolizer build script
This checks are irrelevant with monorepo.
2022-09-30 12:25:59 -07:00
Vitaly Buka 5a86b53a91 [sanitizer] Fix build of 32bit symbolizer 2022-09-30 12:21:17 -07:00
Dmitry Vyukov 3056ccdbae tsan: fix deadlock/crash in signal handling
We set in_blocking_func around some blocking C functions so that we don't
delay signal infinitely (if in_blocking_func is set we deliver signals
synchronously).

However, pthread_join is blocking but also call munmap/free to free thread
resources. If we are inside the munmap/free interceptors called from
pthread_join and deliver a signal synchronously, it can lead to deadlocks
and crashes since we re-enter runtime and try to lock the same mutexes
or use the same per-thread data structures.

If we re-enter runtime via an interceptor when in_blocking_func is set,
temporary reset in_blocking_func around the interceptor and restore it back
when we return from the recursive interceptor.

Also move in_blocking_func from ThreadSignalContext to ThreadContext
so that we can CHECK that it's not set in SlotLocker ctor.

Fixes https://github.com/google/sanitizers/issues/1540

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D127845
2022-09-30 14:23:46 +02:00
Vitaly Buka 4d7c0f8ccf [sanitizer] Fix symbolizer build script 2022-09-29 23:32:54 -07:00
Petr Hosek 559ca30936 Revert "[CMake] Use libcxx targets for in-tree sanitizer C++ ABI"
This reverts commit 7dbdffefb7 since
it appears to have broken several ASan tests.
2022-09-30 05:52:49 +00:00
Petr Hosek bd0a35edfd [CMake] Use correct include flag for MSVC
When building using the MSVC driver, we need to use /imsvc rather than
-isystem for system headers.

Differential Revision: https://reviews.llvm.org/D134864
2022-09-30 01:29:04 +00:00
Petr Hosek 7dbdffefb7 [CMake] Use libcxx targets for in-tree sanitizer C++ ABI
When in-tree libcxx is selected as the sanitizer C++ ABI, use libcxx
targets rather than libcxxabi and libunwind, since those may not be
available on all platforms (Windows for example).

Differential Revision: https://reviews.llvm.org/D134855
2022-09-30 01:29:03 +00:00
Alex Brachet 2449f42427 [scudo][Fuchsia] Increase MaxNumCachedHint
This brings the value closer to other platforms and allows
for future improvements, see D133897.
2022-09-29 20:57:10 +00:00
Vitaly Buka 346de23ec9 Revert "[sanitizer] Use LLVM_ENABLE_LIBCXX to build symbolizer"
Trigger some "libatomic" error.

This reverts commit ccbb401472.
2022-09-28 23:55:21 -07:00
Petr Hosek 482fa79abb [NFC][CMake] Inline the append_libcxx_libs macro
This is only invoked from a single site and doesn't add any value.
2022-09-29 06:51:43 +00:00
Vitaly Buka ccbb401472 [sanitizer] Use LLVM_ENABLE_LIBCXX to build symbolizer 2022-09-28 19:27:25 -07:00
Vitaly Buka 5f2e2b7d80 [test][msan] -fno-sanitize-memory-param-retval in unittests 2022-09-28 18:53:09 -07:00
Arthur Eubanks f92481e79d [test][msan] Pin varg.cpp to -fno-sanitize-memory-param-retval
Should fix https://lab.llvm.org/buildbot#builders/19/builds/12736
2022-09-28 13:14:14 -07:00
Vitaly Buka aba150ca23 [test][msan] Fix more tests for D134669 2022-09-26 18:06:41 -07:00
Vitaly Buka 15805c030f [tests][msan] Use -fno-sanitize-memory-param-retval in tests
Supports either default of -f[no-]sanitize-memory-param-retval.

Reviewed By: aeubanks, MaskRay

Differential Revision: https://reviews.llvm.org/D134683
2022-09-26 17:24:22 -07:00
Sanjay Patel 34f8112b79 Revert "[PhaseOrdering] add test for issue #50778; NFC"
This reverts commit cdc012fa26.
This accidentally deleted a test file (not sure how that became
part of the commit).
2022-09-23 12:06:29 -04:00
Sanjay Patel cdc012fa26 [PhaseOrdering] add test for issue #50778; NFC
Several different passes are involved to get the expected IR,
and we don't want that to break again.
2022-09-23 12:03:03 -04:00
Rainer Orth 1cd4d63fb9 [sanitizer_common] Restore sanitizer_procmaps_solaris.cpp compilation on Solaris 11.3
When upstream `compiler-rt` was recently imported into GCC's
`libsanitizer`, Solaris 11.3 bootstrap broke because in 11.3
`<sys/procfs.h>` doesn't mix with largefile compilation.  I'd caused this
in D129837 <https://reviews.llvm.org/D129837> where I forgot that the code
still needs to support Solaris 11.3.

Fixed by restoring the `#undef _FILE_OFFSET_BITS`.

Tested on `sparc-sun-solaris2.11` and `amd64-pc-solaris2.11` (Solaris 11.4)
in LLVM and both Solaris 11.3 and 11.4 in GCC.

Differential Revision: https://reviews.llvm.org/D133556
2022-09-23 15:50:00 +02:00
Jan Svoboda 9dc0b16748 [clang][deps] Report module map describing compiled module
This patch fixes compilation failure with explicit modules caused by scanner not reporting the module map describing the module whose implementation is being compiled.

Below is a breakdown of the attached test case. Note the VFS that makes frameworks "A" and "B" share the same header "shared/H.h".

In non-modular build, Clang skips the last import, since the "shared/H.h" header has already been included.

During scan (or implicit build), the compiler handles "tu.m" as follows:
  * `@import B` imports module "B", as expected,
  * `#import <A/H.h>` is resolved textually (due to `-fmodule-name=A`) to "shared/H.h" (due to the VFS remapping),
  * `#import <B/H.h>` is resolved to import module "A_Private", since the header "shared/H.h" is already known to be part of that module, and the import is skipped.
In the end, the only modular dependency of the TU is "B".

In explicit modular build without `-fmodule-name=A`, TU does depend on module "A_Private" properly, not just textually. Clang therefore builds & loads its PCM, and knows to ignore the last import, since "shared/H.h" is known to be part of "A_Private".

But with current scanner behavior and `-fmodule-name=A` present, the last import fails during explicit build. Clang doesn't know about "A_Private" (it's included textually) and tries to import "B_Private" instead, which it doesn't know about either (the scanner correctly didn't report it as dependency). This is fixed by reporting the module map describing "A" and matching the semantics of implicit build.

Reviewed By: Bigcheese

Differential Revision: https://reviews.llvm.org/D134222
2022-09-22 12:06:02 -07:00
Lang Hames f40266603e [ORC-RT] Fix case on test file suffix.
Testcases expect this file to have an uppercase .S suffix.
2022-09-21 11:08:50 -07:00
Blue Gaston 9b194fe2a2 [Sanitizer] Bump macOS deployment target for sanitizer unit test binary to support C++17 requirements.
This patch fixes a test failure on Apple caused by changing standard to c++17.
sanitizer_allocator_test.cpp requires language features introducied in 10.13 for c++17.
After initial investigation, it was not clear how to add this flag to a single file:
https://reviews.llvm.org/D133878

Becuase of this, we have upped the min version of this test suite to 10.13, the min version necessary to support necessary language features.

We felt this was a better option than upping the min version of the product to support a single test.
We are raising deployment target for a single test suite, rather than the product.

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

rdar://98737270
2022-09-20 06:43:30 -04:00
Lang Hames 0e43f3b04d [ORC][ORC-RT] Make WrapperFunctionCall::Create support void functions.
Serialized calls to void-wrapper-functions should have zero bytes of argument
data, but accessing ArgData[0] may (and will, in the case of SmallVector) fail
if the argument data buffer is empty.

This commit fixes the issue by adding a check for empty argument buffers.
2022-09-18 17:53:45 -07:00
Lang Hames 47e9e58808 [ORC][ORC-RT][MachO] Reset __data and __common sections on library close.
If we want to be able to close and then re-open a library then we need to reset
the data section states when the library is closed. This commit updates
MachOPlatform and the ORC runtime to track __data and __common sections, and
reset the state in MachOPlatformRuntimeState::dlcloseDeinitialize.

This is only a first step to full support -- there are other data sections that
we're not capturing, and we'll probably want a more efficient representation
for the sections (rather than passing their string name over IPC), but this is
a reasonable first step.

This commit also contains a fix to MapperJITLinkMemoryManager that prevents it
from calling OnDeallocated twice in the case of an error.
2022-09-16 13:40:19 -07:00
Matheus Izvekov 67e2298311
[clang] use getCommonSugar in an assortment of places
For this patch, a simple search was performed for patterns where there are
two types (usually an LHS and an RHS) which are structurally the same, and there
is some result type which is resolved as either one of them (typically LHS for
consistency).

We change those cases to resolve as the common sugared type between those two,
utilizing the new infrastructure created for this purpose.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D111509
2022-09-16 16:36:00 +02:00
Matheus Izvekov 1d1a98e9a0
Revert "[clang] use getCommonSugar in an assortment of places"
This reverts commit aff1f6310e.
2022-09-16 12:03:34 +02:00
Matheus Izvekov aff1f6310e
[clang] use getCommonSugar in an assortment of places
For this patch, a simple search was performed for patterns where there are
two types (usually an LHS and an RHS) which are structurally the same, and there
is some result type which is resolved as either one of them (typically LHS for
consistency).

We change those cases to resolve as the common sugared type between those two,
utilizing the new infrastructure created for this purpose.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D111509
2022-09-16 11:55:40 +02:00
Lang Hames 9cd28d3f11 [ORC-RT] Update COFF, ELF support after ExecutorAddrDiff change in 4c43483186. 2022-09-15 22:26:36 -07:00
jacquesguan cbd7bc66c4 [ORC-RT] Remove wrong getValue of ExecutorAddrDiff. 2022-09-16 11:18:27 +08:00
Lang Hames 83a0ac12f5 [ORC-RT] Invert the layout of the trivial-jit-re-dlopen testcase.
Compiles and moves the original C code for main to Inputs/dlopen-dlclose-x2.S,
where it can be shared with other testcases that want a
dlopen-dlclose-dlopen-dlclose sequence. The assembly containging the
initializers to be tested is moved into the test file.
2022-09-15 19:11:51 -07:00
Lang Hames 4c43483186 [ORC-RT] Make ExecutorAddrDiff an alias for uint64_t.
Unlike ExecutorAddr, there's limited value to having a distinct type for
ExecutorAddrDiff, and it's occasionally awkward to work with. The corresponding
LLVM type (llvm::orc::ExecutorAddrDiff) was already made a type-alias in
9e2cfb061a.
2022-09-15 19:11:51 -07:00
Navid Emamdoost 3e52c0926c Add -fsanitizer-coverage=control-flow
Reviewed By: kcc, vitalybuka, MaskRay

Differential Revision: https://reviews.llvm.org/D133157
2022-09-15 15:56:04 -07:00
Roy Sundahl 9a82412f82 [test][fuzzer] XFAIL tvOS tests pending investigation. (rdar://99981102)
These four tests are failing on tvOS devices (not simulators) so  XFAIL
them for now for CI and investigate further.

rdar://99981102

Differential Revision: https://reviews.llvm.org/D133963
2022-09-15 13:40:28 -07:00
Leonard Grey ed2c3f46f5 [lsan][Darwin] Scan libdispatch and Foundation memory regions
libdispatch uses its own heap (_dispatch_main_heap) for some allocations, including the dispatch_continuation_t that holds a dispatch source's event handler.
Objective-C block trampolines (creating methods at runtime with a block as the implementations) use the VM_MEMORY_FOUNDATION region (see 8701d5672d/runtime/objc-block-trampolines.mm (L371)).

This change scans both regions to fix false positives. See tests for details; unfortunately I was unable to reduce the trampoline example with imp_implementationWithBlock on a new class, so I'm resorting to something close to the bug as seen in the wild.

Differential Revision: https://reviews.llvm.org/D129385
2022-09-14 16:46:40 -04:00
Akira Hatanaka 157f6fc8ec [compiler-rt][builtins] Enable more warnings in add_security_warnings
Enable -Wsizeof-array-div and -Wsizeof-pointer-divcompiler.

Also, replace -Wmemset-transposed-args with -Wsuspicious-memaccess. The
latter automatically enables the former and a few other warnings.

Differential Revision: https://reviews.llvm.org/D133783
2022-09-14 12:55:56 -07:00
Roy Sundahl 17dde371e7 [test] [fuzzer] Enable tests for iossim, disable for ios (update2)
The fuzzer tests cross_over.test and merge-control-file.test are not handled
correctly on ios device testing. On-device testing requires the macros %t, %s,
etc. to be expanded for a different default directory than when testing on host.

rdar://99889376

Differential Revision: https://reviews.llvm.org/D133811
2022-09-13 16:19:08 -07:00
Lang Hames 35ea0c6d56 [ORC-RT] Update headers for rename of include/orc in a85e4aa37d.
The ORC runtime include directory was renamed from 'orc' to 'orc_rt' in
a85e4aa37d. Update includes to match.
2022-09-12 17:09:06 -07:00
Lang Hames a85e4aa37d [ORC-RT] Drop the 'clang_rt.' prefix from the ORC runtime.
The ORC runtime isn't used by clang -- the prefix was just cargo-culted with
the rest of the XRay config when the ORC runtime was introduced. We now want to
make parts of it available for clients to link directly, so this seems like a
good time to fix the name.
2022-09-12 16:48:20 -07:00
Rainer Orth cadc9cdedf [compiler-rt] Handle non-canonical triples with new runtime lib layout
As described in Issue #54196
<https://github.com/llvm/llvm-project/issues/54196>, the ideas of `clang`
and `compiler-rt` where runtime libs are located with
`-DLLVM_ENABLE_RUNTIMES` can differ.  This is the `compiler-rt` side of the
patch I've used to get them in sync for the `amd64-pc-solaris2.11` and
`sparc64-unknown-linux-gnu` release builds.

Tested on  `amd64-pc-solaris2.11` and `sparc64-unknown-linux-gnu`.

Differential Revision: https://reviews.llvm.org/D133406
2022-09-11 11:25:53 +02:00
sunho 73c4033987 [ORC][ORC_RT][COFF] Support dynamic VC runtime.
Supports dynamic VC runtime. It implements atexits handling which is required to load msvcrt.lib successfully. (the object file containing atexit symbol somehow resolves to static vc runtim symbols) It also default to dynamic vc runtime which tends to be more robust.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D132525
2022-09-10 15:25:49 +09:00
Blue Gaston d1fe5cf522 [ASAN][DARWIN] Remove getpwnam(NULL) test for undefined behavior
Reverting a patch that was added to test for getpwnam(NULL) -- it was noted at the time the behavior might have been a bug, however the patch was added for binary compatibility. Because of the change in the expected behavior, we are reverting this commit, as the test added is no longer passing.

Update: Rather than reverting the original commit, updating this to only remove the unnecessary test.

Original Patch: https://reviews.llvm.org/D40052

rdar://98592334
2022-09-09 08:54:13 -07:00
Fangrui Song d8c09b7bbc Revert D111509 "[clang] use getCommonSugar in an assortment of places"
This reverts commit d42122cd5d.

`clang++ gcc/libstdc++-v3/src/c++98/complex_io.cc` (all language modes) crashes.
Also see https://reviews.llvm.org/D111509#3777980
2022-09-08 17:09:18 -07:00
Matheus Izvekov d42122cd5d
[clang] use getCommonSugar in an assortment of places
For this patch, a simple search was performed for patterns where there are
two types (usually an LHS and an RHS) which are structurally the same, and there
is some result type which is resolved as either one of them (typically LHS for
consistency).

We change those cases to resolve as the common sugared type between those two,
utilizing the new infrastructure created for this purpose.

Depends on D111283

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D111509
2022-09-08 19:17:53 +02:00
Florian Mayer 178554f3c8 [ASan] Show memory rather than tag addresses in tag dump
Reviewed By: eugenis

Differential Revision: https://reviews.llvm.org/D133391
2022-09-07 13:23:00 -07:00