[Dlang-internal] DMD with GC

Rainer Schuetze r.sagitario at gmx.de
Fri Nov 10 07:58:52 UTC 2017



On 09.11.2017 09:20, Jacob Carlborg wrote:
> On 2017-11-09 07:54, RazvanN wrote:
> 
>> I tried to compile the parser as a library with the GC disabled,
>> but running the example in dmd/src/examples/test_parser.d results
>> in a segmentation fault. Running with the GC disabled completes
>> successfully, so I guess there still are some corner cases, though
>> I am noob when it comes to GCed dmd. The patch you mentioned does not
>> fix the case presented in [1].
>>
>> [1] http://forum.dlang.org/thread/dywncjvlezvrbjkfkbsz@forum.dlang.org
> 
> Looks like the problem occurs when importing the ddmd.root.rmem [1] 
> module, which is basically always done one way or other. This module 
> will override some of the D runtime functions [2], which somehow causes 
> a conflict with GC. When the module defines these functions [2] they 
> will end up in the object file for the module. When that happens the 
> linker won't search for these symbols in any external libraries, i.e. 
> druntime (statically linked into Phobos), which it normally does otherwise.
> 
> The solution is available in that module, compile with the "GC" version 
> enabled, i.e. "dmd -version=GC".
> 
> [1] https://github.com/dlang/dmd/blob/master/src/ddmd/root/rmem.d
> [2] https://github.com/dlang/dmd/blob/master/src/ddmd/root/rmem.d#L195
> 

Yes, that's what I did, too: compile the dmd frontend with -version=GC.

IIRC I could also compile phobos unittests with the GC version (it was 
just 10-20% slower), but building them all with a single dmd invocation 
crashed during code generation (which has to run with the GC disabled).
AFAICT it got further than the regular version but probably I didn't 
have enough swap space when the process needed more than 16 GB).


More information about the Dlang-internal mailing list