From patchwork Wed Apr 1 06:35:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yann Sionneau X-Patchwork-Id: 1265272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=uclibc-ng.org (client-ip=2a00:1828:2000:679::23; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=sionneau.net Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=sionneau.net header.i=@sionneau.net header.a=rsa-sha1 header.s=selectormx3 header.b=oAds0BIl; dkim-atps=neutral Received: from helium.openadk.org (helium.openadk.org [IPv6:2a00:1828:2000:679::23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48sswX0qFtz9sP7 for ; Thu, 2 Apr 2020 04:03:40 +1100 (AEDT) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id 6E4D3101AB; Wed, 1 Apr 2020 19:03:27 +0200 (CEST) X-Original-To: devel@uclibc-ng.org Delivered-To: devel@helium.openadk.org Received: from mx3.sionneau.net (mx3.sionneau.net [163.172.183.177]) by helium.openadk.org (Postfix) with ESMTPS id 526DE10127 for ; Wed, 1 Apr 2020 08:35:09 +0200 (CEST) Received: from mx3.sionneau.net (localhost [127.0.0.1]) by mx3.sionneau.net. (OpenSMTPD) with ESMTP id 1c7610ab; Wed, 1 Apr 2020 06:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=simple; d=sionneau.net; h=subject :references:to:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; s=selectormx3; bh=mciIU /nAUqonxo37y2TPwqC8ilA=; b=oAds0BIl/vMZ/i4FsTv9In5/rvzPo8/R7ETcT iMC50hxIq71zzkfxFUmqgC9sJ61zhpD4x6z0lAeEHlkzgLVfECSmOFfcTW+dvKY1 mgCXAsBpKUOe1VusZgyKM2U91Iz1QZ8wnmYVg5eiQmN0TZH/SagQ4QQNv4Irncrp ZA448k= DomainKey-Signature: a=rsa-sha1; c=simple; d=sionneau.net; h=subject :references:to:from:message-id:date:mime-version:in-reply-to :content-type:content-transfer-encoding; q=dns; s=selectormx3; b= n+1DfNq79Jc6BIpMAntlwXLhtf/cY3f+ELhkmRkRo56q/AlsMZRaJrLWnm4A3iLn cklwMtFcKMFeZONHvJhwjobo9hMIkUMznDAa9gIn7hAXJPVuAgtiNGdR+S2toHMA ZhAtX59nziwSQPvWmF68Iexj00Mr6Uw6Cv8wNJkxnEs= Received: by mx3.sionneau.net (OpenSMTPD) with ESMTPSA id 8df7f5be (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128:NO); Wed, 1 Apr 2020 06:35:08 +0000 (UTC) References: <20200331065131.19854-1-yann@sionneau.net> To: devel@uclibc-ng.org, shorne@gmail.com From: Yann Sionneau Autocrypt: addr=yann@sionneau.net; prefer-encrypt=mutual; keydata= xsFNBFG0p4oBEADb2Ur2UzBPHeM/D3obgvW9SAHv/UA+SNeHpQDWXPVYQ54wltW2/C33F2b+ mLqAbt5bVBQzxl849attjSr/KqNv1pkQaHkhORgmiQ2WlX3VBXeSg4vJN+GJILJ/R3ibgUnS Swjj6s2UMdaJJZW5THGq69Sky4A3RrB/fqSsOslRn+v+32F3pkYVgyYoC59kDZWo5EaJAQG+ 1WEk0jjuCtgFDAI/XVvDP1PwmuXu+z7paypX41zAICaP7M3WFvn9htmng3NaDDXPZMLp3yS1 vLngMzv43cWII9nijsf73RQa6vtdTrEbnWibmXwspd1zfIN6gQwpZexzPU3hJvocCMnwxVp3 tAowqw0OQ9t2iBGtgDouY4kkkS/guckWGZTqp+0Xe1doduy+EdAm0En3fR+mWLYe9p+l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o3+A9UdY8nKYt6D+KqWnXrSh+qrU1AP9lMviqpW2+VWEfwa5Y jrCcA8nA8PkvEAit X-Forwarded-Message-Id: <20200331065131.19854-1-yann@sionneau.net> Message-ID: Date: Wed, 1 Apr 2020 08:35:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <20200331065131.19854-1-yann@sionneau.net> Content-Language: en-US Subject: [uclibc-ng-devel] Fwd: [PATCH] or1k: fix some TLS issues X-BeenThere: devel@uclibc-ng.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: uClibc-ng Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devel-bounces@uclibc-ng.org Sender: "devel" From: Yann Sionneau Before this commit tst-tls-at-ctor test would segfault. After it passes. testsuite run before: https://pastebin.com/504JgQXa testsuite run after: https://pastebin.com/d2aNciVt Stafford Horne already fixed it in glibc: * https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L298 * https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L99 --- ldso/ldso/or1k/dl-sysdep.h | 6 ++++-- ldso/ldso/or1k/elfinterp.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) #endif diff --git a/ldso/ldso/or1k/dl-sysdep.h b/ldso/ldso/or1k/dl-sysdep.h index d79249449..d838a50eb 100644 --- a/ldso/ldso/or1k/dl-sysdep.h +++ b/ldso/ldso/or1k/dl-sysdep.h @@ -36,8 +36,10 @@ do { \ #define ELF_TARGET "or1k" #define elf_machine_type_class(type) \ - (((type) == R_OR1K_JMP_SLOT) * ELF_RTYPE_CLASS_PLT \ - | ((type) == R_OR1K_COPY) * ELF_RTYPE_CLASS_COPY) + (((type) == R_OR1K_JMP_SLOT || (type) == R_OR1K_TLS_DTPMOD || \ + (type) == R_OR1K_TLS_DTPOFF || \ + (type) == R_OR1K_TLS_TPOFF) * ELF_RTYPE_CLASS_PLT \ + | ((type) == R_OR1K_COPY) * ELF_RTYPE_CLASS_COPY) static inline Elf32_Addr * or1k_get_got (void) diff --git a/ldso/ldso/or1k/elfinterp.c b/ldso/ldso/or1k/elfinterp.c index 7fd0825ae..6b6589af5 100644 --- a/ldso/ldso/or1k/elfinterp.c +++ b/ldso/ldso/or1k/elfinterp.c @@ -249,11 +249,11 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope, *reloc_addr = tls_tpnt->l_tls_modid; break; case R_OR1K_TLS_DTPOFF: - *reloc_addr = symbol_addr; + *reloc_addr = symbol_addr + rpnt->r_addend; break; case R_OR1K_TLS_TPOFF: CHECK_STATIC_TLS ((struct link_map *) tls_tpnt); - *reloc_addr = tls_tpnt->l_tls_offset + symbol_addr + rpnt->r_addend; + *reloc_addr = tls_tpnt->l_tls_offset + symbol_addr + rpnt->r_addend - TLS_TCB_SIZE; break;