~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/include/asm/compiler.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2004, 2007  Maciej W. Rozycki
  3  *
  4  * This file is subject to the terms and conditions of the GNU General Public
  5  * License.  See the file "COPYING" in the main directory of this archive
  6  * for more details.
  7  */
  8 #ifndef _ASM_COMPILER_H
  9 #define _ASM_COMPILER_H
 10 
 11 /*
 12  * With GCC 4.5 onwards we can use __builtin_unreachable to indicate to the
 13  * compiler that a particular code path will never be hit. This allows it to be
 14  * optimised out of the generated binary.
 15  *
 16  * Unfortunately at least GCC 4.6.3 through 7.3.0 inclusive suffer from a bug
 17  * that can lead to instructions from beyond an unreachable statement being
 18  * incorrectly reordered into earlier delay slots if the unreachable statement
 19  * is the only content of a case in a switch statement. This can lead to
 20  * seemingly random behaviour, such as invalid memory accesses from incorrectly
 21  * reordered loads or stores. See this potential GCC fix for details:
 22  *
 23  *   https://gcc.gnu.org/ml/gcc-patches/2015-09/msg00360.html
 24  *
 25  * It is unclear whether GCC 8 onwards suffer from the same issue - nothing
 26  * relevant is mentioned in GCC 8 release notes and nothing obviously relevant
 27  * stands out in GCC commit logs, but these newer GCC versions generate very
 28  * different code for the testcase which doesn't exhibit the bug.
 29  *
 30  * GCC also handles stack allocation suboptimally when calling noreturn
 31  * functions or calling __builtin_unreachable():
 32  *
 33  *   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365
 34  *
 35  * We work around both of these issues by placing a volatile asm statement,
 36  * which GCC is prevented from reordering past, prior to __builtin_unreachable
 37  * calls.
 38  *
 39  * The .insn statement is required to ensure that any branches to the
 40  * statement, which sadly must be kept due to the asm statement, are known to
 41  * be branches to code and satisfy linker requirements for microMIPS kernels.
 42  */
 43 #undef barrier_before_unreachable
 44 #define barrier_before_unreachable() asm volatile(".insn")
 45 
 46 #define GCC_OFF_SMALL_ASM() "ZC"
 47 
 48 #ifdef CONFIG_CPU_MIPSR6
 49 #define MIPS_ISA_LEVEL "mips64r6"
 50 #define MIPS_ISA_ARCH_LEVEL MIPS_ISA_LEVEL
 51 #define MIPS_ISA_LEVEL_RAW mips64r6
 52 #define MIPS_ISA_ARCH_LEVEL_RAW MIPS_ISA_LEVEL_RAW
 53 #elif defined(CONFIG_CPU_MIPSR5)
 54 #define MIPS_ISA_LEVEL "mips64r5"
 55 #define MIPS_ISA_ARCH_LEVEL MIPS_ISA_LEVEL
 56 #define MIPS_ISA_LEVEL_RAW mips64r5
 57 #define MIPS_ISA_ARCH_LEVEL_RAW MIPS_ISA_LEVEL_RAW
 58 #else
 59 /* MIPS64 is a superset of MIPS32 */
 60 #define MIPS_ISA_LEVEL "mips64r2"
 61 #define MIPS_ISA_ARCH_LEVEL "arch=r4000"
 62 #define MIPS_ISA_LEVEL_RAW mips64r2
 63 #define MIPS_ISA_ARCH_LEVEL_RAW MIPS_ISA_LEVEL_RAW
 64 #endif /* CONFIG_CPU_MIPSR6 */
 65 
 66 #endif /* _ASM_COMPILER_H */
 67 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php