]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
compiler-gcc.h: Introduce __optimize function attribute
authorGeert Uytterhoeven <geert@linux-m68k.org>
Thu, 1 Feb 2018 10:21:58 +0000 (11:21 +0100)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 23 Feb 2018 14:26:46 +0000 (08:26 -0600)
BugLink: http://bugs.launchpad.net/bugs/1751131
commit df5d45aa08f848b79caf395211b222790534ccc7 upstream.

Create a new function attribute __optimize, which allows to specify an
optimization level on a per-function basis.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
include/linux/compiler-gcc.h
include/linux/compiler.h

index 631354acfa7204757a4ec29e74581dc2ee723a13..0a278a527944ad2fdbf1546eaacb821136cf7218 100644 (file)
 #endif /* __CHECKER__ */
 #endif /* GCC_VERSION >= 40300 */
 
+#if GCC_VERSION >= 40400
+#define __optimize(level)      __attribute__((__optimize__(level)))
+#endif /* GCC_VERSION >= 40400 */
+
 #if GCC_VERSION >= 40500
 
 #ifndef __CHECKER__
index 52e611ab9a6cf6fde23dae53784f01bfb06ce448..5ff818e9a836e898da9ba5171001cb728f73d091 100644 (file)
@@ -271,6 +271,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
 
 #endif /* __ASSEMBLY__ */
 
+#ifndef __optimize
+# define __optimize(level)
+#endif
+
 /* Compile time object size, -1 for unknown */
 #ifndef __compiletime_object_size
 # define __compiletime_object_size(obj) -1