lld

lld undefined symbol: mainCRTStartup

老子叫甜甜 提交于 2019-12-19 08:31:49
问题 My cpp code: int main(int argc, char** argv) {} I use the following command to compile and link it: // I want to read the result ir clang -S -emit-llvm main.cpp // I want to compile directly from ir llc -filetype=obj main.ll lld -flavor link main.obj // <root>: undefined symbol: mainCRTStartup Link failed Did I miss something? 回答1: mainCRTStartup is a function defined by the CRT (which clang is probably implicitly using in the first step, and generates an IR file with mainCRTStartup as the

lld undefined symbol: mainCRTStartup

爱⌒轻易说出口 提交于 2019-12-19 08:31:46
问题 My cpp code: int main(int argc, char** argv) {} I use the following command to compile and link it: // I want to read the result ir clang -S -emit-llvm main.cpp // I want to compile directly from ir llc -filetype=obj main.ll lld -flavor link main.obj // <root>: undefined symbol: mainCRTStartup Link failed Did I miss something? 回答1: mainCRTStartup is a function defined by the CRT (which clang is probably implicitly using in the first step, and generates an IR file with mainCRTStartup as the

Unable to run windows binary compiled with clang/lld/mingw

人盡茶涼 提交于 2019-12-11 11:27:03
问题 I have downloaded and installed clang on windows 10 from http://releases.llvm.org/download.html and mingw from https://sourceforge.net/projects/mingw-w64/ I am trying to compile a very basic C program using clang/lld/mingw: int main(int argc, char* argv[argc + 1]) { return 0; } To compile I invoke: clang.exe -target x86_64-windows-gnu -fuse-ld=lld.exe -g -gcodeview -Wl,/debug,/pdb:example.pdb example.c -o example.exe This creates an exe which faults on startup in mainCRTStartup (__security

How to debug an experimental toolchain producing malformed executables

痞子三分冷 提交于 2019-12-10 15:13:09
问题 I am working on cross compiling an experimental GNU free Linux toolchain using clang (instead of gcc ), compiler-rt (instead of libgcc ), libunwind (available at http://llvm.org/git/libunwind.git) (instead of libgcc_s ), lld (instead of GNU ld ), libcxx (instead of libstdc++ ), libcxxabi (instead of not sure, I'm unclear on the GNU distinction between libstdc++ and its ABI) and musl (instead of glibc ). Using a musl based gcc cross compiler and a few patches I've managed to successfully