From a2b0ff98a0d44259cc5f6bd7d3a3676ae9f8996a Mon Sep 17 00:00:00 2001 From: Adhemerval Zanella Date: Mon, 23 Dec 2024 05:11:58 +0800 Subject: 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 Reviewed-by: Sam James --- stdlib/tst-swapcontext2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'stdlib/tst-swapcontext2.c') diff --git a/stdlib/tst-swapcontext2.c b/stdlib/tst-swapcontext2.c index a9c1dc8..f8efdde 100644 --- a/stdlib/tst-swapcontext2.c +++ b/stdlib/tst-swapcontext2.c @@ -32,7 +32,7 @@ static jmp_buf jmpbuf; #define handle_error(msg) \ do { perror(msg); exit(EXIT_FAILURE); } while (0) -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func4(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) { @@ -42,7 +42,7 @@ func4(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) printf(" %sfunc4: returning\e[0m\n", fmt); } -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func3(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) { @@ -51,7 +51,7 @@ func3(ucontext_t *uocp, ucontext_t *ucp, const char *str, const char *fmt) printf(" %sfunc3: returning\e[0m\n", fmt); } -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func1(void) { @@ -67,7 +67,7 @@ func1(void) } } -__attribute__((noinline, noclone)) +__attribute_optimization_barrier__ static void func2(void) { -- cgit v1.1