https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97787
--- Comment #8 from rguenther at suse dot de <rguenther at suse dot de> --- On Fri, 13 Nov 2020, bunk at stusta dot de wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97787 > > --- Comment #7 from Adrian Bunk <bunk at stusta dot de> --- > (In reply to Richard Biener from comment #6) > > I see. Still GCC or GAS produces a bogus object file (the original linker > > error). It might be the new problem is an entirely different one? It looks > > more and more like a target problem to me. > > My guess would be that the situations where -mxgot is required on 64bit MIPS > are not (no longer?) handled properly with LTO. > > Note that when compiling from precompiled sources the linker also exits with > an > error, the main difference in that case is that the correct "relocation > truncated to fit" error message is not output in the LTO case. > > More worrisome is that adding -mxgot to compiler and linker flags did not fix > it in the LTO case. I guess it is because -mxgot is supposed to be handled by the assembler? I see %{mgp32} %{mgp64} %{march=*} %{mxgot:-xgot} \ in ASM_SPEC. I guess this doesn't make it to COLLECT_AS_OPTIONS and eventually makes it dropped from COLLECT_GCC_OPTIONS as well. Can you attach the full output of compiling & linking with -v added? Can you try using -mxgot -Wa,-xgot or -mxgot -Xassembler -xgot at compile time?