Commit Graph

122 Commits

Author SHA1 Message Date
Alex Arslan c3968ca11f Allow building on DragonFly BSD (#167) 2017-09-22 13:22:43 -07:00
Martin Lucina b5b63ba66d Enable long double functions for aarch64
Per discussion in #157, it is correct to enable these for aarch64.
2017-07-27 13:29:33 +00:00
Elliot Saba c21453060d Cleanup `ARCH` handling, reorganize `AArch64` and `Make.inc`.
* Previously, behavior differed if the same value of `ARCH` was defined
  within `Make.inc` or defined on the command line.  Don't do that.

* Provide saner defaults for `ARCH` and `MARCH`, and more importantly,
  allow for the proper overriding of both.

* Split `AArch64` code further away from the other `arm` code.
2017-01-16 11:44:14 -08:00
Keno Fischer 5fd9dcbbdf Fix incorrect attribute as a result of blanket rename 2016-05-03 18:48:45 -04:00
Keno Fischer 28fb939b0d Blanket rename DLLEXPORT->OLM_DLLEXPORT 2016-03-13 21:07:55 -04: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 e836b30cc7 Avoid defining __pure2 if already defined
This gets rid of a warning on Mac OS X due to the fact that
sys/cdefs.h defines it already.
2016-03-08 10:34:20 +01:00
Milan Bouchet-Valat 226faf4e11 Avoid redefining __pure2 in types-compat 2016-03-03 17:05:12 +01: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
Milan Bouchet-Valat b5ca785d4c Avoid redefining endianness macros with some gcc versions
_LITTLE_ENDIAN and _BIG_ENDIAN are built-in on some platforms/versions.
Better use __ORDER_LITTLE_ENDIAN__, __ORDER_BIG_ENDIAN__ and __BYTE_ORDER__,
which are standard for gcc and clang, and define them when they are missing.
Also remove the special-case for FreeBSD, which is apprently not needed.
2016-03-02 21:21:25 +01:00
Milan Bouchet-Valat 949c530994 Fix misleading indentation (spotted by GCC 6) 2016-03-02 21:21:25 +01:00
Ed Schouten 62c7361aab Suppress a compiler warning generated by Clang.
Clang doesn't like it if you bitshift negative numbers, as the behaviour
of it is undefined. Solve this by first shifting, followed by negating.
This was fixed similarly in FreeBSD.
2016-02-27 19:23:08 +01:00
Ed Schouten 78c0afb2a7 Rename _scan_nan() to __scan_nan().
The current tradition of openlibm is to hide all of its internal symbols
into the reserved system namespace. CloudABI has a check in place to
ensure that its C library (which contains openlibm) to not place any
unwanted symbols into the public namespace. openlibm seems to leak
_scan_nan() in there, so we'd better add an additional underscore.
2016-02-27 17:26:15 +01:00
Viral B. Shah 05f9de6c05 Revert "moved src/cdefs-compat.h -> include/cdefs-compat.h"
This reverts commit 07a535e55d.
2016-02-24 10:33:19 +05:30
Viral B. Shah 07a535e55d moved src/cdefs-compat.h -> include/cdefs-compat.h 2016-02-24 10:06:55 +05:30
Simon Byrne 830dc991f3 Support powerpc
This fixes #113, based on files from FreeBSD. Tested on machine hosted by [OSUOSL](http://osuosl.org/services/powerdev/).
2016-02-23 11:08:14 +00:00
Viral B. Shah 4c8740ad58 Import these fixes from upstream.
0563b7a42b/lib/msun/src/e_j0f.c

Fix test build on OS X.
2015-11-13 09:16:51 +05:30
Viral B. Shah c29e8b1b6e Revert "Remove [jy][01n]f(). X/Open only standardizes the double versions."
This reverts commit 8c8693cf79.
2015-11-13 09:06:24 +05:30
Graham Inggs ebe1db3ce4 Build on GNU/kfreeBSD and GNU/Hurd
Use __GLIBC__ instead of __linux
Simplify Make.inc as per JuliaLang/openspecfun@e91925a
2015-11-10 21:38:51 +02:00
Ed Schouten ec5833a498 Add a copy of FreeBSD's lib/libc/aarch64/_fpmath.h.
This makes it possible to build OpenLibm on ARM64 CPUs.
2015-10-26 10:26:19 +01:00
Alexander Light f30b0d3045 Fix build for i386
This would not build on i386 due to a missing include.
2015-02-26 16:01:30 -05:00
Viral B. Shah 8247b5af78 Revert "Update to the latest s_scalbln.c from msun."
This reverts commit a2f4e102f2.
2015-02-21 07:50:35 +05:30
Viral B. Shah a2f4e102f2 Update to the latest s_scalbln.c from msun. 2015-02-20 23:56:48 +05:30
Ed Schouten b6ff8bbe91 Clean up a change that I sneaked in accidentically.
I often build the code with -Wmissing-prototypes to ensure that we don't
accidentically pollute the symbol namespace. If we want to provide a
symbol such as isopenlibm(), make sure we also declare it in
<openlibm_math.h>.
2015-02-12 13:58:35 +01:00
Ed Schouten 16902a6ce1 Reconnect cbrtl() to the build. It seems to build properly. 2015-02-12 13:49:47 +01:00
Ed Schouten 8c8693cf79 Remove [jy][01n]f(). X/Open only standardizes the double versions. 2015-02-12 13:48:13 +01:00
Ed Schouten ce4982acf8 Remove scalb(). The scalbn() or scalbln() function should be used. 2015-02-12 13:38:13 +01:00
Ed Schouten c08bd962f2 Remove the non-standard finite() function. 2015-02-12 13:35:19 +01:00
Ed Schouten ae1e0c309a Remove the non-standard drem() function. 2015-02-12 13:29:38 +01:00
Ed Schouten eca4ac8bf1 Remove the non-standard significand() function. 2015-02-12 13:28:37 +01:00
Ed Schouten 532fe1553e Remove the non-standard gamma() function. Use lgamma() instead. 2015-02-12 13:25:30 +01:00
Viral B. Shah ce8af02232 Merge pull request #82 from talex5/minios2
No stdio.h on Mini-OS, so use cdefs.h again there
2015-01-13 00:52:42 +05:30
Thomas Leonard b19856215c No stdio.h on Mini-OS, so use cdefs.h again there. 2015-01-12 10:45:03 +00:00
Ed Schouten 7e5585aaca Rename openlibm.h to openlibm_math.h.
This is a bit more consistent with the naming of the other header files
(openlibm_complex.h and openlibm_fenv.h). Re-add an openlibm.h header
that includes all of the public headers as a shorthand.

Fix up all of the source files to include <openlibm_math.h> instead of
<openlibm.h>. While there, fix ordering of the includes.
2015-01-11 23:37:01 +01:00
Ed Schouten c2154fd3f3 Add missing void keyword to keep -Wold-style-definition happy. 2015-01-11 23:01:49 +01:00
Ed Schouten bc3f903bc2 Move public headers into include/ and private headers into src/.
While there, also modify the install target. We should make sure to
install all openlibm*.h headers. There is still some work to be done:
openlibm_fenv_*.h still depends on some additional bits. I'd propose
that we eventually create an include/openlibm_cdefs.h that contains all
of the macros we need.
2015-01-11 16:35:32 +01:00
Ed Schouten 23b8f663d4 Revert "Don't use __weak_reference() when a __strong_reference() is needed."
Unlike the __weak_reference() macro, __strong_reference() does type
checking. It can only create the reference if the type of the source and
the destination function match exactly.

Even if double == long double in practice, they remain unequal at the
language level.
2015-01-10 19:24:06 +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 9ab9db387d Don't use __weak_reference() when a __strong_reference() is needed.
OpenLibm uses the __weak_reference() macro for platforms where double
and long double use the same layout. That way functions only need to be
provided by the library once. The point is, in this specific case we
want to use strong references; not weak references.

Strong references can be used to give a symbol a second name. If you
look at the resulting object file, you will have two symbols with the
same offset and size. Weak references are different, in the sense that
they are marked in such a way that they act as fallbacks. They are only
used if an explicitly matching symbol is missing.
2015-01-10 10:04:11 +01:00
Ed Schouten c253db68ca Add a new compilation flag: OPENLIBM_ONLY_THREAD_SAFE.
The global signgam variable is only part of the X/Open System
Interfaces. It is not part of the POSIX base definitions nor the C
standard.

I'd rather have it disabled for my specific use-case, so introduce a new
compilation flag that we can use to disable it.
2015-01-10 09:57:33 +01:00
Ed Schouten 9fdc4f9d9e Fix a small number of -Wmissing-prototypes compiler warnings in sincos().
- Add missing prototypes to openlibm.h for sincos() and sincosf().
- Mark the internal kernel functions static.
2015-01-10 09:44:31 +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 f6b045b4cd Add bits to openlibm headers to switch between using the host headers. 2015-01-09 14:11:11 +01:00
Ed Schouten 410e6ebb59 Move CMPLX() into <openlibm_complex.h>, as it is normally part of <complex.h>.
While there, make CMPLX() work with Clang by using compound literals.
Now that cimag*() uses __imag__, we can also just inline the unions.
There is no need for the separate types anymore.

Also just define CMPLX() unconditionally now, as we no longer pull in
the host's <complex.h>.
2015-01-09 14:04:44 +01:00
Ed Schouten a249c5ebb3 Simply use __imag__ to implement cimag().
We already use this construct in cabs() to call hypot(), so I guess we
can assume our targeted compilers support this construct.
2015-01-09 13:40:29 +01:00
Ed Schouten 08dbb2b517 Never include <complex.h>. Include <openlibm_complex.h> instead.
If we ship with a separate copy of <complex.h>, we should also use this
one instead of the one provided by the system.
2015-01-09 13:30:44 +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
Viral B. Shah f5377fda83 Merge pull request #75 from NuxiNL/signgam
Clean up handling of signgam
2015-01-08 18:58:31 +05:30
Ed Schouten 5d6cb09b96 Change existing code to use CMPLX*() instead of cpack*() where possible.
I am currently working on building openlibm against stock copies of
<math.h>, instead of the openlibm.h header. It seems that a C compliant
<math.h> header can be used as a drop-in replacement for openlibm.h,
with the exception that it lacks cpack*().

In FreeBSD SVN r275819 I patched up the math library by replacing
cpack*() by CMPLX*(). That way many functions become less tied to the
intrinsics of the math library. Make the same change to openlibm.
2015-01-08 12:02:56 +01:00
Ed Schouten 55ac462808 Add lgammal_r().
We already provide lgammaf_r() and lgamma_r(). It's not hard to also add
lgammal_r(), for consistency.

I am currently working on porting openlibm to an environment where
global state, and thus signgam, is not available. By adding lgammal_r(),
I can trivially disable support for signgam by just patching up
src/e_lgamma{f,,l}.c. That way there is no need to patch up the actual
algorithms.
2015-01-08 11:23:28 +01:00