What is wrong with my cross compiler?

我只是一个虾纸丫 提交于 2020-01-30 12:32:29

问题


I am trying to compile a basic program that i can get to cross compile on my mac. I am running Mac OS X Mavericks. My cross compiler is arm-elf-gcc-4.7.3. I wrote a simple test program that looks like:

int main()
{
    ;
    return 0;
}

When I run /opt/local/bin/arm-elf-gcc-4.7.3 -o test test.c I receive these errors.

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

What is wrong with my cross compiler?


回答1:


Reads like the compiler spat out assembly the assembler couldn't read. Check for mismatches.




回答2:


The compiler was using the wrong assembler. I had to specify the prefix with -B/opt/local/arm-elf-



来源:https://stackoverflow.com/questions/24714228/what-is-wrong-with-my-cross-compiler

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!