我正在尝试编译一个基本程序,我可以在我的mac上交叉编译。我正在运行Mac OS X Mavericks。我的交叉编译器是arm-elf-gcc-4.7.3。我写了一个简单的测试程序,看起来像:
int main()
{
;
return 0;
}
当我运行/opt/local/bin/arm-elf-gcc-4.7.3 -o test test.c时,我收到这些错误。
test.c:4:Unknown pseudo-op: .global
test.c:4:Rest of line ignored. 1st junk character valued 109 (m).
test.c:5:Unknown pseudo-op: .type
test.c:5:Rest of line ignored. 1st junk character valued 109 (m).
test.c:7:Junk character 64 (@).
test.c:7:Rest of line ignored. 1st junk character valued 32 ( ).
test.c:8:Junk character 64 (@).
test.c:8:Rest of line ignored. 1st junk character valued 32 ( ).
test.c:9:Junk character 64 (@).
test.c:9:Rest of line ignored. 1st junk character valued 32 ( ).
test.c:10:invalid char '[' beginning operand 2 `[sp'
test.c:11:too many memory references for `add'
test.c:12:expecting operand after ','; got nothing
test.c:13:too many memory references for `mov'
test.c:14:too many memory references for `add'
test.c:15:no such instruction: `ldmfd sp!, {fp}'
test.c:16:no such instruction: `bx lr'
test.c:17:Unknown pseudo-op: .size
我的交叉编译器出了什么问题?
答案 0 :(得分:0)
读取类似于汇编程序无法读取的编译器spat out汇编。检查是否存在不匹配。
答案 1 :(得分:0)
编译器使用了错误的汇编程序。我必须使用-B / opt / local / arm-elf-
指定前缀