如何在Mac OS X 10.9中编写LLVM Pass

5
我在Linux上构建了我的pass,并且它可以正常工作。现在当我把我的代码带到Mac Airbook上的Mac OS X 10.9时,它就不能正常工作了。下面我描述了构建我的llvm pass所采取的步骤。
我的源树是llvm-3.4和llv-3.4/tools/clang-3.4。
我运行了./configure --prefix=/some-path --enable-targets=host,这是成功的。
然后我运行了make && make install,没有出现任何错误。
我导出了bin路径export PATH=/some-path/bin:$path并检查了which clang which opt,它们指向了我的安装位置。
现在当我尝试加载hello passopt -load /some-path/lib/LLVMHello.dylib -hello <fac.bc >/dev/null时,我收到以下错误: Error opening '/some-path/lib/LLVMHello.dylib': dlopen(/some-path/lib/LLVMHello.dylib, 9): Symbol not found: __ZN4llvm12FunctionPass17assignPassManagerERNS_7PMStackENS_15PassManagerTypeE Referenced from: /some-path/lib/LLVMHello.dylib Expected in: flat namespace in /some-path/lib/LLVMHello.dylib -load request ignored. opt: Unknown command line argument '-hello'. Try: '/some-path/bin/opt -help' opt: Did you mean '-help'? 有人能帮我解决这个问题或者至少指引我正确的方向吗?

你在 Mac 上解决了这个问题吗? - Rouzbeh
1个回答

1
在我的情况下,需要用于动态加载插件的动态LLVM库缺失。我通过使用--enable-shared选项配置LLVM来解决了这个问题。我也设置了--enable-keep-symbols选项,但我认为这不是必要的。我使用的完整配置命令如下:
./configure --enable-shared --enable-keep-symbols

我知道我的答案有点晚,但最近我遇到了同样的问题。由于我花了很长时间解决这个问题,所以我想把我的发现传递下去。希望能帮到你。

祝好,Marcus


LLVM不再支持./configure。您如何使用cmake传递KEEP_SYMBOLS - Xvolks

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接