All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] objtool: Be lenient about -Wundef
@ 2019-06-19 12:03 Olof Johansson
  2019-06-28  0:00 ` Josh Poimboeuf
  0 siblings, 1 reply; 3+ messages in thread
From: Olof Johansson @ 2019-06-19 12:03 UTC (permalink / raw)
  To: Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel, Olof Johansson

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] objtool: Be lenient about -Wundef
  2019-06-19 12:03 [PATCH] objtool: Be lenient about -Wundef Olof Johansson
@ 2019-06-28  0:00 ` Josh Poimboeuf
  2019-06-28  3:44   ` Olof Johansson
  0 siblings, 1 reply; 3+ messages in thread
From: Josh Poimboeuf @ 2019-06-28  0:00 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Peter Zijlstra, linux-kernel

On Wed, Jun 19, 2019 at 05:03:37AM -0700, Olof Johansson wrote:
> 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>

Sorry for the delay, I was out last week and I'm still getting caught
up.

Which libelf was this?  I'm guessing it's the old non-elfutils version
which has been unmaintained for 10 years (and which doesn't work with
objtool anyway).

It would be nice if we could figure out a way to detect that libelf and
report a more useful error for it.

-- 
Josh

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] objtool: Be lenient about -Wundef
  2019-06-28  0:00 ` Josh Poimboeuf
@ 2019-06-28  3:44   ` Olof Johansson
  0 siblings, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2019-06-28  3:44 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: Peter Zijlstra, Linux Kernel Mailing List

On Fri, Jun 28, 2019 at 8:00 AM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
>
> On Wed, Jun 19, 2019 at 05:03:37AM -0700, Olof Johansson wrote:
> > 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>
>
> Sorry for the delay, I was out last week and I'm still getting caught
> up.
>
> Which libelf was this?  I'm guessing it's the old non-elfutils version
> which has been unmaintained for 10 years (and which doesn't work with
> objtool anyway).
>
> It would be nice if we could figure out a way to detect that libelf and
> report a more useful error for it.

Yeah, looks like my docker image pulled in the very old libelf 0.8.13,
but has elfutils available. I'll switch it over locally to resolve
this.


-Olof

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-06-28  3:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-19 12:03 [PATCH] objtool: Be lenient about -Wundef Olof Johansson
2019-06-28  0:00 ` Josh Poimboeuf
2019-06-28  3:44   ` Olof Johansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.