https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79560
Bug ID: 79560 Summary: libgccjit is broken on generic mips targets Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: james410 at cowgill dot org.uk Target Milestone: --- Originally from https://bugs.debian.org/798710 On generic MIPS targets (ie something like mipsel-linux-gnu), libgccjit does not work. Running the "Smoketest example" from https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html gives this: > $ ./jit-test > /tmp/libgccjit-m3qxk4/fake.s: Assembler messages: > /tmp/libgccjit-m3qxk4/fake.s:16: Error: `fp=xx' used with a cpu lacking > ldc1/sdc1 instructions > /tmp/libgccjit-m3qxk4/fake.s:16: Error: `fp=xx' used with a cpu lacking > ldc1/sdc1 instructions > /tmp/libgccjit-m3qxk4/fake.s:17: Error: `fp=xx' used with a cpu lacking > ldc1/sdc1 instructions > /tmp/libgccjit-m3qxk4/fake.s:24: Error: `fp=xx' used with a cpu lacking > ldc1/sdc1 instructions > /tmp/libgccjit-m3qxk4/fake.s:26: Error: `fp=xx' used with a cpu lacking > ldc1/sdc1 instructions > /tmp/libgccjit-m3qxk4/fake.s:50: Error: `fp=xx' used with a cpu lacking > ldc1/sdc1 instructions > /tmp/libgccjit-m3qxk4/fake.s:51: Error: `fp=xx' used with a cpu lacking > ldc1/sdc1 instructions > libgccjit.so: error: error invoking gcc driver > NULL result Running the smoke test on a 64-bit target gives (and we'll ignore the binutils error for now...): > $ ./jit-test > Assembler messages: > Error: -march=mips1 is not compatible with the selected ABI > /tmp/libgccjit-LqHWBT/fake.s:16: Error: `gp=32' used with a 64-bit ABI > /tmp/libgccjit-LqHWBT/fake.s:16: Error: `fp=64' used with a 32-bit fpu > /tmp/libgccjit-LqHWBT/fake.s:16: Error: `fp=64' used with a 32-bit fpu > /tmp/libgccjit-LqHWBT/fake.s:17: Error: `fp=64' used with a 32-bit fpu > /tmp/libgccjit-LqHWBT/fake.s:24: Error: `fp=64' used with a 32-bit fpu > /tmp/libgccjit-LqHWBT/fake.s:25: Error: `fp=64' used with a 32-bit fpu > /tmp/libgccjit-LqHWBT/fake.s:26: Error: opcode not supported on this > processor: mips1 (mips1) `daddiu $sp,$sp,-48' > /tmp/libgccjit-LqHWBT/fake.s:27: Warning: macro instruction expanded into > multiple instructions > /tmp/libgccjit-LqHWBT/fake.s:28: Warning: macro instruction expanded into > multiple instructions > /tmp/libgccjit-LqHWBT/fake.s:29: Warning: macro instruction expanded into > multiple instructions > /tmp/libgccjit-LqHWBT/fake.s:32: Error: opcode not supported on this > processor: mips1 (mips1) `daddu $28,$28,$25' > /tmp/libgccjit-LqHWBT/fake.s:33: Error: opcode not supported on this > processor: mips1 (mips1) `daddiu $28,$28,%lo(%neg(%gp_rel(greet)))' > /tmp/libgccjit-LqHWBT/fake.s:34: Warning: macro instruction expanded into > multiple instructions > /tmp/libgccjit-LqHWBT/fake.s:35: Warning: macro instruction expanded into > multiple instructions > /tmp/libgccjit-LqHWBT/fake.s:36: Internal error! > Assertion failure in macro_build at ../../gas/config/tc-mips.c:8655. > Please report this bug. > libgccjit.so: error: error invoking gcc driver > NULL result This seems to be because libgccjit always passes -mips1 to the driver which is obviously wrong. In the Debian bug report, this was traced to add_multilib_driver_arguments where the contents of MULTILIB_DEFAULTS is passed to the driver. On MIPS this always includes the ISA level obtained from MIPS_ISA_DEFAULT, but on generic MIPS targets this is not defined and it falls back to mips1. I am wondering why MIPS_ISA_DEFAULT is even included in MULTILIB_DEFAULTS? If I remove the ISA, libgccjit works again (or at least the smoke test works).