Rab*_*ars 5 assembly gcc c-preprocessor
gcc的手册页说明
file.s
Assembler code.
file.S
file.sx
Assembler code that must be preprocessed.
Run Code Online (Sandbox Code Playgroud)
许多标准包含文件都有
#ifndef __ASSEMBLY__
...
#endif
Run Code Online (Sandbox Code Playgroud)
包装器允许从程序集文件中包含.我可以发誓我以前用gcc写过程序,并在组装时定义了这个程序,但现在我遇到了问题.
这是一些测试代码:
test.S
#include <sys/syscall.h>
#include <asm/signal.h>
.intel_syntax noprefix
.text
.global foo // int foo(int pid)
foo:
mov esi,SIGUSR1
mov eax,SYS_kill
syscall
ret
Run Code Online (Sandbox Code Playgroud)
当我运行时gcc -c test.S
,它抱怨asm/signal.h中的所有类型的东西,因为它没有看到__ASSEMBLY__
定义.
现在我的工作是:
#ifndef __ASSEMBLY__
#define __ASSEMBLY__
#endif
Run Code Online (Sandbox Code Playgroud)
但这似乎是错误的,必须将其添加到我的所有文件.
这是GCC中的错误吗?
或者我在这里做错了什么?
注意:
我在测试中看到gcc确实定义__ASSEMBLER__
但是大多数头文件测试__ASSEMBLY__
(我确实看到了一对测试__ASSEMBLER__
).适当的ifdef在某些时候发生了变化吗?
我使用的是Ubuntu 14.04,gcc报告版本:gcc(Ubuntu 4.8.2-19ubuntu1)4.8.2
sco*_*ttt 10
__ASSEMBLY__
Linux内核项目在他们知道gcc预定义宏的存在之前就已经完成了一个约定__ASSEMBLER__
.
linux内核__ASSEMBLY__
在linux/Makefile中显式传递:
KBUILD_AFLAGS := -D__ASSEMBLY__
Run Code Online (Sandbox Code Playgroud)
LKML上发布的修补程序要迁移到__ASSEMBLER__
2005年,但它们没有合并:Re:[RFC] [MEGAPATCH]将ASSEMBLY更改为ASSEMBLER(由GCC从2.95定义为当前CVS)
归档时间: |
|
查看次数: |
1830 次 |
最近记录: |