Re: [PATCH] x86/boot: Use __ASM_SIZE() to reduce ifdeffery in cpuflags.c

From: H. Peter Anvin
Date: Thu Jul 18 2024 - 03:29:19 EST


On July 18, 2024 12:27:04 AM PDT, Uros Bizjak <ubizjak@xxxxxxxxx> wrote:
>On Thu, Jul 18, 2024 at 8:59 AM H. Peter Anvin <hpa@xxxxxxxxx> wrote:
>>
>> >> >-#ifdef __x86_64__
>> >> >-#define PUSHF "pushfq"
>> >> >-#define POPF "popfq"
>> >> >-#else
>> >> >-#define PUSHF "pushfl"
>> >> >-#define POPF "popfl"
>> >> >-#endif
>> >> >+#define PUSHF __ASM_SIZE(pushf)
>> >> >+#define POPF __ASM_SIZE(popf)
>> >> >
>> >> > int has_eflag(unsigned long mask)
>> >> > {
>> >>
>> >> Just use pushf/popf. gas hasn't needed that suffix for a long time as far as I know.
>> >
>> >Yes, this works, too. So I guess we can also remove the comment
>> >explaining the reason for explicit suffixes?
>> >
>> >Thanks,
>> >Uros.
>> >
>>
>> Yeah. You may want to check the version of binutils that fixed it and put that in the comments.
>
>I have checked that the build works with 9 year old binutils-2.25
>(minimal required version), so the fix was applied to an even earlier
>version. I guess we don't want to burden unsuspecting readers with
>historic toolchain oddities, so I propose to just remove the comment
>for good.
>
>Uros.
>

Yeah, I meant the commit message not comments, sorry.