llvm clang - lld undefined symbol: mainCRTStartup -
my cpp code
int main(int argc, char** argv){ }
i use following command compile , link it:
// want read result ir clang -s -emit-llvm main.cpp // want compile directly ir llc -filetype=obj main.ll lld -flavor link main.obj // <root>: undefined symbol: maincrtstartup link failed
did miss something?
maincrtstartup function defined crt (which clang implicitly using in first step, , generates ir file maincrtstartup entry point)
try passing -nostdlib clang in first step
this mean won't able use standard library functions, though
if want use crt functions link lld need link in native libraries
Comments
Post a Comment