Glibc tgmath implementation

(Timothy Chagnon) #1


I wanted to try to fix a problem I reported on swift-users@ and in 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:

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

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

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.