0

我发现为 llvm-clang 提供的选项很少,我可以编译到其他平台。例如,这将为 ios 编译:

clang -cc1 -triple arm-apple-darwin -emit-obj -mrelax-all -disable-free -main-file-name six.c -pic-level 1 -mdisable-fp-elim -masm-verbose -target-abi apcs-gnu -target-cpu arm7tdmi -msoft-float -mfloat-abi soft -target-feature +soft-float -target-feature +soft-float-abi -target-feature -neon -ferror-limit 1 -fmessage-length 122 -stack-protector 1 -mstackrealign -fblocks -fsjlj-exceptions -fcolor-diagnostics prog.c -o -c

结果,您获得了 prog.o,您需要将其复制到本机平台并与本机 ld 链接。但是已经为该平台编译了目标文件!

现在最后一步是避免在遥控器上使用本机链接器。我需要一个交联剂。但是在哪里可以得到一个?或者 llvm 是否包含一个,我只需要使用正确的选项?或者我需要在跨平台的支持下编译GNU LD?根据我的经验,如果没有专业知识,就不可能编译 LD。

4

1 回答 1

2

I have versions of the gnu tools that I use with clang at http://ellcc.org. I build under Linux (you didn't mention a host OS). I build assemblers, ld and other utilities, as well as gdb to support the ARM, i386, Microblaze, Mips, PowerPC, PowerPC64, and X86_64. The cool thing about my build is that I take advantage of the GNU tools ability to be compiled to support multiple targets. ld, gdb, and most of the utilites support all the processors. Only as needs a separate binary for each target.

于 2013-05-20T15:01:20.680 回答