clang linker problem

前端 未结 4 779
北荒
北荒 2021-01-04 20:18

I just tried out the latest llvm and clang trunk versions. They compiled without a single warning out of the box but I\'m having trouble linking a hello world example. My Co

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-04 21:20

    Seems to be clang version which can't detect host's linux version and gcc version..

    This code in clang which must add path to the crt*: llvm›tools›clang›lib›Driver›Tools.cpp

      CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crt1.o")));
      CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crti.o")));
      CmdArgs.push_back(Args.MakeArgString(getToolChain().GetFilePath(C, "crtbegin.o")));
    

    and the GetFilePath will try to search asked files in getFilePaths() list of current ToolChain (file clang/lib/Driver/ToolChains.cpp). If it can't find a file it will return the Name unchanged.

    Please, give me version of your ubuntu (uname -a, cat /etc/lsb-release), exact release (svn revision number) of clang and llvm, and gcc -v output

提交回复
热议问题