Re: [PATCH v2 8/8] LoongArch: Add ORC unwinder support

From: Tiezhu Yang
Date: Wed Oct 18 2023 - 07:45:03 EST




On 10/10/2023 09:46 PM, kernel test robot wrote:
Hi Tiezhu,

kernel test robot noticed the following build errors:

...

In file included from scripts/sorttable.c:201:
scripts/sorttable.h:96:10: fatal error: 'asm/orc_types.h' file not found
#include <asm/orc_types.h>
^~~~~~~~~~~~~~~~~
1 error generated.

Thanks for your report, I can reproduce the error on x86:

make ARCH=x86_64 olddefconfig
make ARCH=x86_64 prepare

The build error is related with "ARCH=x86_64", there is no error
without "ARCH=x86_64" when build locally on x86.

As described in Documentation/kbuild/makefiles.rst:

For example, you can pass in ARCH=i386, ARCH=x86_64, or ARCH=x86.
For all of them, SRCARCH=x86 because arch/x86/ supports both i386 and
x86_64.

we should use SRCARCH instead of ARCH to specify the directory,
like this:

diff --git a/scripts/Makefile b/scripts/Makefile
index 576cf64..e4cca53 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -31,9 +31,12 @@ HOSTLDLIBS_sign-file = $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null |

ifdef CONFIG_UNWINDER_ORC
ifeq ($(ARCH),x86_64)
-ARCH := x86
+SRCARCH := x86
endif
-HOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/x86/include
+ifeq ($(ARCH),loongarch)
+SRCARCH := loongarch
+endif
+HOSTCFLAGS_sorttable.o += -I$(srctree)/tools/arch/$(SRCARCH)/include
HOSTCFLAGS_sorttable.o += -DUNWINDER_ORC_ENABLED
endif

I will update the related code of this patch in the next version.

Thanks,
Tiezhu