From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Quentin Monnet <quentin@isovalent.com>,
Alexei Starovoitov <ast@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com,
Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 1/3] tools compiler.h: Add attribute to disable tail calls
Date: Mon, 1 Jun 2020 11:53:28 -0300 [thread overview]
Message-ID: <20200601145328.GH31795@kernel.org> (raw)
In-Reply-To: <20200530082015.39162-2-irogers@google.com>
Em Sat, May 30, 2020 at 01:20:13AM -0700, Ian Rogers escreveu:
> Tail call optimizations can remove stack frames that are used in
> unwinding tests. Add an attribute that can be used to disable the tail
> call optimization. Tested on clang and GCC.
>
> Signed-off-by: Ian Rogers <irogers@google.com>
> ---
> tools/include/linux/compiler-gcc.h | 8 ++++++++
> tools/include/linux/compiler.h | 3 +++
> 2 files changed, 11 insertions(+)
>
> diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h
> index 95c072b70d0e..cda555b47d3d 100644
> --- a/tools/include/linux/compiler-gcc.h
> +++ b/tools/include/linux/compiler-gcc.h
> @@ -27,6 +27,14 @@
> #define __pure __attribute__((pure))
> #endif
> #define noinline __attribute__((noinline))
> +#ifdef __has_attribute
> +#if __has_attribute(disable_tail_calls)
> +#define __no_tail_call __attribute__((disable_tail_calls))
> +#endif
> +#endif
> +#ifndef __no_tail_call
> +#define __no_tail_call __attribute__((optimize("no-optimize-sibling-calls")))
> +#endif
Added this for some retro-computing old distros when building with old
clang versions :-)
- Arnaldo
diff --git a/tools/include/linux/compiler-gcc.h b/tools/include/linux/compiler-gcc.h
index cda555b47d3d..dea7378ad646 100644
--- a/tools/include/linux/compiler-gcc.h
+++ b/tools/include/linux/compiler-gcc.h
@@ -33,7 +33,10 @@
#endif
#endif
#ifndef __no_tail_call
+#if GCC_VERSION > 40201
#define __no_tail_call __attribute__((optimize("no-optimize-sibling-calls")))
+#else
+#define __no_tail_call
#endif
#ifndef __packed
#define __packed __attribute__((packed))
next prev parent reply other threads:[~2020-06-01 14:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-30 8:20 [PATCH 0/3] perf test: Unwind fixes Ian Rogers
2020-05-30 8:20 ` [PATCH 1/3] tools compiler.h: Add attribute to disable tail calls Ian Rogers
2020-06-01 14:53 ` Arnaldo Carvalho de Melo [this message]
2020-05-30 8:20 ` [PATCH 2/3] perf tests: Don't tail call optimize in unwind test Ian Rogers
2020-05-30 8:20 ` [PATCH 3/3] perf test: Initialize memory in dwarf-unwind Ian Rogers
2020-05-31 12:17 ` [PATCH 0/3] perf test: Unwind fixes Arnaldo Carvalho de Melo
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=20200601145328.GH31795@kernel.org \
--to=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=ast@kernel.org \
--cc=clang-built-linux@googlegroups.com \
--cc=eranian@google.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=quentin@isovalent.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.