Skip to content

Commit 4cc5373

Browse files
edumazettorvalds
authored andcommitted
clang: work around asm output constraint problems
Work around clang problems with "=rm" asm constraint. clang seems to always chose the memory output, while it is almost always the worst choice. Add ASM_OUTPUT_RM so that we can replace "=rm" constraint where it matters for clang, while not penalizing gcc. Signed-off-by: Eric Dumazet <edumazet@google.com> Suggested-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent f67e8a5 commit 4cc5373

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

include/linux/compiler-clang.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@
145145
*/
146146
#define ASM_INPUT_G "ir"
147147
#define ASM_INPUT_RM "r"
148+
#define ASM_OUTPUT_RM "=r"
148149

149150
/*
150151
* Declare compiler support for __typeof_unqual__() operator.

include/linux/compiler_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,12 @@ struct ftrace_likely_data {
548548

549549
/*
550550
* Clang has trouble with constraints with multiple
551-
* alternative behaviors (mainly "g" and "rm").
551+
* alternative behaviors ("g" , "rm" and "=rm").
552552
*/
553553
#ifndef ASM_INPUT_G
554554
#define ASM_INPUT_G "g"
555555
#define ASM_INPUT_RM "rm"
556+
#define ASM_OUTPUT_RM "=rm"
556557
#endif
557558

558559
#ifdef CONFIG_CC_HAS_ASM_INLINE

0 commit comments

Comments
 (0)