From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2610:1c1:1:606c::19:2]) by sourceware.org (Postfix) with ESMTPS id E14443865C2A; Wed, 23 Mar 2022 23:55:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E14443865C2A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id F265A8216A; Wed, 23 Mar 2022 23:55:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KP4x56JrVz3nsw; Wed, 23 Mar 2022 23:55:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648079737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=74kOIGTRMTLN/rLk5aheYJKDmF86fUlEGWhudBzOML0=; b=BaY9cebh2X7cplmYuVSGB2IOW2KlZWeqqaTTLBMRmsBiUkaOjMtIsGJWZ4JoiTzqt4fBHu PUg6VBZ9QXZ3ENNMCWhq3mLO9N08WDVd/JilGvQHcgsnyKwjG20MUhtLASst8U5sIIZXFV VD76xRRbLQl2dINket2CkZInP1VixnVgmvUlb5fd22V07/ymwcLeIqein3awnKcsqWypjy HGY3LA6mbSoTuM9orPZNGSzBKzNn4WAeFa0FbyBWOFRKxGInZHXCinu4FEazlU+ynNwc8X Fn+q3EvmvbMyAqyzBe/PkaQbTmpsgctWIGdWilwl4gZh258zbRi3Qnw3B1LarQ== Received: from [10.0.1.4] (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 6D53029771; Wed, 23 Mar 2022 23:55:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: Date: Wed, 23 Mar 2022 16:55:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Content-Language: en-US From: John Baldwin To: binutils@sourceware.org, gdb-patches@sourceware.org References: <20220323210048.25525-1-jhb@FreeBSD.org> <20220323210048.25525-2-jhb@FreeBSD.org> Subject: Re: [PATCH 01/12] Handle another edge case for TLS variable lookups. In-Reply-To: <20220323210048.25525-2-jhb@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648079737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=74kOIGTRMTLN/rLk5aheYJKDmF86fUlEGWhudBzOML0=; b=EhZZZ7UdB8mV2y5dog75SQvyq9VxSWQxrLQr96UrVO6CftjhB69LwO+Hbwq90Yyb7jCTKT wc27w5mkpC5E9oIhQ26I1phsBQuAjh1svArIk4W1WYYRyhcK/6XBDk9+Lsd8/uT9zd9ym8 cjeuBpgm31AjkcaucO0l6WMRyq1TNS+GKlciahKDDT+nQMgJw9RQGDB4rqeKUXCUqMoHv5 13uh/nWphFNy/TxuGDAF9mIeA2L/3Oz0NgcW0BjOSb27xgqY3Xlo/bf68k27M9njHd2MNn 1FiNyaJtSNVzfBKB33FrgK+i5PIN2Mel06wvSKMWPKhF/MvlxzIdVPJQl++Hiw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648079737; a=rsa-sha256; cv=none; b=dX5EMc0+Ucfy30Ug02QDab6R627B/LvP57ANOaZNp99ZZ+vxcYW4Ih1+Kt7JDJKZoCNEpe htd8BNiINpr5DqzwcCDpA69mrBF4jQ9fQFkO0ejCYFPItPv/Q9wxiYZp49cXDny0IRki0W knO489CU7kAxOvluZ4y55m9ZcqJjdvIDVyhkbTig/ng7pSTSxBOYAZKx5oC0OeWsgpbWP9 mpcLHkiDneEw9AWCeZegNCMtBywJS4TKQ/YiKGHbrf4TmSDBF/maN5OFdn/JtUwRHh0Ish tb4kyjv1hHAT++eP3Akv1pQfGeylC50C6ckRG54FTVPmzb9hh03uvxAcVIQyUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2022 23:56:00 -0000 On 3/23/22 2:00 PM, John Baldwin wrote: > This is similar to the change in > df22c1e5d53c38f38bce6072bb46de240f9e0e2b but applies to the main > object file. The original change I encountered when testing TLS on > RISC-V for which I was unable to test TLS variables in the main > executable due to issues with compiler-generated debug info, so I only > checked for a backlink before walking the list of shared library > object files. > > However, I ran into this issue again (of a separate debug object file > being passed to svr4_fetch_objfile_link_map) when testing TLS > variables on 32-bit arm. To fix, move the check for a backlink > earlier before the check for the main object file. I now see this when using a separate debug file on FreeBSD/amd64 as well FWIW. This definitely used to work but now needs this fix for me. Curiously, 'info address' shows the variable belonging to the separate debug file, e.g.: % gdb tls tls.core ... (gdb) info address id Symbol "id" is a thread-local variable at offset 0x0 in the thread-local storage for `/usr/home/john/work/johnsvn/test/tls/tls.debug'. Arguably this is a recent bug somewhere in the DWARF parsing that is longer following the backlink when choosing the object file for a TLS variable? I think fixing svr4_fetch_objfile_link_map to be resilient against this is still ok, but it might be worth tracking down the other bug as well. I'll see if I can find it. -- John Baldwin