Re: next-20190826 - objtool fails to build.
From: Josh Poimboeuf
Date: Wed Aug 28 2019 - 15:51:05 EST
On Wed, Aug 28, 2019 at 03:30:00PM -0400, Valdis KlÄtnieks wrote:
> On Wed, 28 Aug 2019 10:10:04 -0500, Josh Poimboeuf said:
> > But I don't see how those warnings could get enabled: -Wsign-compare
> > -Wunused-parameter.
> > Can you "make clean" and do "make V=1 tools/objtool" to show the actual
> > flags?
> And that tells me those warnings in fact don't get specifically enabled.
> (I've added some line breaks for sanity)
> gcc -Wp,-MD,/usr/src/linux-next/tools/objtool/.special.o.d -Wp,-MT,/usr/src/linux-next/tools/objtool/special.o -O2 -D_FORTIFY_SOURCE=2 -Wall -Wextra -Wbad-function-cast
> Found the cause of the mystery - I changed something in a bash profile, and
> as a result...
> export CFLAGS="-O2 -D_FORTIFY_SOURCE=2 -Wall -Wextra"
> And -Wextra pulls in the things that cause problems. So this is mostly
> The real question then becomes - should the Makefile sanitize CFLAGS or just
> append to whatever the user supplied as it does currently? The rest of the tree
> sanitizes CFLAG, because I don't get deluged in -Wsign-compare warnings all
> over the place...
Agreed. I assume this fixes it?
diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 88158239622b..20f67fcf378d 100644
@@ -35,7 +35,7 @@ INCLUDES := -I$(srctree)/tools/include \
WARNINGS := $(EXTRA_WARNINGS) -Wno-switch-default -Wno-switch-enum -Wno-packed
-CFLAGS += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
+CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
LDFLAGS += $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
# Allow old libelf to be used: