2

I need to build for an i586 target (no MMX instructions) using GCC 5.3 within a i686 host environment (32 bit Ubuntu Docker container). The host toolchain is i686. Is there anyway to do this without building a i586 cross-compiler ?

crayguy
  • 75
  • 6

1 Answers1

0

Yes you can tell gcc to generate instructions for a particular machine type by specifying the -march=cpu-type option. See x86 Options in gcc documentation. So you would need something like this:

g++ -march=i586 [...]
Wurmloch
  • 519
  • 3
  • 9
  • Tried that. The generated binary still would not work on the target. Compiled a static binary also and it definitely contained MMX instructions most likely from glibc. – crayguy May 01 '16 at 08:37
  • 1
    I believe you have to link against the libc version (or a smaller one) that is installed on the target machine. I would try to compile the old libc version on your build system (again using -march=i586), and link against that. maybe this helps: [http://stackoverflow.com/questions/2728552/how-to-link-to-a-different-libc-file](http://stackoverflow.com/questions/2728552/how-to-link-to-a-different-libc-file) – Wurmloch May 01 '16 at 08:50