public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* next-20190826 - objtool fails to build.
@ 2019-08-28  4:15 Valdis Klētnieks
  2019-08-28 15:10 ` Josh Poimboeuf
  0 siblings, 1 reply; 5+ messages in thread
From: Valdis Klētnieks @ 2019-08-28  4:15 UTC (permalink / raw)
  To: Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 5642 bytes --]

OK.  I'm mystified.  next-20190806 built fine.  -0818 and -0826 died a
glorious death indeed.  All 3 were build using the same Fedora Rawhide 9.1.1
compiler (installed on July 30). 'git log -- tools/objtool' comes up empty.

Local hack-around was to remove the -Werror from tools/objtool/Makefile

Am particularly mystified by the errors on lines 808/809 - the same compiler that
was happy with the same code in next-0806 is now upset.  The others could possibly
be a stray typedef in an include someplace, but those two errors have me stumped.

For that matter, I'm not even seeing how -Wsign-compare was even getting set, given
a command 'make' and not W=1 or W=2....

(cue twilight zone theme)

  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
  DESCEND  objtool
  HOSTCC   /usr/src/linux-next/tools/objtool/fixdep.o
  HOSTLD   /usr/src/linux-next/tools/objtool/fixdep-in.o
  LINK     /usr/src/linux-next/tools/objtool/fixdep
  CC       /usr/src/linux-next/tools/objtool/exec-cmd.o
  CC       /usr/src/linux-next/tools/objtool/help.o
  CC       /usr/src/linux-next/tools/objtool/pager.o
  CC       /usr/src/linux-next/tools/objtool/parse-options.o
  CC       /usr/src/linux-next/tools/objtool/run-command.o
  CC       /usr/src/linux-next/tools/objtool/sigchain.o
  CC       /usr/src/linux-next/tools/objtool/subcmd-config.o
  LD       /usr/src/linux-next/tools/objtool/libsubcmd-in.o
  AR       /usr/src/linux-next/tools/objtool/libsubcmd.a
  CC       /usr/src/linux-next/tools/objtool/builtin-check.o
  CC       /usr/src/linux-next/tools/objtool/builtin-orc.o
  CC       /usr/src/linux-next/tools/objtool/check.o
check.c: In function '__dead_end_function':
check.c:158:17: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
  158 |   for (i = 0; i < ARRAY_SIZE(global_noreturns); i++)
      |                 ^
check.c: In function 'add_dead_ends':
check.c:330:25: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  330 |   else if (rela->addend == rela->sym->sec->len) {
      |                         ^~
check.c:372:25: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  372 |   else if (rela->addend == rela->sym->sec->len) {
      |                         ^~
check.c: In function 'add_jump_destinations':
check.c:560:36: warning: comparison of integer expressions of different signedness: 'long unsigned int' and 'int' [-Wsign-compare]
  560 |   if (insn->ignore || insn->offset == FAKE_JUMP_OFFSET)
      |                                    ^~
check.c: In function 'handle_jump_alt':
check.c:808:49: warning: unused parameter 'file' [-Wunused-parameter]
  808 | static int handle_jump_alt(struct objtool_file *file,
      |                            ~~~~~~~~~~~~~~~~~~~~~^~~~
check.c:809:27: warning: unused parameter 'special_alt' [-Wunused-parameter]
  809 |       struct special_alt *special_alt,
      |       ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
check.c: In function 'add_jump_table':
check.c:925:20: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
  925 |       rela->addend == pfunc->offset)
      |                    ^~
check.c: In function 'read_unwind_hints':
check.c:1187:16: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
 1187 |  for (i = 0; i < sec->len / sizeof(struct unwind_hint); i++) {
      |                ^
  CC       /usr/src/linux-next/tools/objtool/orc_gen.o
  CC       /usr/src/linux-next/tools/objtool/orc_dump.o
orc_dump.c: In function 'orc_dump':
orc_dump.c:104:16: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
  104 |  for (i = 0; i < nr_sections; i++) {
      |                ^
  CC       /usr/src/linux-next/tools/objtool/elf.o
elf.c: In function 'find_section_by_index':
elf.c:41:16: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
   41 |   if (sec->idx == idx)
      |                ^~
elf.c: In function 'read_sections':
elf.c:148:16: warning: comparison of integer expressions of different signedness: 'int' and 'size_t' {aka 'long unsigned int'} [-Wsign-compare]
  148 |  for (i = 0; i < sections_nr; i++) {
      |                ^
elf.c: In function 'read_relas':
elf.c:370:17: warning: comparison of integer expressions of different signedness: 'int' and 'Elf64_Xword' {aka 'long unsigned int'} [-Wsign-compare]
  370 |   for (i = 0; i < sec->sh.sh_size / sec->sh.sh_entsize; i++) {
      |                 ^
  CC       /usr/src/linux-next/tools/objtool/special.o
special.c: In function 'get_alt_entry':
special.c:71:38: warning: unused parameter 'elf' [-Wunused-parameter]
   71 | static int get_alt_entry(struct elf *elf, struct special_entry *entry,
      |                          ~~~~~~~~~~~~^~~
special.c: In function 'special_get_alts':
special.c:182:21: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
  182 |   for (idx = 0; idx < nr_entries; idx++) {
      |                     ^
  CC       /usr/src/linux-next/tools/objtool/objtool.o
  CC       /usr/src/linux-next/tools/objtool/libstring.o
  CC       /usr/src/linux-next/tools/objtool/libctype.o
  CC       /usr/src/linux-next/tools/objtool/str_error_r.o
  LD       /usr/src/linux-next/tools/objtool/objtool-in.o
  LINK     /usr/src/linux-next/tools/objtool/objtool


[-- Attachment #2: Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: next-20190826 - objtool fails to build.
  2019-08-28  4:15 next-20190826 - objtool fails to build Valdis Klētnieks
@ 2019-08-28 15:10 ` Josh Poimboeuf
  2019-08-28 19:30   ` Valdis Klētnieks
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Poimboeuf @ 2019-08-28 15:10 UTC (permalink / raw)
  To: Valdis Klētnieks; +Cc: Peter Zijlstra, linux-kernel

On Wed, Aug 28, 2019 at 12:15:15AM -0400, Valdis Klētnieks wrote:
> OK.  I'm mystified.  next-20190806 built fine.  -0818 and -0826 died a
> glorious death indeed.  All 3 were build using the same Fedora Rawhide 9.1.1
> compiler (installed on July 30). 'git log -- tools/objtool' comes up empty.
> 
> Local hack-around was to remove the -Werror from tools/objtool/Makefile
> 
> Am particularly mystified by the errors on lines 808/809 - the same compiler that
> was happy with the same code in next-0806 is now upset.  The others could possibly
> be a stray typedef in an include someplace, but those two errors have me stumped.
> 
> For that matter, I'm not even seeing how -Wsign-compare was even getting set, given
> a command 'make' and not W=1 or W=2....
> 
> (cue twilight zone theme)

Weird.  I don't have access to Rawhide at the moment so I can't
recreate.  It builds fine for me on Fedora 29.

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?

The reported warnings do seem reasonable though, maybe we should fix
them regardless and explicitly enable the warnings.

-- 
Josh

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

* Re: next-20190826 - objtool fails to build.
  2019-08-28 15:10 ` Josh Poimboeuf
@ 2019-08-28 19:30   ` Valdis Klētnieks
  2019-08-28 19:51     ` Josh Poimboeuf
  0 siblings, 1 reply; 5+ messages in thread
From: Valdis Klētnieks @ 2019-08-28 19:30 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: Peter Zijlstra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1011 bytes --]

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
self-inflicted.

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...


[-- Attachment #2: Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: next-20190826 - objtool fails to build.
  2019-08-28 19:30   ` Valdis Klētnieks
@ 2019-08-28 19:51     ` Josh Poimboeuf
  2019-08-28 19:58       ` Valdis Klētnieks
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Poimboeuf @ 2019-08-28 19:51 UTC (permalink / raw)
  To: Valdis Klētnieks; +Cc: Peter Zijlstra, linux-kernel

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
> self-inflicted.
> 
> 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
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -35,7 +35,7 @@ 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
-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:

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

* Re: next-20190826 - objtool fails to build.
  2019-08-28 19:51     ` Josh Poimboeuf
@ 2019-08-28 19:58       ` Valdis Klētnieks
  0 siblings, 0 replies; 5+ messages in thread
From: Valdis Klētnieks @ 2019-08-28 19:58 UTC (permalink / raw)
  To: Josh Poimboeuf; +Cc: Peter Zijlstra, linux-kernel

On Wed, 28 Aug 2019 14:51:00 -0500, Josh Poimboeuf said:

> > 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

> -CFLAGS   += -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)
> +CFLAGS   := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBELF_FLAGS)

Yep, thanks.  Feel free to stick these on the final version:

Reported-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Tested-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>

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

end of thread, other threads:[~2019-08-28 19:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-28  4:15 next-20190826 - objtool fails to build Valdis Klētnieks
2019-08-28 15:10 ` Josh Poimboeuf
2019-08-28 19:30   ` Valdis Klētnieks
2019-08-28 19:51     ` Josh Poimboeuf
2019-08-28 19:58       ` Valdis Klētnieks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox