Testing GDC (GCC 7.1) on Runtime-less ARM Cortex-M

Iain Buclaw via D.gnu d.gnu at puremagic.com
Wed Jun 28 16:13:27 PDT 2017


On 29 June 2017 at 00:50, Mike via D.gnu <d.gnu at puremagic.com> wrote:
> On Wednesday, 28 June 2017 at 22:17:09 UTC, Iain Buclaw wrote:
>> 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.
>
>
> If I only import __entrypoint.d and pass the rest of the runtime files on
> the command line and compile with -fwhole-program, it compiles in 5s, but I
> only get an 8byte binary.  I suspect this is due to the error above about
> __entrypoint.  That is, if there's no entry point, the whole program gets
> garbage collected.
>
> I think you might be on to something here though.
>

Yes, it seems like there's a more than a few hundred functions being
emitted, and as they are all considered externally visible, none can
be removed during the optimization pass.  If they are all considered
static (in the C sense), then unused and inlined functions can be
removed immediately, giving the backend less work.  I think the only
caveat with using -fwhole-program is that C main must be present in
the compilation, otherwise as you've noted, everything gets removed as
unused code.

Regards,
Iain.


More information about the D.gnu mailing list