From owner-svn-src-head@freebsd.org Mon Oct 1 18:46:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2351810A72C5; Mon, 1 Oct 2018 18:46:36 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBD0F87028; Mon, 1 Oct 2018 18:46:35 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C65AA24CA6; Mon, 1 Oct 2018 18:46:35 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w91IkZHh019551; Mon, 1 Oct 2018 18:46:35 GMT (envelope-from andreast@FreeBSD.org) Received: (from andreast@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w91IkZLL019549; Mon, 1 Oct 2018 18:46:35 GMT (envelope-from andreast@FreeBSD.org) Message-Id: <201810011846.w91IkZLL019549@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andreast set sender to andreast@FreeBSD.org using -f From: Andreas Tobler Date: Mon, 1 Oct 2018 18:46:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339072 - head/libexec/rtld-elf/powerpc X-SVN-Group: head X-SVN-Commit-Author: andreast X-SVN-Commit-Paths: head/libexec/rtld-elf/powerpc X-SVN-Commit-Revision: 339072 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2018 18:46:36 -0000 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))