Re: lld status

2017-12-22 Thread Paolo Invernizzi via Digitalmars-d

On Friday, 22 December 2017 at 09:46:40 UTC, Jacob Carlborg wrote:

On 2017-12-22 00:11, Atila Neves wrote:

I tried lld on Linux for D binaries and some of them crash. 
That might not mean anything on Windows, but given that I've 
run into 2 dmd bugs so far in which picking one of ld.bfd or 
ld.gold produced crashing binaries, I'd be wary of using lld 
on Windows until it's thoroughly tested on dozens of 
executables.


I tried to use lld to cross compile to macOS on Linux. It 
crashed on the first try, might even have been a C program.


It worked for me the other way round, to Linux on macOS, and 
worked also to Win64 on macOS.


/Paolo


Re: lld status

2017-12-22 Thread Jacob Carlborg via Digitalmars-d

On 2017-12-22 00:11, Atila Neves wrote:

I tried lld on Linux for D binaries and some of them crash. That might 
not mean anything on Windows, but given that I've run into 2 dmd bugs so 
far in which picking one of ld.bfd or ld.gold produced crashing 
binaries, I'd be wary of using lld on Windows until it's thoroughly 
tested on dozens of executables.


I tried to use lld to cross compile to macOS on Linux. It crashed on the 
first try, might even have been a C program.


--
/Jacob Carlborg


Re: lld status

2017-12-21 Thread Atila Neves via Digitalmars-d
On Thursday, 21 December 2017 at 18:40:54 UTC, Andrei 
Alexandrescu wrote:
I only became aware today about https://lld.llvm.org, llvm's 
own linker. I wonder how that changes distribution dynamics for 
us - I heard ldc already uses its embedded variant for linking 
programs (on Widows? Posix? 32bit? 64bit?). Can we distribute 
it as an alternative to optlink? Thanks! -- Andrei


I tried lld on Linux for D binaries and some of them crash. That 
might not mean anything on Windows, but given that I've run into 
2 dmd bugs so far in which picking one of ld.bfd or ld.gold 
produced crashing binaries, I'd be wary of using lld on Windows 
until it's thoroughly tested on dozens of executables.


Atila


Re: lld status

2017-12-21 Thread kinke via Digitalmars-d
On Thursday, 21 December 2017 at 18:40:54 UTC, Andrei 
Alexandrescu wrote:
I heard ldc already uses its embedded variant for linking 
programs (on Widows? Posix? 32bit? 64bit?).


Currently only for Windows-MSVC targets (both 32 and 64 bits) and 
only when specifying the `-link-internally` switch. The host 
platform doesn't matter, i.e., it works for cross-linking from 
any Posix system too, even on ARM etc.
['Embedded variant' => we're linking in the static LLD libs and 
so share the common LLVM code in a single executable.]



Can we distribute it as an alternative to optlink?


Now that it's capable of outputting debuginfo .pdb's too (since 
v5.0, at least on Windows hosts), it should basically be fine.


There's one catch though, and that's the rather big size of the 
executable (26 MB for the v5.0.1 32-bit executable when linked 
against the static MS runtime with VS 2017, with enabled LLVM 
backends for x86[_64], ARM, AArch64 and Nvidia PTX).
That's due to LLD being a cross-linker by default, capable of 
outputting Windows, ELF and Mach-O binaries, and because of 
included codegen capabilities (for Link-Time Optimization), i.e., 
stuff that DMD doesn't need. Unfortunately, those features cannot 
be simply opted-out via CMake.


Re: lld status

2017-12-21 Thread David Nadlinger via Digitalmars-d
On Thursday, 21 December 2017 at 18:40:54 UTC, Andrei 
Alexandrescu wrote:
I heard ldc already uses its embedded variant for linking 
programs (on Widows? Posix? 32bit? 64bit?)


Internal linking is currently enabled by a separate command-line 
flag; we still use the system linker by default (just as a 
precaution to avoid needless breakage because of a new feature).


lld works for COFF, ELF as well as Mach-O. For the latter, there 
is the problem of locating the appropriate C runtime libraries to 
consider, though (those that the `gcc` linker driver implicitly 
passes to the underlying `ld`).



Can we distribute it as an alternative to optlink?


Yes, that should work. As far as I know, it doesn't support OMF, 
though, so we would need to find COFF C/system libraries we can 
redistribute - it is unclear whether Microsoft's license allows 
redistribution of their static libraries.


 - David


lld status

2017-12-21 Thread Andrei Alexandrescu via Digitalmars-d
I only became aware today about https://lld.llvm.org, llvm's own linker. 
I wonder how that changes distribution dynamics for us - I heard ldc 
already uses its embedded variant for linking programs (on Widows? 
Posix? 32bit? 64bit?). Can we distribute it as an alternative to 
optlink? Thanks! -- Andrei