我发现为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是不可能的。