[PATCH 3/4] ORC: unify orc_hash.h generation

Johannes Berg johannes at sipsolutions.net
Thu Sep 24 05:35:52 PDT 2026


From: Johannes Berg <johannes.berg at intel.com>

There's no real reason this needs to be duplicated,
and while not a lot of code, I'm adding it yet again
for UML. Move it out to the common Makefile.

Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
 Makefile                | 13 +++++++++++++
 arch/loongarch/Makefile | 12 ------------
 arch/x86/Makefile       | 12 ------------
 3 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/Makefile b/Makefile
index 751a08643bf8..110aa0036e3f 100644
--- a/Makefile
+++ b/Makefile
@@ -1490,6 +1490,19 @@ filechk_compile.h = $(srctree)/scripts/mkcompile_h \
 include/generated/compile.h: FORCE
 	$(call filechk,compile.h)
 
+ifdef CONFIG_UNWINDER_ORC
+orc_hash_dir := arch/$(or $(HEADER_ARCH),$(SRCARCH))/include
+orc_hash_h := $(orc_hash_dir)/generated/asm/orc_hash.h
+orc_hash_sh := $(srctree)/scripts/orc_hash.sh
+targets += $(orc_hash_h)
+quiet_cmd_orc_hash = GEN     $@
+      cmd_orc_hash = mkdir -p $(dir $@); \
+		     $(CONFIG_SHELL) $(orc_hash_sh) < $< > $@
+$(orc_hash_h): $(srctree)/$(orc_hash_dir)/asm/orc_types.h $(orc_hash_sh) FORCE
+	$(call if_changed,orc_hash)
+archprepare: $(orc_hash_h)
+endif
+
 PHONY += headerdep
 headerdep:
 	$(Q)find $(srctree)/include/ -name '*.h' | xargs --max-args 1 \
diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
index 4b22f95aaafb..96ceda11e307 100644
--- a/arch/loongarch/Makefile
+++ b/arch/loongarch/Makefile
@@ -35,18 +35,6 @@ endif
 CC_FLAGS_FPU		:= -mfpu=64
 CC_FLAGS_NO_FPU		:= -msoft-float
 
-ifdef CONFIG_UNWINDER_ORC
-orc_hash_h := arch/$(SRCARCH)/include/generated/asm/orc_hash.h
-orc_hash_sh := $(srctree)/scripts/orc_hash.sh
-targets += $(orc_hash_h)
-quiet_cmd_orc_hash = GEN     $@
-      cmd_orc_hash = mkdir -p $(dir $@); \
-		     $(CONFIG_SHELL) $(orc_hash_sh) < $< > $@
-$(orc_hash_h): $(srctree)/arch/loongarch/include/asm/orc_types.h $(orc_hash_sh) FORCE
-	$(call if_changed,orc_hash)
-archprepare: $(orc_hash_h)
-endif
-
 ifdef CONFIG_DYNAMIC_FTRACE
 KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY
 CC_FLAGS_FTRACE := -fpatchable-function-entry=2
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 8af6b80cffdd..9089318a621c 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -331,18 +331,6 @@ ifeq ($(RETPOLINE_CFLAGS),)
 endif
 endif
 
-ifdef CONFIG_UNWINDER_ORC
-orc_hash_h := arch/$(SRCARCH)/include/generated/asm/orc_hash.h
-orc_hash_sh := $(srctree)/scripts/orc_hash.sh
-targets += $(orc_hash_h)
-quiet_cmd_orc_hash = GEN     $@
-      cmd_orc_hash = mkdir -p $(dir $@); \
-		     $(CONFIG_SHELL) $(orc_hash_sh) < $< > $@
-$(orc_hash_h): $(srctree)/arch/x86/include/asm/orc_types.h $(orc_hash_sh) FORCE
-	$(call if_changed,orc_hash)
-archprepare: $(orc_hash_h)
-endif
-
 archclean:
 	$(Q)rm -rf $(objtree)/arch/i386
 	$(Q)rm -rf $(objtree)/arch/x86_64
-- 
2.55.0




More information about the linux-um mailing list