[PATCH] include: sbi: Don't use #pragma when preprocessing device tree sources

Anup Patel anup at brainfault.org
Mon Jul 21 04:13:14 PDT 2025


On Thu, Jul 10, 2025 at 4:58 AM Jessica Clarke <jrtc27 at jrtc27.com> wrote:
>
> Since this persists in the preprocessed output (so that it can affect
> the subsequent compilation), it ends up in the input to dtc and is a
> syntax error, breaking the k210 build. Ideally we wouldn't add the
> -include flag to DTSCPPFLAGS in the first place as this header is wholly
> pointless there, but that's a more invasive build system change compared
> to just making this header safe to include there.
>
> Fixes: 86c01a73ff9d ("lib: sbi: Avoid GOT indirection for global symbol references")
> Signed-off-by: Jessica Clarke <jrtc27 at jrtc27.com>

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

> ---
>  include/sbi/sbi_visibility.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/sbi/sbi_visibility.h b/include/sbi/sbi_visibility.h
> index e9c401c..f900c44 100644
> --- a/include/sbi/sbi_visibility.h
> +++ b/include/sbi/sbi_visibility.h
> @@ -7,10 +7,12 @@
>  #ifndef __SBI_VISIBILITY_H__
>  #define __SBI_VISIBILITY_H__
>
> +#ifndef __DTS__
>  /*
>   * Declare all global objects with hidden visibility so access is PC-relative
>   * instead of going through the GOT.
>   */
>  #pragma GCC visibility push(hidden)
> +#endif
>
>  #endif
> --
> 2.34.1
>
>
> --
> opensbi mailing list
> opensbi at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi



More information about the opensbi mailing list