From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Tulio Magno Quites Machado Filho <tuliom@ascii.art.br>,
Florian Weimer <fweimer@redhat.com>
Cc: libc-alpha@sourceware.org, Raoni Fassina Firmino <raoni@linux.ibm.com>
Subject: Re: [PATCH] powerpc: Remove backtrace implementation
Date: Tue, 23 Feb 2021 08:56:22 -0300 [thread overview]
Message-ID: <c01d9b29-6d16-a64a-a7d8-ec616348d482@linaro.org> (raw)
In-Reply-To: <87sg5n3g04.fsf@linux.ibm.com>
On 22/02/2021 19:16, Tulio Magno Quites Machado Filho wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> 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
>
Afaik this is true for every other architecture that uses libgcc for
backtrace implementation, currently *everything* but powerpc and
microblaze:
This is on aarch64 with gcc 5.4:
$ gcc -g0 -fno-asynchronous-unwind-tables backtrace.c -o backtrace
$ ./backtrace 3
backtrace() returned 1 addresses
./backtrace() [0x4009dc]
And this is sparc64 with gcc-10:
$ gcc -g0 -fno-asynchronous-unwind-tables backtrace.c -o backtrace
$ ./backtrace 3
backtrace() returned 1 addresses
./backtrace(+0xa74) [0x10000000a74]
So for all other architectures we require -fasynchronous-unwind-tables
to get backtrace work and I plan to remove microblaze implementation
so powerpc will be only outlier.
The question is: should we fix all other architectures to provide a
non-libgcc way to get around this issue? What about architectures that
backtrace through frame layout is not really possible or require hackish
ways (-fomit-frame-pointer for some architecture or thumb mode with
gcc and clang objects)?
I really don't think we should keep this fast-unwinders (sanitizers
has a hard time maintaining for some architectures) so I still think
we should move to use *just* libgcc as backend and document the flags
required to get a meaningful stacktrace
next prev parent reply other threads:[~2021-02-23 11:56 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 17:09 Adhemerval Zanella
2021-02-12 17:21 ` Florian Weimer
2021-02-12 17:25 ` Adhemerval Zanella
2021-02-22 22:16 ` Tulio Magno Quites Machado Filho
2021-02-23 9:52 ` Florian Weimer
2021-02-23 11:56 ` Adhemerval Zanella [this message]
2021-02-23 12:28 ` Florian Weimer
2021-02-23 12:43 ` Adhemerval Zanella
2021-02-26 17:39 ` Raoni Fassina Firmino
2021-04-14 21:37 ` Paul E Murphy
2021-04-15 14:42 ` Tulio Magno Quites Machado Filho
2021-04-15 20:44 ` Adhemerval Zanella
2021-04-27 15:09 ` Florian Weimer
2021-10-14 20:24 ` Raphael M Zinsly
2021-10-14 21:39 ` Tulio Magno Quites Machado Filho
2021-10-20 13:39 ` Adhemerval Zanella
2021-02-26 17:19 ` Raoni Fassina Firmino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c01d9b29-6d16-a64a-a7d8-ec616348d482@linaro.org \
--to=adhemerval.zanella@linaro.org \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=raoni@linux.ibm.com \
--cc=tuliom@ascii.art.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).