热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Linux内核中的prefetch,Clang和Linux内核

我尝试用clang8.0.0为Linux内核2.6.37编写AST文件。clang-emit-astinitmain.c-oastfile-stdc11-Iinclude-Iarc

我尝试用clang8.0.0为Linux内核2.6.37编写AST文件。

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, <&#61; instrlen */

^

/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/alternative.h:164:62: error: unknown

type name &#39;size_t&#39;

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 &#39;size_t&#39;

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 &#39;size_t&#39;

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 &#39;u64&#39;

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 &#39;u64&#39;

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 &#39;asm&#39;

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 &#39;asm&#39;

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 &#39;asm&#39;

asm volatile("cli": : :"memory");

^

/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/irqflags.h:44:2: error: use of

undeclared identifier &#39;asm&#39;

asm volatile("sti": : :"memory");

^

/mnt/lfs/sources/linux-2.6.37/arch/x86/include/asm/irqflags.h:49:2: error: use of

undeclared identifier &#39;asm&#39;

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 &#39;asm&#39;

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 &#39;asm&#39;

asm volatile("clflush %0" : "&#43;m" (*(volatile char __force *)__p));

^

fatal error: too many errors emitted, stopping now [-ferror-limit&#61;]

1 warning and 20 errors generated.

请帮忙,我已经试着用谷歌搜索这个错误,但没有找到合适的。我已经添加了来自内核源目录的内核头

-I

标志,因为编译器在我的系统ArchLinux 5.0.10-arch1-1-ARCH上找不到它们。



推荐阅读
  • Ihavetwomethodsofgeneratingmdistinctrandomnumbersintherange[0..n-1]我有两种方法在范围[0.n-1]中生 ... [详细]
  • 本文详细介绍了在 CentOS 7 系统中配置 fstab 文件以实现开机自动挂载 NFS 共享目录的方法,并解决了常见的配置失败问题。 ... [详细]
  • 解决Only fullscreen opaque activities can request orientation错误的方法
    本文介绍了在使用PictureSelectorLight第三方框架时遇到的Only fullscreen opaque activities can request orientation错误,并提供了一种有效的解决方案。 ... [详细]
  • 单片微机原理P3:80C51外部拓展系统
      外部拓展其实是个相对来说很好玩的章节,可以真正开始用单片机写程序了,比较重要的是外部存储器拓展,81C55拓展,矩阵键盘,动态显示,DAC和ADC。0.IO接口电路概念与存 ... [详细]
  • 解决Bootstrap DataTable Ajax请求重复问题
    在最近的一个项目中,我们使用了JQuery DataTable进行数据展示,虽然使用起来非常方便,但在测试过程中发现了一个问题:当查询条件改变时,有时查询结果的数据不正确。通过FireBug调试发现,点击搜索按钮时,会发送两次Ajax请求,一次是原条件的请求,一次是新条件的请求。 ... [详细]
  • 普通树(每个节点可以有任意数量的子节点)级序遍历 ... [详细]
  • 如果应用程序经常播放密集、急促而又短暂的音效(如游戏音效)那么使用MediaPlayer显得有些不太适合了。因为MediaPlayer存在如下缺点:1)延时时间较长,且资源占用率高 ... [详细]
  • 如何在Java中使用DButils类
    这期内容当中小编将会给大家带来有关如何在Java中使用DButils类,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。D ... [详细]
  • 如何在Linux服务器上配置MySQL和Tomcat的开机自动启动
    在Linux服务器上部署Web项目时,通常需要确保MySQL和Tomcat服务能够随系统启动而自动运行。本文将详细介绍如何在Linux环境中配置MySQL和Tomcat的开机自启动,以确保服务的稳定性和可靠性。通过合理的配置,可以有效避免因服务未启动而导致的项目故障。 ... [详细]
  • 在Windows系统中安装TensorFlow GPU版的详细指南与常见问题解决
    在Windows系统中安装TensorFlow GPU版是许多深度学习初学者面临的挑战。本文详细介绍了安装过程中的每一个步骤,并针对常见的问题提供了有效的解决方案。通过本文的指导,读者可以顺利地完成安装并避免常见的陷阱。 ... [详细]
  • 您的数据库配置是否安全?DBSAT工具助您一臂之力!
    本文探讨了Oracle提供的免费工具DBSAT,该工具能够有效协助用户检测和优化数据库配置的安全性。通过全面的分析和报告,DBSAT帮助用户识别潜在的安全漏洞,并提供针对性的改进建议,确保数据库系统的稳定性和安全性。 ... [详细]
  • 如何将TS文件转换为M3U8直播流:HLS与M3U8格式详解
    在视频传输领域,MP4虽然常见,但在直播场景中直接使用MP4格式存在诸多问题。例如,MP4文件的头部信息(如ftyp、moov)较大,导致初始加载时间较长,影响用户体验。相比之下,HLS(HTTP Live Streaming)协议及其M3U8格式更具优势。HLS通过将视频切分成多个小片段,并生成一个M3U8播放列表文件,实现低延迟和高稳定性。本文详细介绍了如何将TS文件转换为M3U8直播流,包括技术原理和具体操作步骤,帮助读者更好地理解和应用这一技术。 ... [详细]
  • 深入解析C语言中结构体的内存对齐机制及其优化方法
    为了提高CPU访问效率,C语言中的结构体成员在内存中遵循特定的对齐规则。本文详细解析了这些对齐机制,并探讨了如何通过合理的布局和编译器选项来优化结构体的内存使用,从而提升程序性能。 ... [详细]
  • 本文深入解析了JDK 8中HashMap的源代码,重点探讨了put方法的工作机制及其内部参数的设定原理。HashMap允许键和值为null,但键为null的情况只能出现一次,因为null键在内部通过索引0进行存储。文章详细分析了capacity(容量)、size(大小)、loadFactor(加载因子)以及红黑树转换阈值的设定原则,帮助读者更好地理解HashMap的高效实现和性能优化策略。 ... [详细]
  • 在Linux系统中,通过命令行查询计算机硬件配置是一项重要的技能。本文介绍了多种实用的命令和技巧,帮助用户高效地获取硬件信息。例如,可以通过 `cat /proc/cpuinfo | grep "physical id"` 命令来查看物理CPU的数量。此外,文章还涵盖了其他关键硬件组件的查询方法,如内存、磁盘和网络设备等。这些命令不仅适用于系统管理员,也适合普通用户了解自己的系统配置。 ... [详细]
author-avatar
炎木柏玮
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有