linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Olof Johansson <olof@lixom.net>
To: Josh Poimboeuf <jpoimboe@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org, Olof Johansson <olof@lixom.net>
Subject: [PATCH] objtool: Be lenient about -Wundef
Date: Wed, 19 Jun 2019 05:03:37 -0700	[thread overview]
Message-ID: <20190619120337.78624-1-olof@lixom.net> (raw)

Some libelf versions use undefined macros, which combined with newer GCC
makes for errors from system headers. This isn't overly useful to fail
compiling objtool for.

Error as seen:

cc1: all warnings being treated as errors
In file included from arch/x86/../../elf.h:10,
                 from arch/x86/decode.c:14:
/usr/include/libelf/gelf.h:25:5: error: "__LIBELF_INTERNAL__" is not defined, evaluates to 0 [-Werror=undef]
 #if __LIBELF_INTERNAL__
     ^~~~~~~~~~~~~~~~~~~

For this reason, skip -Wundef on objtool.

Signed-off-by: Olof Johansson <olof@lixom.net>
---
 tools/objtool/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 88158239622bc..0c49206c5216b 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -35,6 +35,8 @@ INCLUDES := -I$(srctree)/tools/include \
 	    -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
 	    -I$(srctree)/tools/objtool/arch/$(ARCH)/include
 WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
+# Some system libelf versions uses undefined "#if <var>", so skip the warning/error
+WARNINGS += -Wno-undef
 CFLAGS   += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
 LDFLAGS  += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
 
-- 
2.11.0


             reply	other threads:[~2019-06-19 12:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-19 12:03 Olof Johansson [this message]
2019-06-28  0:00 ` [PATCH] objtool: Be lenient about -Wundef Josh Poimboeuf
2019-06-28  3:44   ` Olof Johansson

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=20190619120337.78624-1-olof@lixom.net \
    --to=olof@lixom.net \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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).