[PATCH i-g-t 3/3] lib/svga/vm_basic_types: fix musl libs compilation

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Jul 11 11:40:52 UTC 2025


Hi Andrzej,
On 2025-07-11 at 10:18:02 +0200, Hajda, Andrzej wrote:
> 
> W dniu 10.07.2025 o 21:00, Kamil Konieczny pisze:
> > Fix gcc compilation on Void Linux with musl C libs, where
> > PAGE_SIZE is already defined.
> > 
> > Reported-by: zlice <zlice555 at gmail.com>
> > Closes: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/179
> > Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
> > ---
> >   lib/svga/vm_basic_types.h | 10 +++++++++-
> 
> 
> lib/svga contains generated headers, ie if, for some reason, it will be regenerated this will need to be re-applied.
> 
> Maybe it would be better to create some top-level libc-compat.h containing
> fixes for different variants of libc, like in Linux kernel, then include it
> either from headers, either from command line, whatever suits better.
> 
> Morever almost the same code is in lib/svga/vm_basic_types.h
> 
> 
> Regards
> 
> Andrzej

Having libc-compat.h seems good, I will add few more devs found
with git blame for discussion:

Cc: Zack Rusin <zack.rusin at broadcom.com>
Cc: Maaz Mombasawala <maaz.mombasawala at broadcom.com>
Cc: Martin Krastev <martin.krastev at broadcom.com>

Regards,
Kamil

> >   1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/svga/vm_basic_types.h b/lib/svga/vm_basic_types.h
> > index 8fec5b665..ea10a683c 100644
> > --- a/lib/svga/vm_basic_types.h
> > +++ b/lib/svga/vm_basic_types.h
> > @@ -27,7 +27,15 @@
> >   #define VM_BASIC_TYPES_H
> >   #define PAGE_SHIFT 12
> > -#define PAGE_SIZE (1 << PAGE_SHIFT)
> > +
> > +#ifndef PAGE_SIZE
> > +# define PAGE_SIZE (1 << PAGE_SHIFT)
> > +#else
> > +# if PAGE_SIZE != 4096
> > +#  error "Unexpected PAGE_SIZE"
> > +# endif
> > +#endif
> > +
> >   #define PAGE_MASK (~(PAGE_SIZE - 1))
> >   #define PAGE_ALIGN(addr) (((addr) + PAGE_SIZE - 1) & PAGE_MASK)


More information about the igt-dev mailing list