[llvm-dev] Invoking lld for PE/COFF (Windows) linking

Edward Diener via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 31 16:36:56 PDT 2017


On 3/31/2017 4:53 PM, kyra via llvm-dev wrote:
> Perhaps, you'll find these useful:
> https://sourceforge.net/p/mingw-w64/bugs/597
> https://github.com/lhmouse/mcfgthread/issues/21

I appreciate the links.

>
> (awson is me)
>
> On 31.03.2017 23:07, Edward Diener via llvm-dev wrote:
>> On 3/30/2017 9:03 PM, Reid Kleckner via llvm-dev wrote:
>>> On Thu, Mar 30, 2017 at 5:57 PM, Edward Diener via llvm-dev
>>> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>>
>>>     Actually just doing:
>>>
>>>     clang++ -c t.cpp -o t.o --target=x86_64-windows-msvc
>>> -fmsc-version=1900
>>>     clang++ t.o -o t.exe --target=x86_64-windows-msvc -fuse-ld=lld
>>>
>>>     is not working for me. The first invocation works but the second
>>>     just hangs and never completes. Should it work ? If not, how can I
>>>     invoke the second to make it work properly ?
>>>
>>>
>>> Is it actually running lld-link.exe?  Does lld-link.exe exist next to
>>> clang++.exe? If you add -###, what linker command line is clang trying
>>> to run?
>>
>> "C:/Programming/VersionControl/bninja_installed_clang/bin/clang++" -o
>> "C:\Programming\VersionControl\modular-boost\build\boost\bin.v2\libs\preprocessor\test\config_info.test\clang-linux-5.0cl\debug\address-model-32\config_info.exe"
>> -Wl,--start-group
>> "C:\Programming\VersionControl\modular-boost\build\boost\bin.v2\libs\preprocessor\test\config_info.test\clang-linux-5.0cl\debug\address-model-32\config_info.obj"
>>  -Wl,-Bstatic  -Wl,-Bdynamic  -Wl,--end-group -g
>> --target=i686-pc-windows-msvc -### -fuse-ld=lld
>>
>> clang version 5.0.0 (trunk 298890)
>> Target: i686-pc-windows-msvc
>> Thread model: posix
>> InstalledDir: C:\Programming\VersionControl\bninja_installed_clang\bin
>>
>> "C:\\Programming\\VersionControl\\bninja_installed_clang\\bin\\lld-link.exe"
>> "-out:C:\\Programming\\VersionControl\\modular-boost\\build\\boost\\bin.v2\\libs\\preprocessor\\test\\config_info.test\\clang-linux-5.0cl\\debug\\address-model-32\\config_info.exe"
>> "-defaultlib:libcmt" "-libpath:C:\\Program Files (x86)\\Microsoft
>> Visual Studio 14.0\\VC\\lib" "-libpath:C:\\Program Files
>> (x86)\\Windows Kits\\10\\Lib\\10.0.14393.0\\ucrt\\x86"
>> "-libpath:C:\\Program Files (x86)\\Windows
>> Kits\\10\\Lib\\10.0.14393.0\\um\\x86" "-nologo" "-debug"
>> "--start-group"
>> "C:\\Programming\\VersionControl\\modular-boost\\build\\boost\\bin.v2\\libs\\preprocessor\\test\\config_info.test\\clang-linux-5.0cl\\de
>>
>>
>> When I actually try to run the lld-link command as:
>>
>> C:\Programming\VersionControl\bninja_installed_clang\bin\lld-link.exe
>> -out:C:\Programming\VersionControl\modular-boost\build\boost\bin.v2\libs\preprocessor\test\config_info.test\clang-linux-5.0cl\debug\address-model-32\config_info.exe
>> -defaultlib:libcmt "-libpath:C:\Program Files (x86)\Microsoft Visual
>> Studio 14.0\VC\lib" "-libpath:C:\Program Files (x86)\Windows
>> Kits\10\Lib\10.0.14393.0\ucrt\x86" "-libpath:C:\Program Files
>> (x86)\Windows Kits\10\Lib\10.0.14393.0\um\x86" -nologo -debug
>> --start-group
>> C:\Programming\VersionControl\modular-boost\build\boost\bin.v2\libs\preprocessor\test\config_info.test\clang-linux-5.0cl\debug\address-model-32\config_info.obj
>> -Bstatic -Bdynamic --end-group
>>
>> I get for output in a Windows command window:
>>
>> C:\Programming\VersionControl\bninja_installed_clang\bin\lld-link.exe:
>> warning:
>> ignoring unknown argument: --start-group
>> C:\Programming\VersionControl\bninja_installed_clang\bin\lld-link.exe:
>> warning:
>> ignoring unknown argument: -Bstatic
>> C:\Programming\VersionControl\bninja_installed_clang\bin\lld-link.exe:
>> warning:
>> ignoring unknown argument: -Bdynamic
>> C:\Programming\VersionControl\bninja_installed_clang\bin\lld-link.exe:
>> warning:
>> ignoring unknown argument: --end-group
>>
>> and then nothing further and lld_link.exe just hangs and never
>> completes. So it looks to me that lld_link, in it effort to link
>> PE/COFF (Windows) files created by clang++ targeting VC++, has some
>> sort of bug.




More information about the llvm-dev mailing list