From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dog.elm.relay.mailchannels.net (dog.elm.relay.mailchannels.net [23.83.212.48]) by sourceware.org (Postfix) with ESMTPS id 5E0473858009 for ; Mon, 22 Feb 2021 22:16:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 5E0473858009 X-Sender-Id: dreamhost|x-authsender|tuliom@ascii.art.br Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 6DEF592216A; Mon, 22 Feb 2021 22:16:41 +0000 (UTC) Received: from pdx1-sub0-mail-a67.g.dreamhost.com (100-96-10-160.trex.outbound.svc.cluster.local [100.96.10.160]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 3E90A921E76; Mon, 22 Feb 2021 22:16:34 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|tuliom@ascii.art.br Received: from pdx1-sub0-mail-a67.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.96.10.160 (trex/6.0.2); Mon, 22 Feb 2021 22:16:41 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|tuliom@ascii.art.br X-MailChannels-Auth-Id: dreamhost X-Battle-Exultant: 73112d754ab772e0_1614032194517_3645498069 X-MC-Loop-Signature: 1614032194516:1444316640 X-MC-Ingress-Time: 1614032194516 Received: from pdx1-sub0-mail-a67.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a67.g.dreamhost.com (Postfix) with ESMTP id 8324A7E6A6; Mon, 22 Feb 2021 14:16:32 -0800 (PST) Received: from ascii.art.br (unknown [187.1.62.160]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: tuliom@ascii.art.br) by pdx1-sub0-mail-a67.g.dreamhost.com (Postfix) with ESMTPSA id 519907ECEA; Mon, 22 Feb 2021 14:16:30 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a67 From: Tulio Magno Quites Machado Filho To: Adhemerval Zanella , Florian Weimer Cc: libc-alpha@sourceware.org, Raoni Fassina Firmino Subject: Re: [PATCH] powerpc: Remove backtrace implementation In-Reply-To: <90d1d0e5-a31e-fbac-ead0-7f76f2645cd9@linaro.org> References: <20210212170941.1786380-1-adhemerval.zanella@linaro.org> <878s7ti4m0.fsf@oldenburg.str.redhat.com> <90d1d0e5-a31e-fbac-ead0-7f76f2645cd9@linaro.org> User-Agent: Notmuch/0.31.3 (http://notmuchmail.org) Emacs/27.1 (x86_64-redhat-linux-gnu) Date: Mon, 22 Feb 2021 19:16:27 -0300 Message-ID: <87sg5n3g04.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=1.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_ABUSEAT, RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2021 22:16:45 -0000 Adhemerval Zanella writes: > On 12/02/2021 14:21, Florian Weimer wrote: >> * Adhemerval Zanella: >> >> Does this really work well (enough) on systems which do not build >> everything with asynchronous unwind tables? If I recall correctly, GCC >> enabled them by default only quite recently. > > This should work as well any other architecture since it uses the libgcc_s > routines. Afaik the powerpc implementation was done as optimization, not > for correctness. I think Florian is correct. GCC enabled -fasynchronous-unwind-tables by default on ppc* ELF targets on version 8 [1]. So if you take a Debian 10 ppc64le, build the backtrace example from linux-manpages [2] with gcc-7 or with a newer GCC using 'gcc-9 -g0 -fno-asynchronous-unwind-tables', this executable won't be able to print the correct backtrace, e.g.: $ ./testrun.sh ./tst-no-asynchronous-unwind-tables 3 backtrace() returned 1 addresses ./tst-no-asynchronous-unwind-tables(+0xb48) [0x7fff99a00b48] 8 addresses were expected in the previous test. With that said, I don't think the powerpc files are just an optimization and removing them may cause old binaries to stop getting the right backtrace. [1] https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=0359465c703a [2] https://www.man7.org/linux/man-pages/man3/backtrace.3.html -- Tulio Magno