D is our last hope

Iain Buclaw ibuclaw at gdcproject.org
Mon Jan 1 19:37:26 UTC 2024


On Wednesday, 20 December 2023 at 13:38:38 UTC, Siarhei Siamashka 
wrote:
> On Wednesday, 20 December 2023 at 03:49:30 UTC, Richard (Rikki) 
> Andrew Cattermole wrote:
>> On 20/12/2023 4:21 PM, Siarhei Siamashka wrote:
>>>     We currently have a chain of compilers if you want to 
>>> bootstrap
>>>     latest compiler from C++.
>>> 
>>> This doesn't look good.
>>
>> This is why its N compilers.
>
> From where I stand, it looks like someone tried to tweak the GC 
> and memory allocation in a non-portable ubeRc0ol way inside of 
> the DMD source code. Which made it incompatible with GDC 11, 
> but who cares? Supposedly this is intended to make the compiler 
> faster. Yet the DMD compiler falls flat on its face due to 
> mundane reasons in a simple compilation speed dependent 
> benchmark: 
> https://forum.dlang.org/thread/fqziujkpdbivsqxsgszu@forum.dlang.org
>
>> Every link in that chain of compilers has to be maintained.
>
> My alternative mundane suggestion would be to just fix the DMD 
> code on github, so that it can be compiled with GDC 11 again. 
> And then add GDC 11 to the CI in order to prevent it from 
> breaking again in the future.
>

I think I know the line you're referring to.

https://github.com/dlang/dmd/blob/1f7ba493a96797eb99c18dc0ec14ad9a9131b945/compiler/src/dmd/root/rmem.d#L196-L202

I turn this off when building gdc - though other maintainers 
turned this on "because it passes CI".  However, the one caveat 
that was overlooked was that the override behaviour is dependent 
on either:

1. The druntime of the function declaration being @weak (I think 
this only was introduced around v2.098)

2. Pre-v2.098 on ELF systems, linking against the shared library 
version of libphobos. The default is to use the static library, 
which causes the link issues you see  (only Debian and Ubuntu 
have distribution-local patches which make gdc link against the 
shared library by default).

IMO I think these functions may have to be ripped out of the 
compiler sooner or later.  IIUC, the moving of all these runtime 
hooks from from extern(C) to templates means that they will all 
eventually not be called anyway.


More information about the Digitalmars-d mailing list