为httpd生成LLVM IR [英] Generate LLVM IR for httpd

查看:157
本文介绍了为httpd生成LLVM IR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用LLVM编译apache2,以在LLVM IR中生成最终的二进制文件.

I am trying to compile apache2 with LLVM, to generate final binaries in LLVM IR.

我在编译和链接时使用了flto选项,并通过clang将"also-emit-llvm"传递给了链接器. 它似乎适用于大多数步骤,但是我有两个担忧

I used flto option in compiling and linking and passed "also-emit-llvm" to the linker through clang. It seems to work for most steps, however I had two concerns

1)之前我使用了LLVM 3.6,它的金牌插件不接受also-emit-llvm,但是只具有Emit-llvm,基本上它将仅发出elf或llvm. Autotools构建系统不喜欢它. configure和make脚本需要二进制文件,而我想要llvm.有什么解决办法吗?

1) Earlier I used LLVM 3.6, whose gold plugin doesn't accept also-emit-llvm, but has emit-llvm only, basically it will emit only elf or llvm. Which the Autotools build system doesn't like. The configure and make script want binaries, while I want llvm. Any solutions to this?

2)因此,我转移到LLVM 3.5.2,构建过程进行得很顺利,我可以生成httpd.bc和httpd elf二进制文件,但是链接器不想链接模块(它可以链接用于二进制文件) 具体来说,我会收到此错误

2) So I shifted to LLVM 3.5.2, the build process goes well, I can generate both httpd.bc and httpd elf binaries, but the linker doesn't want to link for modules (it was able to link for binaries) Specifically, I get this error

`

/usr/share/apr-1.0/build/libtool --silent --mode=link /home/rbhatia/Desktop/llvm-newbuild/bin/clang  -pthread  -flto -o mod_authn_file.la -rpath /home/rbhatia/Desktop/httpd-2.4.12/llvm/modules -module -avoid-version  mod_authn_file.lo 
/usr/bin/ld: error: .libs/mod_authn_file.o:1:3: invalid chaenter code hereracter
/usr/bin/ld: error: .libs/mod_authn_file.o:1:3: syntax error, unexpected $end
/usr/bin/ld: error: .libs/mod_authn_file.o: not an object or archive
collect2: error: ld returned 1 exit status

`

我可以看到mod_authn_file.o是有效的LLVM IR文件,可以使用llvm-dis对其进行反汇编. 另外,在此步骤之前,链接器就可以链接httpd和httpd.bc

I can see that mod_authn_file.o is a valid LLVM IR file which I can disassemble with llvm-dis. Also, just before this step, the linker is able to link httpd and httpd.bc

有什么错误的帮助吗?

推荐答案

看看

https://github.com/SRI-CSL/whole-program-llvm

我们使用此工具将相当大的项目构建为位码.我们的 到目前为止最大的是FreeBSD 10.0,因此大小通常不是问题.

we use this tool to build quite large projects into bitcode. Our biggest so far was FreeBSD 10.0, so size is not usually an issue.

我们的travis构建检查实际上是 apache,就像我们的教程一样.希望能有所帮助.

Our travis build check is actually apache, as is our tutorial. Hope that helps.

这篇关于为httpd生成LLVM IR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆