Skip to content

Commit 1a2c73f

Browse files
FlyGoattsbogend
authored andcommitted
MIPS: Workaround clang inline compat branch issue
Clang is unable to handle the situation that a chunk of inline assembly ends with a compat branch instruction and then compiler generates another control transfer instruction immediately after this compat branch. The later instruction will end up in forbidden slot and cause exception. Workaround by add a option to control the use of compact branch. Currently it's selected by CC_IS_CLANG and hopefully we can change it to a version check in future if clang manages to fix it. Fix boot on boston board. Link: llvm/llvm-project#61045 Signed-off-by: Jiaxun Yang <[email protected]> Acked-by: Nathan Chancellor <[email protected]> Acked-by: Nick Desaulniers <[email protected]> Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent 70f864d commit 1a2c73f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

arch/mips/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3200,6 +3200,10 @@ config CC_HAS_MNO_BRANCH_LIKELY
32003200
def_bool y
32013201
depends on $(cc-option,-mno-branch-likely)
32023202

3203+
# https://github.com/llvm/llvm-project/issues/61045
3204+
config CC_HAS_BROKEN_INLINE_COMPAT_BRANCH
3205+
def_bool y if CC_IS_CLANG
3206+
32033207
menu "Power management options"
32043208

32053209
config ARCH_HIBERNATION_POSSIBLE

arch/mips/include/asm/asm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ symbol = value
336336
*/
337337
#ifdef CONFIG_WAR_R10000_LLSC
338338
# define SC_BEQZ beqzl
339-
#elif MIPS_ISA_REV >= 6
339+
#elif !defined(CONFIG_CC_HAS_BROKEN_INLINE_COMPAT_BRANCH) && MIPS_ISA_REV >= 6
340340
# define SC_BEQZ beqzc
341341
#else
342342
# define SC_BEQZ beqz

0 commit comments

Comments
 (0)