我试图一起编译程序集和 C 代码(不是 C 到程序集),但无法完成。
例如
文件 common.h
#ifndef __COMMON_H__
#define __COMMON_H__
struct tree{
tree* left;
tree* right;
void* elem;
};
void foo(int c);
#endif
文件common.S
#include "common.h"
.text
.globl foo
.ent foo
foo:
//foo implementation
.end foo
当我尝试编译这个时:
# gcc -c common.S
common.h: Assembler messages:
common.h:5: Error: unrecognized opcode `struct tree{'
common.h:7: Error: unrecognized opcode `tree* left'
common.h:8: Error: unrecognized opcode `tree* right'
common.h:10: Error: unrecognized opcode `void* elem'
common.h:12: Error: junk at end of line, first unrecognized character is `}'
common.h:14: Error: unrecognized opcode `void foo(int c)'
有什么方法可以使用 gcc 将 C 定义放入汇编中?
提前致谢。