On 17 July 2017 at 22:26, Mike via D.gnu <d.gnu@puremagic.com> wrote: > On Wednesday, 28 June 2017 at 22:17:09 UTC, Iain Buclaw wrote: > >> A thought just occurred to me, you are compiling the entire program + >> object.d right? Nothing else will link/be linked to the binary? >> >> If that is the case, you should definitely compile with -fwhole-program. >> I suspect that may cut down your compilation time by half or even more. > > > I'm back and have spend the last two days trying to get my project compiled > with -fwhole-program in an effort to reduce the compile times, but I haven't > had any success. > > Regardless of what I do, the compiler doesn't emit anything except main. > > arm-none-eabi-gdc -c -O2 -finline-functions -nophoboslib -nostdinc > -nodefaultlibs -nostdlib -fno-emit-moduleinfo -mthumb -mcpu=cortex-m4 > -fwhole-program -Isource/entrypoint -fno-bounds-check -ffunction-sections > -fdata-sections source/gcc/attribute.d source/runtime/exception.d > source/runtime/invariant.d source/runtime/object.d source/runtime/dmain2.d > source/board/lcd.d source/board/ILI9341.d source/board/package.d > source/board/statusLED.d source/board/ltdc.d source/board/random.d > source/board/spi5.d source/stm32f42/nvic.d source/stm32f42/gpio.d > source/stm32f42/flash.d source/stm32f42/scb.d source/stm32f42/spi.d > source/stm32f42/pwr.d source/stm32f42/ltdc.d source/stm32f42/trace.d > source/stm32f42/rcc.d source/stm32f42/bus.d source/stm32f42/rng.d > source/stm32f42/dma2d.d source/stm32f42/mmio.d source/main.d -o > binary/firmware.o > > arm-none-eabi-nm binary/firmware.o > U _Dmain > U _d_run_main > 00000000 T main > > Are you sure this works with multiple modules passed to the compiler on one > line? >
Humm, it looks like it can't sufficiently determine that both the _d_run_main declarations are for the same symbol. After making a tweak, it compiles a program that does a little bit more. https://gist.github.com/ibuclaw/d1fad77b074fded2682a16df93369a84 This is the compiled result: https://gist.github.com/ibuclaw/93c707f4729ffc4376539283defdc709 Iain.