Я пытаюсь сделать файл AST для ядра Linux 2.6.37 с кодом clang 8.0.0.Я запускаю следующее в корневой директории ядра
clang -emit-ast init/main.c -o astfile -std=c11 -Iinclude -Iarch/x86/include
и получаю ошибки
In file included from /mnt/lfs/sources/linux-2.6.37/init/main.c:12:
/mnt/lfs/sources/linux-2.6.37/include/linux/types.h:13:2: warning: "Attempt to use kernel
headers from user space, see http://kernelnewbies.org/KernelHeaders" [-W#warnings]
#warning "Attempt to use kernel headers from user space, see http://kernelnewbies...
^
In file included from /mnt/lfs/sources/linux-2.6.37/init/main.c:13:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/module.h:9:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/list.h:7:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/prefetch.h:14:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/processor.h:15:
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/current.h:12:8: error: unknown type
name '__always_inline'
static __always_inline struct task_struct *get_current(void)
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/current.h:12:24: error: expected
identifier or '('
static __always_inline struct task_struct *get_current(void)
^
In file included from /mnt/lfs/sources/linux-2.6.37/init/main.c:13:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/module.h:9:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/list.h:7:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/prefetch.h:14:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/processor.h:17:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/system.h:7:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/cmpxchg.h:4:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/cmpxchg_64.h:4:
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/alternative.h:47:2: error: unknown
type name 'u8'
u8 *instr; /* original instruction */
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/alternative.h:48:2: error: unknown
type name 'u8'
u8 *replacement;
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/alternative.h:49:2: error: unknown
type name 'u16'
u16 cpuid; /* cpuid bit set for replacement */
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/alternative.h:50:2: error: unknown
type name 'u8'
u8 instrlen; /* length of original instruction */
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/alternative.h:51:2: error: unknown
type name 'u8'
u8 replacementlen; /* length of new instruction, <= instrlen */
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/alternative.h:164:62: error: unknown
type name 'size_t'
extern void *text_poke_early(void *addr, const void *opcode, size_t len);
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/alternative.h:183:56: error: unknown
type name 'size_t'
extern void *text_poke(void *addr, const void *opcode, size_t len);
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/alternative.h:184:60: error: unknown
type name 'size_t'
extern void *text_poke_smp(void *addr, const void *opcode, size_t len);
^
In file included from /mnt/lfs/sources/linux-2.6.37/init/main.c:13:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/module.h:9:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/list.h:7:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/prefetch.h:14:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/processor.h:17:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/system.h:7:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/cmpxchg.h:4:
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/cmpxchg_64.h:6:39: error: unknown type
name 'u64'
static inline void set_64bit(volatile u64 *ptr, u64 val)
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/cmpxchg_64.h:6:49: error: unknown type
name 'u64'
static inline void set_64bit(volatile u64 *ptr, u64 val)
^
In file included from /mnt/lfs/sources/linux-2.6.37/init/main.c:13:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/module.h:9:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/list.h:7:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/prefetch.h:14:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/processor.h:17:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/system.h:11:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/irqflags.h:15:
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/irqflags.h:20:2: error: use of
undeclared identifier 'asm'
asm volatile("# __raw_save_flags\n\t"
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/irqflags.h:31:2: error: use of
undeclared identifier 'asm'
asm volatile("push %0 ; popf"
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/irqflags.h:39:2: error: use of
undeclared identifier 'asm'
asm volatile("cli": : :"memory");
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/irqflags.h:44:2: error: use of
undeclared identifier 'asm'
asm volatile("sti": : :"memory");
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/irqflags.h:49:2: error: use of
undeclared identifier 'asm'
asm volatile("sti; hlt": : :"memory");
^
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/irqflags.h:54:2: error: use of
undeclared identifier 'asm'
asm volatile("hlt": : :"memory");
^
In file included from /mnt/lfs/sources/linux-2.6.37/init/main.c:13:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/module.h:9:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/list.h:7:
In file included from /mnt/lfs/sources/linux-2.6.37/include/linux/prefetch.h:14:
In file included from /mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/processor.h:17:
/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/system.h:335:2: error: use of
undeclared identifier 'asm'
asm volatile("clflush %0" : "+m" (*(volatile char __force *)__p));
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
Пожалуйста, помогите, я пытался гуглить об этих ошибках, но не нашел ничего подходящего.Я добавил заголовок ядра из исходного каталога ядра с флагом -I
, потому что компилятор не смог найти их в моей системе ArchLinux 5.0.10-arch1-1-ARCH.