[swift-dev] Glibc tgmath implementation

Timothy Chagnon tachagnon at gmail.com
Tue Feb 2 12:58:22 CST 2016


Hi,

I wanted to try to fix a problem I reported on swift-users@ and in SR-638
<https://bugs.swift.org/browse/SR-638> where Glibc doesn't have a tgmath
overlay.  This means that, for example, sin(Float(1.23)) works on Darwin
but won't compile on Linux.

As an experiment, I tried just symlinking the Darwin tgmath to Glibc and
fixing some things to make it compile and test. You can take a look here:
https://github.com/tchagnon/swift/commit/742eff3914f2a62e799980523badaca4eeee95fe

I ran into a couple issues that I had questions about or couldn't figure
out:

1. What's the best way for tgmath.swift.gyb to be shared between both
Darwin and Glibc? Move it to a common location and symlink? Would it be
better to have a common Math module? It would be a lot nicer if I could
just import Math instead of the preprocessor block to switch between
Darwin/Glibc.

2. @_silgen_name doesn't appear to work on Linux. I get linker errors or
hidden symbol `_swift_Glibc_ilogb' isn't defined if I try to set up an
extern function in Misc.c. Is this known? How do I work around this to
avoid the ambiguous overloading in the case of ilogb(CDouble) -> CInt.

Thanks,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20160202/b571c29a/attachment.html>


More information about the swift-dev mailing list