mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [tip: objtool/core] objtool: Also include tools/include/uapi
@ 2024-10-31 21:29 tip-bot2 for HONG Yifan
  0 siblings, 0 replies; only message in thread
From: tip-bot2 for HONG Yifan @ 2024-10-31 21:29 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: HONG Yifan, Josh Poimboeuf, x86, linux-kernel

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     32b504854bd96f707a03c6ddecb0af9d7fbc4775
Gitweb:        https://git.kernel.org/tip/32b504854bd96f707a03c6ddecb0af9d7fbc4775
Author:        HONG Yifan <elsk@google.com>
AuthorDate:    Tue, 08 Oct 2024 23:47:17 
Committer:     Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Thu, 17 Oct 2024 15:13:06 -07:00

objtool: Also include tools/include/uapi

When building objtool against a sysroot that contains a stripped down
version of the UAPI headers, the following error happens:

    In file included from arch/x86/decode.c:10:
    In file included from .../tools/arch/x86/include/asm/insn.h:10:
    In file included from <sysroot>/include/asm/byteorder.h:9:
    In file included from <sysroot>/include/linux/byteorder/little_endian.h:15:
    In file included from <sysroot>/include/linux/stddef.h:9:
    In file included from .../tools/include/linux/compiler_types.h:36:
    .../tools/include/linux/compiler-gcc.h:3:2: error: "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
        3 | #error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead."
        |  ^
    1 error generated.

As hinted by the error, this is because <sysroot>/include/linux/stddef.h
(a stripped-down version of uapi/include/linux/stddef.h) includes
linux/compiler_types.h directly. However, this gets resolved to
tools/include/linux/compiler_types.h, which is not expected to be
included directly.

To resolve this, I added tools/include/uapi to the include paths when
building objtool. With this trick, linux/stddef.h is resolved to
tools/include/uapi/linux/stddef.h, which doesn't include
linux/compiler_types.h.

Signed-off-by: HONG Yifan <elsk@google.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
 tools/objtool/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile
index bf7f7f8..f56e277 100644
--- a/tools/objtool/Makefile
+++ b/tools/objtool/Makefile
@@ -24,6 +24,7 @@ LIBELF_LIBS  := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lel
 all: $(OBJTOOL)
 
 INCLUDES := -I$(srctree)/tools/include \
+	    -I$(srctree)/tools/include/uapi \
 	    -I$(srctree)/tools/arch/$(HOSTARCH)/include/uapi \
 	    -I$(srctree)/tools/arch/$(SRCARCH)/include	\
 	    -I$(srctree)/tools/objtool/include \

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-10-31 21:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-31 21:29 [tip: objtool/core] objtool: Also include tools/include/uapi tip-bot2 for HONG Yifan

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

all inboxes | Powered by JetHome®