On 22.04.2025 13:39, Andrew Cooper wrote:
> Compilers estimate the size of an asm() block for inlining purposes.
> 
> Constructs such as ALTERNATIVE appear large due to the metadata, depsite often
> only being a handful of instructions.  asm inline() overrides the estimation
> to identify the block as being small.
> 
> This has a substantial impact on inlining decisions, expected to be for the
> better given that the compiler has a more accurate picture to work with.
> 
> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com>

So this is effectively a generalized version of
https://lists.xen.org/archives/html/xen-devel/2022-08/msg00712.html
with ...

> --- a/xen/Kconfig
> +++ b/xen/Kconfig
> @@ -29,6 +29,10 @@ config LD_IS_GNU
>  config LD_IS_LLVM
>       def_bool $(success,$(LD) --version | head -n 1 | grep -q "^LLD")
>  
> +config CC_HAS_ASM_INLINE
> +     # GCC >= 9, Clang >= 11
> +     def_bool $(success,echo 'void foo(void) { asm inline (""); }' | $(CC) 
> -x c - -c -o /dev/null)

... detection once again done in Kconfig (only). I don't think I had any
feedback there; I'm hence having a hard time seeing why I should now like
this any better than mine was liked.

In any event it's clearly increasingly necessary that we finally get the
detection aspect settled.

Jan

Reply via email to