The -mxgot flag was negatively effecting certain micromips builds. This patch narrows its use to to only mips64 targets.
Generally the patch looks good. But when I remove -mxgot option completely and unconditionally and run LLVM test suite in both 32 and 64-bit modes, I did not see any new failures. I used both LLD and GNU BFD linkers. Could you check it? What tests and what configurations will fail?
This test will fail for mips64r6 n64 configurations with -O0 or -O1. I think those are the minimal requirements for reproducing the failure and adding other flags shouldn't have an effect on the result.
As for simplifying, I could maybe remove the -mcpu= part from the comparison. Do you think that would a nicer solution or does leaving the full flag give more context without effecting generality?
Thanks. I could reproduce the problem with the -O0 option. But I could reproduce the problem for both -mips64r2 and -mips64r6 flags. Is it true for you? If so, I would check for something like $(findstring -mabi=64, $(TARGET_FLAGS)).