-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export ldexp aliases on Windows #56
Conversation
Hm, crap. Maybe don't merge this, this might be better to fix at the assembly level. I didn't notice https://github.com/JuliaLang/openlibm/blob/master/amd64/s_scalbn.S#L46-L47, those probably just need exports on Windows. |
those don't appear to work on windows. in julia, we switched to simply using the name of the actual function rather than the alias |
Yes, for the ccall's that use these. This cropped back up again on Monday because LLVM is optimizing some powf into ldexpf, according to Jeff in 6777. I think I'm getting something workable, in the C for Win32 and in the assembly for Win64. |
Maybe we need to define the appropriate |
Actually, never mind. The way it works is by putting things in the .drectve section (see e.g. http://gcc.gnu.org/ml/gcc-patches/1999-06n/msg00448.html) |
That's exactly what I was trying to do, going off the example set by |
I think I'm getting somewhere with the assembly. The I like this version much better than what I had yesterday, and it tests cleanly on Win32, Win64, and Linux 64. I can make the C changes Windows-only if there's a performance concern. I can also put |
Yes, let's make the C changes windows-only. |
Have you tried |
I'm pretty sure I did but I'll try it one more time just to be sure. |
Actually, it seems that in our cdefs-compat.h we have
which might be the reason it doesn't work? |
IIRC, mach-o doesn't have a notion of strong references so it can't compile with them |
Thanks. So does the latest commit I just pushed not work on Mac then? |
correct. it fails with:
|
OK thanks, bummer. Blank definition |
Or maybe weak references instead? |
I don't know how to get the |
Is this better on Mac now? @StefanKarpinski you have a 32-bit Linux VM now right, does this cause any trouble there? |
What I meant was using weak references on Mac and strong references anywhere else (do we need DLLEXPORT on mac?) |
No you don't need DLLEXPORT anywhere besides Windows. But evidently these files having to do with ldexp/scalbn are not the only place strong references are used (the error Jameson posted was in s_nextafterl.c). Are you proposing:
And in the locations here where I needed DLLEXPORT, doing
? |
Or just
|
I'll give that a try, though it'll introduce more DLLEXPORT's that we may or may not need. That might be harmless, let's see. |
skip END and add .drectve export in assembly versions uncomment __strong_reference definition from cdefs-compat.h use weak references in place of strong references on Mac add DLLEXPORT to all strong references Fixes Julia issue #6777
Alright this passes Julia tests cleanly on Win32, Win64, and Linux 64. Is it okay on Mac and Linux 32? |
Build passes on Fedora 32 and 64 bits (I can't run the tests unfortunately because they always fail). |
Thank you for that. Do you mean openlibm tests, Julia tests, or both? |
Everything works for me on OSX, openlibm tests fail the same way they do on |
As a side note, I wonder why gcc on Apple rejects this construct, while the linker allowed me to create symbol aliases for gfortblas |
@tkelman The openlibm tests are the ones I can't run. But I've also just run the Julia tests, and they pass. |
Thanks guys! This mergable then? |
Export ldexp aliases on Windows
The existing strong_reference's in src/s_scalbn.c are not being found since
those files get skipped in favor of the arch-specific assembly versions.
And on Windows, ldexp needs to be defined with a DLLEXPORT to be resolved.
Fixes JuliaLang/julia#6777
This could be made platform-dependent, using a __strong_reference on Unix and this DLLEXPORT version only on Windows, if there are performance implications of these being functions.