Bug 463027

Summary: broken check for MPX instruction support in assembler
Product: [Developer tools] valgrind Reporter: Samuel Bronson <naesten>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: normal CC: pjfloyd
Priority: NOR    
Version First Reported In: 3.21 GIT   
Target Milestone: ---   
Platform: Other   
OS: Other   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Samuel Bronson 2022-12-14 04:26:24 UTC
SUMMARY
There is a syntax error in the "if amd64 assembler knows the MPX instructions" check.
The assembler never gets to see it.

STEPS TO REPRODUCE
1. On amd64, follow the build instructions from README, up through step 4

OBSERVED RESULT
The configure output includes the line:
checking if amd64 assembler knows the MPX instructions... no

EXPECTED RESULT
With a sufficiently-new assembler, it should instead be:
checking if amd64 assembler knows the MPX instructions... yes

SOFTWARE/OS VERSIONS
gcc (Debian 10.2.1-6) 10.2.1 20210110
GNU assembler (GNU Binutils for Debian) 2.35.2

ADDITIONAL INFORMATION
The relevant portion of config.log is:
configure:12750: checking if amd64 assembler knows the MPX instructions
configure:12773: gcc -c   conftest.c >&5
conftest.c: In function 'main':
conftest.c:51:11: error: expected ':' or ')' before 'bnd'
   51 |           bnd jmp  end\n"
      |           ^~~
conftest.c:51:23: error: stray '\' in program
   51 |           bnd jmp  end\n"
      |                       ^
conftest.c:51:25: warning: missing terminating " character
   51 |           bnd jmp  end\n"
      |                         ^
conftest.c:51:25: error: missing terminating " character
conftest.c:52:23: error: stray '\' in program
   52 |           foo: bnd ret\n"
      |                       ^
conftest.c:52:25: warning: missing terminating " character
   52 |           foo: bnd ret\n"
      |                         ^
conftest.c:52:25: error: missing terminating " character
conftest.c:53:19: warning: missing terminating " character
   53 |           end: nop");
      |                   ^
conftest.c:53:19: error: missing terminating " character
   53 |           end: nop");
      |                   ^~~
configure:12773: $? = 1

However, it's actually just missing some starting " characters.
See attached patch. The test even passes!
Comment 1 Paul Floyd 2022-12-14 09:13:14 UTC
Thanks for the analysis, but it looks like you forgot to add the patch.
Comment 2 Paul Floyd 2022-12-23 13:52:14 UTC
commit 316282cd3b357fe94cac466754adb42c17fad7d2 (HEAD -> master, origin/master, origin/HEAD)
Author: Paul Floyd <pjfloyd@wanadoo.fr>
Date:   Fri Dec 23 14:49:39 2022 +0100

    Bug 463027 - broken check for MPX instruction support in assembler