使用cmake从llvm源目录开发llvm传递

使用cmake从llvm源目录开发llvm传递

本文介绍了使用cmake从llvm源目录开发llvm传递的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在我的项目目录下开发一个llvm pass。为此,我遵循。我在这个链接中适当地创建我的CMakeFiles,我的最终项目目录是:

  |  -  src 
| | - CMakeLists.txt
| | - bigForPass
| | | - CMakeLists.txt
| | | - bigForPass.cpp
| | | - merged.bc
| | - build

我还将我的源文件与llvm根目录链接,没有任何问题。
最后,我在'build'文件夹下构建,我的共享库成功创建,没有问题(在build / bin文件夹下),名称为LLVMHello1.dylib。
然而,当我尝试使用命令运行我的通过merged.bc文件(其中包含我的llvm代码)

  opt -load ../build/bin/LLVMHello1.dylib -bishe_insert< merged.bc> final.bc 

我一直收到错误;

 打开'../build/bin/LLVMHello1.dylib'时出错:dlopen(../ build / bin / LLVMHello1.dylib,9):未找到符号:__ZTIN4llvm10ModulePassE 
引用自:../build/bin/LLVMHello1.dylib
预期在:flat命名空间
在../build/bin/LLVMHello1.dylib
中 - 请求被忽略。有任何想法和建议对此赞赏吗?


p>提前多谢。

解决方案

来自

SET(CMAKE_CXX_FLAGS-Wall -fno-rtti)到我的传递图书馆的CMakeLists.txt,然后它的工作。


I am trying to develop an llvm pass under my project directory. For that, I follow the info in http://llvm.org/docs/CMake.html#developing-llvm-pass-out-of-source. I create my CMakeFiles appropriately as in this link and my final project directory is like;

|-- src
|   |-- CMakeLists.txt
|   |-- bigForPass
|   |   |-- CMakeLists.txt
|   |   |-- bigForPass.cpp
|   |   |-- merged.bc
|   |-- build

I also linked my source files with llvm root directory without any problem.Finally I make the build under the 'build' folder and my shared library is created successfully with no problems (under build/bin folder) with the name LLVMHello1.dylib.However, when I try to run my pass over merged.bc file (which contains my llvm code) with the command

opt -load ../build/bin/LLVMHello1.dylib -bishe_insert <merged.bc> final.bc

I keep getting the error;

Error opening '../build/bin/LLVMHello1.dylib': dlopen(../build/bin/LLVMHello1.dylib, 9): Symbol not found: __ZTIN4llvm10ModulePassE
  Referenced from: ../build/bin/LLVMHello1.dylib
  Expected in: flat namespace
 in ../build/bin/LLVMHello1.dylib
  -load request ignored.

Any ideas and suggestions on this appreciated ?

Thanks a lot in advance.

解决方案

from http://www.jiang925.com/node/28

So I added SET(CMAKE_CXX_FLAGS "-Wall -fno-rtti") to CMakeLists.txt of my pass library and then it's working.

这篇关于使用cmake从llvm源目录开发llvm传递的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 06:13