···11+#22+# Kbuild for top-level directory of the kernel33+# This file takes care of the following:44+# 1) Generate asm-offsets.h55+66+#####77+# 1) Generate asm-offsets.h 88+#99+1010+offsets-file := include/asm-$(ARCH)/asm-offsets.h1111+1212+always := $(offsets-file)1313+targets := $(offsets-file)1414+targets += arch/$(ARCH)/kernel/asm-offsets.s1515+1616+# Default sed regexp - multiline due to syntax constraints1717+define sed-y1818+ "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"1919+endef2020+# Override default regexp for specific architectures2121+sed-$(CONFIG_MIPS) := "/^@@@/s///p"2222+2323+quiet_cmd_offsets = GEN $@2424+define cmd_offsets2525+ cat $< | \2626+ (set -e; \2727+ echo "#ifndef __ASM_OFFSETS_H__"; \2828+ echo "#define __ASM_OFFSETS_H__"; \2929+ echo "/*"; \3030+ echo " * DO NOT MODIFY."; \3131+ echo " *"; \3232+ echo " * This file was generated by $(srctree)/Kbuild"; \3333+ echo " *"; \3434+ echo " */"; \3535+ echo ""; \3636+ sed -ne $(sed-y); \3737+ echo ""; \3838+ echo "#endif" ) > $@3939+endef4040+4141+# We use internal kbuild rules to avoid the "is up to date" message from make4242+arch/$(ARCH)/kernel/asm-offsets.s: arch/$(ARCH)/kernel/asm-offsets.c FORCE4343+ $(Q)mkdir -p $(dir $@)4444+ $(call if_changed_dep,cc_s_c)4545+4646+$(srctree)/$(offsets-file): arch/$(ARCH)/kernel/asm-offsets.s Kbuild4747+ $(call cmd,offsets)4848+
+11-28
Makefile
···776776# A multi level approach is used. prepare1 is updated first, then prepare0.777777# prepare-all is the collection point for the prepare targets.778778779779-.PHONY: prepare-all prepare prepare0 prepare1 prepare2779779+.PHONY: prepare-all prepare prepare0 prepare1 prepare2 prepare3780780781781-# prepare2 is used to check if we are building in a separate output directory,781781+# prepare3 is used to check if we are building in a separate output directory,782782# and if so do:783783# 1) Check that make has not been executed in the kernel src $(srctree)784784# 2) Create the include2 directory, used for the second asm symlink785785786786-prepare2:786786+prepare3:787787ifneq ($(KBUILD_SRC),)788788 @echo ' Using $(srctree) as source for kernel'789789 $(Q)if [ -f $(srctree)/.config ]; then \···795795 $(Q)ln -fsn $(srctree)/include/asm-$(ARCH) include2/asm796796endif797797798798-# prepare1 creates a makefile if using a separate output directory799799-prepare1: prepare2 outputmakefile798798+# prepare2 creates a makefile if using a separate output directory799799+prepare2: prepare3 outputmakefile800800801801-prepare0: prepare1 include/linux/version.h include/asm \801801+prepare1: prepare2 include/linux/version.h include/asm \802802 include/config/MARKER803803ifneq ($(KBUILD_MODULES),)804804 $(Q)rm -rf $(MODVERDIR)805805 $(Q)mkdir -p $(MODVERDIR)806806endif807807808808+prepare0: prepare prepare1 FORCE809809+ $(Q)$(MAKE) $(build)=$(srctree)810810+808811# All the preparing..809809-prepare-all: prepare0 prepare812812+prepare-all: prepare0810813811814# Leave this as default for preprocessing vmlinux.lds.S, which is now812815# done in arch/$(ARCH)/kernel/Makefile···952949953950endif # CONFIG_MODULES954951955955-# Generate asm-offsets.h 956956-# ---------------------------------------------------------------------------957957-958958-define filechk_gen-asm-offsets959959- (set -e; \960960- echo "#ifndef __ASM_OFFSETS_H__"; \961961- echo "#define __ASM_OFFSETS_H__"; \962962- echo "/*"; \963963- echo " * DO NOT MODIFY."; \964964- echo " *"; \965965- echo " * This file was generated by arch/$(ARCH)/Makefile"; \966966- echo " *"; \967967- echo " */"; \968968- echo ""; \969969- sed -ne "/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"; \970970- echo ""; \971971- echo "#endif" )972972-endef973973-974974-975952###976953# Cleaning is done on three levels.977954# make clean Delete most generated files···974991#975992clean: rm-dirs := $(CLEAN_DIRS)976993clean: rm-files := $(CLEAN_FILES)977977-clean-dirs := $(addprefix _clean_,$(vmlinux-alldirs))994994+clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs))978995979996.PHONY: $(clean-dirs) clean archclean980997$(clean-dirs):
···55 * Verify that we have not overflowed the stack. Oops if we have.66 */7788-#include <asm/asm_offsets.h>88+#include <asm/asm-offsets.h>991010 .text1111 .set noat
+1-1
arch/alpha/lib/dbg_stackkill.S
···66 * uninitialized local variables in the act.77 */8899-#include <asm/asm_offsets.h>99+#include <asm/asm-offsets.h>10101111 .text1212 .set noat
···2626 * Note that ADDR_LIMIT is either 0 or 0xc0000000.2727 * Note also that it is intended that __get_user_bad is not global.2828 */2929-#include <asm/constants.h>2929+#include <asm/asm-offsets.h>3030#include <asm/thread_info.h>3131#include <asm/errno.h>3232
+1-1
arch/arm/lib/putuser.S
···2626 * Note that ADDR_LIMIT is either 0 or 0xc00000002727 * Note also that it is intended that __put_user_bad is not global.2828 */2929-#include <asm/constants.h>2929+#include <asm/asm-offsets.h>3030#include <asm/thread_info.h>3131#include <asm/errno.h>3232
···1111 * These assume a split I/D TLB.1212 */1313#include <linux/linkage.h>1414-#include <asm/constants.h>1414+#include <asm/asm-offsets.h>1515#include <asm/page.h>1616#include <asm/tlbflush.h>1717#include "proc-macros.S"
+1-1
arch/arm/nwfpe/entry26.S
···2020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.2121*/22222323-#include <asm/constants.h>2323+#include <asm/asm-offsets.h>24242525/* This is the kernel's entry point into the floating point emulator.2626It is called from the kernel with code similar to this:
···2626 * Note that ADDR_LIMIT is either 0 or 0xc0000000.2727 * Note also that it is intended that __get_user_bad is not global.2828 */2929-#include <asm/asm_offsets.h>2929+#include <asm/asm-offsets.h>3030#include <asm/thread_info.h>3131#include <asm/errno.h>3232
+1-1
arch/arm26/lib/putuser.S
···2626 * Note that ADDR_LIMIT is either 0 or 0xc00000002727 * Note also that it is intended that __put_user_bad is not global.2828 */2929-#include <asm/asm_offsets.h>2929+#include <asm/asm-offsets.h>3030#include <asm/thread_info.h>3131#include <asm/errno.h>3232
···2020 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.2121*/22222323-#include <asm/asm_offsets.h>2323+#include <asm/asm-offsets.h>24242525/* This is the kernel's entry point into the floating point emulator.2626It is called from the kernel with code similar to this:
+2-8
arch/cris/Makefile
···107107 rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img108108 rm -rf $(LD_SCRIPT).tmp109109110110-prepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch \111111- include/asm-$(ARCH)/$(SARCH)/offset.h110110+prepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch112111113112# Create some links to make all tools happy114113$(SRC_ARCH)/.links:···119120 @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib120121 @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch121122 @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S123123+ @ln -sfn $(SRC_ARCH)/$(SARCH)/asm-offsets.c $(SRC_ARCH)/kernel/asm-offsets.c122124 @touch $@123125124126# Create link to sub arch includes···128128 @rm -f include/asm-$(ARCH)/arch129129 @ln -sf $(srctree)/include/asm-$(ARCH)/$(SARCH) $(srctree)/include/asm-$(ARCH)/arch130130 @touch $@131131-132132-arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \133133- include/config/MARKER134134-135135-include/asm-$(ARCH)/$(SARCH)/offset.h: arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s136136- $(call filechk,gen-asm-offsets)
···33 * object prelinked to its virtual address, and with only one read-only44 * segment (that fits in one page). This script controls its layout.55 */66-#include <asm/asm_offsets.h>66+#include <asm/asm-offsets.h>7788SECTIONS99{
···2424#warning PA64 support needs more work...did first cut2525#endif26262727-#include <asm/offsets.h>2727+#include <asm/asm-offsets.h>2828#include <asm/assembly.h>2929#include <asm/signal.h>3030
+1-1
arch/parisc/kernel/entry.S
···2323 */24242525#include <linux/config.h>2626-#include <asm/offsets.h>2626+#include <asm/asm-offsets.h>27272828/* we have the following possibilities to act on an interruption:2929 * - handle in assembly and use shadowed registers only
+1-1
arch/parisc/kernel/head.S
···14141515#include <linux/autoconf.h> /* for CONFIG_SMP */16161717-#include <asm/offsets.h>1717+#include <asm/asm-offsets.h>1818#include <asm/psw.h>1919#include <asm/pdc.h>2020
···1818#include <asm/cache.h>1919#include <asm/thread_info.h>2020#include <asm/ppc_asm.h>2121-#include <asm/offsets.h>2121+#include <asm/asm-offsets.h>22222323/*2424 * This task wants to use the FPU now.
···4040#include <asm/cputable.h>4141#include <asm/thread_info.h>4242#include <asm/ppc_asm.h>4343-#include <asm/offsets.h>4343+#include <asm/asm-offsets.h>44444545/* As with the other PowerPC ports, it is expected that when code4646 * execution begins here, the following registers contain valid, yet
+1-1
arch/ppc/kernel/head_8xx.S
···3030#include <asm/cputable.h>3131#include <asm/thread_info.h>3232#include <asm/ppc_asm.h>3333-#include <asm/offsets.h>3333+#include <asm/asm-offsets.h>34343535/* Macro to make the code more readable. */3636#ifdef CONFIG_8xx_CPU6
+1-1
arch/ppc/kernel/head_fsl_booke.S
···4141#include <asm/cputable.h>4242#include <asm/thread_info.h>4343#include <asm/ppc_asm.h>4444-#include <asm/offsets.h>4444+#include <asm/asm-offsets.h>4545#include "head_booke.h"46464747/* As with the other PowerPC ports, it is expected that when code
···2222#include <asm/irq.h>2323#include <asm/errno.h>24242525-#include <asm/asm-consts.h>2525+#include <asm/asm-offsets.h>262627272828/* Make a slightly more convenient alias for C_SYMBOL_NAME. */
···5757#include <linux/config.h>58585959#include <asm/fpu.h>6060-#include <asm/offsets.h>6060+#include <asm/asm-offsets.h>61616262/*6363 * Base-2 logarithm of number of pages to allocate per task structure
···7373#endif74747575/*7676- * The asm_offsets.h is a generated file, so we cannot include it.7676+ * The asm-offsets.h is a generated file, so we cannot include it.7777 * It may be OK for glibc headers, but it's utterly pointless for C code.7878 * The assembly code using those offsets has to include it explicitly.7979 */8080-/* #include <asm/asm_offsets.h> */8080+/* #include <asm/asm-offsets.h> */81818282/* These are for pt_regs. */8383#define PT_PSR 0x0