1 <!DOCTYPE html PUBLIC
"-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta content=
"text/html; charset=ISO-8859-1" http-equiv=
"content-type">
5 <title>D Front End for GCC
</title>
8 <h2>D Front End for GCC - Release
0.24<br>
10 Last update: August
22,
2007<br>
11 <h3>Supported Systems
</h3>
13 <li>GCC
3.4.x,
4.0.x,
4.1.x
<br>
15 <li>Linux (tested on Fedora Core
5 x86, x86_64, and PowerPC)
<br>
17 <li>Mac OS X
10.3.9,
10.4.x
<br>
22 <li>AIX (tested on
5.1)
</li>
25 Similar versions of the above systems should work and other Unix
28 Although the compiler will
29 probably work on most architectures, the D
30 runtime library will still need to be updated to support them.
<br>
37 The MacOS X universal binary package requires XCode
2.4.1 or the
38 equivalent version of cctools.
49 <li><a href=
"http://sourceforge.net/projects/dgcc">Main
55 <li><a href=
"install.html">Build Instructions
</a></li>
75 <li><a href=
"http://dgcc.sourceforge.net/">GDC: D
76 Compiler for GCC
</a><br>
86 <li><a href=
"http://www.digitalmars.com/d/">The D
87 Programming Language
</a></li>
92 <li><a href=
"http://digitalmars.com/d/dlinks.html">D
103 <li><a href=
"news://news.digitalmars.com/D.gnu">The
104 D.gnu newsgroup
</a></li>
109 <li>For general D discussion, the
<a href=
"news://news.digitalmars.com/digitalmars.D">digitalmars.D
</a>
110 and
<a href=
"news://news.digitalmars.com/digitalmars.D.bugs">digitalmars.D.bugs
</a>
121 <li><a href=
"http://gcc.gnu.org/">The GNU Compiler
127 <li><a href=
"http://gdcmac.sourceforge.net/">Mac
154 e-mail: dvdfrdmn
<at
> users.sf.net
<br>
169 <h4>Known Issues
</h4>
179 <li>See the
<a href=
"http://svn.kuehne.cn/dstress/www/dstress.html">DStress
</a>
180 page for known failing cases.
<br>
190 <li>Debugging information may have a few problems. To enable D
192 mangling in gdb, apply
<a href=
"http://dsource.org/projects/gdb-patches/">this patch
</a>.
<br>
202 <li>Some targets do not support once-only linking. A workaround
204 manually control template emission. See the
<span style=
"font-family: monospace;">-femit-templates
</span>
205 option below. For Darwin, Apple's GCC
3.x compiler supports
206 one-only linking, but GDC does not build with those sources. There are
208 problems with the stock GCC
4.x on Darwin.
<br>
234 <li>Complex floating point operations may not work the same as
240 <li>Some math functions behave differently due to different
241 implementations of the extended floating-point type.
</li>
246 <li>Volatile statements may not always do the right thing.
</li>
251 <li>Because of
<a href=
"http://groups-beta.google.com/groups?hl=en&q=%22large+executables+on+AIX%22&qt_s=Search">a
252 problem on AIX
</a>, the linker will pull in more modules than
263 <li>Some C libraries (Cygwin, MinGW, AIX) don't handle
265 formatting and parsing in a standard way.
<br>
280 <h4>Known Differences from DMD
</h4>
290 <li>The type of
<span style=
"font-family: monospace;">_argptr
</span>
291 in variadic functions is the target-specific
<span style=
"font-family: monospace;">va_list
</span>
294 to use
<span style=
"font-family: monospace;">_argptr
</span>
295 is the
<span style=
"font-family: monospace;">std.stdarg.va_arg
</span>
296 template.
In particular, you cannot construct a
<span style=
"font-family: monospace;">va_list
</span> from a
298 an expect it to work.
<br>
308 <li>In assembler code, direct access to parameters in naked
310 works differently.
Frame relative addressing through
<span style=
"font-family: monospace;">[ESP+
4]
</span> does
311 work the same way.
<br>
321 <li>Currently, GDC uses the C calling convention for all
323 except those declared
<span style=
"font-family: monospace;">extern
324 (Windows)
</span>.
</li>
329 <li>GDC allows
<span style=
"font-family: monospace;">catch
</span> statements in
<span style=
"font-family: monospace;">finally
</span>
335 <li><span style=
"font-family: monospace;">pragma(lib)
</span>
342 <li>Some targets do not have a distinct extended floating-point
343 type.
On these targets,
<span style=
"font-family: monospace;">real
</span>
344 and
<span style=
"font-family: monospace;">double
</span>
351 <li>On Win32, GDC allocates
12 bytes for the
<span style=
"font-family: monospace;">real
</span> type,
353 10 bytes. This also applies to the components of the
<span style=
"font-family: monospace;">creal
</span> type.
<br>
368 <h4>Inline Assembler Notes
</h4>
378 <li>Getting GCC to respect the
"naked" attribute is
380 It is recommended that you use only assembler statements in a naked
381 function.
When generating position-independent code, accessing global symbols in a naked function will result in an error.
</li>
386 <li>Jumps from assembler statements will not run cleanups (auto
403 <h4>Invoking gdc and gdmd
</h4>
408 The compiler driver is named 'gdc' and accepts the standard GCC
409 options.
There is also a script named 'gdmd' which has the
411 interface as the Digital Mars dmd.
<br>
421 The mapping from DMD options to GCC is as follows:
<br>
426 <table style=
"text-align: left; width: 50%;" border=
"1" cellpadding=
"2" cellspacing=
"2">
441 <td style=
"vertical-align: top;">-c
<br>
451 <td style=
"vertical-align: top;">-c
<br>
471 <td style=
"vertical-align: top;">-D
<br>
481 <td style=
"vertical-align: top;">-fdoc
<br>
501 <td style=
"vertical-align: top;">-Dd
<docdir
><br>
511 <td style=
"vertical-align: top;">-fdoc-dir=
<docdir
><br>
531 <td style=
"vertical-align: top;">-Df
<filename
><br>
541 <td style=
"vertical-align: top;">-fdoc-file=
<filename
><br>
561 <td style=
"vertical-align: top;">-d
</td>
566 <td style=
"vertical-align: top;">-fdeprecated
</td>
581 <td style=
"vertical-align: top;">-debug[=
<arg
>]
<br>
591 <td style=
"vertical-align: top;">-fdebug[=
<arg
>]
<br>
611 <td style=
"vertical-align: top;">-g
<br>
621 <td style=
"vertical-align: top;">-g
<br>
641 <td style=
"vertical-align: top;">-inline
<br>
651 <td style=
"vertical-align: top;">-finline-functions
<br>
671 <td style=
"vertical-align: top;">-I
<path
><br>
681 <td style=
"vertical-align: top;">-I
697 <td style=
"vertical-align: top;">-J
<path
><br>
701 <td style=
"vertical-align: top;">-J
<path
><br>
712 <td style=
"vertical-align: top;">-L
<arg
><br>
722 <td style=
"vertical-align: top;">-Wl,
<arg
><br>
742 <td style=
"vertical-align: top;">-O
<br>
752 <td style=
"vertical-align: top;">-O3 without
774 <td style=
"vertical-align: top;">-o-
<br>
784 <td style=
"vertical-align: top;">-fsyntax-only
<br>
804 <td style=
"vertical-align: top;">-od
<dir
><br>
814 <td style=
"vertical-align: top;">no equivalent; use
836 <td style=
"vertical-align: top;">-of
<file
></td>
841 <td style=
"vertical-align: top;">-o
862 <td style=
"vertical-align: top;">-op
<dir
><br>
872 <td style=
"vertical-align: top;">no equivalent; use
894 <td style=
"vertical-align: top;">-profile
<br>
904 <td style=
"vertical-align: top;">(see the GCC manual
922 <td style=
"vertical-align: top;">-quiet
<br>
932 <td style=
"vertical-align: top;">no equivalent
<br>
952 <td style=
"vertical-align: top;">-release
<br>
962 <td style=
"vertical-align: top;">-frelease
<br>
982 <td style=
"vertical-align: top;">-run
<br>
992 <td style=
"vertical-align: top;">no equivalent; use
1009 <td style=
"vertical-align: top;">-unittest
<br>
1019 <td style=
"vertical-align: top;">-funittest
<br>
1039 <td style=
"vertical-align: top;">-version=
<arg
><br>
1049 <td style=
"vertical-align: top;">-fversion=
<arg
><br>
1069 <td style=
"vertical-align: top;">-w
<br>
1079 <td style=
"vertical-align: top;">-Wall
<br>
1099 <td style=
"vertical-align: top;"><.ddoc
1110 <td style=
"vertical-align: top;">-fdoc-inc=
<.ddoc
1145 <table style=
"text-align: left; width: 75%;" border=
"1" cellpadding=
"2" cellspacing=
"2">
1160 <td style=
"vertical-align: top;">-f[no-]bounds-check
<br>
1170 <td style=
"vertical-align: top;">Controls array
1191 <td style=
"vertical-align: top;">-femit-templates[=normal|private|all|none|auto]
<br>
1196 -f[no-]emit-templates
<br>
1206 <td style=
"vertical-align: top;">Controls whether or
1208 code is emitted.
<br>
1218 "normal" -- Emit templates, expecting multiple copies to be merged by
1225 "private" -- Emit templates, but make them private to the translation
1226 unit.
The executable will have multiple copies of code and
1232 "all" -- Emit all template instances with public visibility.
1234 this even if they would not normally be emitted.
<br>
1239 "none" -- Do not emit templates at all.
<br>
1244 "auto" -- For targets that support templates, the
"full" mode is
1245 used.
Otherwise, the
"private" mode is used.
<br>
1255 "none" and -fno-emit-templates are synonyms.
<br>
1260 "auto" and -femit-templates are synonyms.
<br>
1280 <td style=
"vertical-align: top;">-fall-sources
<br>
1290 <td style=
"vertical-align: top;">For each source
1292 command line, semantically process each file preceding it.
1295 compilation errors occur due to complicated circular module
1296 references.
This will slow compilation noticeably.
<br>
1316 <td style=
"vertical-align: top;">-fdump-source
<br>
1326 <td style=
"vertical-align: top;">Dump decoded UTF-
8
1328 source from HTML to
<source
>.utf-
8 and
1329 <source
>.d.utf-
8.
<br>
1357 <h5>Extended Assembler
</h5>
1361 GDC implements a GCC extension that allows inline assembler with D
1362 expression operands.
It is available on nearly all targets, not
1363 just i386.
The syntax differs from the C language extension in
1369 <li>Statements start with '
<span style=
"font-family: monospace;">asm { ...
</span>', just like the regular DMD inline assembler.
</li>
1373 <li>It is not necesary to put parentheses around operands.
</li>
1377 <li>Instruction templates can be compile-time string constants, not
1378 just string literals.
If the template is not a string literal,
1379 use parenthesis to indicate that it is not an opcode.
</li>
1387 Unlike i386 inline assembler statements, extended assembler statements do not prevent a function from being inlined.
<br>
1395 See the GCC manual for more information about this extension.
<br>
1411 <div style=
"margin-left: 40px;"><span style=
"font-family: monospace;">uint invert(uint v)
</span><br style=
"font-family: monospace;">
1415 <span style=
"font-family: monospace;">{
</span><br style=
"font-family: monospace;">
1419 <span style=
"font-family: monospace;"> uint result;
</span><br style=
"font-family: monospace;">
1423 <span style=
"font-family: monospace;"> version(X86)
</span><br style=
"font-family: monospace;">
1427 <span style=
"font-family: monospace;"> asm{
"notl %[iov]" : [iov]
"=r" result :
"0" v; }
</span><br style=
"font-family: monospace;">
1431 <span style=
"font-family: monospace;"> else version(PPC)
</span><br style=
"font-family: monospace;">
1435 <span style=
"font-family: monospace;"> asm{
"nor %[oresult],%[iv],%[iv]" : [oresult]
"=r" result : [iv]
"r" v; }
</span><br style=
"font-family: monospace;">
1439 <span style=
"font-family: monospace;"> return result;
</span><br style=
"font-family: monospace;">
1443 <span style=
"font-family: monospace;">}
</span><br style=
"font-family: monospace;">
1451 <h5>Declaration and Type Attributes
</h5>
1455 (This extension is a work in progress.)
<br>
1463 GDC implements the GCC
<span style=
"font-family: monospace;">__attribute__
</span> extension with two pragmas:
<br>
1471 <span style=
"font-family: monospace;"><span style=
"font-weight: bold;">pragma
</span>(
<span style=
"font-weight: bold;">GNU_attribute
</span>,
<span style=
"font-style: italic;"> name1
</span>(
<span style=
"font-style: italic;">arg1
</span>,
<span style=
"font-style: italic;">arg2
</span>, ...), ...)
<span style=
"font-style: italic;">declarations
</span>...
</span><br style=
"font-family: monospace;">
1479 <span style=
"font-family: monospace;"><span style=
"font-weight: bold;">pragma
</span>(
<span style=
"font-weight: bold;">GNU_set_attribute
</span>,
<span style=
"font-style: italic;">symbol
</span>,
<span style=
"font-style: italic;">name1
</span>(
<span style=
"font-style: italic;">arg1
</span>,
<span style=
"font-style: italic;">arg2
</span>...), ...);
</span><br>
1487 If an attribute has no arguments, the argument list may be omitted.
<br>
1495 The first form applies to declarations directly contained in the
1496 pragma.
The second form affects the given symbol.
See the
1497 GCC manual for a list of attributes that can be set.
Not all
1498 attributes are supported yet by GDC.
Also, the interaction
1499 between these extended attributes and D languge attributes (alignment,
1500 for example) is not well defined.
1503 <a name=
"0.24"></a>0.24:
1505 <li>Removed support for GCC
3.3.x
</li>
1506 <li>Updated to DMD
1.020</li>
1507 <li>Fixed Bugzilla
1037,
1038 (gdc specific),
1043,
1045,
1046,
</li>
1508 1031,
1032,
1034,
1065,
1109,
1191,
1137,
1152,
1208,
1325,
</li>
1509 1329,
1898,
1400</li>
1510 <li>Fixed SourceForge issues
1689634,
1749622,
1721496,
1721435</li>
1512 <a name=
"0.23"></a>0.23:
1514 <li>Added support for
64-bit targets
</li>
1515 <li>Added multilib support
</li>
1516 <li>Updated to DMD
1.007</li>
1517 <li>Fixed Bugzilla
984,
1013</li>
1519 <a name=
"0.22"></a>0.22:
1521 <li>Added support for GCC
4.1.x
</li>
1522 <li>Support for GCC
3.3.x is deprecated
</li>
1523 <li>Updated to DMD
1.004</li>
1524 <li>Fixed Bugzilla
836,
837,
838,
839,
841,
843,
844,
889,
896</li>
1525 <li>Fixed problems with missing debug information
</li>
1526 <li>Added Rick Mann's -frameowrk patch for gdmd
</li>
1528 <a name=
"0.21"></a>0.21:
1530 <li>Updated to DMD
1.00</li>
1531 <li>Fixed Bugzilla
695,
696,
737,
738,
739,
742,
743,
745</li>
1532 <li>Implemented GCC extended assembler
</li>
1533 <li>Implemented basic support for GCC attributes
</li>
1535 <a name=
"0.20"></a>0.20:
1537 <li>Updated to DMD
0.177</li>
1538 <li>Fixes for synchronized code generation
</li>
1539 <li>Better support for cross-hosted builds
</li>
1540 <li>Fixed Bugzilla
307,
375,
403,
575,
578</li>
1541 <li>Applied Anders Bj
örklund's MacOS X build patches
</li>
1543 <a name=
"0.19"></a>0.19:
1545 <li>Fixed D Bugzilla bugs
141(gdc),
157,
162,
164,
171,
174,
1547 <li>Applied Dave Fladebo's suggestion for -O3 in gdmd
</li>
1548 <li>Updated to DMD
0.162</li>
1549 <li>The version symbol for FreeBSD is now
"freebsd"</li>
1550 <li>Enabled std.loader for FreeBSD
</li>
1551 <li>Implement offsetof in assembler
</li>
1552 <li>Support building with Apple's GCC (
4.0 only)
</li>
1553 <li>Fix parallel builds
</li>
1555 <a name=
"0.18"></a>0.18:
<br>
1562 <li>ICE on assignment arithmetic
</li>
1563 <li>Problems mixing D and assembler floating point operations
</li>
1564 <li>Mac OS X
10.2 build problems
</li>
1565 <li>The gdc driver no longer compiles C source as C++.
<br>
1567 <li>Many others...
</li>
1572 <li>Improvements
</li>
1577 <li>Updated to DMD
0.157.
</li>
1578 <li>Added support for PowerPC Linux.
<br>
1580 <li>Added partial support for SkyOS.
</li>
1581 <li>Compiler can be relocated to another directory.
<br>
1588 <a name=
"0.17"></a>0.17:
<br>
1595 <li>Mixed complex/float operations on GCC
4.0 (
<a href=
"http://www.digitalmars.com/drn-bin/wwwnews?D.gnu/1485">D.gnu/
1485</a>)
</li>
1596 <li>Applied Thomas Kuhne's HTML line number fix
</li>
1597 <li>Foreach/nested functions in templates (
<a href=
"http://www.digitalmars.com/drn-bin/wwwnews?D.gnu/1514">D.gnu/
1514</a>)
</li>
1598 <li>Use correct default initializer when allocating arrays of
1599 typedef'd types
</li>
1600 <li>Recursive calls to nested functions (
<a href=
"http://www.digitalmars.com/drn-bin/wwwnews?D.gnu/1525">D.gnu/
1525</a>)
</li>
1605 <li>Improvements
</li>
1610 <li>Updated to DMD
0.140<br>
1617 <a name=
"0.16"></a>0.16:
<br>
1624 <li>Concatenating a array and single element
</li>
1625 <li>"__arrayArg already defined"</li>
1626 <li>ICE on nested foreach statements (
<a href=
"http://www.digitalmars.com/drn-bin/wwwnews?D.gnu/1393">D.gnu/
1393</a>)
</li>
1627 <li>Inline assembler
</li>
1632 <li>Functions returning floating point types
</li>
1641 <li>Spurious error on scaled register without a base
1643 <li>Access to locals by var+ofs[EBP] now works with
1645 <li>Can now guess operand size from referenced variables.
</li>
1650 <li>Thunks errors with reimplemented interfaces (e.g., Mango)
<br>
1656 <li>Improvements
</li>
1661 <li>Support GCC
4.0.x
</li>
1662 <li>Updated to DMD
0.137</li>
1663 <li>Support DW_LANG_D for DWARF debugging
</li>
1664 <li>Support compiling multiple sources to a single object
1674 <a name=
"0.15"></a>0.15:
<br>
1675 <div style=
"margin-left: 40px;">
1676 Updated to DMD
0.128<br>
1679 <a name=
"0.14"></a>0.14:
<br>
1686 <li>Classes nested in functions actually work now.
</li>
1687 <li>Fix for newest versions of the GNU assembler.
<br>
1693 <li>Improvements
</li>
1698 <li>Updated to DMD
0.127<br>
1706 <a name=
"0.13"></a>0.13:
<br>
1713 <li>Cygwin/MinGW assembler problem
</li>
1718 <li>Improvements
</li>
1723 <li>Updated to DMD
0.126.
</li>
1724 <li>Calling nested functions with delegates is faster.
</li>
1725 <li>The
"check-target-libphobos" uses unit tests and runtime
1733 <a name=
"0.12.1"></a>0.12.1:
<br>
1740 <li>Compilation errors and crashes with -fpic
</li>
1741 <li>Crashes with interfaces on Cygwin/MinGW
</li>
1742 <li>Support the -mno-cygwin option
<br>
1749 <a name=
"0.12"></a>0.12:
<br>
1756 <li>Various problems building MinGW in MSYS
</li>
1757 <li>Mango
"endless output"</li>
1758 <li>Build problems with gcc
3.4.1</li>
1759 <li>Various problems revealed by dmdscript
<br>
1761 <li>Error message now go to standard error
</li>
1762 <li>DStress catch_01, catch_02, new_04, switch_19, throw_02,
1769 <li>Improvements
</li>
1774 <li>Updated to DMD
0.125</li>
1775 <li>New target: AIX
</li>
1776 <li>GDC and DMD versions are reported with
"gcc --version"</li>
1777 <li>Take advantage of DMD template improvements on
<br>
1788 <li>std.c.unix is now std.c.unix.unix
</li>
1789 <li>The runtime library is now
"libgphobos" to avoid
1792 <li>The dmd wrapper script...
</li>
1797 <li>Is now named
"gdmd".
</li>
1798 <li>Looks for gdc in its own directory instead of searching
1801 <li>Requires a comma after the
"-q" option.
<br>
1812 <a name=
"0.11"></a>0.11:
<br>
1819 <li>Reversed structure compare
</li>
1820 <li>Correct meaning of '-L' option in wrapper script
</li>
1821 <li>Static data GC bug on Linux
</li>
1826 <li>Improvements
</li>
1831 <li>Updated to DMD
0.121</li>
1832 <li>New target: MingGW
</li>
1833 <li>Included Anders F Bj
örklund's man pages.
<br>
1835 <li>It is now possible to build a cross-compiler.
1837 is supported out-of-the-box, however.
</li>
1850 This program is free software; you can redistribute it and/or modify
<br>
1854 it under the terms of the GNU General Public License as published by
<br>
1858 the Free Software Foundation; either version
2 of the License, or
<br>
1862 (at your option) any later version.
<br>
1870 This program is distributed in the hope that it will be useful,
<br>
1874 but WITHOUT ANY WARRANTY; without even the implied warranty of
<br>
1878 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the
<br>
1882 GNU General Public License for more details.
<br>
1890 You should have received a copy of the GNU General Public License
<br>
1894 along with this program; if not, write to the Free Software
<br>
1898 Foundation, Inc.,
59 Temple Place, Suite
330, Boston, MA
02111-
1307 USA
<br>