]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
include/sys/cdefs.h: Add __attribute_optimization_barrier__
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Sun, 22 Dec 2024 21:11:58 +0000 (05:11 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Sun, 22 Dec 2024 22:28:55 +0000 (06:28 +0800)
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>
45 files changed:
benchtests/bench-hash-funcs-kernel.h
benchtests/bench-hash-funcs.c
benchtests/bench-strchr.c
debug/tst-backtrace.h
debug/tst-ssp-1.c
elf/tst-p_alignmod-base.c
gmon/tst-gmon.c
gmon/tst-mcount-overflow.c
include/sys/cdefs.h
malloc/tst-malloc-thread-exit.c
malloc/tst-malloc-thread-fail.c
malloc/tst-mallocstate.c
misc/tst-syscalls.c
nptl/tst-minstack-throw.cc
nptl/tst-thread-exit-clobber.cc
nptl/tst-thread_local1.cc
stdlib/tst-makecontext-align.c
stdlib/tst-quick_exit.cc
stdlib/tst-setcontext10.c
stdlib/tst-setcontext11.c
stdlib/tst-setcontext5.c
stdlib/tst-setcontext8.c
stdlib/tst-setcontext9.c
stdlib/tst-swapcontext1.c
stdlib/tst-swapcontext2.c
stdlib/tst-thread-quick_exit.cc
string/tst-xbzero-opt.c
sysdeps/generic/tst-stack-align.h
sysdeps/unix/sysv/linux/x86_64/tst-cet-property-2.c
sysdeps/unix/sysv/linux/x86_64/tst-cet-setcontext-1.c
sysdeps/unix/sysv/linux/x86_64/tst-cet-vfork-1.c
sysdeps/unix/sysv/linux/x86_64/tst-gnu2-tls2-amx.c
sysdeps/x86/tst-ldbl-nonnormal-printf.c
sysdeps/x86/tst-memchr-rtm.c
sysdeps/x86/tst-memcmp-rtm.c
sysdeps/x86/tst-memmove-rtm.c
sysdeps/x86/tst-memrchr-rtm.c
sysdeps/x86/tst-memset-rtm.c
sysdeps/x86/tst-strchr-rtm.c
sysdeps/x86/tst-strcmp-rtm.c
sysdeps/x86/tst-strcpy-rtm.c
sysdeps/x86/tst-strlen-rtm.c
sysdeps/x86/tst-strncmp-rtm.c
sysdeps/x86/tst-strrchr-rtm.c
sysdeps/x86_64/tst-rsi-strlen.c

index 7eaa3665b6b43e8ce1a3b1024684b47c49a5fa76..3e58fde084ce024d243220f430476fe6b45cfff3 100644 (file)
@@ -35,7 +35,7 @@
 #define PRIMITIVE_CAT(x, y) x ## y
 #define CAT(x, y) PRIMITIVE_CAT (x, y)
 
-static double __attribute__ ((noinline, noclone))
+static double __attribute_optimization_barrier__
 CAT (do_one_test_kernel, POSTFIX) (const char *s, size_t len)
 {
 
@@ -58,7 +58,7 @@ CAT (do_one_test_kernel, POSTFIX) (const char *s, size_t len)
   return (double) cur / (double) NFIXED_ITERS;
 }
 
-static double __attribute__ ((noinline, noclone))
+static double __attribute_optimization_barrier__
 CAT (do_rand_test_kernel, POSTFIX) (char const *bufs,
                                    unsigned int const *sizes)
 {
index 8dd88c9e390cac8ac81f67071a29d33ba1414604..3d150292781aac30c9b22772aacf450d3a3b82e3 100644 (file)
@@ -67,7 +67,7 @@ do_one_test (json_ctx_t *json_ctx, size_t len)
   json_element_object_end (json_ctx);
 }
 
-static void __attribute__ ((noinline, noclone))
+static void __attribute_optimization_barrier__
 do_rand_test (json_ctx_t *json_ctx)
 {
   size_t i, sz, offset;
index eed6882085c3fbf2b05cdf84a80dd5da8fd46a96..fed3b9b22395c8dee02f2a55a77b5cc1ba313aaa 100644 (file)
@@ -92,7 +92,7 @@ IMPL (generic_strchrnul, 0)
    branch coming we want to test the case where a potential branch in
    strchr can be used to skip a later mispredict because of the
    relationship between the two branches. */
-static void __attribute__ ((noinline, noclone))
+static void __attribute_optimization_barrier__
 do_one_rand_plus_branch_test (json_ctx_t *json_ctx, impl_t *impl,
                               const CHAR *s, const CHAR *c)
 {
@@ -117,7 +117,7 @@ do_one_rand_plus_branch_test (json_ctx_t *json_ctx, impl_t *impl,
   json_element_double (json_ctx, (double)cur / (double)iters);
 }
 
-static void __attribute__ ((noinline, noclone))
+static void __attribute_optimization_barrier__
 do_one_rand_test (json_ctx_t *json_ctx, impl_t *impl, const CHAR *s,
                   const CHAR *c)
 {
index 53239dad59b001bf36315580fd66851ac4a8bda0..0ed38b6892423919e16719e449b708d49eecb156 100644 (file)
@@ -33,7 +33,7 @@ volatile int x;
 
 /* Use this attribute to prevent inlining, so that all expected frames
    are present.  */
-#define NO_INLINE __attribute__ ((noinline, noclone, weak))
+#define NO_INLINE __attribute__ ((weak)) __attribute_optimization_barrier__
 
 /* Look for a match in SYM from backtrace_symbols to NAME, a fragment
    of a function name.  Ignore the filename before '(', but presume
index a1e4fb0630609fab8fcc3b107b1ba6b7bb7ceee2..2c8861ae59a2f54d6ac8c208a926c23c758bc08b 100644 (file)
@@ -21,7 +21,7 @@
 #include <signal.h>
 
 static void
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 test (char *foo)
 {
   int i;
index d6930b9f1643c59c46df5b5b385241b50299d688..23b20f12db58a1457d8457409a85a3aff51a8450 100644 (file)
@@ -26,7 +26,7 @@
 int foo __attribute__ ((aligned (ALIGN))) = 1;
 
 bool
-__attribute__ ((weak, noclone, noinline))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 is_aligned_p (void *p, int align)
 {
   return (((uintptr_t) p) & (align - 1)) == 0;
index 9de4e7f85f56695b71581311be1c83e95336e26b..eca8246a5cfc52f0312337b653d6e535787d492c 100644 (file)
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <sys/cdefs.h>
+
 /* This program does not use the test harness because we want tight
    control over the call graph.  */
 
-__attribute__ ((noinline, noclone, weak)) void
+__attribute__ ((weak)) __attribute_optimization_barrier__ void
 f1 (void)
 {
 }
 
-__attribute__ ((noinline, noclone, weak)) void
+__attribute__ ((weak)) __attribute_optimization_barrier__ void
 f2 (void)
 {
   f1 ();
@@ -32,7 +34,7 @@ f2 (void)
   asm volatile ("");
 }
 
-__attribute__ ((noinline, noclone, weak)) void
+__attribute__ ((weak)) __attribute_optimization_barrier__ void
 f3 (int count)
 {
   for (int i = 0; i < count; ++i)
index 0e60f7e2e665cb03266fdd2caf986f577ccd4d2e..a681872bf7adf1b0d6ba12994bca92526cfc40bd 100644 (file)
@@ -16,6 +16,8 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
+#include <sys/cdefs.h>
+
 /* Program with sufficiently complex, yet pointless, call graph
    that it will trigger an mcount overflow, when you set the
    minarcs/maxarcs tunables to very low values. */
 
 /* Defines 16 leaf functions named f1_0 to f1_15 */
 #define REP(n) \
-  __attribute__ ((noinline, noclone, weak)) void f1_##n (void) {};
+  __attribute__ ((weak)) __attribute_optimization_barrier__ void f1_##n (void) {};
 REPS
 #undef REP
 
 /* Calls all 16 leaf functions f1_* in succession */
-__attribute__ ((noinline, noclone, weak)) void
+__attribute__ ((weak)) __attribute_optimization_barrier__ void
 f2 (void)
 {
 # define REP(n) f1_##n();
@@ -47,12 +49,12 @@ f2 (void)
 
 /* Defines 16 functions named f2_0 to f2_15, which all just call f2 */
 #define REP(n) \
-  __attribute__ ((noinline, noclone, weak)) void \
+  __attribute__ ((weak)) __attribute_optimization_barrier__ void \
   f2_##n (void) { f2(); PREVENT_TAIL_CALL; };
 REPS
 #undef REP
 
-__attribute__ ((noinline, noclone, weak)) void
+__attribute__ ((weak)) __attribute_optimization_barrier__ void
 f3 (int count)
 {
   for (int i = 0; i < count; ++i)
index b84ad34a7019ee01325b29dd28b9d5c516c45d45..a676f75f6259a303edf27ca076c62764c5cceda0 100644 (file)
@@ -56,4 +56,11 @@ rtld_hidden_proto (__chk_fail)
 
 #endif /* !defined _ISOMAC */
 
+/*  Prevents a function from being considered for inlining and cloning.  */
+#ifdef __clang__
+# define __attribute_optimization_barrier__ __attribute__ ((optnone))
+#else
+# define __attribute_optimization_barrier__ __attribute__ ((noinline, noclone))
+#endif
+
 #endif
index aec389708776cd21a029af2363eabae31ff14e58..269abcea8cd23091d0183df4dbab0fdfec3f241e 100644 (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);
index f6988718762b4ddacf77a13a271ff9c8edc226eb..56553dd299a30e5533d650f3cfb4238646a641b4 100644 (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);
index f72e1a1b28f002c6995760153ffc71bd4396d5ba..3664fcda01d55d57cf621c8350ed1c713680e079 100644 (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)
 {
index d060b125c9e17eca4ca0657f96717d3eedbdc9aa..ac1e1014e162e57d1f0ac6f150975ae91a18a7cc 100644 (file)
@@ -37,7 +37,7 @@ struct Array
 
 static int error_count;
 
-__attribute__ ((noclone, noinline))
+__attribute_optimization_barrier__
 struct Array
 allocate (size_t bytes)
 {
@@ -52,7 +52,7 @@ allocate (size_t bytes)
   return __extension__ (struct Array) {bytes, p};
 }
 
-__attribute__ ((noclone, noinline))
+__attribute_optimization_barrier__
 void
 deallocate (struct Array b)
 {
@@ -66,7 +66,7 @@ deallocate (struct Array b)
     }
 }
 
-__attribute__ ((noclone, noinline))
+__attribute_optimization_barrier__
 void *
 do_mmap (void *addr, size_t length)
 {
@@ -74,7 +74,7 @@ do_mmap (void *addr, size_t length)
               MAP_PRIVATE | MAP_ANON, -1, 0);
 }
 
-__attribute__ ((noclone, noinline))
+__attribute_optimization_barrier__
 void *
 reallocate (struct Array b)
 {
@@ -86,7 +86,7 @@ reallocate (struct Array b)
   return NULL;
 }
 
-__attribute__ ((noclone, noinline))
+__attribute_optimization_barrier__
 void
 protect (struct Array b)
 {
@@ -104,7 +104,7 @@ protect (struct Array b)
     }
 }
 
-__attribute__ ((noclone, noinline))
+__attribute_optimization_barrier__
 ssize_t
 do_read (int fd, void *ptr, struct Array b)
 {
@@ -116,7 +116,7 @@ do_read (int fd, void *ptr, struct Array b)
   return 0;
 }
 
-__attribute__ ((noclone, noinline))
+__attribute_optimization_barrier__
 ssize_t
 do_write (int fd, void *ptr, struct Array b)
 {
index b729091ec494274102c50dc941ba33e52bbe10ba..ff0d3d39dada6ab68fa3d87b173d35c0bd8dbe78 100644 (file)
@@ -24,7 +24,7 @@
 #include <support/xthread.h>
 
 /* Throw a std::runtime_exception.  */
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 do_throw_exception ()
 {
@@ -38,17 +38,17 @@ struct class_with_destructor
   ~class_with_destructor ();
 };
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 class_with_destructor::class_with_destructor ()
 {
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 class_with_destructor::~class_with_destructor ()
 {
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 function_with_destructed_object ()
 {
index b3b69892689856935e2c46eb0e117d456dde156f..9a50848ef84f28b357251218fbf950642460a150 100644 (file)
@@ -73,7 +73,7 @@ enum { no_check = -1 };
 
 /* Check that VALUE is the magic value for INDEX, behind a compiler
    barrier.  */
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_magic (int index, unsigned int value)
 {
@@ -103,7 +103,7 @@ check_magic (int index, unsigned int value)
 
 /* Check that VALUE is the magic value for INDEX, behind a compiler
    barrier.  Double variant.  */
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_magic (int index, double value)
 {
@@ -153,7 +153,7 @@ struct checker
    call_pthread_exit are used to call pthread_exit indirectly, with
    the intent of clobbering the register values.  */
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 call_pthread_exit_0 (const values<unsigned int> *pvalues)
 {
@@ -166,7 +166,7 @@ call_pthread_exit_0 (const values<unsigned int> *pvalues)
   pthread_exit (NULL);
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 call_pthread_exit_1 (const values<double> *pvalues)
 {
@@ -180,7 +180,7 @@ call_pthread_exit_1 (const values<double> *pvalues)
   call_pthread_exit_0 (&other_values);
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 call_pthread_exit ()
 {
@@ -192,7 +192,7 @@ call_pthread_exit ()
    pthread_exit.  If Nested is true, call pthread_exit indirectly via
    call_pthread_exit.  */
 template <class T, bool Nested>
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void *
 threadfunc (void *closure)
 {
index 270520528c423aa2ee2aea736e66234c193d50d7..d78ad2731c19d32e18b020526a086dbb19251d65 100644 (file)
@@ -53,27 +53,27 @@ to_string (const counter &c)
 template <counter *Counter>
 struct counting
 {
-  counting () __attribute__ ((noinline, noclone));
-  ~counting () __attribute__ ((noinline, noclone));
-  void operation () __attribute__ ((noinline, noclone));
+  counting () __attribute_optimization_barrier__;
+  ~counting () __attribute_optimization_barrier__;
+  void operation () __attribute_optimization_barrier__;
 };
 
 template<counter *Counter>
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 counting<Counter>::counting ()
 {
   ++Counter->constructed;
 }
 
 template<counter *Counter>
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 counting<Counter>::~counting ()
 {
   ++Counter->destructed;
 }
 
 template<counter *Counter>
-void __attribute__ ((noinline, noclone))
+void __attribute_optimization_barrier__
 counting<Counter>::operation ()
 {
   // Optimization barrier.
index e54b3e1ff29b2f62a735474b501e2115f621d135..a2648bf41e6e507eddfc88ab74eb89b3512d3500 100644 (file)
@@ -30,7 +30,7 @@ static const char *context;
 
 /* Check that ADDRESS is aligned to ALIGNMENT bytes, behind a compiler
    barrier.  */
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_align (void *address, size_t alignment)
 {
@@ -45,7 +45,7 @@ check_align (void *address, size_t alignment)
 
 /* Various alignment checking functions.  */
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_align_int (void)
 {
@@ -53,7 +53,7 @@ check_align_int (void)
   check_align (&a, __alignof__ (a));
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_align_long (void)
 {
@@ -61,7 +61,7 @@ check_align_long (void)
   check_align (&a, __alignof__ (a));
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_align_long_long (void)
 {
@@ -69,7 +69,7 @@ check_align_long_long (void)
   check_align (&a, __alignof__ (a));
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_align_double (void)
 {
@@ -77,7 +77,7 @@ check_align_double (void)
   check_align (&a, __alignof__ (a));
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_align_4 (void)
 {
@@ -85,7 +85,7 @@ check_align_4 (void)
   check_align (&a, 4);
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_align_8 (void)
 {
@@ -93,7 +93,7 @@ check_align_8 (void)
   check_align (&a, 8);
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_align_16 (void)
 {
@@ -105,7 +105,7 @@ check_align_16 (void)
   check_align (&a, 16);
 }
 
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_align_32 (void)
 {
@@ -120,7 +120,7 @@ check_align_32 (void)
 }
 
 /* Call all the alignment checking functions.  */
-__attribute__ ((noinline, noclone, weak))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 void
 check_alignments (void)
 {
index 4331d8038396a4b5312b3f6ebb8b41c2b3261cf6..1cf2dbfed2d455e4ab9390126dc552238cb3f38c 100644 (file)
@@ -26,7 +26,7 @@ struct A
 thread_local A a;
 
 void
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 optimization_barrier (A &)
 {
 }
index 7267f5efe3b10f7f743f05c0f4c3d226898f3ce9..4991d87ebb78f074e5065f0203adccd5a6a8341a 100644 (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];
index 1883c44b760d9fe9a41e54a6f59d818aef856b3d..dbb23640d285a7dd2d05f3f6d58c1900afb13255 100644 (file)
@@ -54,7 +54,7 @@ f1 (int a0, int a1, int a2, int a3)
 }
 
 static void
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 call_longjmp (void)
 {
   longjmp_called = 1;
index 9b29907a13eb5b86397315a1c93383a4c4195eae..ad400818520c15ebdfba8c4465a94de85999a1ab 100644 (file)
@@ -27,7 +27,7 @@ static volatile int done;
 static void f2 (void);
 
 static void
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 f1 (void)
 {
   printf ("start f1\n");
@@ -35,7 +35,7 @@ f1 (void)
 }
 
 static void
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 f2 (void)
 {
   printf ("start f2\n");
index cdcf5eb871e2ea3e89b769521b5ecd05b40c5c01..72f1c1b2c4175e5d28dfda459904dbde8876e4fb 100644 (file)
@@ -26,7 +26,7 @@ static ucontext_t ctx[3];
 static atomic_int done;
 
 static void
-__attribute__((noinline, noclone))
+__attribute_optimization_barrier__
 f2 (void)
 {
   printf ("start f2\n");
index 91b62551388452a2de9ab887c86a8d388fa9fa3d..7d2d341fe0261816273970e761d274b1077db8e0 100644 (file)
@@ -26,7 +26,7 @@ static ucontext_t ctx[5];
 static atomic_int done;
 
 static void
-__attribute__((noinline, noclone))
+__attribute_optimization_barrier__
 f2 (void)
 {
   done++;
index c96b8a27a8435e0f4817b92eb84a75a8f2eaaec3..8b1590d0fd0d25d412eb4b5d25b0237d4b1771f9 100644 (file)
@@ -29,7 +29,7 @@ const char *fmt2 = "\e[34m";
 #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)
 {
@@ -39,7 +39,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)
 {
@@ -48,7 +48,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)
 {
@@ -59,7 +59,7 @@ func1(void)
     }
 }
 
-__attribute__((noinline, noclone))
+__attribute_optimization_barrier__
 static void
 func2(void)
 {
index a9c1dc827cb897f3492dd0b6d33334ac8dce848f..f8efdde7e661ea0a86f86af8e5c3af1647a0def4 100644 (file)
@@ -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)
 {
index dadccee3348d67e523a0f324f1990379a3eea6ab..66ea855a0d678d462a46d568b8eba5fd3e123476 100644 (file)
@@ -30,7 +30,7 @@ thread_local A a1;
 thread_local A a2;
 
 void
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 optimization_barrier (A &)
 {
 }
index 2392eaa2c1ec3f75cfc089dddce083a2b7c9ab4f..0247eec9af03b3c4cf83fb15ddaee1cc461f4f38 100644 (file)
@@ -97,7 +97,7 @@ static const unsigned char test_pattern[16] =
 
 static ucontext_t uc_main, uc_co;
 
-static __attribute__ ((noinline, noclone)) int
+static __attribute_optimization_barrier__ int
 use_test_buffer (unsigned char *buf)
 {
   unsigned int sum = 0;
index 12473e32b86154866d1a07066da9b1a90c162f52..e73acdc29aaebc39080e05887b1284ca6dcf5c77 100644 (file)
@@ -20,7 +20,7 @@
 #include <stdint.h>
 
 int
-__attribute__ ((weak, noclone, noinline))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 is_aligned (void *p, int align)
 {
   return (((uintptr_t) p) & (align - 1)) != 0;
index 5274a09509349c544bcac0600028d2b2cfbc983f..2b0126bf8e909a4945d33fa7337c30cd0db8e6d7 100644 (file)
@@ -25,7 +25,7 @@
 extern void bar (void);
 
 void
-__attribute__ ((noclone, noinline))
+__attribute_optimization_barrier__
 test (void (*func_p) (void))
 {
   func_p ();
index 388931f5f38c8bf1dfce05f5fab35ab23fa9f0d4..c9d49bd9071c071d713d3f065e70a0b6086c0782 100644 (file)
@@ -30,7 +30,7 @@ static ucontext_t ctx[5];
 static atomic_int done;
 
 static void
-__attribute__((noinline, noclone))
+__attribute_optimization_barrier__
 f2 (void)
 {
   printf ("start f2\n");
index 56d77530aecb16869430b9daa245cafde29537a5..cf23bd40211c9bdd87305a7c0b2da8a294325147 100644 (file)
@@ -25,7 +25,7 @@
 #include <x86intrin.h>
 #include <support/test-driver.h>
 
-__attribute__ ((noclone, noinline))
+__attribute_optimization_barrier__
 static void
 do_test_1 (void)
 {
index ae4dd82556c9b2ef41166eeca00820dd1e16b0ce..c3b2afe136184e807f78e45a4dd2d7a3bed3ad99 100644 (file)
@@ -27,7 +27,7 @@ extern int arch_prctl (int, ...);
 #define X86_XSTATE_TILEDATA_ID 18
 
 /* Initialize tile config.  */
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static void
 init_tile_config (__tilecfg *tileinfo)
 {
index 3a60750de4baaffe3c87180b3463cce360bb3b1d..5869e7499423e3e399b03a608f6ac06966c9063f 100644 (file)
@@ -23,7 +23,7 @@
 
 /* Fill the stack with non-zero values.  This makes a crash in
    snprintf more likely.  */
-static void __attribute__ ((noinline, noclone))
+static void __attribute_optimization_barrier__
 fill_stack (void)
 {
   char buffer[65536];
index 7dc0718b7c6726bb4161a3d42901fe1d72b43943..773f972693c9b60424d0f398580a7c4e94c60fc2 100644 (file)
@@ -22,7 +22,7 @@
 #define STRING_SIZE 1024
 char string1[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -36,7 +36,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index 124eb17aed52fc225d90471a7cf91aca370ff50b..91920412edc78d974311ce29a01b88f82329e731 100644 (file)
@@ -23,7 +23,7 @@
 char string1[STRING_SIZE];
 char string2[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -35,7 +35,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index dfb55337843e9f99d89abc65c80c4d6b6b020df9..ed4bcc1ee7c340a8d1f5d83c813f13ef8f50dce0 100644 (file)
@@ -23,7 +23,7 @@
 char string1[STRING_SIZE];
 char string2[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -35,7 +35,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index 48512de7f4ce991ad030c6c11dd039bb5242b075..f59708131066571ee9c0a53436dc986db6c6f560 100644 (file)
@@ -22,7 +22,7 @@
 #define STRING_SIZE 1024
 char string1[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -36,7 +36,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index 60e714c757ac969e733d6d7992114b469e132a30..cf12a2af24f016ed61d17779c7d78f2ac1e8c4f1 100644 (file)
@@ -22,7 +22,7 @@
 #define STRING_SIZE 1024
 char string1[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -30,7 +30,7 @@ prepare (void)
   return EXIT_SUCCESS;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index 8294cc5118c4f97c6d86f10ec1c98843d823ce40..c7b020d45935f709f4f546e216a5d7702ab0dfa6 100644 (file)
@@ -22,7 +22,7 @@
 #define STRING_SIZE 1024
 char string1[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -36,7 +36,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index c2274a5d3e19568734fcdc1273fbd9427e19c6f7..96e19be6c23171a01d740512a796dfdc0f72c02e 100644 (file)
@@ -40,7 +40,7 @@
 CHAR string1[STRING_SIZE];
 CHAR string2[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -52,7 +52,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index 139f52004ec5a491dfdd7568d266bfab70214f0c..15f341904503081f2ecb568847f1eedbbd0ba117 100644 (file)
@@ -23,7 +23,7 @@
 char string1[STRING_SIZE];
 char string2[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -35,7 +35,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index 5b083f29dc9780a9773efe4387531ffd39be38ba..0155b686475ee09762ce2b2963b53c65ba5998b0 100644 (file)
@@ -22,7 +22,7 @@
 #define STRING_SIZE 1024
 char string1[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -35,7 +35,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index ebc8837ad12e14896e40a9adcb4d4b4ad755d397..bd54c41e77d2cd1bf53ae77c7f733e78360955e4 100644 (file)
@@ -40,7 +40,7 @@
 CHAR string1[STRING_SIZE];
 CHAR string2[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -52,7 +52,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
@@ -62,7 +62,7 @@ function (void)
     return 1;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function_overflow (void)
 {
@@ -72,7 +72,7 @@ function_overflow (void)
     return 1;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function_overflow2 (void)
 {
index 487d2071d4468ca002b9b22d46f2d4048a622e5e..c7f41427b589686e70a0c3a7a73e783e2a56cd67 100644 (file)
@@ -22,7 +22,7 @@
 #define STRING_SIZE 1024
 char string1[STRING_SIZE];
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 prepare (void)
 {
@@ -35,7 +35,7 @@ prepare (void)
     return EXIT_FAILURE;
 }
 
-__attribute__ ((noinline, noclone))
+__attribute_optimization_barrier__
 static int
 function (void)
 {
index 2c424ffe9484820ed7b4a5da138e6df95de9d396..704a2f56a8b1a47737204c74a6b5eeefd2222677 100644 (file)
@@ -44,7 +44,7 @@ typedef struct
 } parameter_t;
 
 size_t
-__attribute__ ((weak, noinline, noclone))
+__attribute__ ((weak)) __attribute_optimization_barrier__
 do_strlen (parameter_t *a, int zero, const CHAR *str)
 {
   return CALL (a, str);