DMD release compiler flags when building with LDC

Jonathan Marler johnnymarler at
Thu Oct 24 14:03:32 UTC 2019

On Wednesday, 23 October 2019 at 11:24:32 UTC, kinke wrote:
> On Wednesday, 23 October 2019 at 09:49:57 UTC, Per Nordlöw 
> wrote:
>> On Tuesday, 22 October 2019 at 18:55:03 UTC, kinke wrote:
>>> On Tuesday, 22 October 2019 at 14:02:28 UTC, Per Nordlöw 
>>> wrote:
>>>>     ENABLE_LTO=1 \
>>> This has exactly 0 effect on DMD itself, from DMD's 
>>> src/posix.mak:
>>> ifdef ENABLE_LTO
>>> CXXFLAGS  += -flto
>>> endif
>> So, I presume we could set
>> ifdef ENABLE_LTO
>> DFLAGS += -flto=full
>> endif
>> in the case when `HOST_DC` is either `ldmd2` or `ldc2` then, 
>> right?
>> This works for me.
> My bad, I thought build.d was a replacement for the Makefile, 
> instead the Makefile is based on it, so this should kick in: 
> druntime is linked as machine code though, so an additional 
> `-defaultlib=druntime-ldc-lto` (if available in the used LDC 
> package, true for almost all official packages) would 
> additionally enable LTO across DMD and druntime.

build.d is meant to replace the Makefiles. It just takes a long 
time to get PRs through and they need to be small. So to make the 
change incremental I've been removing logic from the Makefiles 
and forwarding the targets to call build.d instead. We've 
recently made some good progress and we just started getting help 
from MoonlightSentinel so hopefully well get it all moved over 

That being said, having the Makefiles around doesn't really 
bother me. Maybe we'll leave them so people can still use make to 
build dmd. So long as all the logic is removed and all it does is 
forward to build.d.

More information about the Digitalmars-d mailing list