This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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
rightly IMO).

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.

Index: gcc/config/mips/mips.c
--- 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.  */
+    model = TLS_MODEL_LOCAL_EXEC;
   switch (model)
@@ -2078,7 +2083,6 @@ mips_legitimize_tls_address (rtx loc)
       if (Pmode == DImode)
 	emit_insn (gen_tls_get_tp_di (v1));

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]