]>
Commit | Line | Data |
---|---|---|
65418671 SL |
1 | From 42449e3341fdbe8209742950c33e313417c1284d Mon Sep 17 00:00:00 2001 |
2 | From: Ilya Leoshkevich <iii@linux.ibm.com> | |
3 | Date: Fri, 21 Jun 2019 17:39:12 +0200 | |
4 | Subject: s390/jump_label: Use "jdd" constraint on gcc9 | |
5 | ||
6 | [ Upstream commit 146448524bddbf6dfc62de31957e428de001cbda ] | |
7 | ||
8 | [heiko.carstens@de.ibm.com]: | |
9 | ----- | |
10 | Laura Abbott reported that the kernel doesn't build anymore with gcc 9, | |
11 | due to the "X" constraint. Ilya provided the gcc 9 patch "S/390: | |
12 | Introduce jdd constraint" which introduces the new "jdd" constraint | |
13 | which fixes this. | |
14 | ----- | |
15 | ||
16 | The support for section anchors on S/390 introduced in gcc9 has changed | |
17 | the behavior of "X" constraint, which can now produce register | |
18 | references. Since existing constraints, in particular, "i", do not fit | |
19 | the intended use case on S/390, the new machine-specific "jdd" | |
20 | constraint was introduced. This patch makes jump labels use "jdd" | |
21 | constraint when building with gcc9. | |
22 | ||
23 | Reported-by: Laura Abbott <labbott@redhat.com> | |
24 | Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> | |
25 | Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> | |
26 | Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> | |
27 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
28 | --- | |
29 | arch/s390/include/asm/jump_label.h | 14 ++++++++++---- | |
30 | 1 file changed, 10 insertions(+), 4 deletions(-) | |
31 | ||
32 | diff --git a/arch/s390/include/asm/jump_label.h b/arch/s390/include/asm/jump_label.h | |
33 | index 40f651292aa7..9c7dc970e966 100644 | |
34 | --- a/arch/s390/include/asm/jump_label.h | |
35 | +++ b/arch/s390/include/asm/jump_label.h | |
36 | @@ -10,6 +10,12 @@ | |
37 | #define JUMP_LABEL_NOP_SIZE 6 | |
38 | #define JUMP_LABEL_NOP_OFFSET 2 | |
39 | ||
40 | +#if __GNUC__ < 9 | |
41 | +#define JUMP_LABEL_STATIC_KEY_CONSTRAINT "X" | |
42 | +#else | |
43 | +#define JUMP_LABEL_STATIC_KEY_CONSTRAINT "jdd" | |
44 | +#endif | |
45 | + | |
46 | /* | |
47 | * We use a brcl 0,2 instruction for jump labels at compile time so it | |
48 | * can be easily distinguished from a hotpatch generated instruction. | |
49 | @@ -19,9 +25,9 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran | |
50 | asm_volatile_goto("0: brcl 0,"__stringify(JUMP_LABEL_NOP_OFFSET)"\n" | |
51 | ".pushsection __jump_table, \"aw\"\n" | |
52 | ".balign 8\n" | |
53 | - ".quad 0b, %l[label], %0\n" | |
54 | + ".quad 0b, %l[label], %0+%1\n" | |
55 | ".popsection\n" | |
56 | - : : "X" (&((char *)key)[branch]) : : label); | |
57 | + : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label); | |
58 | ||
59 | return false; | |
60 | label: | |
61 | @@ -33,9 +39,9 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key, bool | |
62 | asm_volatile_goto("0: brcl 15, %l[label]\n" | |
63 | ".pushsection __jump_table, \"aw\"\n" | |
64 | ".balign 8\n" | |
65 | - ".quad 0b, %l[label], %0\n" | |
66 | + ".quad 0b, %l[label], %0+%1\n" | |
67 | ".popsection\n" | |
68 | - : : "X" (&((char *)key)[branch]) : : label); | |
69 | + : : JUMP_LABEL_STATIC_KEY_CONSTRAINT (key), "i" (branch) : : label); | |
70 | ||
71 | return false; | |
72 | label: | |
73 | -- | |
74 | 2.20.1 | |
75 |