Files
blis/travis/patch-ld-so.py
Devin Matthews 850a8a46c0 Test all x86_64 configurations*... (#212)
* Add custom SDE cpuid files.

* Set up testing of all x86_64 architectures (except bulldozer) using SDE.

* Update .travis.yml

[ci skip]

* Update do_testsuite.sh

[ci skip]

* Updated .travis.yml with my secret token.

Details:
- Replaced Devin's temporary secret token with my own, which is used by
  Travis when accessing the Intel SDE via Dropbox.

* Work around CPUID dispatch in glibc/libm by patching ld.so.

* Detect path of loader at runtime.

* Attempt to make SDE run on Travis

* Allow unpatched ld.so if we don't know how to patch it.

I *think* this only happens for older glibc without the multi-arch stuff (e.g. Ubuntu 14.04 on Travis), but who knows?

* Upgrade Travis to gcc-6 and binutils-2.26.

* Try to get Travis to use the right assembler.

* Apparently you need ld-2.26 too.

* Try to also patch ld.so from Ubuntu 14.04.

* Take the nuclear option.

* Account for non-absolute dependencies in ldd output.

* String manipulation fail.

* Update patch-ld-so.py

* Add Zen to SDE testing.

* Removed dead variable from travis/do_testsuite.sh.

Details:
- Removed 'BLIS_ENABLE_TEST_OUTPUT=yes' from make invocations in
  travis/do_testsuite.sh. This variable is no longer present in the
  BLIS build system (if it ever was?), and therefore has no effect.
2018-05-29 13:51:21 -05:00

17 lines
378 B
Python
Executable File

#!/usr/bin/env python
#
# Patch ld.so to disable runtime CPUID detection
# Taken from https://stackoverflow.com/a/44483482
#
import re
import sys
infile, outfile = sys.argv[1:]
d = open(infile, 'rb').read()
# Match CPUID(eax=0), "xor eax,eax" followed closely by "cpuid"
o = re.sub(b'(\x31\xc0.{0,32})\x0f\xa2', b'\\1\x66\x90', d)
#assert d != o
open(outfile, 'wb').write(o)