Skip to content

Commit cc89ac0

Browse files
image-dragongregkh
authored andcommitted
arch: Add the macro COMPILE_OFFSETS to all the asm-offsets.c
[ Upstream commit 35561ba ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 8297de5 commit cc89ac0

File tree

20 files changed

+24
-0
lines changed

20 files changed

+24
-0
lines changed

arch/alpha/kernel/asm-offsets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* This code generates raw asm output which is post-processed to extract
55
* and format the required data.
66
*/
7+
#define COMPILE_OFFSETS
78

89
#include <linux/types.h>
910
#include <linux/stddef.h>

arch/arc/kernel/asm-offsets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/*
33
* Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
44
*/
5+
#define COMPILE_OFFSETS
56

67
#include <linux/sched.h>
78
#include <linux/mm.h>

arch/arm/kernel/asm-offsets.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
* This code generates raw asm output which is post-processed to extract
88
* and format the required data.
99
*/
10+
#define COMPILE_OFFSETS
11+
1012
#include <linux/compiler.h>
1113
#include <linux/sched.h>
1214
#include <linux/mm.h>

arch/arm64/kernel/asm-offsets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
* 2001-2002 Keith Owens
77
* Copyright (C) 2012 ARM Ltd.
88
*/
9+
#define COMPILE_OFFSETS
910

1011
#include <linux/arm_sdei.h>
1112
#include <linux/sched.h>

arch/csky/kernel/asm-offsets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3+
#define COMPILE_OFFSETS
34

45
#include <linux/sched.h>
56
#include <linux/kernel_stat.h>

arch/hexagon/kernel/asm-offsets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*
99
* Copyright (c) 2010-2012, The Linux Foundation. All rights reserved.
1010
*/
11+
#define COMPILE_OFFSETS
1112

1213
#include <linux/compat.h>
1314
#include <linux/types.h>

arch/loongarch/kernel/asm-offsets.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
*
55
* Copyright (C) 2020-2022 Loongson Technology Corporation Limited
66
*/
7+
#define COMPILE_OFFSETS
8+
79
#include <linux/types.h>
810
#include <linux/sched.h>
911
#include <linux/mm.h>

arch/m68k/kernel/asm-offsets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* #defines from the assembly-language output.
1010
*/
1111

12+
#define COMPILE_OFFSETS
1213
#define ASM_OFFSETS_C
1314

1415
#include <linux/stddef.h>

arch/microblaze/kernel/asm-offsets.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* License. See the file "COPYING" in the main directory of this archive
88
* for more details.
99
*/
10+
#define COMPILE_OFFSETS
1011

1112
#include <linux/init.h>
1213
#include <linux/stddef.h>

arch/mips/kernel/asm-offsets.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Kevin Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
1010
* Copyright (C) 2000 MIPS Technologies, Inc.
1111
*/
12+
#define COMPILE_OFFSETS
13+
1214
#include <linux/compat.h>
1315
#include <linux/types.h>
1416
#include <linux/sched.h>

0 commit comments

Comments
 (0)