[6/6] s390x: Use <gcc-macros.h> in early HWCAP check

Message ID 07f71c2a57d045f20aebc2217a7f7f635785e5f6.1642179009.git.fweimer@redhat.com
State New
Headers show
Series
  • Reliable CPU compatibility diagnostics in ld.so
Related show

Commit Message

Sunil K Pandey via Libc-alpha Jan. 14, 2022, 4:53 p.m.
This is required so that the checks still work if $(early-cflags)
selects a different ISA level.
---
 sysdeps/s390/s390-64/dl-hwcap-check.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.34.1

Comments

Sunil K Pandey via Libc-alpha Jan. 14, 2022, 6:52 p.m. | #1
On 1/14/22 11:53, Florian Weimer via Libc-alpha wrote:
> This is required so that the checks still work if $(early-cflags)

> selects a different ISA level.


LGTM. No regressions on x86_64 and i686 builders. No CI/CD regressions.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>

Tested-by: Carlos O'Donell <carlos@redhat.com>



> ---

>  sysdeps/s390/s390-64/dl-hwcap-check.h | 5 +++--

>  1 file changed, 3 insertions(+), 2 deletions(-)

> 


[carlos@athas glibc-pristine]$ grep -rl '__ARCH__' *
sysdeps/s390/s390-64/dl-hwcap-check.h

Just one file we care about wrapping.


> diff --git a/sysdeps/s390/s390-64/dl-hwcap-check.h b/sysdeps/s390/s390-64/dl-hwcap-check.h

> index 53e02250b8..f769932325 100644

> --- a/sysdeps/s390/s390-64/dl-hwcap-check.h

> +++ b/sysdeps/s390/s390-64/dl-hwcap-check.h

> @@ -19,17 +19,18 @@

>  #ifndef _DL_HWCAP_CHECK_H

>  #define _DL_HWCAP_CHECK_H

>  

> +#include <gcc-macros.h>


OK. 2 checks need wrapping.

>  #include <ldsodefs.h>

>  

>  static inline void

>  dl_hwcap_check (void)

>  {

>  #if defined __ARCH__

> -# if __ARCH__ >= 13

> +# if GCCMACRO__ARCH__ >= 13


OK. 1/2.

>    if (!(GLRO(dl_hwcap) & HWCAP_S390_VXRS_EXT2))

>      _dl_fatal_printf ("\

>  Fatal glibc error: CPU lacks VXRS_EXT2 support (z15 or later required)\n");

> -# elif __ARCH__ >= 12

> +# elif GCCMACRO__ARCH__ >= 12


OK. 2/2.

>    if (!(GLRO(dl_hwcap) & HWCAP_S390_VXE))

>      _dl_fatal_printf ("\

>  Fatal glibc error: CPU lacks VXE support (z14 or later required)\n");



-- 
Cheers,
Carlos.

Patch

diff --git a/sysdeps/s390/s390-64/dl-hwcap-check.h b/sysdeps/s390/s390-64/dl-hwcap-check.h
index 53e02250b8..f769932325 100644
--- a/sysdeps/s390/s390-64/dl-hwcap-check.h
+++ b/sysdeps/s390/s390-64/dl-hwcap-check.h
@@ -19,17 +19,18 @@ 
 #ifndef _DL_HWCAP_CHECK_H
 #define _DL_HWCAP_CHECK_H
 
+#include <gcc-macros.h>
 #include <ldsodefs.h>
 
 static inline void
 dl_hwcap_check (void)
 {
 #if defined __ARCH__
-# if __ARCH__ >= 13
+# if GCCMACRO__ARCH__ >= 13
   if (!(GLRO(dl_hwcap) & HWCAP_S390_VXRS_EXT2))
     _dl_fatal_printf ("\
 Fatal glibc error: CPU lacks VXRS_EXT2 support (z15 or later required)\n");
-# elif __ARCH__ >= 12
+# elif GCCMACRO__ARCH__ >= 12
   if (!(GLRO(dl_hwcap) & HWCAP_S390_VXE))
     _dl_fatal_printf ("\
 Fatal glibc error: CPU lacks VXE support (z14 or later required)\n");