LoongArch: Add DT_RELR support

The logic is same as a71d876801 ("aarch64: Add DT_RELR support").

As LoongArch does not have -z dynamic-undefined-weak, we don't need to
consider UNDEFWEAK_NO_DYNAMIC_RELOC.

The linker relaxation adds another layer of complexity.  When we delete
bytes in a section during relaxation, we need to fix up the offset in
the to-be-packed relative relocations against this section.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
This commit is contained in:
Xi Ruoyao
2024-06-30 15:18:24 +08:00
committed by liuzhensong
parent 17cae6980b
commit d89ecf33ab
3 changed files with 486 additions and 4 deletions

View File

@@ -474,6 +474,7 @@ proc supports_dt_relr {} {
|| [istarget i?86-*-*]
|| [istarget powerpc64*-*-*]
|| [istarget aarch64*-*-*])
|| [istarget loongarch64*-*-*]
&& ([istarget *-*-linux*]
|| [istarget *-*-gnu*]) } {
return 1