forked from jimenezrick/patch-AuthenticAMD
-
Notifications
You must be signed in to change notification settings - Fork 0
Utility to patch binaries generated by the Intel Compiler to run on any CPU
License
tjahns/patch-for-any-cpu
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
patch-for-any-cpu
====================
Utility to patch binaries generated by the Intel compilers to run on
any CPU.
The Intel compilers add a CPUID test to generated binaries that looks
if they are executed on a Intel CPU, so the binaries don't run on
non-Intel CPUs. This utility patches such CPUID tests, so the binaries
can run on an any CPU as if they were on a Intel CPU, provided the
same features are available.
**Tested on Linux with Intel C Compiler 16.0.8.266 (it might work with
future releases of ICC). Maybe it also works with Fortran compiler if
it has the same CPUID test, but this is not confirmed.**
The patching is designed to work with multiple versions of the Intel
compilers but that needs further testing at the moment.
Currently it appears binaries prog.x that match the following
nm prog.x | grep -E '^[0-9a-f]{16} [tT] __intel_cpu_features_init_body'
need patching in some cases. In case the symbol is linked from an
Intel library (U instead of t or T) that library will need to be
patched. This can result if a program was built the -shared-intel
option.
How to compile
----------------
You must have the libelf library. In Ubuntu 8.04 just install the
package libelfg0-dev. On newer systems the library will be named
libelf-dev. With a version around 0.8.6 it should work well. Now you
can compile with the command:
make
How to patch a binary generated by Intel compilers
-------------------------------------------------------
Just run:
patch-for-any-cpu <executable_name>
How to patch the Intel C++ Compiler
-------------------------------------
In the /path/to/icc/lib there are the shared libraries used by the
compiler. It seems that patching all of them, the binaries generated
by ICC won't have the CPUID test. So they run perfectly in
AMD. Probably only one of the shared libraries is the responsible of
adding such test. Anyway, I can't confirm this because I didn't try
it.
**But you are warned that modifying, disassembling or reverse
engineering the Intel C++ Compiler goes against the Intel EULA (End
User License Agreement). So do at your own risk.**
If you want to try, run this command in /path/to/icc/lib:
for i in *; do patch-for-any-cpu -ev $i; done
Report results
----------------
Just open an issue on github.
The content of the doc directory
------------------------------------
- libelf by Example.mht: http://people.freebsd.org/~jkoshy/download/libelf/article.html
a tutorial for libelf in FreeBSD. Almost everything it says is valid for Linux.
- naughty-intel.html: the person who wrote this article explains everything one need to know about
the subject.
How it works
--------------
This is derived from the patch-AuthenticAMD utility which replaces three CMP
instructions by other three CMPs that look for the vendor string
AuthenticAMD. But instead each cmp and the following conditional jump
are replaced by NOPs.
About
Utility to patch binaries generated by the Intel Compiler to run on any CPU
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published
Languages
- C 97.4%
- Makefile 2.6%