https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123045
--- Comment #11 from Iain Buclaw <ibuclaw at gcc dot gnu.org> ---
(In reply to Kirill A. Korinsky from comment #10)
> ld.so: d21: can't load library 'libestdc++.so.21.0'
This is impossible in upstream gcc because `d21` is built with
-static-libstdc++
> proves that libestdc++ wasn't built yet at this stage.
No, it more likely proves that libestdc++ is being incorrectly linked into d21
dynamically.
---
Upstream gcc:
Heavily simplified build command in the Makefile recipe:
gdc d/*.o -o d21 -static-libphobos -static-libstdc++ -lstdc++
What the gdc driver does:
ld d/*.o -o d21 -Bstatic -lgphobos -lstdc++ -Bdynamic
---
---
OpenBSD ports:
https://github.com/openbsd/ports/blob/31fce533a47608ab691928c783dfc2b75382f206/lang/gcc/15/patches/patch-gcc_d_Make-lang_in#L8-L9
gdc d/*.o -o d21 -static-libphobos -static-libstdc++ -lestdc++
What I *suspect* the gdc driver does:
ld d/*.o -o d21 -Bstatic -lgphobos -Bdynamic -lestdc++
---
Why does it do this? Because OpenBSD ports doesn't patch d-spec.cc
https://forge.sourceware.org/gcc/gcc-mirror/src/commit/9748d369e2cfc2b8edca9fa81127601aada23a23/gcc/d/d-spec.cc#L34