x86_64: Improve Intel MPX check to reject incomplete Clang support

Message ID 20211010232335.1679420-1-maskray@google.com
State Superseded
Headers
Series x86_64: Improve Intel MPX check to reject incomplete Clang support |

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent
dj/TryBot-32bit success Build for i686

Commit Message

Fangrui Song Oct. 10, 2021, 11:23 p.m. UTC
  LLVM integrated assembler has incomplete MPX support, e.g.
bnd is not supported while bndmov is supported:

    error: invalid instruction mnemonic 'bnd'

Improve the configure check so that HAVE_MPX_SUPPORT code can be
properly skipped.
---
 sysdeps/x86_64/configure    | 2 ++
 sysdeps/x86_64/configure.ac | 2 ++
 2 files changed, 4 insertions(+)
  

Comments

H.J. Lu Oct. 10, 2021, 11:37 p.m. UTC | #1
On Sun, Oct 10, 2021 at 4:23 PM Fangrui Song <maskray@google.com> wrote:
>
> LLVM integrated assembler has incomplete MPX support, e.g.
> bnd is not supported while bndmov is supported:
>
>     error: invalid instruction mnemonic 'bnd'
>
> Improve the configure check so that HAVE_MPX_SUPPORT code can be
> properly skipped.
> ---
>  sysdeps/x86_64/configure    | 2 ++
>  sysdeps/x86_64/configure.ac | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
> index 585279f83d..c3145e6030 100755
> --- a/sysdeps/x86_64/configure
> +++ b/sysdeps/x86_64/configure
> @@ -30,6 +30,8 @@ if ${libc_cv_asm_mpx+:} false; then :
>  else
>    cat > conftest.s <<\EOF
>          bndmov %bnd0,(%rsp)
> +        bnd
> +        jmp *%r11
>  EOF
>  if { ac_try='${CC-cc} -c $ASFLAGS conftest.s 1>&5'
>    { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
> index 29e14033c0..3c935d66e1 100644
> --- a/sysdeps/x86_64/configure.ac
> +++ b/sysdeps/x86_64/configure.ac
> @@ -14,6 +14,8 @@ dnl Check whether asm supports Intel MPX
>  AC_CACHE_CHECK(for Intel MPX support, libc_cv_asm_mpx, [dnl
>  cat > conftest.s <<\EOF
>          bndmov %bnd0,(%rsp)
> +        bnd
> +        jmp *%r11
>  EOF
>  if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
>    libc_cv_asm_mpx=yes
> --
> 2.33.0.882.g93a45727a2-goog
>

Intel MPX has been deprecated.   Can you simply remove MPX support?

Thanks.
  
Fangrui Song Oct. 11, 2021, 12:29 a.m. UTC | #2
On 2021-10-10, H.J. Lu wrote:
>On Sun, Oct 10, 2021 at 4:23 PM Fangrui Song <maskray@google.com> wrote:
>>
>> LLVM integrated assembler has incomplete MPX support, e.g.
>> bnd is not supported while bndmov is supported:
>>
>>     error: invalid instruction mnemonic 'bnd'
>>
>> Improve the configure check so that HAVE_MPX_SUPPORT code can be
>> properly skipped.
>> ---
>>  sysdeps/x86_64/configure    | 2 ++
>>  sysdeps/x86_64/configure.ac | 2 ++
>>  2 files changed, 4 insertions(+)
>>
>> diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
>> index 585279f83d..c3145e6030 100755
>> --- a/sysdeps/x86_64/configure
>> +++ b/sysdeps/x86_64/configure
>> @@ -30,6 +30,8 @@ if ${libc_cv_asm_mpx+:} false; then :
>>  else
>>    cat > conftest.s <<\EOF
>>          bndmov %bnd0,(%rsp)
>> +        bnd
>> +        jmp *%r11
>>  EOF
>>  if { ac_try='${CC-cc} -c $ASFLAGS conftest.s 1>&5'
>>    { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
>> diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
>> index 29e14033c0..3c935d66e1 100644
>> --- a/sysdeps/x86_64/configure.ac
>> +++ b/sysdeps/x86_64/configure.ac
>> @@ -14,6 +14,8 @@ dnl Check whether asm supports Intel MPX
>>  AC_CACHE_CHECK(for Intel MPX support, libc_cv_asm_mpx, [dnl
>>  cat > conftest.s <<\EOF
>>          bndmov %bnd0,(%rsp)
>> +        bnd
>> +        jmp *%r11
>>  EOF
>>  if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
>>    libc_cv_asm_mpx=yes
>> --
>> 2.33.0.882.g93a45727a2-goog
>>
>
>Intel MPX has been deprecated.   Can you simply remove MPX support?
>
>Thanks.
>
>-- 
>H.J.

Like https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/maskray/x86-mpx ?
  
H.J. Lu Oct. 11, 2021, 12:49 a.m. UTC | #3
On Sun, Oct 10, 2021 at 5:29 PM Fangrui Song <maskray@google.com> wrote:
>
>
> On 2021-10-10, H.J. Lu wrote:
> >On Sun, Oct 10, 2021 at 4:23 PM Fangrui Song <maskray@google.com> wrote:
> >>
> >> LLVM integrated assembler has incomplete MPX support, e.g.
> >> bnd is not supported while bndmov is supported:
> >>
> >>     error: invalid instruction mnemonic 'bnd'
> >>
> >> Improve the configure check so that HAVE_MPX_SUPPORT code can be
> >> properly skipped.
> >> ---
> >>  sysdeps/x86_64/configure    | 2 ++
> >>  sysdeps/x86_64/configure.ac | 2 ++
> >>  2 files changed, 4 insertions(+)
> >>
> >> diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
> >> index 585279f83d..c3145e6030 100755
> >> --- a/sysdeps/x86_64/configure
> >> +++ b/sysdeps/x86_64/configure
> >> @@ -30,6 +30,8 @@ if ${libc_cv_asm_mpx+:} false; then :
> >>  else
> >>    cat > conftest.s <<\EOF
> >>          bndmov %bnd0,(%rsp)
> >> +        bnd
> >> +        jmp *%r11
> >>  EOF
> >>  if { ac_try='${CC-cc} -c $ASFLAGS conftest.s 1>&5'
> >>    { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
> >> diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
> >> index 29e14033c0..3c935d66e1 100644
> >> --- a/sysdeps/x86_64/configure.ac
> >> +++ b/sysdeps/x86_64/configure.ac
> >> @@ -14,6 +14,8 @@ dnl Check whether asm supports Intel MPX
> >>  AC_CACHE_CHECK(for Intel MPX support, libc_cv_asm_mpx, [dnl
> >>  cat > conftest.s <<\EOF
> >>          bndmov %bnd0,(%rsp)
> >> +        bnd
> >> +        jmp *%r11
> >>  EOF
> >>  if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
> >>    libc_cv_asm_mpx=yes
> >> --
> >> 2.33.0.882.g93a45727a2-goog
> >>
> >
> >Intel MPX has been deprecated.   Can you simply remove MPX support?
> >
> >Thanks.
> >
> >--
> >H.J.
>
> Like https://sourceware.org/git/?p=glibc.git;a=shortlog;h=refs/heads/maskray/x86-mpx ?

The patch looks OK.  Commit message should mention MPX deprecation.

Thanks.
  

Patch

diff --git a/sysdeps/x86_64/configure b/sysdeps/x86_64/configure
index 585279f83d..c3145e6030 100755
--- a/sysdeps/x86_64/configure
+++ b/sysdeps/x86_64/configure
@@ -30,6 +30,8 @@  if ${libc_cv_asm_mpx+:} false; then :
 else
   cat > conftest.s <<\EOF
         bndmov %bnd0,(%rsp)
+        bnd
+        jmp *%r11
 EOF
 if { ac_try='${CC-cc} -c $ASFLAGS conftest.s 1>&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
diff --git a/sysdeps/x86_64/configure.ac b/sysdeps/x86_64/configure.ac
index 29e14033c0..3c935d66e1 100644
--- a/sysdeps/x86_64/configure.ac
+++ b/sysdeps/x86_64/configure.ac
@@ -14,6 +14,8 @@  dnl Check whether asm supports Intel MPX
 AC_CACHE_CHECK(for Intel MPX support, libc_cv_asm_mpx, [dnl
 cat > conftest.s <<\EOF
         bndmov %bnd0,(%rsp)
+        bnd
+        jmp *%r11
 EOF
 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
   libc_cv_asm_mpx=yes