mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Nick Desaulniers <ndesaulniers@google.com>,
	torvalds@linux-foundation.org
Cc: keescook@chromium.org, corbet@lwn.net,
	yamada.masahiro@socionext.com, arnd@arndb.de, dwmw@amazon.co.uk,
	linux-kernel@vger.kernel.org, tglx@linutronix.de,
	will.deacon@arm.com, geert@linux-m68k.org, mingo@kernel.org,
	akpm@linux-foundation.org, asmadeus@codewreck.org,
	daniel@iogearbox.net, hpa@zytor.com
Subject: Re: [PATCH] include/linux/compiler*.h: make compiler-*.h mutually exclusive
Date: Wed, 22 Aug 2018 17:20:26 -0700	[thread overview]
Message-ID: <b68b8748212e74768cf457c9f41dbcf9ae887a88.camel@perches.com> (raw)
In-Reply-To: <20180822233724.110454-1-ndesaulniers@google.com>

On Wed, 2018-08-22 at 16:37 -0700, Nick Desaulniers wrote:
> Commit cafa0010cd51 ("Raise the minimum required gcc version to 4.6")
> recently exposed a brittle part of the build for supporting non-gcc
> compilers.

style trivia:

> diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
[]
> @@ -54,32 +54,20 @@ extern void __chk_io_ptr(const volatile void __iomem *);
[]
> +/* Compiler specific macros. */
>  #ifdef __clang__
>  #include <linux/compiler-clang.h>

probably better as

#if defined(__clang)

to match the style of the #elif defined()s below it

> +#elif defined(__INTEL_COMPILER)
> +#include <linux/compiler-intel.h>
> +#elif defined(__GNUC__)
[]
> @@ -272,4 +174,92 @@ struct ftrace_likely_data {
[]
> +#ifdef __GNUC_STDC_INLINE__
> +# define __gnu_inline	__attribute__((gnu_inline))
> +#else
> +# define __gnu_inline
> +#endif

Perhaps __gnu_inline should be in compiler-gcc and this
should use

#ifndef __gnu_inline
#define __gnu_inline
#endif
 
> +
> +/*
> + * Force always-inline if the user requests it so via the .config.
> + * GCC does not warn about unused static inline functions for
> + * -Wunused-function.  This turns out to avoid the need for complex #ifdef
> + * directives.  Suppress the warning in clang as well by using "unused"
> + * function attribute, which is redundant but not harmful for gcc.
> + * Prefer gnu_inline, so that extern inline functions do not emit an
> + * externally visible function. This makes extern inline behave as per gnu89
> + * semantics rather than c99. This prevents multiple symbol definition errors
> + * of extern inline functions at link time.
> + * A lot of inline functions can cause havoc with function tracing.
> + */
> +#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
> +	!defined(CONFIG_OPTIMIZE_INLINING)
> +#define inline \
> +	inline __attribute__((always_inline, unused)) notrace __gnu_inline
> +#else
> +#define inline inline	__attribute__((unused)) notrace __gnu_inline
> +#endif

This bit might be better adding another __<foo> attribute like:

#if defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) &&
    defined(CONFIG_OPTIMIZE_INLINING)
#define __optimized_inline __unused
#else
#define __optimized_inline __unused __attribute__((always_inline))
#endif

#define inline inline __optimized_inline notrace __gnu_inline

> +
> +#define __inline__ inline
> +#define __inline inline
> +#define noinline	__attribute__((noinline))
> +
> +#ifndef __always_inline
> +#define __always_inline inline __attribute__((always_inline))
> +#endif

[]

> diff --git a/mm/migrate.c b/mm/migrate.c
[]
> @@ -1131,7 +1131,8 @@ static int __unmap_and_move(struct page *page, struct page *newpage,
>   * gcc 4.7 and 4.8 on arm get an ICEs when inlining unmap_and_move().  Work
>   * around it.
>   */
> -#if (GCC_VERSION >= 40700 && GCC_VERSION < 40900) && defined(CONFIG_ARM)
> +#if defined(CONFIG_ARM) && \
> +	defined(GCC_VERSION) && GCC_VERSION < 40900 && GCC_VERSION >= 40700

I find the reversed version tests a bit odd to read

>  #define ICE_noinline noinline
>  #else
>  #define ICE_noinline

  reply	other threads:[~2018-08-23  0:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-22 23:37 Nick Desaulniers
2018-08-23  0:20 ` Joe Perches [this message]
2018-08-23  0:21 ` Linus Torvalds
2018-08-23  0:25 ` Dominique Martinet
2018-08-23  1:02   ` Linus Torvalds
2018-08-23  1:10     ` Dominique Martinet
2018-08-23  1:13       ` Linus Torvalds
2018-08-23  8:32     ` Kees Cook
2018-08-23 21:03       ` Nick Desaulniers
2018-08-23 21:10         ` Joe Perches
2018-08-23 21:19         ` Joe Perches
2018-08-23 23:12           ` Nick Desaulniers
2018-08-23 23:31             ` Joe Perches
2018-08-26 17:37               ` Miguel Ojeda
2018-08-23 22:08         ` Dominique Martinet
2018-08-23  2:42 ` Masahiro Yamada

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=b68b8748212e74768cf457c9f41dbcf9ae887a88.camel@perches.com \
    --to=joe@perches.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=asmadeus@codewreck.org \
    --cc=corbet@lwn.net \
    --cc=daniel@iogearbox.net \
    --cc=dwmw@amazon.co.uk \
    --cc=geert@linux-m68k.org \
    --cc=hpa@zytor.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=will.deacon@arm.com \
    --cc=yamada.masahiro@socionext.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®