<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hello,
    <br>
    <br>
    I'm aiming to eventually incorporate clang and lld into a program in
    order to compile native C++ code at runtime. I built LLVM with clang
    and LLVM-ld in the tools directory with CMake using VS2012 as the
    generator. Right now I'm just trying to compile and link a simple
    test program (just an empty main) with clang/lld just to see how
    things work.
    <br>
    <br>
    I'm using -c and trying to link with lld manually since clang++
    wants to use link.exe.
    <br>
    <br>
    C:\Program Files (x86)\LLVM\build\bin\Debug>clang++ -o test.o
    test.cpp -c -v
    <br>
    clang version 3.3 (trunk)
    <br>
    Target: i686-pc-win32
    <br>
    Thread model: posix
    <br>
    "C:/Program Files (x86)/LLVM/build/bin/Debug/clang++.exe" -cc1
    -triple i686-pc-win32 -emit-obj -mrelax-all -disable-free
    -main-file-name test.cpp -mrelocation-model static -mdisable-fp-elim
    -fmath-errno -masm-verbose -mconstructor-aliases -target-cpu
    pentium4 -v -coverage-file test.o -resource-dir "C:/Program Files
    (x86)/LLVM/build/bin/Debug\\..\\lib\\clang\\3.3" -internal-isystem
    "C:<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>Program
      Files (x86)/LLVM/build/bin/Debug<span class="moz-txt-tag">/</span></i>../lib/clang/3.3/include"
    -internal-isystem "C:\\Program Files (x86)\\Microsoft Visual Studio
    11.0\\VC\\include" -internal-isystem "C:\\Program Files
    (x86)\\Windows Kits\\8.0\\\\include" -std=c++11 -fdeprecated-macro
    -ferror-limit 19 -fmessage-length 150 -mstackrealign -fms-extensions
    -fms-compatibility -fmsc-version=1300 -fdelayed-template-parsing
    -fobjc-runtime=gcc -fobjc-default-synthesize-properties
    -fcxx-exceptions -fexceptions -fdiagnostics-show-option
    -fcolor-diagnostics -backend-option -vectorize-loops -o test.o -x
    c++ test.cpp
    <br>
    clang -cc1 version 3.3 based upon LLVM 3.3svn default target
    i686-pc-win32
    <br>
    #include "..." search starts here:
    <br>
    #include <...> search starts here:
    <br>
    C:<i class="moz-txt-slash"><span class="moz-txt-tag">/</span>Program
      Files (x86)/LLVM/build/bin/Debug<span class="moz-txt-tag">/</span></i>../lib/clang/3.3/include
    <br>
    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include
    <br>
    C:\Program Files (x86)\Windows Kits\8.0\\include
    <br>
    End of search list.
    <br>
    <br>
    <br>
    The .o file is successfully created so I try to run the linker on
    it. This is where I get this output and lld crashes.
    <br>
    <br>
    C:\Program Files (x86)\LLVM\build\bin\Debug>lld -flavor core
    test.o
    <br>
    YAML:1:2: error: Got empty plain scalar
    <br>
    LÔiyQQ.text< P`U‰åP¸ÇEüƒÄ]Ã.text_main 
    <br>
    Assertion failed: Val && "isa<> used on a null
    pointer", file C:\Program Files
    (x86)\LLVM\include\llvm/Support/Casting.h, line 97
    <br>
    Stack dump:
    <br>
    0. Program arguments: lld -flavor core test.o
    <br>
    0x6E9CA16A (0x0000000A 0x00000000 0x00C0F59C 0x6EAA4074), exit() +
    0x13A bytes(s)
    <br>
    0x6EAB47BC (0x00C0F734 0x00C0F5B0 0x00000082 0x00C0EAA4), abort() +
    0x1C bytes(s)
    <br>
    0x6EAA4074 (0x01612BC8 0x01612970 0x00000061 0x00C0F748), _wassert()
    + 0xD4 bytes(s)
    <br>
    0x01505577 (0x00000000 0x00C0F5D0 0x015057E3 0x00C0F5CC),
    llvm::isa_impl_cl<llvm::yaml::NullNode,llvm::yaml::Node const
    *>::doit() + 0x27 bytes(s), c:\program files
    (x86)\llvm\include\llvm\support\casting.h, line 97 + 0x23 byte(s)
    <br>
    0x015057AE (0x00C0F5CC 0x00000000 0x00C0F5DC 0x0150047C),
    llvm::isa_impl_wrap<llvm::yaml::NullNode,llvm::yaml::Node const
    *,llvm::yaml::Node const *>::doit() + 0xE bytes(s), c:\program
    files (x86)\llvm\include\llvm\support\casting.h, line 124 + 0xB
    byte(s)
    <br>
    0x015057E3 (0x00C0F5F4 0x00C0F600 0x014FD75E 0x00C0F5F4),
    llvm::isa_impl_wrap<llvm::yaml::NullNode,llvm::yaml::Node *
    const,llvm::yaml::Node const *>::doit() + 0x23 bytes(s),
    c:\program files (x86)\llvm\include\llvm\support\casting.h, line 116
    + 0x18 byte(s)
    <br>
    0x0150047C (0x00C0F5F4 0xCCCCCCCC 0x00000000 0xCCCCCCCC),
    llvm::isa<llvm::yaml::NullNode,llvm::yaml::Node *>() + 0xC
    bytes(s), c:\program files
    (x86)\llvm\include\llvm\support\casting.h, line 136 + 0x9 byte(s)
    <br>
    0x014FD75E (0xCCCCCCCC 0xCCCCCCCC 0x00000000 0x00C0F734),
    llvm::yaml::Input::setCurrentDocument() + 0x6E bytes(s), c:\program
    files (x86)\llvm\lib\support\yamltraits.cpp, line 69 + 0x9 byte(s)
    <br>
    0x0143958A (0x00C0F698 0x00C0F680 0x00C0F7A0 0xCCCCCCCC),
    llvm::yaml::operator>><std::vector<lld::File const
    *,std::allocator<lld::File const *> > >() + 0x2A
    bytes(s), c:\program files
    (x86)\llvm\include\llvm\support\yamltraits.h, line 944 + 0x8 byte(s)
    <br>
    0x0145241A (0x00C0F960 0x00C0F778 0x00C0F970 0x00C0F76C),
    lld::yaml::ReaderYAML::parseFile() + 0x7A bytes(s), c:\program files
    (x86)\llvm\tools\lld\lib\readerwriter\yaml\readerwriteryaml.cpp,
    line 1360 + 0x13 byte(s)
    <br>
    0x01454A0C (0x00C0F960 0x00C0F778 0x00C0F970 0x00C0F9E0),
    lld::CoreTargetInfo::parseFile() + 0x7C bytes(s), c:\program files
    (x86)\llvm\tools\lld\lib\readerwriter\coretargetinfo.cpp, line 365 +
    0x29 byte(s)
    <br>
    0x01465185 (0x00C0F960 0x00D52A00 0x00000006 0x00C0F970),
    lld::TargetInfo::readFile() + 0x95 bytes(s), c:\program files
    (x86)\llvm\tools\lld\lib\core\targetinfo.cpp, line 36 + 0x1B byte(s)
    <br>
    0x0123D15A (0x00C0F9FC 0x0174AB90 0x00C0FAE8 0xCCCCCCCC),
    lld::Driver::link() + 0x1BA bytes(s), c:\program files
    (x86)\llvm\tools\lld\lib\driver\driver.cpp, line 48 + 0x2D byte(s)
    <br>
    0x0123C3AF (0x00000002 0x00D51E98 0x0174AB90 0x00000004),
    lld::CoreDriver::link() + 0x5F bytes(s), c:\program files
    (x86)\llvm\tools\lld\lib\driver\coredriver.cpp, line 75 + 0xF
    byte(s)
    <br>
    0x012332A5 (0x00000004 0x00D4EE48 0x0174AB90 0x00000000),
    lld::UniversalDriver::link() + 0xE5 bytes(s), c:\program files
    (x86)\llvm\tools\lld\lib\driver\universaldriver.cpp, line 126 + 0x1B
    byte(s)
    <br>
    0x01231406 (0x00000004 0x00D4EE48 0x00D4FD38 0x3D2279F5), main() +
    0x46 bytes(s), c:\program files
    (x86)\llvm\tools\lld\tools\lld\lld.cpp, line 36 + 0x13 byte(s)
    <br>
    0x01530799 (0x00C0FB4C 0x77403677 0x7EFDE000 0x00C0FB8C),
    __tmainCRTStartup() + 0x199 bytes(s),
    f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c, line 536 + 0x19
    byte(s)
    <br>
    0x015308DD (0x7EFDE000 0x00C0FB8C 0x77E89F42 0x7EFDE000),
    mainCRTStartup() + 0xD bytes(s),
    f:\dd\vctools\crt_bld\self_x86\crt\src\crtexe.c, line 377
    <br>
    0x77403677 (0x7EFDE000 0x739C9B37 0x00000000 0x00000000),
    BaseThreadInitThunk() + 0x12 bytes(s)
    <br>
    0x77E89F42 (0x015308D0 0x7EFDE000 0x00000000 0x00000000),
    RtlInitializeExceptionChain() + 0x63 bytes(s)
    <br>
    0x77E89F15 (0x015308D0 0x7EFDE000 0x00000000 0x00000000),
    RtlInitializeExceptionChain() + 0x36 bytes(s)
    <br>
    <br>
    I have a few questions. Firstly, am I invoking lld correctly? What
    args should I be using to successfully link a program? How can I
    configure clang++ to use lld by default?
    <br>
    <br>
    Secondly and a little more broadly, how complete is LLVM-ld? Is it
    capable of fully linking programs on its own or does it still rely
    on GCC?
    <br>
    <br>
    Thanks a lot for your time.
    <br>
    <br>
    (sorry if this message was already received, it's my first time
    using a mailing list and I'm not sure if it sent correctly)<br>
  </body>
</html>