Skip to content

Commit 9e57126

Browse files
authored
Update compiler-rt to LLVM 20.1.4 (#24357)
This updates compiler-rt to LLVM 20.1.4. Additional change: - Reflect GetThreadStackAndTls's API change: a463f5a In llvm/llvm-project#108883, `GetThreadStackAndTls`'s API changed from ``` void GetThreadStackAndTls(bool main, uptr *stk_addr, uptr *stk_size, uptr *tls_addr, uptr *tls_size); ``` to ``` void GetThreadStackAndTls(bool main, uptr *stk_begin, uptr *stk_end, uptr *tls_begin, uptr *tls_end); ``` So this fixes `sanitizer_emscripten.cpp`'s `GetThreadStackAndTls` accordingly. Also this changes the variable names to match those of the header.
1 parent fb6cc19 commit 9e57126

File tree

148 files changed

+4340
-2063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+4340
-2063
lines changed

ChangeLog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ See docs/process.md for more on how version tagging works.
2020

2121
4.0.10 (in development)
2222
----------------------
23-
- libcxx and libcxxabi were updated to LLVM 20.1.4. (#24346)
23+
- libcxx, libcxxabi, and compiler-rt were updated to LLVM 20.1.4. (#24346 and
24+
#24357)
2425
- Emscripten will not longer generate trampoline functions for Wasm exports
2526
prior to the module being instantiated. Storing a reference to a Wasm export
2627
(e.g. `Module['_malloc']`) prior to instantiation will no longer work. In

system/lib/compiler-rt/include/sanitizer/common_interface_defs.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,43 @@ void SANITIZER_CDECL __sanitizer_annotate_double_ended_contiguous_container(
193193
const void *old_container_beg, const void *old_container_end,
194194
const void *new_container_beg, const void *new_container_end);
195195

196+
/// Copies memory annotations from a source storage region to a destination
197+
/// storage region. After the operation, the destination region has the same
198+
/// memory annotations as the source region, as long as sanitizer limitations
199+
/// allow it (more bytes may be unpoisoned than in the source region, resulting
200+
/// in more false negatives, but never false positives). If the source and
201+
/// destination regions overlap, only the minimal required changes are made to
202+
/// preserve the correct annotations. Old storage bytes that are not in the new
203+
/// storage should have the same annotations, as long as sanitizer limitations
204+
/// allow it.
205+
///
206+
/// This function is primarily designed to be used when moving trivially
207+
/// relocatable objects that may have poisoned memory, making direct copying
208+
/// problematic under sanitizer. However, this function does not move memory
209+
/// content itself, only annotations.
210+
///
211+
/// A contiguous container is a container that keeps all of its elements in a
212+
/// contiguous region of memory. The container owns the region of memory
213+
/// <c>[src_begin, src_end)</c> and <c>[dst_begin, dst_end)</c>. The memory
214+
/// within these regions may be alternately poisoned and non-poisoned, with
215+
/// possibly smaller poisoned and unpoisoned regions.
216+
///
217+
/// If this function fully poisons a granule, it is marked as "container
218+
/// overflow".
219+
///
220+
/// Argument requirements: The destination container must have the same size as
221+
/// the source container, which is inferred from the beginning and end of the
222+
/// source region. Addresses may be granule-unaligned, but this may affect
223+
/// performance.
224+
///
225+
/// \param src_begin Begin of the source container region.
226+
/// \param src_end End of the source container region.
227+
/// \param dst_begin Begin of the destination container region.
228+
/// \param dst_end End of the destination container region.
229+
void SANITIZER_CDECL __sanitizer_copy_contiguous_container_annotations(
230+
const void *src_begin, const void *src_end, const void *dst_begin,
231+
const void *dst_end);
232+
196233
/// Returns true if the contiguous container <c>[beg, end)</c> is properly
197234
/// poisoned.
198235
///

system/lib/compiler-rt/include/sanitizer/memprof_interface.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ void SANITIZER_CDECL __memprof_print_accumulated_stats(void);
4747

4848
/// User-provided default option settings.
4949
///
50-
/// You can provide your own implementation of this function to return a string
51-
/// containing MemProf runtime options (for example,
52-
/// <c>verbosity=1:print_stats=1</c>).
50+
/// You can set these options via the -memprof-runtime-default-options LLVM flag
51+
/// or you can provide your own implementation of this function. See
52+
/// memprof_flags.h for more info.
5353
///
5454
/// \returns Default options string.
5555
const char *SANITIZER_CDECL __memprof_default_options(void);
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
//===-- sanitizer/rtsan_interface.h -----------------------------*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file is a part of RealtimeSanitizer.
10+
//
11+
// Public interface header.
12+
//===----------------------------------------------------------------------===//
13+
14+
#ifndef SANITIZER_RTSAN_INTERFACE_H
15+
#define SANITIZER_RTSAN_INTERFACE_H
16+
17+
#include <sanitizer/common_interface_defs.h>
18+
19+
#ifdef __cplusplus
20+
extern "C" {
21+
#endif // __cplusplus
22+
23+
// Disable all RTSan error reporting.
24+
// Must be paired with a call to `__rtsan_enable`
25+
void SANITIZER_CDECL __rtsan_disable(void);
26+
27+
// Re-enable all RTSan error reporting.
28+
// Must follow a call to `__rtsan_disable`.
29+
void SANITIZER_CDECL __rtsan_enable(void);
30+
31+
#ifdef __cplusplus
32+
} // extern "C"
33+
34+
namespace __rtsan {
35+
#if defined(__has_feature) && __has_feature(realtime_sanitizer)
36+
37+
class ScopedDisabler {
38+
public:
39+
ScopedDisabler() { __rtsan_disable(); }
40+
~ScopedDisabler() { __rtsan_enable(); }
41+
42+
#if __cplusplus >= 201103L
43+
ScopedDisabler(const ScopedDisabler &) = delete;
44+
ScopedDisabler &operator=(const ScopedDisabler &) = delete;
45+
ScopedDisabler(ScopedDisabler &&) = delete;
46+
ScopedDisabler &operator=(ScopedDisabler &&) = delete;
47+
#else
48+
private:
49+
ScopedDisabler(const ScopedDisabler &);
50+
ScopedDisabler &operator=(const ScopedDisabler &);
51+
#endif // __cplusplus >= 201103L
52+
};
53+
54+
#else
55+
56+
class ScopedDisabler {
57+
public:
58+
ScopedDisabler() {}
59+
#if __cplusplus >= 201103L
60+
ScopedDisabler(const ScopedDisabler &) = delete;
61+
ScopedDisabler &operator=(const ScopedDisabler &) = delete;
62+
ScopedDisabler(ScopedDisabler &&) = delete;
63+
ScopedDisabler &operator=(ScopedDisabler &&) = delete;
64+
#else
65+
private:
66+
ScopedDisabler(const ScopedDisabler &);
67+
ScopedDisabler &operator=(const ScopedDisabler &);
68+
#endif // __cplusplus >= 201103L
69+
};
70+
71+
#endif // defined(__has_feature) && __has_feature(realtime_sanitizer)
72+
} // namespace __rtsan
73+
#endif // __cplusplus
74+
75+
#endif // SANITIZER_RTSAN_INTERFACE_H

0 commit comments

Comments
 (0)