1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +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

@@ -37,7 +37,7 @@ static ucontext_t ctx;
static void f2 (void);
static void
__attribute__ ((noinline, noclone))
__attribute_optimization_barrier__
f1 (void)
{
printf ("start f1\n");
@@ -45,7 +45,7 @@ f1 (void)
}
static void
__attribute__ ((noinline, noclone))
__attribute_optimization_barrier__
f2 (void)
{
printf ("start f2\n");
@@ -64,7 +64,7 @@ f3 (void)
}
static int
__attribute__ ((noinline, noclone))
__attribute_optimization_barrier__
do_test_1 (void)
{
char st1[32768];