[Issue 17596] dmd d 2.073.2 and 2.074.1 interim generated dmd segfaults on FreeBSD 12-CURRENT
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jul 6 05:50:52 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17596
--- Comment #4 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Cy Schubert from comment #3)
> The implementer of inode64 has done a great job of avoiding ABI breakage.
> Applications built before inode64 continue to run due to code in libc to
> detect "old" v.s. "new". Most newly compiled code builds and runs okay. DMD
> is different however because many data structures are replicated in DMD. For
> example stat_t and dirent_t headers have issues.
How does the old/new detection work? Does it look at the ELF timestamp, or
something like that?
Because D has binary releases for FreeBSD (and compiling it from source is a
bit onerous as it requires bootstrapping through an older version of D), we
will probably want to ensure, if possible, that the binary D releases will work
on both new and old versions of the system for a while. This likely means that
we would want to use the old fstat ABI exclusively for a few years, so if it's
possible to opt in to the old ABI, that would probably be the way to go for
now.
Is the new functionality available via a new function akin to fstat64 on Linux?
> I wasn't able to find a stub that DMD D might use to make the actual call.
> If you can point me in the right direction I should be able to do the work
> myself (when I can find the time).
dmd/src/root/file.d is now located at dmd/src/ddmd/root/file.d:
https://github.com/dlang/dmd/blob/master/src/ddmd/root/file.d#L97
For FreeBSD, fstat is defined here:
https://github.com/dlang/druntime/blob/master/src/core/sys/posix/sys/stat.d#L1207
and stat_t here:
https://github.com/dlang/druntime/blob/master/src/core/sys/posix/sys/stat.d#L730-L758
Finally, ino_t is defined here:
https://github.com/dlang/druntime/blob/master/src/core/sys/posix/sys/types.d#L135
I believe that fstat is called by linking to the respective libc, i.e. D does
not perform the syscall directly.
> Having said that, any change would be incompatible with older releases of
> FreeBSD so, a possible solution might be a version check for
> version(FreeBSD12+) -- (FreeBSD uses a version check in
> /usr/include/sys/param.h.) Is there a way to determine which release of
> FreeBSD within DMD D? Such as version(something)?
Not as far as I know. I guess it would require changing the compiler to detect
the FreeBSD release and enable a corresponding version, which would also need
to be added.
--
More information about the Digitalmars-d-bugs
mailing list