GDC

From D Wiki
(Redirected from Compiler:GDC)
Jump to: navigation, search

Compilers: OverviewDMDGDCLDC

Welcome to GDC. This project aims to continue the development of GDC, a GCC frontend for the D programming language.

Useful Links

Introduction

What is GDC?

GDC is a frontend for the D programming language. By using GCC as a backend, it gives us the ability to target the same platforms that GCC targets.

This project was originally started by David Friedman. His first announcement can be found here and his original project page can be found here. Unfortunately, he disappeared from the D scene, and was no longer able to maintain GDC. This project was the result of an effort to help continue David Friedman's work on GDC.

The paperwork is complete and efforts are currently underway to merge GDC into the official GCC codebase, which represents a great step forward for D. However, more than ever, GDC is in need of contributors to keep it up to date with both the D frontend and the trunk development of the GCC backend.

Why GDC?

There are many advantages to adding a D frontend to GCC, and most of them stem from the fact that the GCC codebase has been the focus of extensive development over several decades, and that the GCC middle and back ends are designed such that multiple languages can easily take advantage of them. This means that a D frontend that can make use of the GCC middle and backend code will gain many advantages that would require years of development to match in the DMD codebase.

Firstly, GCC targets many more platforms than DMD.

Secondly, GCC has a very well-developed optimization framework that can generally generate more performant code than DMD, particularly when taking advantage of more recent CPU features such as SIMD instructions (both directly and through automatic vectorization).

Thirdly, GDB is primarily developed to debug code generated by GCC, so debugging code generated by GCC will generally result in a better user experience.

Status

D2 Frontend Versions: 2.068, 2.076, 2.081

Supported GCC versions

GDC (implementing version 2.076 of the language and runtime) was merged ( https://gcc.gnu.org/gcc-9/changes.html#d ) into GCC project in version 9.0, and will be supported and updated for all future GCC versions indefinitely.

Installing GDC

Linux distribution packages

Official packages are available for these distributions

For Gentoo Linux, GDC enabled ebuilds of GCC are available from the dlang overlay:

Enable the d USE-flag for sys-devel/gcc and emerge it again. If you are currently on stable GCC you can install the GDC enabled testing version in parallel. gcc-config should be used to switch the active version temporarily if you would like to be able to run gdc without typing the full path.

Official prebuilt binaries

Various precompiled toolchains are available on the official download page.

Detailed installation guide

GDC/Installation contains detailed information on building and installing GDC alongside your system's host compilers.

Documentation

User Documentation

GDC/Using_GDC aims to explain some aspects of GDC such as its usage, differences from DMD, and known issues. If you need help using GDC, take a look here.

Target Documentation

MinGW

This documentation page aims to explain aspects of the MinGW port of GDC. Such as MinGW specific features, Windows specific topics and known issues. A source code repository containing various patches and a build script can be found here, but it may be out of date.

ARM Cortex-M

A minimal "Hello World!" example that requires no D runtime, no standard library (Phobos), and no C can be found here. It serves as an excellent starting point for anyone wishing to pursue their own port of D to the ARM Cortex-M family of microcontrollers.

Additionally, there is minlibd. A collection of libraries and tools to compile D language programs for embedded systems with the GDC compiler.

See also Bare Metal ARM Cortex-M GDC Cross Compiler for instructions specific to building a bare metal ARM Cortex-M GDC cross compiler.

Developer Documentation

GDC/Development/DevelopmentEnvironment provides instructions on how to set up a development environment for hacking the GDC compiler.

GDC/Hacking describes the structure of the GCC and GDC source code repositories.

GDC/Development contains information about the internals of GDC, and will be a valuable resource for those that wish to help with GDC's development.

Support

Support can be found in a couple of different places:

  • On irc.libera.chat, there is a GDC irc channel. It is channel #d-gdc.
  • The D.gnu newsgroup, located here.
  • Sending an inbox message to one of the maintainers.

The D.gnu newsgroup should also be used for general discussion about GDC. A bug, proposal, or enhancement can go to the issue tracker. If you choose to use the issue tracker, please label the issue appropriately. (bug, proposal, enhancement)

Bugs

A list of open bugs can be found here. New bugs should be submitted to the GDC Bugzilla site. A simple comment saying "This also happens/doesn't happen on Mac\Windows\Linux under GCC x.x.x(GCC version)" can be useful in helping solve the bug.

If you have found a possible bug in GDC, please submit it! Here are some guidelines that you should follow when submitting a bug:

  1. Make sure the bug has not already been submitted to GDC.
  2. Include the GCC version. (e.g. 4.7.0, etc)
  3. Include the git changeset you are using for GDC. (e.g. changeset 6f03952ff48f)
  4. Include your operating system.(Mac/Windows/flavour of Linux)
  5. Include a simple test case demonstrating the issue.
  6. if possible, include a patch to fix the issue.

Getting Involved

Please see Submission of D Front End for a list of open (and closed) tasks for the current GCC submission process.

Please see Project Ideas for inspiration and long term goals.

GDC is currently developed by a very small group (as the commit history on GitHub shows). While the addition of a D frontend to GCC represents a great step forward for D, it also represents an informal promise by the D community to keep the D frontend up to date with the latest GCC development.

If you use GDC, we encourage you to try to contribute, whether by submitting pull requests or bug reports. In the past, GDC has nearly died due to poor communication and lack of development. Avoiding those issues is easier than ever before, but GDC will always need a community that's willing to give back.

Thanks to GitHub, contributing to GDC is as easy as forking the repository and submitting a pull request (although this workflow will likely change when the merge is officially complete), and filing a bug report is a simple web form.

There are a lot of things that you can do to get involved and help out with GDC. They vary from making simple documentation for some of the files, finding and submitting bugs, testing out bugs on different platforms, or submitting patches for GDC. Any help is appreciated.