编写LLVM通行证

时间:2012-03-05 15:25:09

标签: optimization llvm clang bytecode

我正在尝试使用http://llvm.org/releases/2.9/docs/WritingAnLLVMPass.html的指南创建LLVM传递 但我有几个问题:

  • 我指南(lib / Transform / Hello)和(Debug + Asserts)中没有很多文件夹,我创建了它们,是不是?什么是正确的道路? 我创建这些:/usr/lib/llvm-2.9/lib/Transforms/Hello和/usr/lib/llvm-2.9/Debug+Asserts

  • 当我尝试在指南中制作文件时出现错误:

# Makefile for hello pass


# Path to top level of LLVM heirarchy
LEVEL = /usr/lib/llvm-2.9/build        #*********I MODIFY THIS!!!! ***************

# 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

# Tell the build system which LLVM libraries your pass needs. You'll probably
# need at least LLVMSystem.a, LLVMSupport.a, LLVMCore.a but possibly several
# others too.
LLVMLIBS = LLVMCore.a LLVMSupport.a LLVMSystem.a

# Include the makefile implementation stuff
include $(LEVEL)/Makefile.common

我还将其他行修改为Makefile.common:

ifndef LLVM_SRC_ROOT
include $(LEVEL)/Makefile.rules
else
include $(LLVM_SRC_ROOT)/Makefile.rules
endif

因为它找不到Makefile.rules(以这种方式工作)

但是当我进入包含我的hello.c文件的文件夹(/usr/lib/llvm-2.9/lib/Transforms/Hello)时,我有这个错误:

make: ***  No rule to make target "/configure", needed by "/config.status".  Stop.

有什么问题?!?

1 个答案:

答案 0 :(得分:2)

显然,您似乎正在尝试使用库的二进制文件进行开发。不幸的是,这不起作用。您需要下载源代码,构建它们,然后开始开发自己的传递。

另外,2.9已经太古老了。至少考虑升级到3.0版本。