linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vasily Gorbik <gor@linux.ibm.com>
To: Josh Poimboeuf <jpoimboe@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	David Laight <David.Laight@aculab.com>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	Miroslav Benes <mbenes@suse.cz>,
	Alexandre Chartre <alexandre.chartre@oracle.com>,
	Julien Thierry <jthierry@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [RFC PATCH v4 1/4] objtool: allow nested externs to enable BUILD_BUG()
Date: Sun, 4 Oct 2020 16:30:43 +0200	[thread overview]
Message-ID: <patch-1.thread-a8def4.git-71a9d5e14a6c.your-ad-here.call-01601818410-ext-7687@work.hours> (raw)
In-Reply-To: <cover.thread-a8def4.your-ad-here.call-01601818410-ext-7687@work.hours>

Currently BUILD_BUG() macro is expanded to smth like the following:
   do {
           extern void __compiletime_assert_0(void)
                   __attribute__((error("BUILD_BUG failed")));
           if (!(!(1)))
                   __compiletime_assert_0();
   } while (0);

If used in a function body this obviously would produce build errors
with -Wnested-externs and -Werror.

Build objtool with -Wno-nested-externs to enable BUILD_BUG() usage.

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
---
 tools/objtool/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 33d1e3ca8efd..4ea9a833dde7 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -37,7 +37,7 @@ INCLUDES := -I$(srctree)/tools/include \
 	    -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
 	    -I$(srctree)/tools/arch/$(SRCARCH)/include	\
 	    -I$(srctree)/tools/objtool/arch/$(SRCARCH)/include
-WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
+WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed -Wno-nested-externs
 CFLAGS   := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
 LDFLAGS  += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
 
-- 
⣿⣿⣿⣿⢋⡀⣀⠹⣿⣿⣿⣿
⣿⣿⣿⣿⠠⣶⡦⠀⣿⣿⣿⣿
⣿⣿⣿⠏⣴⣮⣴⣧⠈⢿⣿⣿
⣿⣿⡏⢰⣿⠖⣠⣿⡆⠈⣿⣿
⣿⢛⣵⣄⠙⣶⣶⡟⣅⣠⠹⣿
⣿⣜⣛⠻⢎⣉⣉⣀⠿⣫⣵⣿


  reply	other threads:[~2020-10-04 14:31 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 22:17 [RFC PATCH v3 0/4] objtool and cross compilation Vasily Gorbik
2020-09-30 22:17 ` [RFC PATCH v3 1/4] objtool: allow nested externs to enable BUILD_BUG() Vasily Gorbik
2020-09-30 22:17 ` [RFC PATCH v3 2/4] objtool: x86 instruction decoder and big endian cross compiles Vasily Gorbik
2020-10-02 15:18   ` Josh Poimboeuf
2020-10-05  3:41     ` Masami Hiramatsu
2020-09-30 22:17 ` [RFC PATCH v3 3/4] objtool: correct rebuilding of reloc sections Vasily Gorbik
2020-09-30 22:17 ` [RFC PATCH v3 4/4] objtool: fix x86 orc generation on big endian cross compiles Vasily Gorbik
2020-10-02 16:01   ` Josh Poimboeuf
2020-10-04 14:30     ` [RFC PATCH v4 0/4] objtool and cross compilation Vasily Gorbik
2020-10-04 14:30       ` Vasily Gorbik [this message]
2020-10-04 14:30       ` [RFC PATCH v4 2/4] x86/insn: instruction decoder and big endian cross compiles Vasily Gorbik
2020-10-04 14:30       ` [RFC PATCH v4 3/4] objtool: correct rebuilding of reloc sections Vasily Gorbik
2020-10-04 14:30       ` [RFC PATCH v4 4/4] objtool: fix x86 orc generation on big endian cross compiles Vasily Gorbik
2020-10-05 14:03         ` Josh Poimboeuf
2020-10-05 15:50           ` [RFC PATCH RESEND v4 0/4] objtool and cross compilation Vasily Gorbik
2020-10-05 15:50             ` [RFC PATCH RESEND v4 1/4] objtool: allow nested externs to enable BUILD_BUG() Vasily Gorbik
2020-10-05 15:50             ` [RFC PATCH RESEND v4 2/4] x86/insn: instruction decoder and big endian cross compiles Vasily Gorbik
2020-10-05 15:50             ` [RFC PATCH RESEND v4 3/4] objtool: correct rebuilding of reloc sections Vasily Gorbik
2020-10-05 15:50             ` [RFC PATCH RESEND v4 4/4] objtool: fix x86 orc generation on big endian cross compiles Vasily Gorbik
2020-10-05 15:50             ` [PATCH v2] objtool: avoid ../ headers includes and name clashes Vasily Gorbik
2020-10-05 15:56           ` [RFC PATCH v4 4/4] objtool: fix x86 orc generation on big endian cross compiles Vasily Gorbik

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=patch-1.thread-a8def4.git-71a9d5e14a6c.your-ad-here.call-01601818410-ext-7687@work.hours \
    --to=gor@linux.ibm.com \
    --cc=David.Laight@aculab.com \
    --cc=alexandre.chartre@oracle.com \
    --cc=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=jthierry@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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 NNTP newsgroup(s).