Skip to content

Update compiler-rt to LLVM 20.1.4 #24357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ See docs/process.md for more on how version tagging works.

4.0.10 (in development)
----------------------
- libcxx and libcxxabi were updated to LLVM 20.1.4. (#24346)
- libcxx, libcxxabi, and compiler-rt were updated to LLVM 20.1.4. (#24346 and
#24357)
- Emscripten will not longer generate trampoline functions for Wasm exports
prior to the module being instantiated. Storing a reference to a Wasm export
(e.g. `Module['_malloc']`) prior to instantiation will no longer work. In
Expand Down
37 changes: 37 additions & 0 deletions system/lib/compiler-rt/include/sanitizer/common_interface_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,43 @@ void SANITIZER_CDECL __sanitizer_annotate_double_ended_contiguous_container(
const void *old_container_beg, const void *old_container_end,
const void *new_container_beg, const void *new_container_end);

/// Copies memory annotations from a source storage region to a destination
/// storage region. After the operation, the destination region has the same
/// memory annotations as the source region, as long as sanitizer limitations
/// allow it (more bytes may be unpoisoned than in the source region, resulting
/// in more false negatives, but never false positives). If the source and
/// destination regions overlap, only the minimal required changes are made to
/// preserve the correct annotations. Old storage bytes that are not in the new
/// storage should have the same annotations, as long as sanitizer limitations
/// allow it.
///
/// This function is primarily designed to be used when moving trivially
/// relocatable objects that may have poisoned memory, making direct copying
/// problematic under sanitizer. However, this function does not move memory
/// content itself, only annotations.
///
/// A contiguous container is a container that keeps all of its elements in a
/// contiguous region of memory. The container owns the region of memory
/// <c>[src_begin, src_end)</c> and <c>[dst_begin, dst_end)</c>. The memory
/// within these regions may be alternately poisoned and non-poisoned, with
/// possibly smaller poisoned and unpoisoned regions.
///
/// If this function fully poisons a granule, it is marked as "container
/// overflow".
///
/// Argument requirements: The destination container must have the same size as
/// the source container, which is inferred from the beginning and end of the
/// source region. Addresses may be granule-unaligned, but this may affect
/// performance.
///
/// \param src_begin Begin of the source container region.
/// \param src_end End of the source container region.
/// \param dst_begin Begin of the destination container region.
/// \param dst_end End of the destination container region.
void SANITIZER_CDECL __sanitizer_copy_contiguous_container_annotations(
const void *src_begin, const void *src_end, const void *dst_begin,
const void *dst_end);

/// Returns true if the contiguous container <c>[beg, end)</c> is properly
/// poisoned.
///
Expand Down
6 changes: 3 additions & 3 deletions system/lib/compiler-rt/include/sanitizer/memprof_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ void SANITIZER_CDECL __memprof_print_accumulated_stats(void);

/// User-provided default option settings.
///
/// You can provide your own implementation of this function to return a string
/// containing MemProf runtime options (for example,
/// <c>verbosity=1:print_stats=1</c>).
/// You can set these options via the -memprof-runtime-default-options LLVM flag
/// or you can provide your own implementation of this function. See
/// memprof_flags.h for more info.
///
/// \returns Default options string.
const char *SANITIZER_CDECL __memprof_default_options(void);
Expand Down
75 changes: 75 additions & 0 deletions system/lib/compiler-rt/include/sanitizer/rtsan_interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//===-- sanitizer/rtsan_interface.h -----------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file is a part of RealtimeSanitizer.
//
// Public interface header.
//===----------------------------------------------------------------------===//

#ifndef SANITIZER_RTSAN_INTERFACE_H
#define SANITIZER_RTSAN_INTERFACE_H

#include <sanitizer/common_interface_defs.h>

#ifdef __cplusplus
extern "C" {
#endif // __cplusplus

// Disable all RTSan error reporting.
// Must be paired with a call to `__rtsan_enable`
void SANITIZER_CDECL __rtsan_disable(void);

// Re-enable all RTSan error reporting.
// Must follow a call to `__rtsan_disable`.
void SANITIZER_CDECL __rtsan_enable(void);

#ifdef __cplusplus
} // extern "C"

namespace __rtsan {
#if defined(__has_feature) && __has_feature(realtime_sanitizer)

class ScopedDisabler {
public:
ScopedDisabler() { __rtsan_disable(); }
~ScopedDisabler() { __rtsan_enable(); }

#if __cplusplus >= 201103L
ScopedDisabler(const ScopedDisabler &) = delete;
ScopedDisabler &operator=(const ScopedDisabler &) = delete;
ScopedDisabler(ScopedDisabler &&) = delete;
ScopedDisabler &operator=(ScopedDisabler &&) = delete;
#else
private:
ScopedDisabler(const ScopedDisabler &);
ScopedDisabler &operator=(const ScopedDisabler &);
#endif // __cplusplus >= 201103L
};

#else

class ScopedDisabler {
public:
ScopedDisabler() {}
#if __cplusplus >= 201103L
ScopedDisabler(const ScopedDisabler &) = delete;
ScopedDisabler &operator=(const ScopedDisabler &) = delete;
ScopedDisabler(ScopedDisabler &&) = delete;
ScopedDisabler &operator=(ScopedDisabler &&) = delete;
#else
private:
ScopedDisabler(const ScopedDisabler &);
ScopedDisabler &operator=(const ScopedDisabler &);
#endif // __cplusplus >= 201103L
};

#endif // defined(__has_feature) && __has_feature(realtime_sanitizer)
} // namespace __rtsan
#endif // __cplusplus

#endif // SANITIZER_RTSAN_INTERFACE_H
Loading