[Dlang-internal] DMD with GC
Jacob Carlborg
doob at me.com
Thu Nov 9 08:20:13 UTC 2017
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
--
/Jacob Carlborg
More information about the Dlang-internal
mailing list