Created attachment 50441 [details] OpenBSD support for GDC Hello -- Provided here is a patch demonstrating OpenBSD support for GDC. Some important notes and helps needed: * Iain, you'll notice that my druntime is different from the DMD druntime diff you saw on GitHub. I will do my best to sync the two, which will mean replacing what I've done for DMD with what I've done here for GDC, to make all lives easier. * I cannot get a shared libgphobos to work on OpenBSD. I get random crashes that I have not yet been able to track down. I do not know how to disable --enable-shared in libphobos's configure.ac without disabling it for all of gcc, which is not desirable. If that's a patch I have to carry until I can get a working shared libgphobos, that's fine. * I suspect libphobos will work on more than just x86_64 and i386 but as I've only been able to test on x86_64, I kept libphobos to just those 2 archs. I will submit further diffs for more platforms as I'm able to test. * The port is otherwise fairly straightforward and I am using this in production. Thanks! Happy to work with you to get this in.
Thanks, I have an OpenBSD VM with a WIP port as well, so I'll compare the two - I don't recall any problems with shared libraries, though the host system demands that PIC/PIE is forced for all built compilers/generator programs.
(In reply to Iain Buclaw from comment #1) > Thanks, I have an OpenBSD VM with a WIP port as well, so I'll compare the > two - I don't recall any problems with shared libraries, though the host > system demands that PIC/PIE is forced for all built compilers/generator > programs. Yes, I do the same with PIC/PIE. Thanks.
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>: https://gcc.gnu.org/g:8ab1d637440532d9698daae84cc81a43d36b4aa8 commit r11-7845-g8ab1d637440532d9698daae84cc81a43d36b4aa8 Author: Iain Buclaw <ibuclaw@gdcproject.org> Date: Sun Mar 21 11:00:29 2021 +0100 d: Add openbsd support for D compiler [PR99691] gcc/ChangeLog: PR d/99691 * config.gcc (*-*-openbsd*): Add openbsd-d.o. * config/t-openbsd: Add openbsd-d.o. * config/openbsd-d.c: New file.
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>: https://gcc.gnu.org/g:d86e60855f05a0e493f8362c12bfd40d5432d337 commit r11-8246-gd86e60855f05a0e493f8362c12bfd40d5432d337 Author: Iain Buclaw <ibuclaw@gdcproject.org> Date: Mon Apr 19 14:23:00 2021 +0200 libphobos: Add section support code for OpenBSD (PR99691) libphobos/ChangeLog: PR d/99691 * configure: Regenerate. * libdruntime/config/common/threadasm.S: Add __OpenBSD__. * libdruntime/gcc/backtrace.d: Import core.sys.openbsd.dlfcn on OpenBSD platforms. * libdruntime/gcc/sections/elf.d (SharedElf): Define on OpenBSD. (linkMapForHandle): Implement for OpenBSD. (exeLinkMap): Remove. (getDependencies): Adjust dlpi_addr on OpenBSD. (handleForName): Implement for OpenBSD. (IterateManually): Define on OpenBSD. * libdruntime/gcc/sections/package.d (SectionsElf): Define on OpenBSD. * m4/druntime/libraries.m4 (DRUNTIME_LIBRARIES_ATOMIC): Test for enable_libatomic. (DRUNTIME_LIBRARIES_BACKTRACE): Test for enable_libbacktrace.