This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] gcc feature request: Moving blocks into sections
- From: "H. Peter Anvin" <hpa at linux dot intel dot com>
- To: Steven Rostedt <rostedt at goodmis dot org>
- Cc: LKML <linux-kernel at vger dot kernel dot org>, gcc <gcc at gcc dot gnu dot org>, Linus Torvalds <torvalds at linux-foundation dot org>, Ingo Molnar <mingo at kernel dot org>, Mathieu Desnoyers <mathieu dot desnoyers at efficios dot com>, Thomas Gleixner <tglx at linutronix dot de>, David Daney <ddaney dot cavm at gmail dot com>, Behan Webster <behanw at converseincode dot com>, Peter Zijlstra <peterz at infradead dot org>
- Date: Mon, 05 Aug 2013 10:02:24 -0700
- Subject: Re: [RFC] gcc feature request: Moving blocks into sections
- References: <1375721715 dot 22073 dot 80 dot camel at gandalf dot local dot home>
On 08/05/2013 09:55 AM, Steven Rostedt wrote:
>
> Almost a full year ago, Mathieu suggested something like:
>
> if (unlikely(x)) __attribute__((section(".unlikely"))) {
> ...
> } else __attribute__((section(".likely"))) {
> ...
> }
>
> https://lkml.org/lkml/2012/8/9/658
>
> Which got me thinking. How hard would it be to set a block in its own
> section. Like what Mathieu suggested, but it doesn't have to be
> ".unlikely".
>
> if (x) __attibute__((section(".foo"))) {
> /* do something */
> }
>
One concern I have is how this kind of code would work when embedded
inside a function which already has a section attribute. This could
easily cause really weird bugs when someone "optimizes" an inline or
macro and breaks a single call site...
-hpa