[Mips] Use the local GOT sequence for forward references to local symbols (#242758)
In PIC mode the la and jal macros need to know if the symbol is local
or global. The assembler made that choice while parsing, so a symbol
that is defined later in the file was always treated as global. For
O32 this gave an R_MIPS_GOT16 without the matching R_MIPS_LO16 for la,
and an R_MIPS_CALL16 against a local symbol for jal, which GNU ld
rejects. jal on N32/N64 had the same R_MIPS_CALL16 problem.
GNU as waits until the end of the file to choose. Do the same: if the
symbol is not defined yet and has no explicit binding, emit a
PseudoGOTLoadGlobal. MipsAsmBackend relaxes it to PseudoGOTLoadLocal if
the symbol ends up local, and MipsMCCodeEmitter expands both into the
real instructions.
Symbols that stay undefined or become global get the same code as
before. XGOT and -mrelax-all keep the old behavior.
cplocal.s had a jal to a local symbol defined after it, so it now
gets R_MIPS_GOT_DISP instead of R_MIPS_CALL16.
Fixes #65020
Fixes #217373
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>