NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: port-i386/47061: ld.elf_so does not understand R_386_TLS_TPOFF32



The following reply was made to PR port-i386/47061; it has been noted by GNATS.

From: Nick Hudson <skrll%netbsd.org@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: port-i386-maintainer%netbsd.org@localhost,
 gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost
Subject: Re: port-i386/47061: ld.elf_so does not understand R_386_TLS_TPOFF32
Date: Fri, 19 Oct 2012 11:45:25 +0100

 --Boundary-00=_F9SgQ/Zj+/MZhXf
 Content-Type: text/plain;
   charset="iso-8859-15"
 Content-Transfer-Encoding: 7bit
 
 On Friday 12 October 2012 11:20:00 apb%cequrux.com@localhost wrote:
 > >Number:         47061
 > >Category:       port-i386
 > >Synopsis:       ld.elf_so does not understand R_386_TLS_TPOFF32
 
 The attached patch adds support and adds in addend (presumably always zero) 
 for R_386_TLS_TPOFF.
 
 It's untested.
 
 Nick
 
 --Boundary-00=_F9SgQ/Zj+/MZhXf
 Content-Type: text/x-patch;
   charset="iso-8859-1";
   name="pr47061.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
        filename="pr47061.diff"
 
 Index: libexec/ld.elf_so/arch/i386/mdreloc.c
 ===================================================================
 RCS file: /cvsroot/src/libexec/ld.elf_so/arch/i386/mdreloc.c,v
 retrieving revision 1.34
 diff -u -p -u -r1.34 mdreloc.c
 --- libexec/ld.elf_so/arch/i386/mdreloc.c      25 Mar 2011 18:07:05 -0000      
1.34
 +++ libexec/ld.elf_so/arch/i386/mdreloc.c      19 Oct 2012 10:11:18 -0000
 @@ -121,6 +121,7 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
                        break;
  
                case R_TYPE(TLS_TPOFF):
 +              case R_TYPE(TLS_TPOFF32):
                        def = _rtld_find_symdef(symnum, obj, &defobj, false);
                        if (def == NULL)
                                return -1;
 @@ -129,9 +130,13 @@ _rtld_relocate_nonplt_objects(Obj_Entry 
                            _rtld_tls_offset_allocate(obj))
                                return -1;
  
 -                      *where = (Elf_Addr)(def->st_value - defobj->tlsoffset);
 +                      if (ELF_R_TYPE(rel->r_info) == R_TYPE(TLS_TPOFF))
 +                              *where += (Elf_Addr)(def->st_value - 
defobj->tlsoffset);
 +                      else
 +                              *where += (Elf_Addr)(defobj->tlsoffset - 
def->st_value);
  
 -                      rdbg(("TLS_TPOFF %s in %s --> %p",
 +                      rdbg(("TLS_TPOFF%s %s in %s --> %p",
 +                          ELF_R_TYPE(rel->r_info) == R_TYPE(TLS_TPOFF) ? "" : 
"32",
                            obj->strtab + obj->symtab[symnum].st_name,
                            obj->path, (void *)*where));
                        break;
 
 --Boundary-00=_F9SgQ/Zj+/MZhXf--
 


Home | Main Index | Thread Index | Old Index