This is the mail archive of the
mailing list for the GCC project.
Fix implementation of MIPS TLS for !TARGET_ABICALLS
- From: Richard Sandiford <richard at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 08 Oct 2006 15:41:03 +0100
- Subject: Fix implementation of MIPS TLS for !TARGET_ABICALLS
On MIPS, !TARGET_ABICALLS code can only be used to create static
executables, and such code should not use a GOT. All TLS models
reduce to local exec in this situation.
(I think it _is_ worth allowing local-exec TLS for !TARGET_ABICALLS.
I can imagine an OS using a *-elf-like toolchain but having enough
thread support to handle this simple case. In fact, I don't see
any reason why a stock *-elf toolchain couldn't be used in this
This patch fixes the tls/alias-1.c on mipsisa64-elf. The test
previously failed to link because we were trying to use a GOT,
and the idt64.ld script doesn't have a GOT section (quite
Tested on mipsisa64-elf and applied. Thanks to Dan for blessing
the idea as being at least vaguely sensisible, though of course
all errors are my own.
* config/mips/mips.c (mips_legitimize_tls_address): Implement
all TLS models in the same way as local exec if !TARGET_ABICALLS.
Remove stray newline.
--- gcc/config/mips/mips.c (revision 117553)
+++ gcc/config/mips/mips.c (working copy)
@@ -2036,6 +2036,11 @@ mips_legitimize_tls_address (rtx loc)
v1 = gen_rtx_REG (Pmode, GP_RETURN + 1);
model = SYMBOL_REF_TLS_MODEL (loc);
+ /* Only TARGET_ABICALLS code can have more than one module; other
+ code must be be static and should not use a GOT. All TLS models
+ reduce to local exec in this situation. */
+ if (!TARGET_ABICALLS)
+ model = TLS_MODEL_LOCAL_EXEC;
@@ -2078,7 +2083,6 @@ mips_legitimize_tls_address (rtx loc)
if (Pmode == DImode)
emit_insn (gen_tls_get_tp_di (v1));