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
This commit is contained in:
Andreas Tobler 2018-10-01 18:46:35 +00:00
parent 7c65532627
commit 953cba365f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=339072
2 changed files with 3 additions and 3 deletions

View file

@ -258,7 +258,7 @@ reloc_nonplt_object(Obj_Entry *obj_rtld, Obj_Entry *obj, const Elf_Rela *rela,
*(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;

View file

@ -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))