linking against llvm libraries

北战南征 提交于 2019-12-10 14:48:08

问题


I'm developing a llvm-based compiler and when I try to generate executable file the following error occurs:

./bin/llvmcode.s:35: undefined reference to `operator new[](unsigned long)'

Note that in the generated IR, the function '@_Znam' is called which is located in one of llvm libraries. So, I should have linked the generated assembly file with that library. Here is the code I used to do that:

llvm-as ./bin/llvmcode.ll
llc ./bin/llvmcode.bc
g++ -g ./bin/llvmcode.s \`llvm-config --cppflags --ldflags --libs core jit native\` -O3 -o executable -rdynamic

What's wrong with this code? Any assistance would be appreciated.

来源:https://stackoverflow.com/questions/12750526/linking-against-llvm-libraries

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!