x86/alternatives: fix build issue with binutils before 2.28
PATCH 1/1 x86/alternatives: fix build issue with binutils before 2.28
The usage of the BIT() macro in asm code was introduced in 6.3 in by commit 5d1dd961e743 ("x86/alternatives: Add alt_instr.flags") but this macro uses "1UL" in the shift operations, while gas before 2.28 do not support the "L" suffix after a number, and those before 2.27 do not support the "U" suffix, resulting in build errors such as the following with such versions:
./arch/x86/include/asm/uaccess_64.h:124: Error: found 'L', expected: ')' ./arch/x86/include/asm/uaccess_64.h:124: Error: junk at end of line, first unrecognized character is `L'
There's a single use of this macro here, let's revert to (1 << 0) that works with such older binutils.
---
Boris, I understood from your message that 2.28 was the first working version, so that's what I mentioned here. My tests showed that 2.27 wasn't sufficient and that 2.29 was OK. If I was wrong and it's 2.29 instead, feel free to edit the subject line, description and the comment, I'm totally fine with this!
arch/x86/include/asm/alternative.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/alternative.h +1 -1
@@ -8,7 +8,7 @@#define ALT_FLAGS_SHIFT 16 -#define ALT_FLAG_NOT BIT(0) +#define ALT_FLAG_NOT (1 << 0)/* note: gas < 2.28 can't use BIT(0) */ #define ALT_NOT (feature) ((ALT_FLAG_NOT << ALT_FLAGS_SHIFT) | (feature))#ifndef __ASSEMBLY__
Signature · 1 line
2.35.3
Quoted 35 lines · Willy Tarreau
The usage of the
BIT()macro in asm code was introduced in 6.3 in by commit5d1dd961e743("x86/alternatives: Add alt_instr.flags") but this macro uses "1UL" in the shift operations, while gas before 2.28 do not support the "L" suffix after a number, and those before 2.27 do not support the "U" suffix, resulting in build errors such as the following with such versions:
./arch/x86/include/asm/uaccess_64.h:124: Error: found 'L', expected: ')'./arch/x86/include/asm/uaccess_64.h:124: Error: junk at end of line, first unrecognized character is `L'There's a single use of this macro here, let's revert to (1 << 0) that works with such older binutils.
Cc Jingbo Xu <[email protected]>Cc Borislav Petkov <[email protected]>Cc "H. Peter Anvin" <[email protected]>Signed-off-by Willy Tarreau <[email protected]>---
Boris, I understood from your message that 2.28 was the first working version, so that's what I mentioned here. My tests showed that 2.27 wasn't sufficient and that 2.29 was OK. If I was wrong and it's 2.29 instead, feel free to edit the subject line, description and the comment, I'm totally fine with this!
arch/x86/include/asm/alternative.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/include/asm/alternative.h +0
-0
arch/x86/include/asm/alternative.h line 14
Quoted 8 lines
arch/x86/include/asm/alternative.h +1
-1@@ -8,7 +8,7 @@#define ALT_FLAGS_SHIFT 16 -#define ALT_FLAG_NOT BIT(0) +#define ALT_FLAG_NOT (1 << 0)/* note: gas < 2.28 can't use BIT(0) */ #define ALT_NOT (feature) ((ALT_FLAG_NOT << ALT_FLAGS_SHIFT) | (feature))#ifndef __ASSEMBLY__
It works for me.
Signature · 2 lines
Thanks, Jingbo
Borislav Petkov
maintainerQuoted 3 lines · Willy Tarreau
Boris, I understood from your message that 2.28 was the first working version, so that's what I mentioned here. My tests showed that 2.27 wasn't sufficient and that 2.29 was OK.
No, you have it right above:
U suffix - 2.27
L/LL suffixes - 2.28
I was wondering where to put that info for future reference but didn't find a good place so I extended your commit message with it. Now at least we have left bread crumbs in case we need it in the future.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteQuoted 5 lines · Borislav Petkov
Quoted 3 lines · Willy Tarreau
Boris, I understood from your message that 2.28 was the first working version, so that's what I mentioned here. My tests showed that 2.27 wasn't sufficient and that 2.29 was OK.
Quoted 8 lines
No, you have it right above:
U suffix - 2.27
L/LL suffixes - 2.28I was wondering where to put that info for future reference but didn't find a good place so I extended your commit message with it. Now at least we have left bread crumbs in case we need it in the future.
I wondered the same which is why I left it in the comment as a warning for future wanderers.
Thanks!
Willy