1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

include/sys/cdefs.h: Add __attribute_optimization_barrier__

Add __attribute_optimization_barrier__ to disable inlining and cloning on a
function.  For Clang, expand it to

__attribute__ ((optnone))

Otherwise, expand it to

__attribute__ ((noinline, clone))

Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
Adhemerval Zanella
2024-12-23 05:11:58 +08:00
committed by H.J. Lu
parent 3fb895ac88
commit a2b0ff98a0
45 changed files with 112 additions and 101 deletions

View File

@@ -42,7 +42,7 @@ static int inner_thread_count = 4;
static size_t malloc_size = 32;
static void
__attribute__ ((noinline, noclone))
__attribute_optimization_barrier__
unoptimized_free (void *ptr)
{
free (ptr);

View File

@@ -33,7 +33,7 @@
/* Wrapper for calloc with an optimization barrier. */
static void *
__attribute__ ((noinline, noclone))
__attribute_optimization_barrier__
allocate_zeroed (size_t a, size_t b)
{
return calloc (a, b);

View File

@@ -366,7 +366,7 @@ full_heap_check (void)
}
/* Used as an optimization barrier to force a heap allocation. */
__attribute__ ((noinline, noclone))
__attribute_optimization_barrier__
static void
my_free (void *ptr)
{