GCC and such supports response files, which looks like this
where foo.rsp is just a textfile with many many flags
-o foo -lfoo -blablabla -asdf -sdfg -dfgh
Ninja was going this for me automatically i think when i was building QEMU (which have such long link lines it requires the use of a file, ~45k characters long).
It think this breaks linking for us with the rpath_wrappers, but I'm not 100% sure how it works out, other than that QEMU didn't end up using RPATH when linking, instead it used RUNPATH (which is kind of better?) by itself, so it still is OK.