【发布时间】:2011-11-24 02:07:19
【问题描述】:
我正在尝试将程序集和 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 定义带入汇编?
提前致谢。
【问题讨论】:
标签: c gcc compiler-construction assembly avr-gcc