WIP: Port dmd and druntime to GNU/Hurd#22829
Conversation
|
Thanks for your pull request and interest in making D better, @yelninei! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + dmd#22829" |
|
The error from the circleci is I guess this is expected, is there a way to regenerate the header? |
|
Re: regenerating the headers, if you read a few more lines down in that error message, you will see this:
Which refers to https://github.com/dlang/dmd/tree/master/compiler/src#cxx-headers-test |
I thought dmd triplet (tuples?) matched ldc. Historically, I guess gnu/hurd would be |
| /** | ||
| * D header file for GNU Hurd | ||
| * | ||
| * Copyright: Copyright Martin Nowak 2012. |
There was a problem hiding this comment.
Wrong year, wrong copyright. :-)
If unsure, please use:
Copyright: Copyright (c) 2026 D Language Foundation
| * | ||
| * Copyright: Copyright Martin Nowak 2012. | ||
| * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) | ||
| * Authors: Martin Nowak |
There was a problem hiding this comment.
I assume Martin didn't author this module.
There was a problem hiding this comment.
The file is a copy paste of the linux version with s/linux/hurd/
Is that enough to void the original copyright as it is clearly a derivative?
There was a problem hiding this comment.
I'm not qualified to say. In isolation, I don't consider the file big enough to warrant any copyright claim.
Rather, the body of work as a whole (this PR) ought to be considered as authored by the contributor.
| @@ -0,0 +1,25 @@ | |||
| module core.sys.hurd.unistd; | |||
There was a problem hiding this comment.
Some modules are missing comment headings/notices entirely. Others have inconsistent styles.
As these are newly introduced sources, I'd err towards not repeating previous bad habits, and pick one format, and use it consistently throughout all new files.
| } | ||
| else version (Hurd) | ||
| { | ||
| // What is needed here? |
There was a problem hiding this comment.
Any part of ioctls.h or ioctl-types.h that would be needed to interact with ioctl().
| version (CRuntime_Glibc) | ||
| { | ||
| version (linux) | ||
| { |
There was a problem hiding this comment.
It looks like the outer CRuntime_Glibc is unneeded here. Just version (linux) { } else version (Hurd) { } else ... ?
There was a problem hiding this comment.
Not sure, that would shadow the musl, uclibc and bionic versions on linux which are not 1:1 copies of the glibc one
| version (CRuntime_Glibc) | ||
| { | ||
| version (linux) |
There was a problem hiding this comment.
Likewise, maybe just remove the CRuntime_Glibc guard.
For llvm the triplet would be The thing that confuses me is that
Currently the match for both All this confusion etc is why i am askingas it does not match to the triplets for gcc and llvm that are already used. i think llvm added Edit: The merge conflict i just resolved in the documentation for As some people might epect "gnu" to specifiy the libc leaning on the llvm side with hurd-gnu might be more reasonable |
| EX_FREEBSD | EX_FREEBSD64 | | ||
| EX_SOLARIS | EX_SOLARIS64 | | ||
| EX_OPENBSD | EX_OPENBSD64 | | ||
| EX_HURD | EX_HURD64 | |
There was a problem hiding this comment.
Should this be below the dragonflybsd case?
as trhere is no 32bit one it looks a bit weird
There was a problem hiding this comment.
Looks shouldnt matter. But also neither does order.
| EX_SOLARIS64 | | ||
| EX_OPENBSD64 | | ||
| EX_HURD64 | | ||
| EX_DRAGONFLYBSD64; |
There was a problem hiding this comment.
same, for symmtry with the 32bit case i added after openbsd but maybe it should be at the end?
| os = Target.OS.OpenBSD; | ||
| else if (matches("linux")) | ||
| os = Target.OS.linux; | ||
| else if (matches("hurd")) // "gnu"? |
There was a problem hiding this comment.
what should be the match for the os here?
db53723 to
e279d25
Compare
|
I ran detab everywhere, cleaned up a lot of things manually and then also ran dfix for the alias conversion (separate commit to make it easier to backport to earlier versions) some things remain (especially where i need guard off linux code as that would also need to be reindented) |
|
EDIT: Adding the This was not great to debug. |
| version (CRuntime_Glibc) | ||
| runtime = Runtime.Glibc; | ||
| else | ||
| assert(0); |
There was a problem hiding this comment.
| version (CRuntime_Glibc) | |
| runtime = Runtime.Glibc; | |
| else | |
| assert(0); | |
| runtime = Runtime.Glibc; |
I would just unconditionally set runtime as glibc.
Version doesn't make sense here for cross compilation purposes.
I wrote that code, and it was not great debugging (proprietary) solaris either. :-) Is Hurd's fork implemented in glibc? |
yes, see glibc/sysdeps/mach/hurd/_Fork.c the main issue was that things like |
|
One thing for gdc how do these files map to dmd or are these gdc specific?
|
Hi,
As announced on https://forum.dlang.org/thread/agrrykgbdsjlbsgjtatq@forum.dlang.org here is my WIP PR for porting druntime and dmd to GNU Hurd.
To be able to build also #22787 is needed.
Things that I know are still a bit of a mess:
version(linux)whereCRuntime_Glibcis used to mean linux + glibc.I am currently quite happy with the dmd part as all tests pass on 32bit and 64bit except
For the runtime some tests still crash in pthread_join, I am not entirely sure why as the same test outside of libdruntime_ut works fine.
On x86_64 the test runner gets killed after a while with the gc suspend signal, I dont know yet why the runtime does not handle it.
I am not erntirely sure about the format for the dmd triplet as it differs from both the gnu config and llvm triplet.
I have asked people on the bug-hurd mailing list for help as well
https://lists.gnu.org/archive/html/bug-hurd/2026-03/msg00274.html
https://lists.gnu.org/archive/html/bug-hurd/2026-03/msg00275.html
There are some more things needed to bring this back into gdc,