GCC 5.1でmips32r5とか、mips32r6とかがサポートになったとしても、何故だかコンパイルはできても、リンクが出来ない。
unrecognised emulation mode : -ips32 (詳細メモしておくの忘れた...)
どうやら、binutilsがちゃんとこれらのオプションをサポートしてないようだった。
LDのオプション周りをチェックすると何とかなるかも知れないと思い、grepしまくっていたら、./ld/ldmain.cに以下のような記述を見つけた。
else if (strcmp (argv[i], "-mips1") == 0 || strcmp (argv[i], "-mips2") == 0 || strcmp (argv[i], "-mips3") == 0 || strcmp (argv[i], "-mips4") == 0 || strcmp (argv[i], "-mips5") == 0 || strcmp (argv[i], "-mips32") == 0 || strcmp (argv[i], "-mips32r2") == 0 || strcmp (argv[i], "-mips32r6") == 0 || strcmp (argv[i], "-mips64") == 0 || strcmp (argv[i], "-mips64r2") == 0 || strcmp (argv[i], "-mips64r6") == 0) { /* FIXME: The arguments -mips1, -mips2, -mips3, etc. are passed to the linker by some MIPS compilers. They generally tell the linker to use a slightly different library path. Perhaps someday these should be implemented as emulations; until then, we just ignore the arguments and hope that nobody ever creates emulations named ips1, ips2 or ips3. */
mips32r5が無い。これにr5を付け加えると動作するんじゃないかという単純な発想だ(本当か...?) ついでに、これだけでは動作しなかったので、
const char *mips_emul_mode = "elf32elmip"; ... else if (strcmp (argv[i], "-mips1") == 0 || strcmp (argv[i], "-mips2") == 0 || strcmp (argv[i], "-mips3") == 0 || strcmp (argv[i], "-mips4") == 0 || strcmp (argv[i], "-mips5") == 0 || strcmp (argv[i], "-mips32") == 0 || strcmp (argv[i], "-mips32r2") == 0 || strcmp (argv[i], "-mips32r4") == 0 || strcmp (argv[i], "-mips32r5") == 0 || strcmp (argv[i], "-mips32r6") == 0 || strcmp (argv[i], "-mips64") == 0 || strcmp (argv[i], "-mips64r2") == 0 || strcmp (argv[i], "-mips64r4") == 0 || strcmp (argv[i], "-mips64r5") == 0 || strcmp (argv[i], "-mips64r6") == 0) { /* FIXME: The arguments -mips1, -mips2, -mips3, etc. are passed to the linker by some MIPS compilers. They generally tell the linker to use a slightly different library path. Perhaps someday these should be implemented as emulations; until then, we just ignore the arguments and hope that nobody ever creates emulations named ips1, ips2 or ips3. */ emulation = mips_emul_mode;
という自分でも何だか良く分からない大改造を施し、binutilsをリビルドするとうまく動作してしまった。
という訳で作ってみたGCC5.1のMIPSコンパイラでCoremarkをコンパイルし、試しにシミュレータで命令数をカウントすると、
- GCC4.8 : 352539
- GCC5.1 : 310851
うそぉ、1割くらい削減されてない...?どうなってるのか詳細を調査する予定。