Fix for "Unsupported relocation type" ?

Nathaniel W. Filardo nwf at andrew.cmu.edu
Thu May 5 10:39:04 PDT 2005


Unsure of the proper place to send this, I'll post it here and see what 
happens.

There have been a few reports of "Unsupported relocation type" with type 
R_386_TLS_TPOFF32.  This patch fixes the problem locally enough to let 
lang/ruby18 (with errno definitions removed) build successfully where it 
could not before.  If this was already in the works, sorry for stepping on 
toes.

--nwf;--- ./libexec/rtld-elf/i386/reloc.c.orig-nwf	2005-05-05 12:26:45.000000000 -0400
+++ ./libexec/rtld-elf/i386/reloc.c	2005-05-05 12:27:38.000000000 -0400
@@ -236,6 +236,36 @@
 		}
 		break;
 
+	    case R_386_TLS_TPOFF32:
+		{
+		    const Elf_Sym *def;
+		    const Obj_Entry *defobj;
+
+		    def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
+		      false, cache);
+		    if (def == NULL)
+			goto done;
+
+		    /*
+		     * We lazily allocate offsets for static TLS as we
+		     * see the first relocation that references the
+		     * TLS block. This allows us to support (small
+		     * amounts of) static TLS in dynamically loaded
+		     * modules. If we run out of space, we generate an
+		     * error.
+		     */
+		    if (!defobj->tls_done) {
+			if (!allocate_tls_offset((Obj_Entry*) defobj)) {
+			    _rtld_error("%s: No space available for static "
+					"Thread Local Storage", obj->path);
+			    goto done;
+			}
+		    }
+
+		    *where += (Elf_Addr) (defobj->tlsoffset - def->st_value);
+		}
+		break;
+
 	    case R_386_TLS_DTPMOD32:
 		{
 		    const Elf_Sym *def;




More information about the Users mailing list