objtool: Fix compile failure when using the x32 compiler
authorMikulas Patocka <mpatocka@redhat.com>
Sat, 30 Mar 2024 19:23:08 +0000 (20:23 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 30 Mar 2024 21:12:37 +0000 (22:12 +0100)
When compiling the v6.9-rc1 kernel with the x32 compiler, the following
errors are reported. The reason is that we take an "unsigned long"
variable and print it using "PRIx64" format string.

In file included from check.c:16:
check.c: In function ‘add_dead_ends’:
/usr/src/git/linux-2.6/tools/objtool/include/objtool/warn.h:46:17: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 5 has type ‘long unsigned int’ [-Werror=format=]
   46 |                 "%s: warning: objtool: " format "\n",   \
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~
check.c:613:33: note: in expansion of macro ‘WARN’
  613 |                                 WARN("can't find unreachable insn at %s+0x%" PRIx64,
      |                                 ^~~~
...

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: linux-kernel@vger.kernel.org
tools/objtool/check.c

index 0b10ad00866867d9f4ba6787ca000f43bed230be..0a33d9195b7a9112df7824899d7564081e3d8782 100644 (file)
@@ -585,7 +585,7 @@ static int add_dead_ends(struct objtool_file *file)
        struct section *rsec;
        struct reloc *reloc;
        struct instruction *insn;
-       unsigned long offset;
+       uint64_t offset;
 
        /*
         * Check for manually annotated dead ends.