문제

looking into /usr/llvm-gcc-4.2/bin I have

544416 Oct 31 17:10 i686-apple-darwin11-llvm-g++-4.2*
544416 Oct 31 17:10 i686-apple-darwin11-llvm-gcc-4.2*
117168 Oct 31 17:10 llvm-c++-4.2*
257552 Oct 31 17:10 llvm-cpp-4.2*
117168 Oct 31 17:10 llvm-g++-4.2*
117168 Oct 31 17:10 llvm-gcc-4.2*

can somebody explain the difference between these compilers?

i compile the same application (a c hello-world) with both i686-apple-darwin11-llvm-gcc-4.2 and llvm-gcc-4.2: they both work but diff reports differences.

Can somebody explain what is the difference between those executables?

도움이 되었습니까?

해결책

llvm-gcc-4.2 is a default front-end and has platform dependent options. It can specify architecture and machine to invoke the compiler for specific targets, if the llvm has been built with target support and found. For /usr directory, it is used for system-wide (Intel x86) platform, so it contains i686-apple-darwin11 (i386 and x86_64) platform only. So if you explicitly invoke i686-apple-darwin11-llvm-gcc, it just can support x86, x86_64 target.

If you have Xcode and iOS development environment installed, you should find more files as follows.

$ ls -l
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin
total 2336
-rwxr-xr-x  1 root  wheel  555056 Sep  8 16:49 arm-apple-darwin10-llvm-g++-4.2
-rwxr-xr-x  1 root  wheel  546832 Sep  8 16:49 arm-apple-darwin10-llvm-gcc-4.2
-rwxr-xr-x  1 root  wheel  130784 Sep  8 16:49 gcov-4.2
-rwxr-xr-x  1 root  wheel  550960 Sep  8 16:49 i686-apple-darwin10-llvm-g++-4.2
-rwxr-xr-x  1 root  wheel  542752 Sep  8 16:49 i686-apple-darwin10-llvm-gcc-4.2
-rwxr-xr-x  1 root  wheel  106064 Sep  8 16:49 llvm-c++-4.2
-rwxr-xr-x  1 root  wheel  255696 Sep  8 16:49 llvm-cpp-4.2
-rwxr-xr-x  1 root  wheel  106064 Sep  8 16:49 llvm-g++-4.2
-rwxr-xr-x  1 root  wheel  106064 Sep  8 16:49 llvm-gcc-4.2

There are two targets for llvm-gcc, arm-apple-darwin10 and i686-apple-darwin10. The HOST is still i686 Mac OS X, so the llvm-gcc-4.2 is also use default i686 for the host compiler. arm-apple-darwin10-llvm-gcc-4.2 is a cross compiler, which can be run on Intel Mac OS X platform, to produce ARM instruction code.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top