19515 Commits

Author SHA1 Message Date
Jacek Caban
3764ba2348
[compiler-rt] Add initial ARM64EC builtins support (#139279)
Use the aarch64 variants of assembly functions.

Co-authored-by: Billy Laws <blaws05@gmail.com>
2025-05-15 11:42:55 +02:00
David Tenty
224ec839a4
[AIX] Opt in to per-target runtime dir (#139620)
Many targets have already migrated to the per-target runtime directory
layout, which is generally preferred. For AIX however, we are currently
using per-target runtime directories by default for some runtimes (i.e.
`flang-rt`) but not others. This change makes things consistent for
other runtimes (most primarily `compiler-rt`) as well, adopting the
layout uniformly for the AIX target.

This change also normalizes the triple used for building compiler-rt to
remove any OS version number, as there is currently no need to version
the runtimes this way and the driver code doesn't expect this anyhow.
2025-05-13 12:00:59 -04:00
Mariusz Kwiczala
f4b80b9109
LLVM symbolizer gsym support - attempt 2 (#139686)
Add support for gsym files to llvm-symbolizer.

co-author @sfc-gh-sgiesecke

Notes:
There was a PR that was 
approved and merged: https://github.com/llvm/llvm-project/pull/134847 
and reverted: https://github.com/llvm/llvm-project/pull/139660
Due to buildbot failures:
https://lab.llvm.org/buildbot/#/builders/66/builds/13851 - it looks like
related
https://lab.llvm.org/buildbot/#/builders/51/builds/16018 - it looks like
related
https://lab.llvm.org/buildbot/#/builders/146/builds/2905 - it looks like
it's not related to changes

Fix:
To fix missing GSYM symbols 
```
+ diff -u expected.new undefined.new
+_ZN4llvm4gsym10GsymReader8openFileENS_9StringRefE U
+_ZN4llvm4gsym10GsymReaderC1EOS1_ U
+_ZN4llvm4gsym10GsymReaderD1Ev U
+_ZN4llvm4gsym13GsymDIContextC1ENSt20__InternalSymbolizer10unique_ptrINS0_10GsymReaderENS2_14default_deleteIS4_EEEE U
+ echo 'Failed: unexpected symbols'
```
for script
compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh
LLVMDebugInfoGSYM was added. 
Please check the commit:

ba55425db9
That's the only change compare to
https://github.com/llvm/llvm-project/pull/134847
2025-05-13 08:27:05 -07:00
Jake Egan
5b2fc2bfb9
[sanitizer_common][AIX] Use scoped pragma to suppress atomic alignment warnings (#139272)
Have the warning suppression apply only to the code that is currently
affected. The suppression is guarded via preprocessor conditions to
cases where it is tested and known to be needed.

Issue: https://github.com/llvm/llvm-project/issues/138916

Co-authored-by: Hubert Tong <hubert.reinterpretcast@gmail.com>
2025-05-12 16:32:29 -04:00
Jacek Caban
6ade80ce18
[compiler-rt] Use mangled function names on ARM64EC (#137960)
On ARM64EC, function names and calls (but not address-taking or data
symbol references) use symbols prefixed with "#". Since it's an unique
behavior, introduce a new `FUNC_SYMBOL` macro instead of reusing
something like `SYMBOL_NAME`, which is also used for data symbols.

Based on patch by Billy Laws.
2025-05-09 14:29:58 +02:00
Vitaly Buka
856632bfc1
[NFC][ubsan_minimal] Clang-format a file (#139000) 2025-05-08 14:43:16 -07:00
Vitaly Buka
d1da41bf4d
[ubsan_minimal] Add __ubsan_report_error_fatal (#138999)
Override may need to know if sanitizer in recover mode.
2025-05-08 09:58:48 -07:00
Simi Pallipurath
d178340672
[ARM][Compiler-RT] Add optional exclusion of libc provided ARM AEABI builtins from compiler-rt. (#137952)
This patch introduces a new optional CMake flag:
  COMPILER_RT_EXCLUDE_LIBC_PROVIDED_ARM_AEABI_BUILTINS

When enabled, this flag excludes the following ARM AEABI memory function
implementations from the compiler-rt build:
        __aeabi_memcmp
	__aeabi_memset
	__aeabi_memcpy
	__aeabi_memmove

These functions are already provided by standard C libraries like glibc,
newlib, and picolibc, so excluding them avoids duplicate symbol
definitions and reduces unnecessary code duplication.

Note: 
- libgcc does not define the __aeabi_* functions that overlap with those
provided by the C library. Enabling this option makes compiler-rt behave
consistently with libgcc.
- This prevents duplicate symbol errors when linking, particularly in
bare-metal configurations where compiler-rt is linked first.
- This flag is OFF by default, meaning all AEABI memory builtins will
still be built unless explicitly excluded.

This change is useful for environments where libc provides runtime
routines, supporting more minimal, conflict free builds.
2025-05-08 12:41:07 +01:00
PiJoules
1d073fd1ca
[lsan][Fuchsia] Define EarlySanitizerInit for standalone lsan (#138946)
I forgot to add this definition in https://github.com/llvm/llvm-project/pull/131886.
2025-05-07 15:42:51 -07:00
PiJoules
573721bf0c
[sanitizer][Fuchsia] Add callback at end of __sanitizer_startup_hook (#131886)
Sanitizers using this hook on Fuchsia can define this function to do any
extra stuff at the end of the startup hook. For now this is only used by
HWASan which needs to explicitly be initialized before libc extensions
are intitialized.
2025-05-06 10:03:38 -07:00
Jake Egan
24cd3a0bc0
[sanitizer_common] Split FREXPF/FREXPL interceptor defines (#138624)
Will allow other platforms, such as AIX, to opt out of these
interceptors individually.
2025-05-06 09:23:46 -04:00
Jake Egan
efaa5295d4
[sanitizer_common] Use internal_memcpy with wcrtomb/wctomb interceptors (#138623) 2025-05-06 09:23:14 -04:00
thetruestblue
c685355811
Unsupported zero_page_pc on iOS. (#137893) 2025-04-29 16:36:46 -07:00
thetruestblue
0864e3c8a9
[Test][Darwin] Mark zero_page_pc test as unsupported for iOS (#137858)
This is handled as a SIGKILL and can't be intercepted by ASan's signal
handler.

rdar://127512190
2025-04-29 12:08:34 -07:00
Koakuma
5d0e26e571
[compiler-rt] Make sure __clzdi2 doesn't call itself recursively on sparc64 (#136737)
On 64-bit platforms, libgcc doesn't ship with __clzsi2, so __builtin_clz
gets lowered to __clzdi2. A check already exists for GCC, but as of
commit 8210ca019839fc5430b3a95d7caf5c829df3232a clang also lowers
__builtin_clz to __clzdi2 on sparc64.

Update the check so that building __clzdi2 with clang/sparc64 also
works.
2025-04-29 07:36:32 +07:00
Vitaly Buka
b111da97e8
[NFC][asan] Try to deflake asan_lsan_deadlock test (#137718)
10s looks not enough. With highly parallel test
execution on VMs it's very possible that Asan
report will have no enough time to produce output.

I can reproduce locally 1s is not always enough,
but likely my workstation is faster then buildbot.

Additionally, don't use puts/CHECK to validate
timeout. We can exit with 0 and it should violate
"not" expectation.

Follow up to #131756.
2025-04-28 15:17:51 -07:00
Tom Stellard
59978b21ad
[sanitizer_common] Remove interceptors for deprecated struct termio (#137403)
This struct will be removed from glibc-2.42 and has been deprecated for
a very long time.

Fixes #137321
2025-04-28 13:45:11 -07:00
Vitaly Buka
367b91a6f8
[NFC][CFI] Fix setup of UBSAN_TEST_HAS_CFI (#137424)
For #137245
2025-04-25 17:23:09 -07:00
Vitaly Buka
0f73e89db7
[NFC][CFI] Fix test from #137245 (#137420)
Check if arch supports CFI.

For #137245
2025-04-25 16:47:00 -07:00
kevkevin
8cd628f472
doc: get rid of redundant TODO tag in FuzzedDataProvider.h (#137395)
'list.size()' is determined at runtime, so using static_assert on it as
suggested by the TODO comment is not feasible and produces the following
error when done:

error: static assertion expression is not an integral constant
expression

initially referenced in https://github.com/bitcoin/bitcoin/pull/32024

Co-authored-by: Chand-ra <chandrapratap376@gmail.com>
2025-04-25 14:51:10 -07:00
Vitaly Buka
012cf4ff60
[NFC][CFI] Fix test from #137245 (#137390)
For #137245
2025-04-25 13:05:07 -07:00
Vitaly Buka
0383e545d1
[NFC][CFI] Add minimal runtime test for CFI (#137245)
It's in UBSAN dir, as diagnostic runtime for CFI,
full or minimal is UBSAN.
2025-04-25 12:25:55 -07:00
Sam Elliott
683c3b8b7e
[RISCV] Allocate Feature Bits for Zilsd/Zclsd/Zcmp (#135197)
As proposed in https://github.com/riscv-non-isa/riscv-c-api-doc/pull/104

No real compiler-rt implementation, as these are not exposed by Linux.
2025-04-25 11:06:04 -07:00
gbMattN
067067580f
[TySan] Fix false positives with derived classes (#126260)
Fixes issue #125079 as well as another case I discovered while trying to
build LLVM with TySan.
2025-04-25 10:55:20 +01:00
Martin Storsjö
3e56f5f418
[compiler-rt] [test] Adjust profile tests to allow arm_aapcs_vfpcc (#137176)
This fixes these tests for Windows on armv7.
2025-04-25 12:18:17 +03:00
Martin Storsjö
2de001da38
[compiler-rt] Detect arm hardfloat targets via __ARM_PCS_VFP (#137175)
This makes sure that COMPILER_RT_ARMHF_TARGET is set properly for
targets without a specific "armhf" target name, such as armv7 windows.

This fixes the builtins test comparesf2_test.c on Windows on armv7.
2025-04-25 12:17:50 +03:00
Martin Storsjö
b3387968be
[compiler-rt] [test] Look for the right file name suffix for arm targets (#137174)
Compiler-rt libraries on arm use "arm" or "armhf" as suffix, not the
full exact arch name like "armv7".

This matches what was done for the build system in
8e11bede3a6ac11ebcc05c82fac39899feaf9534, to match the names that Clang
expects (in getArchNameForCompilerRTLib in Clang).

This fixes building a large number of the compiler-rt tests for
Windows/armv7.
2025-04-25 12:17:23 +03:00
Martin Storsjö
6559330702
[compiler-rt] Only include asan on x86 architectures on Windows (#137173)
This avoids building asan when targeting Windows on armv7 or aarch64. It
is possible to build asan successfully for those configurations (since
5ea9dd8c7076270695a1d90b9c73718e7d95e0bf and
0c391133c9201ef29273554a1505ef855ce17668), but asan isn't functional
there.

This change skips building asan for targets other than x86_32 and
x86_64.

By excluding asan from the build, we fix the "check-ubsan" target for
armv7 and aarch64 Windows. If asan is included in the build, an
ubsan-asan configuration gets added to the tests, and as asan isn't
functional for these targets, it produces a lot of test failures even
when just trying to run "check-ubsan".
2025-04-25 12:16:59 +03:00
Martin Storsjö
34660eb60e
[compiler-rt] Don't exclude ubsan-asan tests on Windows/x86_64 (#137171)
This removes a leftover workaround from
00f3f6e296d49eb261e1ad47868a50122bfc111e from 2016. Currently the tests
seem to work fine on x86_64 in both MSVC and mingw configurations with
this workaround removed.

(On aarch64, asan isn't functional at all; this workaround used to hide
that issue when running "check-ubsan", but the issue is apparent if
running all tests with "check-compiler-rt" anyway.)
2025-04-25 12:16:09 +03:00
Vitaly Buka
9f74d517f1
[NFC][UBSAN] Fix minimal UBSAN test names (#137244)
Same approach as in Asan.

Now it's going to print:
```
Failed Tests (2):
  UBSan-Minimal-i386-linux :: TestCases/icall.c
  UBSan-Minimal-x86_64-linux :: TestCases/icall.c
```

Before it was:
```
Failed Tests (2):
  UBSan-Minimal-x86_64 :: TestCases/icall.c
  UBSan-Minimal-x86_64 :: TestCases/icall.c
```
2025-04-24 13:13:19 -07:00
Camsyn
fe90b9dac7
[ASan] Limits the conditions of the deadlock patch (#137127)
PR #131756 introduced a patch to fix a deadlock between LSan and ASan.

The relevant deadlock only occurs when LSan is enabled and
`dl_iterate_phdr` is used for Stop-the-World, i.e., under the condition
`CAN_SANITIZE_LEAKS && (SANITIZER_LINUX || SANITIZER_NETBSD)`.

Therefore, this commit also sets the effective condition of this patch
to the above condition, avoiding unnecessary problems in other
environments, e.g., stack overflow on MSVC/Windows.
2025-04-24 09:51:38 -07:00
Camsyn
59b26abbbe
[TSan, SanitizerBinaryMetadata] Analyze the capture status for alloca rather than arbitrary Addr (#132756)
This PR is based on my last PR #132752 (the first commit of this PR),
but addressing a different issue.

This commit addresses the limitation in `PointerMayBeCaptured` analysis
when dealing with derived pointers (e.g. arr+1) as described in issue
#132739.

The current implementation of `PointerMayBeCaptured` may miss captures
of the underlying `alloca` when analyzing derived pointers, leading to
some FNs in TSan, as follows:
```cpp
void *Thread(void *a) {
  ((int*)a)[1] = 43;
  return 0;
}

int main() {
  int Arr[2] = {41, 42};
  pthread_t t;
  pthread_create(&t, 0, Thread, &Arr[0]);
  // Missed instrumentation here due to the FN of PointerMayBeCaptured
  Arr[1] = 43;
  barrier_wait(&barrier);
  pthread_join(t, 0);
}
```
Refer to this [godbolt page](https://godbolt.org/z/n67GrxdcE) to get the
compilation result of TSan.

Even when `PointerMayBeCaptured` working correctly, it should backtrack
to the original `alloca` firstly during analysis, causing redundancy to
the outer's `findAllocaForValue`.
```cpp
    const AllocaInst *AI = findAllocaForValue(Addr);
    // Instead of Addr, we should check whether its base pointer is captured.
    if (AI && !PointerMayBeCaptured(Addr, true)) ...
```

Key changes:
Directly analyze the capture status of the underlying `alloca` instead
of derived pointers to ensure accurate capture detection
```cpp
    const AllocaInst *AI = findAllocaForValue(Addr);
    // Instead of Addr, we should check whether its base pointer is captured.
    if (AI && !PointerMayBeCaptured(AI, true)) ...
```
2025-04-24 10:48:07 +02:00
Hubert Tong
53e62c654a
[compiler-rt][profile][tests][NFC] Avoid using a.out from PATH (#136465)
Fix use of `a.out` from the PATH by specifying `./a.out`.
2025-04-21 19:34:33 -04:00
Tristan Ross
f87109f018
[compiler-rt] allow building with uefi (#131499)
I'm trying to put together an LLVM built toolchain (including LLVM libc)
targeting UEFI, currently I get an error saying "Unknown target". This
PR enables compiling compiler-rt for UEFI.
2025-04-20 14:23:53 -07:00
Brad Smith
15ea45b100
[sanitizer_common] Updated build fix for newer NetBSD (#134742)
Co-authored-by: Thomas Klausner <wiz@gatalith.at>
2025-04-18 18:29:06 -04:00
thetruestblue
7cc4472037
[RTSan][Darwin] Adjust OSSpinLock/_os_nospin_lock interceptor and tests (#132867)
These changes align with these lock types and allows builds and tests to
pass with various SDKS.

rdar://147067322
2025-04-18 19:25:31 +01:00
Christopher Ferris
1756fcb8b0
[scudo] Add primary option to enable/disable cache blocks. (#129794)
When configured this way, no primary blocks will be cached except the
batch class. Nothing else changes, no change in the page releasing
strategy.
2025-04-17 14:23:42 -07:00
Vitaly Buka
91df4cce44 [NFC][Asan] Disabled test dead-locking on Darwin
After #131756.
2025-04-16 15:19:54 -07:00
Vitaly Buka
9c98a9801d [NFC][Asan] CRLF to LF in a test 2025-04-16 15:18:46 -07:00
Vitaly Buka
7623501c05
[asan] Fix build on fuchsia (#136042)
Does not link after #131756
2025-04-16 15:04:06 -07:00
Jonas Paulsson
6d03f51f0c
[SystemZ] Add support for 16-bit floating point. (#109164)
- _Float16 is now accepted by Clang.

- The half IR type is fully handled by the backend.

- These values are passed in FP registers and converted to/from float around
  each operation.

- Compiler-rt conversion functions are now built for s390x including the missing
  extendhfdf2 which was added.

Fixes #50374
2025-04-16 20:02:56 +02:00
Kostiantyn Lazukin
72506eb37d
[compiler-rt] Fix addtf3_test.c being skipped due to misplaced include (#134106)
[compiler-rt] The test `addtf3_test.c` is currently guarded by `#if
defined(CRT_HAS_IEEE_TF)`, a macro that is declared in `int_lib.h`.
However, `int_lib.h` is included *after* the preprocessor check, which
results in the macro not being defined in time and causes the test to
always be skipped.

This patch moves the includes of `fp_test.h` and `int_lib.h` to the top
of the file so that `CRT_HAS_IEEE_TF` is defined before it is checked.

Co-authored-by: Kostiantyn Lazukin <koslaz01@ip-10-252-21-142.eu-west-1.compute.internal>
2025-04-16 09:54:42 -07:00
Camsyn
bd4d3519c7
[ASan] Prevent ASan/LSan deadlock by preloading modules before error reporting (#131756)
### Description  
This PR resolves a deadlock between AddressSanitizer (ASan) and
LeakSanitizer (LSan)
that occurs when both sanitizers attempt to acquire locks in conflicting
orders across
threads. The fix ensures safe lock acquisition ordering by preloading
module information
before error reporting.  

---  

### Issue Details  
**Reproducer**
```cpp  
// Thread 1: ASan error path 
int arr[1] = {0};
std::thread t([&]() {  
  arr[1] = 1; // Triggers ASan OOB error  
});  

// Thread 2: LSan check path  
__lsan_do_leak_check();   
```  

**Lock Order Conflict**:  

- Thread 1 (ASan error reporting):  
  1. Acquires ASan thread registry lock (B)  
  1. Attempts to acquire libdl lock (A) via `dl_iterate_phdr`

- Thread 2 (LSan leak check):  
  1. Acquires libdl lock (A) via `dl_iterate_phdr`
  1. Attempts to acquire ASan thread registry lock (B)  
  

This creates a circular wait condition (A -> B -> A) meeting all four
Coffman deadlock criteria.

---  

### Fix Strategy  
The root cause lies in ASan's error reporting path needing
`dl_iterate_phdr` (requiring lock A)
while already holding its thread registry lock (B). The solution:  

1. **Preload Modules Early**: Force module list initialization _before_
acquiring ASan's thread lock
2. **Avoid Nested Locking**: Ensure symbolization (via dl_iterate_phdr)
completes before error reporting locks

Key code change:  
```cpp  
// Before acquiring ASan's thread registry lock:  
Symbolizer::GetOrInit()->GetRefreshedListOfModules();  
```  

This guarantees module information is cached before lock acquisition,
eliminating
the need for `dl_iterate_phdr` calls during error reporting.  

---  

### Testing  
Added **asan_lsan_deadlock.cpp** test case:  
- Reproduces deadlock reliably without fix **under idle system
conditions**
   - Uses watchdog thread to detect hangs  
   - Verifies ASan error reports correctly without deadlock  

**Note**: Due to the inherent non-determinism of thread scheduling and
lock acquisition timing,
this test may not reliably reproduce the deadlock on busy systems (e.g.,
during parallel
   `ninja check-asan` runs).



---  

### Impact  
- Fixes rare but severe deadlocks in mixed ASan+LSan environments  
- Maintains thread safety guarantees for both sanitizers  
- No user-visible behavior changes except deadlock elimination  

---

### Relevant Buggy Code
- Code in ASan's asan_report.cpp
```cpp
  explicit ScopedInErrorReport(bool fatal = false)
      : halt_on_error_(fatal || flags()->halt_on_error) {
    // Acquire lock B
    asanThreadRegistry().Lock();
  }
  ~ScopedInErrorReport() {
    ...
    // Try to acquire lock A under holding lock B via the following path
    // #4  0x000071a353d83e93 in __GI___dl_iterate_phdr (
    //     callback=0x5d1a07a39580 <__sanitizer::dl_iterate_phdr_cb(dl_phdr_info*, unsigned long, void*)>, 
    //     data=0x6da3510fd3f0) at ./elf/dl-iteratephdr.c:39
    // #5  0x00005d1a07a39574 in __sanitizer::ListOfModules::init (this=0x71a353ebc080)
    //     at llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp:784
    // #6  0x00005d1a07a429e3 in __sanitizer::Symbolizer::RefreshModules (this=0x71a353ebc058)
    //     at llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp:188
    // #7  __sanitizer::Symbolizer::FindModuleForAddress (this=this@entry=0x71a353ebc058, 
    //     address=address@entry=102366378805727)
    //     at llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp:214
    // #8  0x00005d1a07a4291b in __sanitizer::Symbolizer::SymbolizePC (this=0x71a353ebc058, addr=102366378805727)
    //     at llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp:88
    // #9  0x00005d1a07a40df7 in __sanitizer::(anonymous namespace)::StackTraceTextPrinter::ProcessAddressFrames (
    //     this=this@entry=0x6da3510fd520, pc=102366378805727)
    //     at llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp:37
    // #10 0x00005d1a07a40d27 in __sanitizer::StackTrace::PrintTo (this=this@entry=0x6da3510fd5e8, 
    //     output=output@entry=0x6da3510fd588)
    //     at llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp:110
    // #11 0x00005d1a07a410a1 in __sanitizer::StackTrace::Print (this=0x6da3510fd5e8)
    //     at llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp:133
    // #12 0x00005d1a0798758d in __asan::ErrorGeneric::Print (
    //     this=0x5d1a07aa4e08 <__asan::ScopedInErrorReport::current_error_+8>)
    //     at llvm-project/compiler-rt/lib/asan/asan_errors.cpp:617    
    current_error_.Print();
    ... 
  }
```

- Code in LSan's lsan_common_linux.cpp
```cpp
void LockStuffAndStopTheWorld(StopTheWorldCallback callback,
                              CheckForLeaksParam *argument) {
  // Acquire lock A
  dl_iterate_phdr(LockStuffAndStopTheWorldCallback, &param);
}

static int LockStuffAndStopTheWorldCallback(struct dl_phdr_info *info,
                                            size_t size, void *data) {
  // Try to acquire lock B under holding lock A via the following path
  // #3  0x000055555562b34a in __sanitizer::ThreadRegistry::Lock (this=<optimized out>)
  //     at llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_thread_registry.h:99
  // #4  __lsan::LockThreads () at llvm-project/compiler-rt/lib/asan/asan_thread.cpp:484
  // #5  0x0000555555652629 in __lsan::ScopedStopTheWorldLock::ScopedStopTheWorldLock (this=<optimized out>)
  //     at llvm-project/compiler-rt/lib/lsan/lsan_common.h:164
  // #6  __lsan::LockStuffAndStopTheWorldCallback (info=<optimized out>, size=<optimized out>, data=0x0, 
  //     data@entry=0x7fffffffd158) at llvm-project/compiler-rt/lib/lsan/lsan_common_linux.cpp:120
  ScopedStopTheWorldLock lock;
  DoStopTheWorldParam *param = reinterpret_cast<DoStopTheWorldParam *>(data);
  StopTheWorld(param->callback, param->argument);
  return 1;
}
```
2025-04-15 17:15:57 -07:00
thetruestblue
8fe5ac896f
[Test][Darwin] Disable test on watchos due to memory restraints (#135671)
Because of the nature of this test (mmap stress-test) it tests too large
of memory allocations to be stable on watchos. WatchOS has memory limits
that can lead to the termination of this process before it reaches the
limit set by the flag. Typical only on devices that are under heavy
load. disable on watchOS.

rdar://147222346
2025-04-14 16:43:49 -07:00
Mircea Trofin
e7aed23d32
[ctxprof] Handle instrumenting functions with musttail calls (#135121)
Functions with `musttail` calls can't be roots because we can't instrument their `ret` to release the context. This patch tags their `CtxRoot` field in their `FunctionData`. In compiler-rt we then know not to allow such functions become roots, and also not confuse `CtxRoot == 0x1` with there being a context root.

Currently we also lose the context tree under such cases. We can, in a subsequent patch, have the root detector search past these functions.
2025-04-14 10:01:25 -07:00
Brad Smith
d49063b496
[compiler-rt][sanitizer][NFC] update endif markers for Haiku (#135475) 2025-04-12 00:49:23 -04:00
Alexandre Ganea
78fbba9921 [compiler-rt] On Windows, silence warning when building with Clang ToT
Fixes:
```
[6113/7139] Building CXX object projects\compiler-rt\lib\interception\CMakeFiles\RTInterception.x86_64.dir\interception_win.cpp.obj
C:\git\llvm-project\compiler-rt\lib\interception\interception_win.cpp(746,5): warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
  746 |     case 0xB841:  // 41 B8 XX XX XX XX : mov r8d, XX XX XX XX
      |     ^
C:\git\llvm-project\compiler-rt\lib\interception\interception_win.cpp(746,5): note: insert 'FALLTHROUGH;' to silence this warning
  746 |     case 0xB841:  // 41 B8 XX XX XX XX : mov r8d, XX XX XX XX
      |     ^
      |     FALLTHROUGH;
C:\git\llvm-project\compiler-rt\lib\interception\interception_win.cpp(746,5): note: insert 'break;' to avoid fall-through
  746 |     case 0xB841:  // 41 B8 XX XX XX XX : mov r8d, XX XX XX XX
      |     ^
      |     break;
1 warning generated.
```
2025-04-11 17:50:15 -04:00
Brad Smith
d1fd97737e
[compiler-rt][sanitizer] add Haiku support (#134772)
Co-authored-by: Jérôme Duval <jerome.duval@gmail.com>
2025-04-11 16:21:00 -04:00
Victor Vianna
90a202f2ff
[cpp23] Remove usage of std::aligned_union<> in llvm (#135146)
std::aligned_union<> is deprecated in C++23. See more details in the
linked bug.

Bug: https://crbug.com/388068052
2025-04-11 16:16:33 -04:00
Thurston Dang
3ad2cd5e70 [asan] Fix-forward #133175 by restricting newly-added tests to Linux
This was failing on Mac
(https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA/4107/ and
https://issues.chromium.org/issues/409995888). Since this is an
experimental feature, rather than play whack-a-mole with selectively
disabling failing platforms (previously done for Android), this patch
restricts it to Linux.
2025-04-11 15:09:41 +00:00