[PATCH v2 15/16] objtool/powerpc: Enable objtool to be built on ppc

Josh Poimboeuf jpoimboe at kernel.org
Sun Feb 5 02:47:17 AEDT 2023


On Sat, Feb 04, 2023 at 02:10:34PM +0100, Christophe Leroy wrote:
> Ok, got the same problem as you with next-20230203
> 
>   DESCEND objtool
> <stdin>:1:10: fatal error: libelf.h: No such file or directory
> compilation terminated.
>   HOSTCC  /home/chleroy/linux-powerpc/tools/objtool/fixdep.o
>   HOSTLD  /home/chleroy/linux-powerpc/tools/objtool/fixdep-in.o
>   LINK    /home/chleroy/linux-powerpc/tools/objtool/fixdep
>   CC      /home/chleroy/linux-powerpc/tools/objtool/libsubcmd/exec-cmd.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/libsubcmd/help.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/libsubcmd/pager.o
>   CC /home/chleroy/linux-powerpc/tools/objtool/libsubcmd/parse-options.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/libsubcmd/run-command.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/libsubcmd/sigchain.o
>   CC /home/chleroy/linux-powerpc/tools/objtool/libsubcmd/subcmd-config.o
>   LD /home/chleroy/linux-powerpc/tools/objtool/libsubcmd/libsubcmd-in.o
>   AR      /home/chleroy/linux-powerpc/tools/objtool/libsubcmd/libsubcmd.a
>   INSTALL libsubcmd_headers
>   CC      /home/chleroy/linux-powerpc/tools/objtool/arch/powerpc/decode.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/arch/powerpc/special.o
>   LD /home/chleroy/linux-powerpc/tools/objtool/arch/powerpc/objtool-in.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/weak.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/check.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/special.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/builtin-check.o
>   CC      /home/chleroy/linux-powerpc/tools/objtool/elf.o
> elf.c: In function 'read_sections':
> elf.c:273:9: error: 'elf_getshnum' is deprecated
> [-Werror=deprecated-declarations]
>   273 |         if (elf_getshdrnum(elf->elf, &sections_nr)) {
>       |         ^~

This should be fixed with the latest tip/objtool/core which was rebased
today.  Here's the diff:

diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index 29a8cd7449bf..83b100c1e7f6 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -36,7 +36,7 @@ OBJTOOL_CFLAGS := -Werror $(WARNINGS) $(KBUILD_HOSTCFLAGS) -g $(INCLUDES) $(LIBE
 OBJTOOL_LDFLAGS := $(LIBELF_LIBS) $(LIBSUBCMD) $(KBUILD_HOSTLDFLAGS)
 
 # Allow old libelf to be used:
-elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(CC) $(CFLAGS) -x c -E - | grep elf_getshdr)
+elfshdr := $(shell echo '$(pound)include <libelf.h>' | $(HOSTCC) $(OBJTOOL_CFLAGS) -x c -E - | grep elf_getshdr)
 OBJTOOL_CFLAGS += $(if $(elfshdr),,-DLIBELF_USE_DEPRECATED)
 
 # Always want host compilation.


More information about the Linuxppc-dev mailing list