From patchwork Thu Aug 27 17:42:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Weigand X-Patchwork-Id: 8488 Received: (qmail 85780 invoked by alias); 27 Aug 2015 17:42:46 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 85766 invoked by uid 89); 27 Aug 2015 17:42:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, KAM_STOCKGEN, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: e06smtp11.uk.ibm.com Received: from e06smtp11.uk.ibm.com (HELO e06smtp11.uk.ibm.com) (195.75.94.107) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 27 Aug 2015 17:42:44 +0000 Received: from /spool/local by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 27 Aug 2015 18:42:41 +0100 Received: from d06dlp02.portsmouth.uk.ibm.com (9.149.20.14) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 27 Aug 2015 18:42:40 +0100 X-MailFrom: uweigand@de.ibm.com X-RcptTo: gdb-patches@sourceware.org Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 2C68E2190046 for ; Thu, 27 Aug 2015 18:42:13 +0100 (BST) Received: from d06av07.portsmouth.uk.ibm.com (d06av07.portsmouth.uk.ibm.com [9.149.37.248]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t7RHgadh31653972 for ; Thu, 27 Aug 2015 17:42:39 GMT Received: from d06av07.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t7RHgRS3022214 for ; Thu, 27 Aug 2015 11:42:27 -0600 Received: from oc7340732750.ibm.com (dyn-9-152-213-24.boeblingen.de.ibm.com [9.152.213.24]) by d06av07.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t7RHgRVd022026 for ; Thu, 27 Aug 2015 11:42:27 -0600 Received: by oc7340732750.ibm.com (Postfix, from userid 500) id 9552F39FA; Thu, 27 Aug 2015 19:42:18 +0200 (CEST) Subject: [pushed][Cell/B.E.] Fix wrong relocation for TLS variable offset To: gdb-patches@sourceware.org Date: Thu, 27 Aug 2015 19:42:18 +0200 (CEST) From: "Ulrich Weigand" MIME-Version: 1.0 Message-Id: <20150827174218.9552F39FA@oc7340732750.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15082717-0041-0000-0000-0000059B536B Hello, when debugging Cell/B.E. code, the cross-architecture frame unwinding works by accessing data structures refered to by a thread-local variable in the inferior. While accessing this variable via minimal symbol, code would use BMSYMBOL_VALUE_ADDRESS to determine the offset of the variable in the thread-local storage block. This is incorrect, since it adds any relocation offset of the shared library defining the TLS variable. That offset would be OK when accessing the initial copy present in the .tbss section, but it must not be applied to the offset of the variable in the TLS block at runtime. Depending on whether or not the libspe2.so library was prelinked, access to the variable would fail due to the incorrectly relocated offset. Tested on Cell/B.E., pushed to mainline. Bye, Ulrich ChangeLog: * ppc-linux-tdep.c (ppc_linux_spe_context_lookup): Do not attempt to relocate a TLS variable offset. Index: binutils-gdb/gdb/ppc-linux-tdep.c =================================================================== --- binutils-gdb.orig/gdb/ppc-linux-tdep.c +++ binutils-gdb/gdb/ppc-linux-tdep.c @@ -1140,7 +1140,7 @@ ppc_linux_spe_context_lookup (struct obj { spe_context_objfile = objfile; spe_context_lm_addr = svr4_fetch_objfile_link_map (objfile); - spe_context_offset = BMSYMBOL_VALUE_ADDRESS (sym); + spe_context_offset = MSYMBOL_VALUE_RAW_ADDRESS (sym.minsym); spe_context_cache_ptid = minus_one_ptid; spe_context_cache_address = 0; return;