x86: In ld.so, diagnose missing APX support in APX-only builds

Message ID 875xw563so.fsf@oldenburg.str.redhat.com
State Committed
Commit b62928f9070c6f3c5cc43a4cb89b4bfb950d7406
Headers
Series x86: In ld.so, diagnose missing APX support in APX-only builds |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Testing passed

Commit Message

Florian Weimer April 25, 2024, 12:10 p.m. UTC
  At this point, this is mainly a tool for testing the early ld.so
CPU compatibility diagnostics: GCC uses the new instructions in most
functions, so it's easy to spot if some of the early code is not
built correctly.  (No such problems were flagged for the current
tree.)

---
 sysdeps/x86/dl-get-cpu-features.c | 5 +++++
 1 file changed, 5 insertions(+)


base-commit: 3a3a4497421422aa854c855cbe5110ca7d598ffc
  

Comments

H.J. Lu April 25, 2024, 2:50 p.m. UTC | #1
On Thu, Apr 25, 2024 at 5:11 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> At this point, this is mainly a tool for testing the early ld.so
> CPU compatibility diagnostics: GCC uses the new instructions in most
> functions, so it's easy to spot if some of the early code is not
> built correctly.  (No such problems were flagged for the current
> tree.)
>
> ---
>  sysdeps/x86/dl-get-cpu-features.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/sysdeps/x86/dl-get-cpu-features.c b/sysdeps/x86/dl-get-cpu-features.c
> index 4d6c5c59a6..579d02d638 100644
> --- a/sysdeps/x86/dl-get-cpu-features.c
> +++ b/sysdeps/x86/dl-get-cpu-features.c
> @@ -64,6 +64,11 @@ Fatal glibc error: CPU does not support x86-64-v%d\n", 4);
>  #    endif /* ISA level 4 */
>  #   endif /* ISA level 3 */
>  #  endif /* ISA level 2 */
> +# ifdef GCCMACRO__APX_F__
> +      if (!CPU_FEATURE_USABLE_P (cpu_features, APX_F))
> +       _dl_fatal_printf ("\
> +Fatal glibc error: CPU does not support APX\n");
> +# endif
>  # endif /* IS_IN (rtld) */
>      }
>  }
>
> base-commit: 3a3a4497421422aa854c855cbe5110ca7d598ffc
>

LGTM.

Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

BTW, this patch:

https://patchwork.sourceware.org/project/glibc/list/?series=33161

is also required.

Thanks.
  
H.J. Lu April 25, 2024, 2:57 p.m. UTC | #2
On Thu, Apr 25, 2024 at 7:50 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Thu, Apr 25, 2024 at 5:11 AM Florian Weimer <fweimer@redhat.com> wrote:
> >
> > At this point, this is mainly a tool for testing the early ld.so
> > CPU compatibility diagnostics: GCC uses the new instructions in most
> > functions, so it's easy to spot if some of the early code is not
> > built correctly.  (No such problems were flagged for the current
> > tree.)
> >
> > ---
> >  sysdeps/x86/dl-get-cpu-features.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/sysdeps/x86/dl-get-cpu-features.c b/sysdeps/x86/dl-get-cpu-features.c
> > index 4d6c5c59a6..579d02d638 100644
> > --- a/sysdeps/x86/dl-get-cpu-features.c
> > +++ b/sysdeps/x86/dl-get-cpu-features.c
> > @@ -64,6 +64,11 @@ Fatal glibc error: CPU does not support x86-64-v%d\n", 4);
> >  #    endif /* ISA level 4 */
> >  #   endif /* ISA level 3 */
> >  #  endif /* ISA level 2 */
> > +# ifdef GCCMACRO__APX_F__
> > +      if (!CPU_FEATURE_USABLE_P (cpu_features, APX_F))
> > +       _dl_fatal_printf ("\
> > +Fatal glibc error: CPU does not support APX\n");
> > +# endif
> >  # endif /* IS_IN (rtld) */
> >      }
> >  }
> >
> > base-commit: 3a3a4497421422aa854c855cbe5110ca7d598ffc
> >
>
> LGTM.
>
> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
>
> BTW, this patch:
>
> https://patchwork.sourceware.org/project/glibc/list/?series=33161

The v2 patch:

https://patchwork.sourceware.org/project/glibc/list/?series=33162

to keep # in gdb backtrace.

> is also required.
>
> Thanks.
>
> --
> H.J.
  
Florian Weimer April 25, 2024, 2:58 p.m. UTC | #3
* H. J. Lu:

> On Thu, Apr 25, 2024 at 5:11 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> At this point, this is mainly a tool for testing the early ld.so
>> CPU compatibility diagnostics: GCC uses the new instructions in most
>> functions, so it's easy to spot if some of the early code is not
>> built correctly.  (No such problems were flagged for the current
>> tree.)
>>
>> ---
>>  sysdeps/x86/dl-get-cpu-features.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/sysdeps/x86/dl-get-cpu-features.c b/sysdeps/x86/dl-get-cpu-features.c
>> index 4d6c5c59a6..579d02d638 100644
>> --- a/sysdeps/x86/dl-get-cpu-features.c
>> +++ b/sysdeps/x86/dl-get-cpu-features.c
>> @@ -64,6 +64,11 @@ Fatal glibc error: CPU does not support x86-64-v%d\n", 4);
>>  #    endif /* ISA level 4 */
>>  #   endif /* ISA level 3 */
>>  #  endif /* ISA level 2 */
>> +# ifdef GCCMACRO__APX_F__
>> +      if (!CPU_FEATURE_USABLE_P (cpu_features, APX_F))
>> +       _dl_fatal_printf ("\
>> +Fatal glibc error: CPU does not support APX\n");
>> +# endif
>>  # endif /* IS_IN (rtld) */
>>      }
>>  }
>>
>> base-commit: 3a3a4497421422aa854c855cbe5110ca7d598ffc
>>
>
> LGTM.
>
> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>

Thanks.

> BTW, this patch:
>
> https://patchwork.sourceware.org/project/glibc/list/?series=33161
>
> is also required.

Oh, I didn't test with GLIBC_TUNABLES.  I'm going to remove the
incorrect claim from the commit message.

Florian
  

Patch

diff --git a/sysdeps/x86/dl-get-cpu-features.c b/sysdeps/x86/dl-get-cpu-features.c
index 4d6c5c59a6..579d02d638 100644
--- a/sysdeps/x86/dl-get-cpu-features.c
+++ b/sysdeps/x86/dl-get-cpu-features.c
@@ -64,6 +64,11 @@  Fatal glibc error: CPU does not support x86-64-v%d\n", 4);
 #    endif /* ISA level 4 */
 #   endif /* ISA level 3 */
 #  endif /* ISA level 2 */
+# ifdef GCCMACRO__APX_F__
+      if (!CPU_FEATURE_USABLE_P (cpu_features, APX_F))
+	_dl_fatal_printf ("\
+Fatal glibc error: CPU does not support APX\n");
+# endif
 # endif /* IS_IN (rtld) */
     }
 }