[dmd-internals] DragonFlyBSD Support

Dave MacFarlane via dmd-internals dmd-internals at puremagic.com
Sat Aug 19 16:21:50 PDT 2017


Hello,

I'm trying to add support for DragonFlyBSD to dmd, but I'm running
into an issue that I'm not sure how to move forward on..

I've compiled a version of ldc's ltsmaster branch (after adding
support to druntime and phobos), and using it I'm able to compile dmd
(after adding support to druntime and phobos in HEAD, rather than
ltsmaster..), but the compiled dmd isn't able to link anything. It
gets a bunch of errors of the form "error: TLS relocation against
invalid instruction" (the complete log of the errors is at
https://gist.github.com/driusan/6a04060c234806d3fbb2625759bd55a4)

>From what I can tell, the symbols like _d_arrayappendcTX are supposed
to be added from dmd, but for some reason aren't (I might be
misreading the errors, though..)

Unrelatedly (or relatedly?) I'm not sure how the DMD backend uses the
EX_* enums defined in cdefs.h or where the values come from, so it's
not obvious what the right value is for DragonFly. The comment says
it's the "Executable file format", but at least 8 of them just use
elf/elf64 for their executable file format, so I don't see why they're
different or if I should just shift over 1 bit and add a new
EX_DRAGONFLY64.

(I tried sending a pull request with my runtime/phobos ldc changes but
was told I should send them upstream instead.. but I don't want to
send my runtime changes upstream until I'm sure that they work, and
I'm not as confident in these changes since the compiled dmd can't
link. I'm not sure if the trouble is in the backend or the runtime
since the problem seems to come from linking the runtime..)
- Dave


More information about the dmd-internals mailing list