当前位置:Gxlcms > 数据库问题 > Mac OS 下的 gcc gdb

Mac OS 下的 gcc gdb

时间:2021-07-01 10:21:17 帮助过:2人阅读

clang: a C language family frontend for LLVM

The goal of the Clang project is to create a new C, C++, Objective C and Objective C++ front-end for the LLVM compiler. 

也就是说clang是一个编译器的前端,主要负责语法,词法分析并生成LLVM可以理解的代码传递给LLVM进行编译。

LLVM

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Despite its name, LLVM has little to do with traditional virtual machines, though it does provide helpful libraries that can be used to build them. The name "LLVM" itself is not an acronym; it is the full name of the project.

LLVM began as a research project at the University of Illinois, with the goal of providing a modern, SSA-based compilation strategy capable of supporting both static and dynamic compilation of arbitrary programming languages. Since then, LLVM has grown to be an umbrella project consisting of a number of subprojects, many of which are being used in production by a wide variety of commercial and open source projects as well as being widely used in academic research. Code in the LLVM project is licensed under the "UIUC" BSD-Style license.

LLVM则是主要的编译并产生机器码的部分。

gcc

The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, Ada, and Go, as well as libraries for these languages (libstdc++, libgcj,...). GCC was originally written as the compiler for theGNU operating system. 

其实gcc并不是一个软件,而是一套软件,全称GNU Compiler Collection。相对于clang和LLVM来说,也会分为前端,后端,回想一下编译原理,gcc实际上会首先调用cpp对程序进行预处理,这也就相当于clang所做的工作,然后会调用cc1和ld来进行编译和链接,这就相当于LLVM所做的工作。

这里有一篇文章很好的解释了clang/LLVM的发展历史,水果公司和gcc之间的合作以及矛盾等:

GCC,LLVM,Clang  作者 肖雨宸 

从这篇文章中可以看到他们的组合并不是绝对的,gcc同样也可以和LLVM搭配使用。


参考文献:

1,clang官方网站:

http://clang.llvm.org/index.html

2,LLVM官方网站:

http://www.llvm.org/

3,gcc官方网站:

http://gcc.gnu.org/

Mac OS 下的 gcc gdb

标签:

人气教程排行