Commit Graph

42 Commits

Author SHA1 Message Date
Tim Besard be31bff11d Revert "Export `fenv` functions on all platforms (#213)"
The implementation of `fesetenv` cannot be portable, as the value of
`FE_DFL_ENV` differs between platforms. On FreeBSD, it is a actual
environment. With glibc however, it's a sentinel -1 handled in the
implementation of its floating point functions.

With openlibm based on FreeBSD's libm, it assumes `FE_DFL_ENV` to be an
actual environment. That assumption breaks using code that was compiled
against glibc, e.g., `libcuda`:

```
Thread 1 "julia-debug" received signal SIGSEGV, Segmentation fault.
0x00007ffff7b855d0 in fesetenv () from /home/tim/Julia/julia/build/release/usr/bin/../lib/libopenlibm.so
(gdb) bt
```

This reverts commit 5a27b4c0c0.

Fixes https://github.com/JuliaLang/julia/issues/38427.
2020-11-16 09:17:49 +01:00
Elliot Saba 5a27b4c0c0
Export `fenv` functions on all platforms (#213)
Win32 has been using a hack to switch the `fenv` functions from `static`
to `DLLEXPORT`, we apply that hack to all platforms that do not use a
host `fenv.h`.
2020-09-02 12:33:04 -04:00
Peter Colberg aeaf9cefa7 Fix undefined reference to __fpgetprec on i386
Closes #137

This reverts commit ebcd40f1b0.

The tests were failing to load the library on i386 due to an undefined
reference to __fpgetprec, which resulted from __fpgetprec not being inlined
due to the missing definition of __GNUCLIKE_ASM and __CC_SUPPORTS___INLINE__.
2016-06-23 23:32:31 -04:00
Ed Schouten ebcd40f1b0 Update remaining references to bsd_cdefs.h to cdefs-compat.h.
It looks like we didn't substitute the name of the bsd_cdefs.h header
file in two source files when renaming it.
2016-05-15 11:28:26 +02:00
Keno Fischer 28fb939b0d Blanket rename DLLEXPORT->OLM_DLLEXPORT 2016-03-13 21:07:55 -04:00
Keno Fischer 459b557671 Also add DLLEXPORT in fenv.c 2016-03-13 22:52:18 +00:00
Keno Fischer 81053b7fcb Fix Clang warnings on Windows
- Align DLLEXPORT in definitions and declations. There is still a few
  cases left, where the declation in the compiler's complex.h disagrees
  with the implementation here. For now we can't do anything about that,
  but maybe should be revisited in the future.
- Fix the syntax on an .ascii directive that gcc accepted mistakingly, but
  clang does not.
2016-03-13 06:21:15 +00:00
Milan Bouchet-Valat 2c3f3b5a99 Cleanup bsd_cdefs.h, merge i387 and amd64 duplicate files
Most macros were not actually used. This gets rid of warnings when
building on Linux.
2016-03-02 21:21:25 +01:00
Viral B. Shah 4ef4170e64 Change some #ifdefs to be different than the system ones. 2016-02-27 19:52:44 +05:30
Graham Inggs e3336dd022 Enable stack protection for all ELFs, not only __linux__ 2015-11-10 21:39:17 +02:00
Viral B. Shah 388f0f1d32 Remove unused Symbol.map files. 2015-02-01 19:41:55 +05:30
Ed Schouten 93aef7f9b1 Remove $ARCH/openlibm_fenv.h.
It seems I accidentally copied these headers twice in
d07820351b. We should only have them in
include/.
2015-01-11 18:55:04 +01:00
Ed Schouten d07820351b Rename the fenv headers.
I guess the idea would be to eventually also install all of the
openlibm*.h headers, instead of just openlibm.h. Make openlibm_fenv.h
suitable for this purpose by moving all of the $ARCH/fenv.h headers next
to it.

We actually need this change to make OPENLIBM_USE_HOST_FENV_H work.
Right now it's still broken, because the "#include <fenv.h>" performed
by openlibm_fenv.h still pulls in $ARCH/fenv.h as $ARCH/ is added to the
compiler include path.
2015-01-10 10:21:57 +01:00
Ed Schouten 42177873f8 Remove weak reference construct from fenv code.
I grepped through the FreeBSD source tree and for me, it seems to be
totally unclear why these two specific functions are weak references.
Such a construct is commonly used by FreeBSD's threading library
(libthr) to override certain functions, but I can't find any traces of
that.

Just use the function name directly. This fixes a compiler warning as
well (-Wmissing-prototypes).
2015-01-10 09:41:32 +01:00
Ed Schouten 06dbb6e72b Use more uniform style of including headers.
Put external headers before internal ones. While there, replace a lot of
occurences of "openlibm.h" with <openlibm.h>. It should be thought of as
an external header, as it is installed along with the library.
2015-01-09 14:24:24 +01:00
Ed Schouten 17688c4487 Rename include/fenv.h to <openlibm_fenv.h>.
OpenLibm has an implementation of fenv.h internally. This may be
problematic in case you want it to build against the host system's
implementation, as it would require you to somehow take the fenv.h file
out of the compiler search path.

Simply use a different naming scheme, similar to openlibm.h and
openlibm_complex.h. If we want to build against the host's fenv.h, we
can simply add an '#include <fenv.h>' from within this header.
2015-01-09 13:11:12 +01:00
Ed Schouten 7df63d456e Remove unneeded tests for <sys/cdefs.h>.
This test is also present in FreeBSD's <machine/ieeefp.h>. For FreeBSD
it makes sense, but for a portable math library, we cannot assume that
the system has a header file like <sys/cdefs.h> and that it uses a
common header guard.
2015-01-07 22:02:40 +01:00
Viral B. Shah 8b3b520675 Fix #35 2014-12-04 21:41:37 +05:30
Tony Kelman 8b59bbc18b Export ldexp aliases on Windows
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
2014-05-09 17:05:33 -07:00
Jameson Nash 5f4979e5d1 work around msvc bug where .model must be on its own line or it forgets about it 2014-03-18 22:03:14 -04:00
Jameson Nash 995c70eaf7 add win64 compat definitions also 2014-03-18 21:40:07 -04:00
Jameson Nash 66e6f8ea91 normalize __WIN32__ to _WIN32, which is defined by all Windows compilers 2014-03-18 20:47:48 -04:00
Jameson Nash a076418c8b provide fegetround & family functions on win64 2014-01-13 01:10:04 -05:00
Milan Bouchet-Valat 0affa5be19 Enable stack protection in all .S files
Hardware stack protection is required by most distributions.
See https://wiki.gentoo.org/wiki/Project:Hardened/GNU_stack_quickstart
2013-12-21 21:19:54 +01:00
Jameson Nash 9b23967282 provide fenv functions on windows 2013-08-27 21:12:53 -04:00
Jameson Nash 18f475de56 add DLLEXPORT to i387 and amd64 assembly (win32 target) and ld80/ld128 files 2013-08-03 05:52:19 -04:00
Jameson Nash 0cd232d8cf fix calling convention on win64, mostly passing the numerical tests 2013-07-11 20:19:52 -04:00
Jameson Nash 3c8738e642 fix amd64 asm syntax for windows 2013-03-02 22:50:35 -05:00
Jeff Bezanson 1b9b759b48 add exported names for ldexp 2013-03-02 21:11:39 -05:00
Jeff Bezanson 5e08d588a9 change licenses to reflect that the "Winning Strategies, Inc." code has been placed in the public domain 2012-11-23 19:19:01 -05:00
Jeff Bezanson f957ae9169 remove BSD clause 3 from another UCB file 2012-11-23 19:11:43 -05:00
Keno Fischer 87ce7cedda Fix build on amd64 linux 2012-08-19 04:15:47 -04:00
Viral B. Shah 210c1fa7b4 Add fpu.h
Build will currently fail due to amd64/fenv.c not building.
2012-08-19 13:13:52 +05:30
Keno Fischer fed038b32f Remove Leftover Makefiles from old build system 2012-05-26 17:06:20 -04:00
Keno Fischer f21624349f Build fix for amd64 Linux 2012-05-25 20:04:41 -07:00
Keno Fischer c3d4e51cd8 Remove leftover test code 2012-05-25 21:38:58 -04:00
Keno Fischer adb103acec Build fixes for Windows 2012-05-25 21:25:13 -04:00
Keno Fischer 307d7361c5 automatic arch selection in Makefile 2012-05-25 16:24:37 -04:00
Keno Fischer f0862df1db Allow compilation of assembly files on OSX 2012-05-24 23:14:58 -04:00
Viral B. Shah 51a63c3270 Comment out __FBSDID 2011-12-15 11:46:26 +05:30
Viral B. Shah 16b9264f9d Import entire msun from FreeBSD. 2011-12-15 11:29:35 +05:30
Viral B. Shah aba7ae910f Initialize repo. FreeBSD 8.2 msun code + some tweaks 2011-08-13 00:31:25 +05:30