* Re: Compile GLIBC without AVX support
2019-01-01 0:00 Compile GLIBC without AVX support marekzmyslowski
@ 2019-01-01 0:00 ` Florian Weimer
2019-01-01 0:00 ` marekzmyslowski
0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2019-01-01 0:00 UTC (permalink / raw)
To: marekzmyslowski; +Cc: libc-stable, libc-help
* 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: Compile GLIBC without AVX support
2019-01-01 0:00 ` Florian Weimer
@ 2019-01-01 0:00 ` marekzmyslowski
0 siblings, 0 replies; 3+ messages in thread
From: marekzmyslowski @ 2019-01-01 0:00 UTC (permalink / raw)
To: 'Florian Weimer'; +Cc: libc-stable, libc-help
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Compile GLIBC without AVX support
@ 2019-01-01 0:00 marekzmyslowski
2019-01-01 0:00 ` Florian Weimer
0 siblings, 1 reply; 3+ messages in thread
From: marekzmyslowski @ 2019-01-01 0:00 UTC (permalink / raw)
To: libc-stable
Hi,
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
.
----------------------------------------------------------------------------
-------------------------------------------------------------
root@d93e9cc876c3:/work/glibc/build# readelf -Ws libc.a | grep avx
readelf: Warning: unable to apply unsupported reloc type 21 to section
.debug_info
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __strchr_avx2
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __strcmp_avx2
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __strlen_avx2
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __strnlen_avx2
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __strncmp_avx2
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __strrchr_avx2
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __memchr_avx2
.
25: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND
__memcpy_avx_unaligned
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __rawmemchr_avx2
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __strchrnul_avx2
15: 0000000000000000 0 NOTYPE GLOBAL HIDDEN UND __memrchr_avx2
File: libc.a(strcmp-avx2.o)
12: 0000000000000000 1087 FUNC GLOBAL DEFAULT 4 __strcmp_avx2
File: libc.a(strncmp-avx2.o)
12: 0000000000000000 1288 FUNC GLOBAL DEFAULT 4 __strncmp_avx2
File: libc.a(memchr-avx2.o)
12: 0000000000000000 717 FUNC GLOBAL DEFAULT 4 __memchr_avx2
File: libc.a(rawmemchr-avx2.o)
12: 0000000000000000 317 FUNC GLOBAL DEFAULT 4 __rawmemchr_avx2
.
Later, when I build test app :
xxx:/work/example$ gcc -nodefaultlibs -g test.c -O0 -o test -static
/work/glibc/build/libc.a -lgcc -lgcc_eh /work/glibc/build/libc.a
xxx:/work/example$ readelf -Ws test | grep avx
875: 000000000042a4c0 1851 FUNC GLOBAL HIDDEN 6
__memcpy_avx512_no_vzeroupper
897: 00000000004325e0 548 FUNC GLOBAL HIDDEN 6 __strchr_avx2
908: 000000000042a4b0 9 FUNC GLOBAL DEFAULT 6
__memcpy_chk_avx512_no_vzeroupper
929: 0000000000439fa0 19 FUNC GLOBAL HIDDEN 6
__memset_avx512_erms
946: 000000000041def0 980 FUNC GLOBAL HIDDEN 6
__memcmp_avx2_movbe
965: 000000000041d9b0 317 FUNC GLOBAL HIDDEN 6 __rawmemchr_avx2
971: 000000000042a4c0 1851 FUNC GLOBAL HIDDEN 6
__memmove_avx512_no_vzeroupper
1084: 0000000000418ed0 1087 FUNC GLOBAL HIDDEN 6 __strcmp_avx2
1104: 0000000000430b50 5718 FUNC GLOBAL HIDDEN 6
__strcasecmp_l_avx
1107: 0000000000460240 418 FUNC GLOBAL HIDDEN 6 __wcslen_avx2
1117: 0000000000432810 493 FUNC GLOBAL HIDDEN 6 __strchrnul_avx2
1198: 00000000004392d0 8 FUNC GLOBAL HIDDEN 6
__mempcpy_avx_unaligned
1259: 00000000004603f0 834 FUNC GLOBAL HIDDEN 6 __wcsnlen_avx2
1271: 000000000041d2a0 1288 FUNC GLOBAL HIDDEN 6 __strncmp_avx2
1275: 0000000000439e30 267 FUNC GLOBAL HIDDEN 6
__memset_avx2_unaligned_erms
1312: 0000000000439760 1244 FUNC GLOBAL HIDDEN 6
__memmove_avx512_unaligned_erms
1315: 0000000000439710 58 FUNC GLOBAL HIDDEN 6
__memmove_avx512_unaligned
1349: 0000000000439dc0 18 FUNC GLOBAL HIDDEN 6
__wmemset_avx2_unaligned
1364: 000000000046a4d0 1139 FUNC GLOBAL HIDDEN 6
_dl_runtime_profile_avx512
1398: 0000000000439760 1244 FUNC GLOBAL HIDDEN 6
__memcpy_avx512_unaligned_erms
1427: 000000000042a4b0 9 FUNC GLOBAL DEFAULT 6
__memmove_chk_avx512_no_vzeroupper
1476: 00000000004392e0 47 FUNC GLOBAL HIDDEN 6
__memcpy_avx_unaligned
1498: 0000000000439e10 19 FUNC GLOBAL HIDDEN 6
__memset_avx2_erms
1510: 0000000000439de0 42 FUNC GLOBAL HIDDEN 6
__memset_avx2_unaligned
1526: 000000000042a490 9 FUNC GLOBAL DEFAULT 6
__mempcpy_chk_avx512_no_vzeroupper
1544: 0000000000439f60 55 FUNC GLOBAL HIDDEN 6
__memset_avx512_unaligned
1546: 0000000000432ba0 398 FUNC GLOBAL HIDDEN 6 __strlen_avx2
1577: 000000000042a4a0 8 FUNC GLOBAL HIDDEN 6
__mempcpy_avx512_no_vzeroupper
1595: 0000000000439700 8 FUNC GLOBAL HIDDEN 6
__mempcpy_avx512_unaligned
1598: 0000000000439310 8 FUNC GLOBAL HIDDEN 6
__mempcpy_avx_unaligned_erms
1629: 0000000000439750 8 FUNC GLOBAL HIDDEN 6
__mempcpy_avx512_unaligned_erms
1645: 00000000004392e0 47 FUNC GLOBAL HIDDEN 6
__memmove_avx_unaligned
1682: 0000000000438ca0 9 FUNC GLOBAL DEFAULT 6
__memset_chk_avx512_no_vzeroupper
1688: 000000000046a950 1141 FUNC GLOBAL HIDDEN 6
_dl_runtime_profile_avx
1759: 0000000000439fc0 337 FUNC GLOBAL HIDDEN 6
__memset_avx512_unaligned_erms
1770: 000000000045e900 717 FUNC GLOBAL HIDDEN 6 __memchr_avx2
1779: 000000000045f2b0 798 FUNC GLOBAL HIDDEN 6 __strnlen_avx2
1855: 0000000000439f40 24 FUNC GLOBAL HIDDEN 6
__wmemset_avx512_unaligned
1858: 0000000000439320 980 FUNC GLOBAL HIDDEN 6
__memcpy_avx_unaligned_erms
1864: 0000000000430b40 16 FUNC GLOBAL DEFAULT 6 __strcasecmp_avx
1884: 0000000000439710 58 FUNC GLOBAL HIDDEN 6
__memcpy_avx512_unaligned
1891: 000000000045eec0 454 FUNC GLOBAL HIDDEN 6 __strrchr_avx2
1957: 0000000000439320 980 FUNC GLOBAL HIDDEN 6
__memmove_avx_unaligned_erms
1978: 0000000000438cb0 624 FUNC GLOBAL HIDDEN 6
__memset_avx512_no_vzeroupper
Regards
Marek Zmysłowski
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-01-03 13:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01 0:00 Compile GLIBC without AVX support marekzmyslowski
2019-01-01 0:00 ` Florian Weimer
2019-01-01 0:00 ` marekzmyslowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).