Skip to content

Commit 24a295e

Browse files
huthIngo Molnar
authored andcommitted
x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in non-UAPI headers
While the GCC and Clang compilers already define __ASSEMBLER__ automatically when compiling assembly code, __ASSEMBLY__ is a macro that only gets defined by the Makefiles in the kernel. This can be very confusing when switching between userspace and kernelspace coding, or when dealing with UAPI headers that rather should use __ASSEMBLER__ instead. So let's standardize on the __ASSEMBLER__ macro that is provided by the compilers now. This is mostly a mechanical patch (done with a simple "sed -i" statement), with some manual tweaks in <asm/frame.h>, <asm/hw_irq.h> and <asm/setup.h> that mentioned this macro in comments with some missing underscores. Signed-off-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Brian Gerst <brgerst@gmail.com> Cc: Juergen Gross <jgross@suse.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Kees Cook <keescook@chromium.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lore.kernel.org/r/20250314071013.1575167-38-thuth@redhat.com
1 parent 8a141be commit 24a295e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+201
-201
lines changed

arch/x86/boot/boot.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#define STACK_SIZE 1024 /* Minimum number of bytes for stack */
1818

19-
#ifndef __ASSEMBLY__
19+
#ifndef __ASSEMBLER__
2020

2121
#include <linux/stdarg.h>
2222
#include <linux/types.h>
@@ -327,6 +327,6 @@ void probe_cards(int unsafe);
327327
/* video-vesa.c */
328328
void vesa_store_edid(void);
329329

330-
#endif /* __ASSEMBLY__ */
330+
#endif /* __ASSEMBLER__ */
331331

332332
#endif /* BOOT_BOOT_H */

arch/x86/entry/vdso/extable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* vDSO uses a dedicated handler the addresses are relative to the overall
88
* exception table, not each individual entry.
99
*/
10-
#ifdef __ASSEMBLY__
10+
#ifdef __ASSEMBLER__
1111
#define _ASM_VDSO_EXTABLE_HANDLE(from, to) \
1212
ASM_VDSO_EXTABLE_HANDLE from to
1313

arch/x86/include/asm/alternative.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define ALT_DIRECT_CALL(feature) ((ALT_FLAG_DIRECT_CALL << ALT_FLAGS_SHIFT) | (feature))
1616
#define ALT_CALL_ALWAYS ALT_DIRECT_CALL(X86_FEATURE_ALWAYS)
1717

18-
#ifndef __ASSEMBLY__
18+
#ifndef __ASSEMBLER__
1919

2020
#include <linux/stddef.h>
2121

@@ -277,7 +277,7 @@ static inline int alternatives_text_reserved(void *start, void *end)
277277
void BUG_func(void);
278278
void nop_func(void);
279279

280-
#else /* __ASSEMBLY__ */
280+
#else /* __ASSEMBLER__ */
281281

282282
#ifdef CONFIG_SMP
283283
.macro LOCK_PREFIX
@@ -360,6 +360,6 @@ void nop_func(void);
360360
ALTERNATIVE_2 oldinstr, newinstr_no, X86_FEATURE_ALWAYS, \
361361
newinstr_yes, ft_flags
362362

363-
#endif /* __ASSEMBLY__ */
363+
#endif /* __ASSEMBLER__ */
364364

365365
#endif /* _ASM_X86_ALTERNATIVE_H */

arch/x86/include/asm/asm.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef _ASM_X86_ASM_H
33
#define _ASM_X86_ASM_H
44

5-
#ifdef __ASSEMBLY__
5+
#ifdef __ASSEMBLER__
66
# define __ASM_FORM(x, ...) x,## __VA_ARGS__
77
# define __ASM_FORM_RAW(x, ...) x,## __VA_ARGS__
88
# define __ASM_FORM_COMMA(x, ...) x,## __VA_ARGS__,
@@ -113,7 +113,7 @@
113113

114114
#endif
115115

116-
#ifndef __ASSEMBLY__
116+
#ifndef __ASSEMBLER__
117117
#ifndef __pic__
118118
static __always_inline __pure void *rip_rel_ptr(void *p)
119119
{
@@ -144,7 +144,7 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
144144
# include <asm/extable_fixup_types.h>
145145

146146
/* Exception table entry */
147-
#ifdef __ASSEMBLY__
147+
#ifdef __ASSEMBLER__
148148

149149
# define _ASM_EXTABLE_TYPE(from, to, type) \
150150
.pushsection "__ex_table","a" ; \
@@ -164,7 +164,7 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
164164
# define _ASM_NOKPROBE(entry)
165165
# endif
166166

167-
#else /* ! __ASSEMBLY__ */
167+
#else /* ! __ASSEMBLER__ */
168168

169169
# define DEFINE_EXTABLE_TYPE_REG \
170170
".macro extable_type_reg type:req reg:req\n" \
@@ -232,7 +232,7 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
232232
*/
233233
register unsigned long current_stack_pointer asm(_ASM_SP);
234234
#define ASM_CALL_CONSTRAINT "+r" (current_stack_pointer)
235-
#endif /* __ASSEMBLY__ */
235+
#endif /* __ASSEMBLER__ */
236236

237237
#define _ASM_EXTABLE(from, to) \
238238
_ASM_EXTABLE_TYPE(from, to, EX_TYPE_DEFAULT)

arch/x86/include/asm/boot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
# define BOOT_STACK_SIZE 0x1000
7575
#endif
7676

77-
#ifndef __ASSEMBLY__
77+
#ifndef __ASSEMBLER__
7878
extern unsigned int output_len;
7979
extern const unsigned long kernel_text_size;
8080
extern const unsigned long kernel_total_size;

arch/x86/include/asm/cpufeature.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#include <asm/processor.h>
66

7-
#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
7+
#if defined(__KERNEL__) && !defined(__ASSEMBLER__)
88

99
#include <asm/asm.h>
1010
#include <linux/bitops.h>
@@ -137,5 +137,5 @@ static __always_inline bool _static_cpu_has(u16 bit)
137137
#define CPU_FEATURE_TYPEVAL boot_cpu_data.x86_vendor, boot_cpu_data.x86, \
138138
boot_cpu_data.x86_model
139139

140-
#endif /* defined(__KERNEL__) && !defined(__ASSEMBLY__) */
140+
#endif /* defined(__KERNEL__) && !defined(__ASSEMBLER__) */
141141
#endif /* _ASM_X86_CPUFEATURE_H */

arch/x86/include/asm/cpumask.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
#ifndef _ASM_X86_CPUMASK_H
33
#define _ASM_X86_CPUMASK_H
4-
#ifndef __ASSEMBLY__
4+
#ifndef __ASSEMBLER__
55
#include <linux/cpumask.h>
66

77
extern void setup_cpu_local_masks(void);
@@ -34,5 +34,5 @@ static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp
3434

3535
#define arch_cpu_is_offline(cpu) unlikely(!arch_cpu_online(cpu))
3636

37-
#endif /* __ASSEMBLY__ */
37+
#endif /* __ASSEMBLER__ */
3838
#endif /* _ASM_X86_CPUMASK_H */

arch/x86/include/asm/current.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include <linux/build_bug.h>
66
#include <linux/compiler.h>
77

8-
#ifndef __ASSEMBLY__
8+
#ifndef __ASSEMBLER__
99

1010
#include <linux/cache.h>
1111
#include <asm/percpu.h>
@@ -27,6 +27,6 @@ static __always_inline struct task_struct *get_current(void)
2727

2828
#define current get_current()
2929

30-
#endif /* __ASSEMBLY__ */
30+
#endif /* __ASSEMBLER__ */
3131

3232
#endif /* _ASM_X86_CURRENT_H */

arch/x86/include/asm/desc_defs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
#define DESC_USER (_DESC_DPL(3))
6060

61-
#ifndef __ASSEMBLY__
61+
#ifndef __ASSEMBLER__
6262

6363
#include <linux/types.h>
6464

@@ -166,7 +166,7 @@ struct desc_ptr {
166166
unsigned long address;
167167
} __attribute__((packed)) ;
168168

169-
#endif /* !__ASSEMBLY__ */
169+
#endif /* !__ASSEMBLER__ */
170170

171171
/* Boot IDT definitions */
172172
#define BOOT_IDT_ENTRIES 32

arch/x86/include/asm/dwarf2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#ifndef _ASM_X86_DWARF2_H
33
#define _ASM_X86_DWARF2_H
44

5-
#ifndef __ASSEMBLY__
5+
#ifndef __ASSEMBLER__
66
#warning "asm/dwarf2.h should be only included in pure assembly files"
77
#endif
88

0 commit comments

Comments
 (0)