Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LoongArch: Adjust symbol addressing for CONFIG_AS_HAS_EXPLICIT_RELOCS
If explicit relocation hints is used by the toolchain, -Wa,-mla-* options will be useless for C code. Only use them for !CONFIG_AS_HAS_EXPLICIT_RELOCS. Replace "la" with "la.pcrel" in head.S to keep the semantic consistent with new and old toolchains for the low level startup code. For per-CPU variables, the "address" of the symbol is actually an offset from $r21. The value is nearing the loading address of main kernel image, but far from the address of modules. Use model("extreme") attibute to tell the compiler that a a PC-relative addressing with 32-bit offset is not sufficient for local per-CPU variables. The behavior with different assemblers and compilers are summarized in the following table: AS has CC has explicit reloc explicit reloc * Behavior ============================================================== No No Use la.* macros. No change from Linux 6.0. -------------------------------------------------------------- No Yes Disable explicit reloc. No change from Linux 6.0. -------------------------------------------------------------- Yes No Not supported. -------------------------------------------------------------- Yes Yes Use explicit relocs. No -Wa,-mla* options. ============================================================== *: We assume CC must have model attribute if it has explicit reloc. Both features are added in GCC 13 development cycle, so any GCC release >= 13 should be OK. Using early GCC 13 development snapshots may produce modules with unsupported relocations. Link: https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=f09482a Link: https://gcc.gnu.org/r13-1834 Link: https://gcc.gnu.org/r13-2199 Signed-off-by: Xi Ruoyao <[email protected]>
- Loading branch information