Bug 412344 - Problem setting mips flags with specific paths
Summary: Problem setting mips flags with specific paths
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: 3.15 SVN
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-26 02:52 UTC by Chris Packham
Modified: 2019-11-06 17:10 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
patch for configure.ac (629 bytes, patch)
2019-09-26 04:16 UTC, Chris Packham
Details
patch for configure.ac (975 bytes, patch)
2019-09-26 04:30 UTC, Chris Packham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Packham 2019-09-26 02:52:37 UTC
SUMMARY

Hi,

We have a bulid environment/CI system where we are cross-compiling valgrind for various architectures. Due to the way the CI system creates it's working directories such as ${os}-${arch} we end up with paths like /workspace/linux-mips64/output which are included as part of the sysroot when cross-compiling.

Our configure invocation ends up like this

CFLAGS='--sysroot=/workspace/linux-mips64/sysroot -g2 -gz  -mabi=64 -O0' \
    ./configure --target=mips64-unknown-linux-gnu \
                --host=mips64-unknown-linux-gnu \
                --build=x86_64-linux-gnu ...

This trips up the following grep in configure.ac

https://sourceware.org/git/?p=valgrind.git;a=blob;f=configure.ac;hb=HEAD#l1751

It matches the 'linux-mips64' and skips the code that sets FLAG_M32 and FLAG_M64.

STEPS TO REPRODUCE
1. create sysroot in a path with 'linux-mips64' as a component
2. run 
  CFLAGS='--sysroot=/workspace/linux-mips64/sysroot -g2 -gz  -mabi=64 -O0' \
    ./configure --target=mips64-unknown-linux-gnu \
                --host=mips64-unknown-linux-gnu \
                --build=x86_64-linux-gnu
3. check values for FLAG_M32 and FLAG_M64 in config.log

OBSERVED RESULT

FLAG_M32 and FLAG_M64 are not set

EXPECTED RESULT

FLAG_M32='-mips32 -mabi=32' FLAG_M64='-march=mips64r2 -mabi=64'


SOFTWARE/OS VERSIONS
Linux: debian "buster"

ADDITIONAL INFORMATION
Comment 1 Chris Packham 2019-09-26 02:54:07 UTC
I think the solution probably lies in updating the grep patterns to anchor on non-word boundaries (e.g. \b) but I'm not sure how portable that is.
Comment 2 Chris Packham 2019-09-26 04:16:40 UTC
Created attachment 122873 [details]
patch for configure.ac

The attached patch seems to work for me on a linux system
Comment 3 Chris Packham 2019-09-26 04:30:42 UTC
Created attachment 122874 [details]
patch for configure.ac

Found a second instance that needs the same fix. Updated patch attached