D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4010 - dmd should support linkers other than OPTLINK
Summary: dmd should support linkers other than OPTLINK
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Windows
: P2 enhancement
Assignee: No Owner
URL:
Keywords: Optlink
Depends on:
Blocks:
 
Reported: 2010-03-26 04:34 UTC by nfxjfg
Modified: 2017-10-25 03:00 UTC (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description nfxjfg 2010-03-26 04:34:28 UTC
Because of the general instability of OPTLINK, I request that dmd should be able to generate object files consumable by other linkers. OPTLINK is the only OMF linker I've found capable to link dmd's output.

Possible targets include the Microsoft linker (supports COFF) or the GNU linker (supports both COFF and ELF on Windows).

dmd already has an Linux and a MacOSX backend, both with different object file formats; this can't be a too unrealistic feature request.
Comment 1 Jonathan M Davis 2011-01-06 20:50:39 UTC
This is actually one which I'd really like to see done at some point. The fact that you have to use dmc to build your C/C++ code is a huge blocker for D on Windows for anyone who works in an environment which is primarily using Microsoft or Intel's compiler. It would not be possible for me to use dmc for C++ where I work, which makes using D there much harder, even if I were to end up with a project where I would have a chance of choosing to use it in D.

There was a discussion about this on the D list a while back, and it was suggested that dmd at least be altered such that you could have a plugin architecture of some kind to swap out linkers. That way, even though dmd would still use dmc/optlink normally, someone other than Walter could then write and maintain a plugin which used Microsoft's compiler. So, we could potentially get support for other linkers without requiring Walter to deal with it.
Comment 2 Brad Roberts 2011-01-06 20:53:11 UTC
If someone wants to write the .obj writer for an alternate format, do it.  How to wire it up with dmd is the least of the problems.
Comment 3 Jonathan M Davis 2011-01-06 20:55:52 UTC
Likely true. But as with many things around here, it requires someone to step up and do it.
Comment 4 Walter Bright 2011-01-06 22:59:05 UTC
It's more than just writing a different object file format, if the goal is to link with VC output. It's being ABI compatible with whatever the VC compiler puts out.
Comment 5 Andrej Mitrovic 2012-12-20 15:08:34 UTC
(In reply to comment #4)
> It's more than just writing a different object file format, if the goal is to
> link with VC output. It's being ABI compatible with whatever the VC compiler
> puts out.

Is this issue now solved since x64 uses the VC linker?
Comment 6 Brad Roberts 2012-12-20 15:11:57 UTC
I wouldn't consider it done until win/32 is also migrated to the visual studio runtime and linker.  I admit that's an expansion of the original description of this issue, but I think it's the spirit of it.  And I agree with the spirit.
Comment 7 Andrej Mitrovic 2012-12-20 15:16:10 UTC
(In reply to comment #6)
> I wouldn't consider it done until win/32 is also migrated to the visual studio
> runtime and linker.  I admit that's an expansion of the original description of
> this issue, but I think it's the spirit of it.  And I agree with the spirit.

I'm totally for having support for COFF on win32 too, but IIRC Walter mentioned win32 will stay with Optlink? (I might be wrong).

You can currently use one other linker on win32 though, Unilink. It often gives out readable error messages rather than crashing like Optlink.
Comment 8 Jonathan M Davis 2012-12-20 15:23:39 UTC
Walter does not currently plan to make dmd on Windows produce COFF for 32-bit programs. It's considerably more work to do that on top of the 64-bit stuff, and he considers 32-bit to be dying out such that it's not worth the effort to convert it. I doubt that he'd be opposed to someone else doing that work, but as I understand it, he has no intention of doing it himself.
Comment 9 Brad Roberts 2012-12-20 17:21:56 UTC
Speaking for Walter is generally a bad idea.  Anyway, I recall the thread as "64 bit first, 32 bit maybe later".
Comment 10 Jonathan M Davis 2012-12-20 17:45:18 UTC
I'm just repeating what I remember of what he said. I'd obviously have to dig through the archives to get exact quotes though. And he could certainly change his mind. Regardless, we're definitely not getting COFF on 32-bit Windows right now.
Comment 11 Walter Bright 2017-10-25 03:00:21 UTC
dmd will now support MS-COFF output with the -m32mscoff compiler switch.