整个程序llvm
wllvm的Python项目详细描述
这个项目,wllvm,提供了构建整个程序的工具(或者 完整库)LLVM位代码文件来自未修改的C或C++ 源程序包。它目前运行在linux等nix平台上, FreeBSD和Mac OS X。
wllvm提供了基于python的编译器包装器,它们分为两部分工作 台阶。包装器首先以正常方式调用编译器。那么,为了 每个对象文件都调用一个位代码编译器来生成llvm 比特码。包装器还存储生成的位代码的位置。 对象文件的专用部分中的文件。当对象文件是 链接在一起,专用部分的内容是 连接(这样我们就不会丢失任何组成部分的位置 位代码文件)。构建完成后,可以使用wllvm 实用程序,用于读取专用部分的内容并链接所有 将位码转换成一个完整的程序位码文件。这个工具 适用于可执行库和本机库。
这两个阶段的构建过程是必需的 对于任何生成系统中的gcc或g++。在gcc中使用lto框架 gold linker插件在很多情况下都能工作,但在 生成中存在静态库。WLLVM的方法有 生成工作二进制文件的明显优势,在某些情况下 一个构建过程需要这样做。
wllvm可以与clang或gcc dragonegg插件一起工作。
用法
wllvm包含四个python可执行文件:用于编译c代码的wllvm。 和^ TT6}$编译C++,一个辅助工具^ {TT7}$ 从生成产品(对象文件、可执行文件、库)中提取位代码 或者存档),以及一个健全的检查器,wllvm-sanity-checker用于检测 配置疏忽。
必须设置三个环境变量才能使用这些包装器:
- ^{tt9}$ should be set to either ^{tt10}$ or ^{tt3}$.
- ^{tt12}$ should be set to the prefix for the version of gcc that should be used with dragonegg. This can be empty if there is no prefix. This variable is not used if ^{tt13}$.
- ^{tt14}$ should be the full path to the dragonegg plugin. This variable is not used if ^{tt13}$.
设置环境后,只需使用wllvm和wllvm++作为C 以及C++编译器。
除上述环境变量外,还可以选择使用以下变量:
- ^{tt18}$ can be set if your clang compiler is not called ^{tt3}$ but something like ^{tt20}$. Similarly ^{tt21}$ can be used to describe what the C++ compiler is called. Note that in these sorts of cases, the environment variable ^{tt9}$ should still be set to ^{tt3}$ not ^{tt20}$ etc. We also pay attention to the environment variables ^{tt25}$ and ^{tt26}$ in an analagous way, since they too get adorned with suffixes in various Linux distributions.
- ^{tt27}$ can be set to the absolute path to the folder that contains the compiler and other LLVM tools such as ^{tt28}$ to be used. This prevents searching for the compiler in your PATH environment variable. This can be useful if you have different versions of clang on your system and you want to easily switch compilers without tinkering with your PATH variable. Example ^{tt29}$.
- ^{tt30}$ can be set to anything. If it is set, ^{tt5}$ and ^{tt6}$ behave like a normal C or C++ compiler. They do not produce bitcode. Setting ^{tt30}$ may prevent configuration errors caused by the unexpected production of hidden bitcode files.