Author: andreast
Date: Mon Oct  1 18:46:35 2018
New Revision: 339072
URL: https://svnweb.freebsd.org/changeset/base/339072

Log:
  This commit reverts 338930. The approach was wrong.
  
  Fix the issue with subtracting the TLS_TCB_SIZE too when we are trying to get
  the 'where' in the R_PPC_TPREL32 case. At allocation time we added an offset
  and the TLS_TCB_SIZE. This has to be subtracted as well.
  
  Now all the issues reported are fixed. Tests were done on G4 and G5 
PowerMac's.
  Additionally I ran the tls tests from the gcc test suite and made sure the
  results are as good as pre 338486.
  
  Thanks to tuexen for reporting the malfunction and for patient testing.
  Also testing thanks goes to jhibbits.
  
  Reported by:  tuexen
  Discussed with:       jhibbits, nwhitehorn
  Approved by:  re (gjb)
  Pointyhat to: andreast

Modified:
  head/libexec/rtld-elf/powerpc/reloc.c
  head/libexec/rtld-elf/powerpc/rtld_machdep.h

Modified: head/libexec/rtld-elf/powerpc/reloc.c
==============================================================================
--- head/libexec/rtld-elf/powerpc/reloc.c       Mon Oct  1 18:26:41 2018        
(r339071)
+++ head/libexec/rtld-elf/powerpc/reloc.c       Mon Oct  1 18:46:35 2018        
(r339072)
@@ -258,7 +258,7 @@ reloc_nonplt_object(Obj_Entry *obj_rtld, Obj_Entry *ob
 
                *(Elf_Addr **)where = *where * sizeof(Elf_Addr)
                    + (Elf_Addr *)(def->st_value + rela->r_addend 
-                   + defobj->tlsoffset - TLS_TP_OFFSET);
+                   + defobj->tlsoffset - TLS_TP_OFFSET - TLS_TCB_SIZE);
                
                break;
                

Modified: head/libexec/rtld-elf/powerpc/rtld_machdep.h
==============================================================================
--- head/libexec/rtld-elf/powerpc/rtld_machdep.h        Mon Oct  1 18:26:41 
2018        (r339071)
+++ head/libexec/rtld-elf/powerpc/rtld_machdep.h        Mon Oct  1 18:46:35 
2018        (r339072)
@@ -69,12 +69,12 @@ void _rtld_powerpc_pltcall(void);
 
 #define TLS_TP_OFFSET  0x7000
 #define TLS_DTV_OFFSET 0x8000
-#define TLS_TCB_SIZE   16
+#define TLS_TCB_SIZE   8
 
 #define round(size, align) \
     (((size) + (align) - 1) & ~((align) - 1))
 #define calculate_first_tls_offset(size, align) \
-    round(8, align)
+    TLS_TCB_SIZE
 #define calculate_tls_offset(prev_offset, prev_size, size, align) \
     round(prev_offset + prev_size, align)
 #define calculate_tls_end(off, size)    ((off) + (size))
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to