Re: [RFC 00/31] objtool, livepatch: Livepatch module generation

From: Josh Poimboeuf
Date: Fri Sep 06 2024 - 21:47:15 EST


On Fri, Sep 06, 2024 at 09:56:06AM -0400, Joe Lawrence wrote:
> A few minor build complaints on my system:
>
> $ make tools/objtool/check.o
> CALL scripts/checksyscalls.sh
> DESCEND objtool
> INSTALL libsubcmd_headers
> CC /home/jolawren/src/linux/tools/objtool/check.o
> check.c: In function ‘is_livepatch_module’:
> check.c:661:16: error: implicit declaration of function ‘memmem’; did you mean ‘memset’? [-Werror=implicit-function-declaration]

I was confused why you and Song were having compile issues when I
wasn't. But now I'm realizing that your incantation above

make tools/objtool/check.o

uses the kernel's makefiles along with the kernel's compiler flags and
include directories. And I guess it also enables a bunch more warnings
which probably explains the differences


Somehow that normally works for you?

When I try, I get

tools/objtool/check.c:6:10: fatal error: string.h: No such file or directory
6 | #include <string.h>
| ^~~~~~~~~~

because of -nostdinc.


Normally I build objtool with

make tools/objtool

or just

make

Those use the objtool Makefile without all the extra kernel flags.

How do you normally build objtool?

Regardless, I should probably enable a lot of those extra warnings in
the objtool Makefile.

--
Josh