LLVM : Unknown CMake command "add_llvm_loadable_module".

编写LLVM Pass的文档:HowToWriteALLVMPass

1.写Makefile

# Makefile for hello pass

# Path to top level of LLVM hierarchy
LEVEL = ../../..

# Name of the library to build
LIBRARYNAME = Hello

# Make the shared library become a loadable module so the tools can
# dlopen/dlsym on the resulting library.
LOADABLE_MODULE = 1

# Include the makefile implementation stuff
include $(LEVEL)/Makefile.common
2.写Hello.cpp


3.得到Hello.so。

clang++ `llvm-config --libs --ldflags --cxxflags ` Hello.cpp -std=c++0x -fPIC -shared -o Hello.so

4.使用Hello.so。

opt -load /usr/local/arm/llvm3.8.0/lib/Transforms/Hello/Hello.so -hello <hello.bc> /dev/null


在尝试编写一个LLVM pass时,遇到以下问题(未解决,最终使用的第3步的方法):

CMake Error at CMakeLists.txt:16 (include):

  include could not find load file:

    AddLLVM

CMake Error at CMakeLists.txt:17 (add_llvm_loadable_module):
  Unknown CMake command "add_llvm_loadable_module".

-- Configuring incomplete, errors occurred!

Building LLVM with CMake 点击打开链接

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值