Commit 35561bab authored by Menglong Dong's avatar Menglong Dong Committed by Peter Zijlstra
Browse files

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: default avatarMenglong Dong <dongml2@chinatelecom.cn>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
parent 0d4eaf8c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@
 * This code generates raw asm output which is post-processed to extract
 * and format the required data.
 */
#define COMPILE_OFFSETS

#include <linux/types.h>
#include <linux/stddef.h>
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
/*
 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
 */
#define COMPILE_OFFSETS

#include <linux/sched.h>
#include <linux/mm.h>
+2 −0
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@
 * This code generates raw asm output which is post-processed to extract
 * and format the required data.
 */
#define COMPILE_OFFSETS

#include <linux/compiler.h>
#include <linux/sched.h>
#include <linux/mm.h>
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
 *               2001-2002 Keith Owens
 * Copyright (C) 2012 ARM Ltd.
 */
#define COMPILE_OFFSETS

#include <linux/arm_sdei.h>
#include <linux/sched.h>
+1 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
#define COMPILE_OFFSETS

#include <linux/sched.h>
#include <linux/kernel_stat.h>
Loading