Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

arch: Add the macro COMPILE_OFFSETS to all the asm-offsets.c

The include/generated/asm-offsets.h is generated in Kbuild during
compiling from arch/SRCARCH/kernel/asm-offsets.c. When we want to
generate another similar offset header file, circular dependency can
happen.

For example, we want to generate a offset file include/generated/test.h,
which is included in include/sched/sched.h. If we generate asm-offsets.h
first, it will fail, as include/sched/sched.h is included in asm-offsets.c
and include/generated/test.h doesn't exist; If we generate test.h first,
it can't success neither, as include/generated/asm-offsets.h is included
by it.

In x86_64, the macro COMPILE_OFFSETS is used to avoid such circular
dependency. We can generate asm-offsets.h first, and if the
COMPILE_OFFSETS is defined, we don't include the "generated/test.h".

And we define the macro COMPILE_OFFSETS for all the asm-offsets.c for this
purpose.

Signed-off-by: Menglong Dong <dongml2@chinatelecom.cn>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

authored by

Menglong Dong and committed by
Peter Zijlstra
35561bab 0d4eaf8c

+24
+1
arch/alpha/kernel/asm-offsets.c
··· 4 4 * This code generates raw asm output which is post-processed to extract 5 5 * and format the required data. 6 6 */ 7 + #define COMPILE_OFFSETS 7 8 8 9 #include <linux/types.h> 9 10 #include <linux/stddef.h>
+1
arch/arc/kernel/asm-offsets.c
··· 2 2 /* 3 3 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 4 4 */ 5 + #define COMPILE_OFFSETS 5 6 6 7 #include <linux/sched.h> 7 8 #include <linux/mm.h>
+2
arch/arm/kernel/asm-offsets.c
··· 7 7 * This code generates raw asm output which is post-processed to extract 8 8 * and format the required data. 9 9 */ 10 + #define COMPILE_OFFSETS 11 + 10 12 #include <linux/compiler.h> 11 13 #include <linux/sched.h> 12 14 #include <linux/mm.h>
+1
arch/arm64/kernel/asm-offsets.c
··· 6 6 * 2001-2002 Keith Owens 7 7 * Copyright (C) 2012 ARM Ltd. 8 8 */ 9 + #define COMPILE_OFFSETS 9 10 10 11 #include <linux/arm_sdei.h> 11 12 #include <linux/sched.h>
+1
arch/csky/kernel/asm-offsets.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. 3 + #define COMPILE_OFFSETS 3 4 4 5 #include <linux/sched.h> 5 6 #include <linux/kernel_stat.h>
+1
arch/hexagon/kernel/asm-offsets.c
··· 8 8 * 9 9 * Copyright (c) 2010-2012, The Linux Foundation. All rights reserved. 10 10 */ 11 + #define COMPILE_OFFSETS 11 12 12 13 #include <linux/compat.h> 13 14 #include <linux/types.h>
+2
arch/loongarch/kernel/asm-offsets.c
··· 4 4 * 5 5 * Copyright (C) 2020-2022 Loongson Technology Corporation Limited 6 6 */ 7 + #define COMPILE_OFFSETS 8 + 7 9 #include <linux/types.h> 8 10 #include <linux/sched.h> 9 11 #include <linux/mm.h>
+1
arch/m68k/kernel/asm-offsets.c
··· 9 9 * #defines from the assembly-language output. 10 10 */ 11 11 12 + #define COMPILE_OFFSETS 12 13 #define ASM_OFFSETS_C 13 14 14 15 #include <linux/stddef.h>
+1
arch/microblaze/kernel/asm-offsets.c
··· 7 7 * License. See the file "COPYING" in the main directory of this archive 8 8 * for more details. 9 9 */ 10 + #define COMPILE_OFFSETS 10 11 11 12 #include <linux/init.h> 12 13 #include <linux/stddef.h>
+2
arch/mips/kernel/asm-offsets.c
··· 9 9 * Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com 10 10 * Copyright (C) 2000 MIPS Technologies, Inc. 11 11 */ 12 + #define COMPILE_OFFSETS 13 + 12 14 #include <linux/compat.h> 13 15 #include <linux/types.h> 14 16 #include <linux/sched.h>
+1
arch/nios2/kernel/asm-offsets.c
··· 2 2 /* 3 3 * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> 4 4 */ 5 + #define COMPILE_OFFSETS 5 6 6 7 #include <linux/stddef.h> 7 8 #include <linux/sched.h>
+1
arch/openrisc/kernel/asm-offsets.c
··· 18 18 * compile this file to assembler, and then extract the 19 19 * #defines from the assembly-language output. 20 20 */ 21 + #define COMPILE_OFFSETS 21 22 22 23 #include <linux/signal.h> 23 24 #include <linux/sched.h>
+1
arch/parisc/kernel/asm-offsets.c
··· 13 13 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> 14 14 * Copyright (C) 2003 James Bottomley <jejb at parisc-linux.org> 15 15 */ 16 + #define COMPILE_OFFSETS 16 17 17 18 #include <linux/types.h> 18 19 #include <linux/sched.h>
+1
arch/powerpc/kernel/asm-offsets.c
··· 8 8 * compile this file to assembler, and then extract the 9 9 * #defines from the assembly-language output. 10 10 */ 11 + #define COMPILE_OFFSETS 11 12 12 13 #include <linux/compat.h> 13 14 #include <linux/signal.h>
+1
arch/riscv/kernel/asm-offsets.c
··· 3 3 * Copyright (C) 2012 Regents of the University of California 4 4 * Copyright (C) 2017 SiFive 5 5 */ 6 + #define COMPILE_OFFSETS 6 7 7 8 #include <linux/kbuild.h> 8 9 #include <linux/mm.h>
+1
arch/s390/kernel/asm-offsets.c
··· 4 4 * This code generates raw asm output which is post-processed to extract 5 5 * and format the required data. 6 6 */ 7 + #define COMPILE_OFFSETS 7 8 8 9 #include <linux/kbuild.h> 9 10 #include <linux/sched.h>
+1
arch/sh/kernel/asm-offsets.c
··· 8 8 * compile this file to assembler, and then extract the 9 9 * #defines from the assembly-language output. 10 10 */ 11 + #define COMPILE_OFFSETS 11 12 12 13 #include <linux/stddef.h> 13 14 #include <linux/types.h>
+1
arch/sparc/kernel/asm-offsets.c
··· 10 10 * 11 11 * On sparc, thread_info data is static and TI_XXX offsets are computed by hand. 12 12 */ 13 + #define COMPILE_OFFSETS 13 14 14 15 #include <linux/sched.h> 15 16 #include <linux/mm_types.h>
+2
arch/um/kernel/asm-offsets.c
··· 1 + #define COMPILE_OFFSETS 2 + 1 3 #include <sysdep/kernel-offsets.h>
+1
arch/xtensa/kernel/asm-offsets.c
··· 11 11 * 12 12 * Chris Zankel <chris@zankel.net> 13 13 */ 14 + #define COMPILE_OFFSETS 14 15 15 16 #include <asm/processor.h> 16 17 #include <asm/coprocessor.h>