BUILD_BUG_ON(!__builtin_constant_p(feature)) breaks bcc trace tool

Arnd Bergmann arnd at arndb.de
Thu Jan 26 02:44:05 AEDT 2017


On Wed, Jan 25, 2017 at 11:35 AM, David Laight <David.Laight at aculab.com> wrote:
> From: Michael Ellerman

>> #define inline                inline          __attribute__((always_inline)) notrace
>>
>> So in fact every inline function is marked always_inline all the time,
>> which seems dubious.
>
> I've had to do that in the past to get gcc to inline some small leaf functions
> that were only called once.
> (That was for some embedded code where I don't actually want any function calls
> at all.)
>
> To my mind 'inline' should mean 'always_inline' since you need to explicitly
> stop functions being inlined even when not marked 'inline'.

On x86, this is configurable using OPTIMIZE_INLINING, but IIRC no
other architecture
supports it in mainline Linux. I have played a bit with enabling it on
ARM, which
showed a couple of build warnings and errors from the changed inlining, but
they were all fixable. I have not submitted that since I have not actually been
able to do extensive runtime testing on it.

It may turn out to be worthwhile for powerpc, where you have a much more limited
set of configurations you care about and you already do some regular testing.
Potentially this is more efficient than the current default, and any
function that
actually requires being forced inline can be annotated as __always_inline rather
than plain inline.

     Arnd


More information about the Linuxppc-dev mailing list