Two fixes in one:
Firstly, replace non-standard __uint64_t with standard (but optional) uint64_t.
__uint64_t is not a part of C standard; it is defined by some platforms but might not
be present in every environment (e.g. in freestanding build). On the other hand, uint64_t
is standard C. It is optional but virtual guaranteed to be present for any 32/64 bit machine.
Secondly, mark riscv64 for 128-bit long double in make/cmake files. This fixes cmake
build (which detects presence of long double and tries to compile extended functions),
and brings make build to do the same.
Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com>
This adds stack markings to the missing fmod .S files, otherwise the
final libopenlibm object file gets marked with an executable stack.
Output when compiling from source on Gentoo Linux:
```
* QA Notice: The following files contain writable and executable sections
* Files with such sections will not work properly (or at all!) on some
* architectures/operating systems. A bug should be filed at
* https://bugs.gentoo.org/ to make sure the issue is fixed.
* For more information, see:
*
* https://wiki.gentoo.org/wiki/Hardened/GNU_stack_quickstart
*
* Please include the following list of files in your report:
* Note: Bugs should be filed for the respective maintainers
* of the package in question and not hardened@gentoo.org.
* RWX --- --- usr/lib64/libopenlibm.so.4.0
```
* Add BUILD_SHARED_LIBS option to choose between shared and static lib
* Fix build break for Android aarch64
* Install built target
* Set the correct version number
* Don't add include dirs through CFlags. Include dirs are already set as target property
* Install all relevant headers, not just from include dir
* Update note about BUILD_SHARED_LIBS in README.md
* Fix mistake in README.md, option(BUILD_SHARED_LIBS ON) sets the lib to shared by default
* openlibm_fenv.h: fix PowerPC macro for Darwin
* openlibm_fenv_powerpc.h: check if __BYTE_ORDER__ is actually defined
* fpmath.h: fix PowerPC macro for Darwin
* Fix mistake in CMakeLists.txt, only add sources in ld128 if long double isn't the same as double + aarch64
* Update README to mention that cmake build now defaults to shared library
* Add support to build openlibm as a shared library using cmake by not compiling the C implementation when a native one exists
* Add CMake static and shared library build instruction and also added info about support for loongarch64
---------
Co-authored-by: Viral B. Shah <ViralBShah@users.noreply.github.com>
* Add CMakeLists file to build with CMake, tested with MinGW on Windows x64 and Apple Clang on MacOS arm64
* Use regex to ensure 'AppleClang' also passes under Clang
These files are derived from the original fdlibm sin/cos files.
While we do already preserve that license notice in LICENSE.md
(so there's no actual license compliance issue here), it's
cleaner to have the copyright notice in the file as well, in
case somebody copies the file out of the repo.
As discussed in https://github.com/JuliaLang/julia/pull/43786, openlibm's sqrt function is incorrectly rounded for i387. IEEE requires correct rounding for these functions and LLVM relies on it. Fix that by setting the precision in the FPU control word (see e.g. e_ceil.S for similar FPU modifications).
Changes needed for riscv64 support have been added.
Code for openlibm_fenv_riscv.h, riscv_fpmath.h and fenv.c
was taken from https://github.com/freebsd/freebsd
* Another Windows ARM64 fix
include stdint.h to be sure that uint64_t can be used.
This header already had references to uint32_t, so I assumed it was safe to use those typedefs, but a compile error revealed it was not always.
* fix munged whitespace
* aarch64_fpmath.h: deal with LLP64 (Windows ARM64)
use uint64_t instead of unsigned long, as unsigned long is only 32 bits on Windows
* Make.inc: WINNT aarch64 long double is double
Add to list along with Darwin