简体   繁体   English

如何从多个来源生成单个LLVM IR

[英]How to generate a single LLVM IR from multiple sources

Compiling .c files to a single LLVM IR and link multiple libraries during the compilation. 将.c文件编译为单个LLVM IR,并在编译过程中链接多个库。

An example here with gcc: gcc的示例:

gcc -c -Wall -g3 -DVERSION=\"1.1.2\" ssl_proxy.c -o ssl_proxy.o
gcc -o ssl_proxy ssl_proxy.o  -lssl -lcrypto

Now, I want to compile the ssl_proxy.c to ssl_proxy.ll , simply using llvm-gcc -S -emit-llvm won't work as it will not let me link -lssl -lcrypto libraries. 现在,我想将ssl_proxy.c编译为ssl_proxy.ll ,仅使用llvm-gcc -S -emit-llvm将无法工作,因为它不会让我链接-lssl -lcrypto库。

Through this example I hope people can explain a bit more details about compilation with llvm-gcc (not clang), so that all visitors can learn from it and know how to compile complex multiple sources into one LLVM IR. 通过这个示例,我希望人们能够解释有关使用llvm-gcc (而不是clang)进行编译的更多详细信息,以便所有访问者都可以从中学习并知道如何将复杂的多个源编译为一个LLVM IR。

将源文件编译到LLVM IR中不会执行链接,因此它不需要任何库-它只需要标头。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM