From patchwork Wed Jan 17 13:52:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Filippov X-Patchwork-Id: 862274 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=uclibc-ng.org (client-ip=89.238.66.15; helo=helium.openadk.org; envelope-from=devel-bounces@uclibc-ng.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="W/FRQfZ3"; dkim-atps=neutral Received: from helium.openadk.org (helium.openadk.org [89.238.66.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zM7pf1bf2z9sDB for ; Thu, 18 Jan 2018 00:53:28 +1100 (AEDT) Received: from helium.openadk.org (localhost [IPv6:::1]) by helium.openadk.org (Postfix) with ESMTP id A8FA310119; Wed, 17 Jan 2018 14:53:22 +0100 (CET) X-Original-To: devel@uclibc-ng.org Delivered-To: devel@helium.openadk.org Received: from mail-lf0-f66.google.com (mail-lf0-f66.google.com [209.85.215.66]) by helium.openadk.org (Postfix) with ESMTPS id D478910119 for ; Wed, 17 Jan 2018 14:53:20 +0100 (CET) Received: by mail-lf0-f66.google.com with SMTP id m8so22080808lfc.6 for ; Wed, 17 Jan 2018 05:53:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=8kHLka9Lzt0BPbnAecRX+FNbtFqZ0SLf/yrQRvIi7tg=; b=W/FRQfZ3rMnmkG2Y7cJKEoFdO85CvesaUYVKkxfvPZLeqrOkb6/R9KO8EChBeMMykB ZqJa/B4Yrmz05MfClXx4GA+Yfv5OnoO6XGExtbNQY9U7I8ZI59sKcWoNGIcJMDzZDtpi jgjNEOclSnmDvfaK2oMMEXuMXNP1KP4KJYstRS1SwDsKoyR8gS464P8vUXydT3wF5PHb wwXOjVViAxR7u+h37P8Lvsh9uVcE3aPnj12ukBwAOBA/60DEmcoDs7nm7/Slafh7TPS6 xTTDd49hhOyk6Yix5tfghbZ/xg/2JDLvUoGNmKPoMUrICKjsk8auJBw75DjEaZ9oKyyU RSUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8kHLka9Lzt0BPbnAecRX+FNbtFqZ0SLf/yrQRvIi7tg=; b=QMY+WSncvSgG6HQKILy1N3o0XCaiR+E4BVTtjt/6Y73j5j2vzXJ2LiJAReRC17L8zL +gMkqehv3X7wdZXhPhDlGksQuQQ4Jir4wp1a3CkP6UM44OWlyAHtWgXPceHwA960sDfE pfgq5y6kpbDX4VV+l0T0NMy5FBu9QJDautQcov7gh/eiswAazMUu2DfnktIvzpePlsOB gXodzaU4QEfQ0ojfBN9VFvyj750+yKHBvL/thwlhCTmEAs7KuY4QNGSAyktUizKP/7JD UA2DP/QGCckxkbZNvMvVeSpdIxP9EDMPpZ/9utc14Eq6MJh7gR7YoOcEK7Rax/qmsJNA Z0Lw== X-Gm-Message-State: AKwxytcKQv8O60JycKxRRXFKAH8dtqPYSkQaTy7Rrq/kCYI62WCo5SVb Re1KhsQiVLX5abMKk8zZ6CxG8w== X-Google-Smtp-Source: ACJfBot8zN4dRwTwoyZzRqDVy+sHfNXo6G4r8LoM4TQkE6nkw1Ay7L0iGuT6Tn5CXTSyuzRW58p1Lw== X-Received: by 10.25.206.77 with SMTP id e74mr19993208lfg.142.1516197199865; Wed, 17 Jan 2018 05:53:19 -0800 (PST) Received: from octofox.net (jcmvbkbc-1-pt.tunnel.tserv24.sto1.ipv6.he.net. [2001:470:27:1fa::2]) by smtp.gmail.com with ESMTPSA id w26sm877623lje.75.2018.01.17.05.53.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Jan 2018 05:53:19 -0800 (PST) From: Max Filippov To: devel@uclibc-ng.org Date: Wed, 17 Jan 2018 05:52:54 -0800 Message-Id: <1516197174-11306-1-git-send-email-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.1.4 Cc: linux-xtensa@linux-xtensa.org, Chris Zankel Subject: [uclibc-ng-devel] [PATCH] xtensa: fix R_XTENSA_TLSDESC_ARG handling in _dl_do_reloc X-BeenThere: devel@uclibc-ng.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: uClibc-ng Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: devel-bounces@uclibc-ng.org Sender: "devel" R_XTENSA_TLSDESC_ARG is a true RELA relocation, the addend is in the relocation record itself, not in place. Signed-off-by: Max Filippov --- ldso/ldso/xtensa/elfinterp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ldso/ldso/xtensa/elfinterp.c b/ldso/ldso/xtensa/elfinterp.c index 4c83ab65e668..e38a02666477 100644 --- a/ldso/ldso/xtensa/elfinterp.c +++ b/ldso/ldso/xtensa/elfinterp.c @@ -244,10 +244,11 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, if (!TRY_STATIC_TLS ((struct link_map *) tls_tpnt)) *reloc_addr = (ElfW(Addr)) _dl_make_tlsdesc_dynamic((struct link_map *) tls_tpnt, - symbol_addr + *reloc_addr); + symbol_addr + rpnt->r_addend); else #endif - *reloc_addr += symbol_addr + tls_tpnt->l_tls_offset; + *reloc_addr = symbol_addr + rpnt->r_addend + + tls_tpnt->l_tls_offset; break; #endif