x86_64: Improve Intel MPX check to reject incomplete Clang support

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

Commit Message

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(+)

-- 
2.33.0.882.g93a45727a2-goog

Comments

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.
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 ?
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.

-- 
H.J.

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