diff options
author | Xi Ruoyao <xry111@xry111.site> | 2024-01-22 18:07:42 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2024-01-23 16:01:59 +0800 |
commit | f12317306ee714aed0ca7ed01cafa520296b4c4c (patch) | |
tree | 189833cea00449a684fe52e7eb98791c9e94b893 /gcc/config | |
parent | 23ebb09ed2e88c1f292d4232c1fd2974cc5c79e6 (diff) | |
download | gcc-f12317306ee714aed0ca7ed01cafa520296b4c4c.zip gcc-f12317306ee714aed0ca7ed01cafa520296b4c4c.tar.gz gcc-f12317306ee714aed0ca7ed01cafa520296b4c4c.tar.bz2 |
LoongArch: Disable explicit reloc for TLS LD/GD with -mexplicit-relocs=auto
Binutils 2.42 supports TLS LD/GD relaxation which requires the assembler
macro.
gcc/ChangeLog:
* config/loongarch/loongarch.cc (loongarch_explicit_relocs_p):
If la_opt_explicit_relocs is EXPLICIT_RELOCS_AUTO, return false
for SYMBOL_TLS_LDM and SYMBOL_TLS_GD.
(loongarch_call_tls_get_addr): Do not split symbols of
SYMBOL_TLS_LDM or SYMBOL_TLS_GD if la_opt_explicit_relocs is
EXPLICIT_RELOCS_AUTO.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/explicit-relocs-auto-tls-ld-gd.c: Check
for la.tls.ld and la.tls.gd.
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/loongarch/loongarch.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc index 8246747..072c68d 100644 --- a/gcc/config/loongarch/loongarch.cc +++ b/gcc/config/loongarch/loongarch.cc @@ -1970,11 +1970,11 @@ loongarch_explicit_relocs_p (enum loongarch_symbol_type type) { case SYMBOL_TLS_IE: case SYMBOL_TLS_LE: - case SYMBOL_TLSGD: - case SYMBOL_TLSLDM: case SYMBOL_PCREL64: - /* The linker don't know how to relax TLS accesses or 64-bit - pc-relative accesses. */ + /* TLS IE cannot be relaxed. TLS LE relaxation is different from + the normal R_LARCH_RELAX-based relaxation and it **requires** + using the explicit %le_{lo12,hi20,add}_r relocs. The linker + does not relax 64-bit pc-relative accesses as at now. */ return true; case SYMBOL_GOT_DISP: /* The linker don't know how to relax GOT accesses in extreme @@ -2789,7 +2789,7 @@ loongarch_call_tls_get_addr (rtx sym, enum loongarch_symbol_type type, rtx v0) start_sequence (); - if (la_opt_explicit_relocs != EXPLICIT_RELOCS_NONE) + if (la_opt_explicit_relocs == EXPLICIT_RELOCS_ALWAYS) { /* Split tls symbol to high and low. */ rtx high = gen_rtx_HIGH (Pmode, copy_rtx (loc)); |