Compile GLIBC without AVX support

marekzmyslowski@poczta.onet.pl marekzmyslowski@poczta.onet.pl
Thu Jan 3 13:41:00 GMT 2019


Hello Florian,
Thank you for your help. The "--disable-multi-arch" solved my issue 😊 

Regards
Marek

-----Original Message-----
From: libc-stable-owner@sourceware.org <libc-stable-owner@sourceware.org> On Behalf Of Florian Weimer
Sent: Thursday, January 3, 2019 2:05 PM
To: marekzmyslowski@poczta.onet.pl
Cc: libc-stable@sourceware.org; libc-help@sourceware.org
Subject: Re: Compile GLIBC without AVX support

* marekzmyslowski:

> I'm trying to compile the glibc 2.28 version without AVX support. 
> However, whatever option I used, AVX files are still compiled and used.
> I need this to use gdb record/replay tool.
> Here is the configure command I used:
>
> ../configure --enable-mathvec=no --prefix=/work/bin 
> libc_cv_asm_avx512=no libc_cv_asm_avx512dq=no libc_cv_cc_avx512=no  
> libc_cv_cc_sse2avx=no
> --disable-avx2  --disable-avx512 --disable-avx-128-fma
>
> After make the result is following:
>
> root@d93e9cc876c3:/work/glibc/build# readelf -Ws libc.so | grep avx
>   1194: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS 
> strcasecmp_l-avx.os
>   1198: 0000000000000000     0 FILE    LOCAL  DEFAULT  ABS 
> strncase_l-avx.os
>   3257: 0000000000159070   337 FUNC    LOCAL  DEFAULT   13 
> __memset_avx512_unaligned_erms
>   3272: 0000000000158a40     9 FUNC    LOCAL  DEFAULT   13 
> __mempcpy_chk_avx512_unaligned
>   3276: 000000000014f1d0  1288 FUNC    LOCAL  DEFAULT   13 
> __strncmp_avx2 .

GDB needs to communicate to the process that there is no AVX support, by masking CPU flags.  I don't know if GDB has implemented that.  You may have to use KVM or boot the system with a suitable clearcpuid argument on the kernel command line.  If you do that, you won't have to rebuild glibc because glibc will automatically stop using AVX.

You can reduce AVX usage further by using --disable-multi-arch, but some uses will remain if the CPU advertises support for AVX because there are some corner cases where the dynamic linker needs to save and restore AVX-related registers.

Thanks,
Florian



More information about the Libc-help mailing list