On {mips,mipsel,mips64,mips64el}-freebsd, we need to pass any -G option to the linker. See also:
https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html#index-G-2007
This has been adapted from https://reviews.freebsd.org/D1190, with an added test case.