Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package openlibm for openSUSE:Factory checked in at 2022-12-24 14:52:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/openlibm (Old) and /work/SRC/openSUSE:Factory/.openlibm.new.1563 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "openlibm" Sat Dec 24 14:52:24 2022 rev:12 rq:1045139 version:0.8.1 Changes: -------- --- /work/SRC/openSUSE:Factory/openlibm/openlibm.changes 2021-10-04 18:41:46.642234169 +0200 +++ /work/SRC/openSUSE:Factory/.openlibm.new.1563/openlibm.changes 2022-12-24 14:55:14.492664335 +0100 @@ -1,0 +2,9 @@ +Thu Dec 22 14:13:19 UTC 2022 - Andrea Manzini <andrea.manz...@suse.com> + +- Update to 0.8.1: + * Fix sqrt function on i387 + * Fix incorrect results in `hypotl` near underflow + * Export `fenv` functions on all platforms +- add linker flags to prevent executable stack + +------------------------------------------------------------------- Old: ---- openlibm-0.7.1.tar.gz New: ---- openlibm-0.8.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ openlibm.spec ++++++ --- /var/tmp/diff_new_pack.EgPr4O/_old 2022-12-24 14:55:14.864666506 +0100 +++ /var/tmp/diff_new_pack.EgPr4O/_new 2022-12-24 14:55:14.876666576 +0100 @@ -1,7 +1,7 @@ # # spec file for package openlibm # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,10 +16,10 @@ # -%define so_ver 3 +%define so_ver 4 %define libname lib%{name}%{so_ver} Name: openlibm -Version: 0.7.1 +Version: 0.8.1 Release: 0 Summary: Standalone C mathematical library License: BSD-2-Clause AND MIT @@ -68,6 +68,7 @@ %make_build \ FFLAGS="%{optflags}" \ CFLAGS="%{optflags}" \ + LDFLAGS="-Wl,-z,noexecstack" \ %ifarch armv6hl MARCH="armv6" \ %endif ++++++ openlibm-0.7.1.tar.gz -> openlibm-0.8.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/.github/workflows/ci.yml new/openlibm-0.8.1/.github/workflows/ci.yml --- old/openlibm-0.7.1/.github/workflows/ci.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/openlibm-0.8.1/.github/workflows/ci.yml 2022-01-20 00:43:52.000000000 +0100 @@ -0,0 +1,44 @@ +name: CI +on: + pull_request: + branches: + - master + push: + branches: + - master + tags: '*' +jobs: + test-unix: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - macos-latest + steps: + - uses: actions/checkout@v2 + - run: make + - run: make test + windows: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - { sys: mingw64, env: x86_64 } + - { sys: mingw32, env: i686 } + - { sys: ucrt64, env: ucrt-x86_64 } # Experimental! + - { sys: clang64, env: clang-x86_64 } # Experimental! + defaults: + run: + shell: msys2 {0} + steps: + - uses: actions/checkout@v2 + - name: Set up the desired MSYS2 environment + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + install: base-devel mingw-w64-${{matrix.env}}-toolchain + - run: make + - run: make test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/Make.inc new/openlibm-0.8.1/Make.inc --- old/openlibm-0.7.1/Make.inc 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/Make.inc 2022-01-20 00:43:52.000000000 +0100 @@ -6,45 +6,44 @@ OS := $(shell uname) # Do not forget to bump SOMINOR when changing VERSION, # and SOMAJOR when breaking ABI in a backward-incompatible way -VERSION = 0.7.0 -SOMAJOR = 3 +VERSION = 0.8.0 +SOMAJOR = 4 SOMINOR = 0 DESTDIR = -prefix = /usr/local -bindir = $(prefix)/bin -libdir = $(prefix)/lib -includedir = $(prefix)/include +prefix ?= /usr/local +bindir ?= $(prefix)/bin +libdir ?= $(prefix)/lib +includedir ?= $(prefix)/include ifeq ($(OS), FreeBSD) -pkgconfigdir = $(prefix)/libdata/pkgconfig +pkgconfigdir ?= $(prefix)/libdata/pkgconfig else -pkgconfigdir = $(libdir)/pkgconfig +pkgconfigdir ?= $(libdir)/pkgconfig endif -USEGCC = 1 -USECLANG = 0 +USEGCC ?= 1 +USECLANG ?= 0 ifneq (,$(findstring $(OS),Darwin FreeBSD OpenBSD)) -USEGCC = 0 -USECLANG = 1 +USEGCC ?= 0 +USECLANG ?= 1 endif -AR = $(TOOLPREFIX)ar - ifeq ($(ARCH),wasm32) -CC = clang-8 -USEGCC = 0 -CFLAGS_add += -fno-builtin -fno-strict-aliasing +USECLANG = 1 +TOOLPREFIX = llvm- endif +AR ?= $(TOOLPREFIX)ar + ifeq ($(USECLANG),1) -USEGCC = 0 +USEGCC ?= 0 CC = clang CFLAGS_add += -fno-builtin -fno-strict-aliasing endif ifeq ($(USEGCC),1) -CC = $(TOOLPREFIX)gcc +CC ?= $(TOOLPREFIX)gcc CFLAGS_add += -fno-gnu89-inline -fno-builtin endif @@ -55,6 +54,9 @@ endif # OS-specific stuff +ifeq ($(ARCH),arm64) +override ARCH := aarch64 +endif ifeq ($(findstring arm,$(ARCH)),arm) override ARCH := arm MARCH ?= armv7-a @@ -79,6 +81,9 @@ ifeq ($(findstring mips,$(ARCH)),mips) override ARCH := mips endif +ifeq ($(findstring riscv64,$(ARCH)),riscv64) +override ARCH := riscv64 +endif # If CFLAGS does not contain a -O optimization flag, default to -O3 ifeq ($(findstring -O,$(CFLAGS)),) @@ -92,8 +97,7 @@ #keep these if statements separate ifeq ($(OS), WINNT) SHLIB_EXT = dll -SONAME_FLAG = -soname -CFLAGS_add += -nodefaultlibs +SONAME_FLAG = shlibdir = $(bindir) else ifeq ($(OS), Darwin) @@ -144,6 +148,16 @@ endif endif +ifneq ($(filter $(ARCH),i387 amd64),) +# Determines whether `long double` is the same as `double` on this arch. +# linux x86_64, for instance, `long double` is 80 bits wide, whereas on macOS aarch64, +# `long double` is the same as `double`. +LONG_DOUBLE_NOT_DOUBLE := 1 +else ifeq ($(ARCH), aarch64) +ifeq ($(filter $(OS),Darwin WINNT),) +LONG_DOUBLE_NOT_DOUBLE := 1 +endif +endif %.c.o: %.c $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add) -c $< -o $@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/Makefile new/openlibm-0.8.1/Makefile --- old/openlibm-0.7.1/Makefile 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/Makefile 2022-01-20 00:43:52.000000000 +0100 @@ -2,6 +2,7 @@ include ./Make.inc SUBDIRS = src $(ARCH) bsdsrc +ifeq ($(LONG_DOUBLE_NOT_DOUBLE),1) # Add ld80 directory on x86 and x64 ifneq ($(filter $(ARCH),i387 amd64),) SUBDIRS += ld80 @@ -11,6 +12,7 @@ else endif endif +endif define INC_template TEST=test @@ -44,6 +46,7 @@ OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) OLM_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR) endif +LDFLAGS_add += -Wl,$(SONAME_FLAG),libopenlibm.$(OLM_MAJOR_SHLIB_EXT) endif .PHONY: all check test clean distclean \ @@ -65,7 +68,7 @@ $(AR) -rcs libopenlibm.a $(OBJS) libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT): $(OBJS) - $(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(OLM_MAJOR_SHLIB_EXT) -o $@ + $(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -o $@ ifneq ($(OS),WINNT) ln -sf $@ libopenlibm.$(OLM_MAJOR_SHLIB_EXT) ln -sf $@ libopenlibm.$(SHLIB_EXT) @@ -78,7 +81,7 @@ $(MAKE) -C test test-float clean: - rm -f aarch64/*.o amd64/*.o arm/*.o bsdsrc/*.o i387/*.o ld80/*.o ld128/*.o src/*.o powerpc/*.o mips/*.o s390/*.o + rm -f aarch64/*.o amd64/*.o arm/*.o bsdsrc/*.o i387/*.o ld80/*.o ld128/*.o src/*.o powerpc/*.o mips/*.o s390/*.o riscv64/*.o rm -f libopenlibm.a libopenlibm.*$(SHLIB_EXT)* $(MAKE) -C test clean @@ -93,7 +96,13 @@ install-shared: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT) mkdir -p $(DESTDIR)$(shlibdir) +ifeq ($(OS), WINNT) + mkdir -p $(DESTDIR)$(libdir) + cp -RpP -f libopenlibm.*$(SHLIB_EXT) $(DESTDIR)$(shlibdir)/ + cp -RpP -f libopenlibm.*$(SHLIB_EXT).a $(DESTDIR)$(libdir)/ +else cp -RpP -f libopenlibm.*$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/ +endif install-pkgconfig: openlibm.pc mkdir -p $(DESTDIR)$(pkgconfigdir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/README.md new/openlibm-0.8.1/README.md --- old/openlibm-0.7.1/README.md 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/README.md 2022-01-20 00:43:52.000000000 +0100 @@ -18,7 +18,7 @@ OpenLibm builds on Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, and DragonFly BSD. It builds with both GCC and clang. Although largely tested and widely used on the x86 and x86-64 architectures, OpenLibm -also supports arm, aarch64, ppc64le, mips, wasm32, and s390(x). +also supports arm, aarch64, ppc64le, mips, wasm32, riscv, and s390(x). ## Build instructions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/aarch64/fenv.c new/openlibm-0.8.1/aarch64/fenv.c --- old/openlibm-0.7.1/aarch64/fenv.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/aarch64/fenv.c 2022-01-20 00:43:52.000000000 +0100 @@ -26,7 +26,6 @@ * $FreeBSD: src/lib/msun/arm/fenv.c,v 1.3 2011/10/16 05:37:56 das Exp $ */ -#define __fenv_static #include <openlibm_fenv.h> #ifdef __GNUC_GNU_INLINE__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/amd64/Make.files new/openlibm-0.8.1/amd64/Make.files --- old/openlibm-0.7.1/amd64/Make.files 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/amd64/Make.files 2022-01-20 00:43:52.000000000 +0100 @@ -3,4 +3,5 @@ s_llrint.S s_llrintf.S s_llrintl.S \ s_logbl.S s_lrint.S s_lrintf.S s_lrintl.S \ s_remquo.S s_remquof.S s_remquol.S \ - s_rintl.S s_scalbn.S s_scalbnf.S s_scalbnl.S + s_rintl.S s_scalbn.S s_scalbnf.S s_scalbnl.S \ + e_fmod.S e_fmodf.S e_fmodl.S diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/amd64/e_fmod.S new/openlibm-0.8.1/amd64/e_fmod.S --- old/openlibm-0.7.1/amd64/e_fmod.S 1970-01-01 01:00:00.000000000 +0100 +++ new/openlibm-0.8.1/amd64/e_fmod.S 2022-01-20 00:43:52.000000000 +0100 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Based on the i387 version written by: + * J.T. Conklin (j...@wimsey.com), Winning Strategies, Inc. + */ + +#include <amd64/bsd_asm.h> + +ENTRY(fmod) + movsd %xmm0,-8(%rsp) + movsd %xmm1,-16(%rsp) + fldl -16(%rsp) + fldl -8(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstpl -8(%rsp) + movsd -8(%rsp),%xmm0 + fstp %st + ret +END(fmod) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/amd64/e_fmodf.S new/openlibm-0.8.1/amd64/e_fmodf.S --- old/openlibm-0.7.1/amd64/e_fmodf.S 1970-01-01 01:00:00.000000000 +0100 +++ new/openlibm-0.8.1/amd64/e_fmodf.S 2022-01-20 00:43:52.000000000 +0100 @@ -0,0 +1,21 @@ +/* + * Based on the i387 version written by J.T. Conklin <j...@netbsd.org>. + * Public domain. + */ + +#include <amd64/bsd_asm.h> + +ENTRY(fmodf) + movss %xmm0,-4(%rsp) + movss %xmm1,-8(%rsp) + flds -8(%rsp) + flds -4(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstps -4(%rsp) + movss -4(%rsp),%xmm0 + fstp %st + ret +END(fmodf) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/amd64/e_fmodl.S new/openlibm-0.8.1/amd64/e_fmodl.S --- old/openlibm-0.7.1/amd64/e_fmodl.S 1970-01-01 01:00:00.000000000 +0100 +++ new/openlibm-0.8.1/amd64/e_fmodl.S 2022-01-20 00:43:52.000000000 +0100 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 1993,94 Winning Strategies, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Winning Strategies, Inc. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Based on the i387 version written by: + * J.T. Conklin (j...@wimsey.com), Winning Strategies, Inc. + */ + +#include <amd64/bsd_asm.h> + +ENTRY(fmodl) + fldt 24(%rsp) + fldt 8(%rsp) +1: fprem + fstsw %ax + testw $0x400,%ax + jne 1b + fstp %st(1) + ret +END(fmodl) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/amd64/fenv.c new/openlibm-0.8.1/amd64/fenv.c --- old/openlibm-0.7.1/amd64/fenv.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/amd64/fenv.c 2022-01-20 00:43:52.000000000 +0100 @@ -29,7 +29,7 @@ #include "bsd_fpu.h" #include "math_private.h" -#ifndef OPENLIBM_USE_HOST_FENV_H +#ifdef _WIN32 #define __fenv_static OLM_DLLEXPORT #endif #include <openlibm_fenv.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/bsdsrc/b_tgamma.c new/openlibm-0.8.1/bsdsrc/b_tgamma.c --- old/openlibm-0.7.1/bsdsrc/b_tgamma.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/bsdsrc/b_tgamma.c 2022-01-20 00:43:52.000000000 +0100 @@ -38,6 +38,7 @@ * acknowledged. */ +#include <float.h> #include <openlibm_math.h> #include "mathimpl.h" @@ -312,3 +313,7 @@ if (sgn < 0) y = -y; return (M_PI / (y*z)); } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(tgamma, tgammal); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/i387/e_sqrt.S new/openlibm-0.8.1/i387/e_sqrt.S --- old/openlibm-0.7.1/i387/e_sqrt.S 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/i387/e_sqrt.S 2022-01-20 00:43:52.000000000 +0100 @@ -8,12 +8,29 @@ //__FBSDID("$FreeBSD: src/lib/msun/i387/e_sqrt.S,v 1.10 2011/01/07 16:13:12 kib Exp $") ENTRY(sqrt) - fldl 4(%esp) + pushl %ebp + movl %esp,%ebp + subl $8,%esp + + fstcw -4(%ebp) /* store fpu control word */ + movw -4(%ebp),%dx + andw $0xfeff,%dx /* Set precision field to 64 bits (53 bit mantissa). + We assume it's set to 0b11 (extended precision), + so zeroing out the low bit of the precision field, + will correctly set the precision */ + movw %dx,-8(%ebp) + fldcw -8(%ebp) /* load modfied control word */ + + fldl 8(%ebp) fsqrt + + fldcw -4(%ebp) /* restore original control word */ + + leave ret END(sqrt) - + /* Enable stack protection */ #if defined(__ELF__) .section .note.GNU-stack,"",%progbits diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/include/openlibm_fenv.h new/openlibm-0.8.1/include/openlibm_fenv.h --- old/openlibm-0.7.1/include/openlibm_fenv.h 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/include/openlibm_fenv.h 2022-01-20 00:43:52.000000000 +0100 @@ -14,6 +14,8 @@ #include <openlibm_fenv_mips.h> #elif defined(__s390__) #include <openlibm_fenv_s390.h> +#elif defined(__riscv) +#include <openlibm_fenv_riscv.h> #else #error "Unsupported platform" #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/include/openlibm_fenv_i387.h new/openlibm-0.8.1/include/openlibm_fenv_i387.h --- old/openlibm-0.7.1/include/openlibm_fenv_i387.h 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/include/openlibm_fenv_i387.h 2022-01-20 00:43:52.000000000 +0100 @@ -29,6 +29,7 @@ #ifndef _FENV_H_ #define _FENV_H_ +#include "openlibm_defs.h" #include "cdefs-compat.h" #include "types-compat.h" @@ -88,8 +89,8 @@ /* After testing for SSE support once, we cache the result in __has_sse. */ enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK }; -extern enum __sse_support __has_sse; -int __test_sse(void); +OLM_DLLEXPORT extern enum __sse_support __has_sse; +OLM_DLLEXPORT int __test_sse(void); #ifdef __SSE__ #define __HAS_SSE() 1 #else @@ -98,7 +99,7 @@ #endif /* Default floating-point environment */ -extern const fenv_t __fe_dfl_env; +OLM_DLLEXPORT extern const fenv_t __fe_dfl_env; #define FE_DFL_ENV (&__fe_dfl_env) #define __fldcw(__cw) __asm __volatile("fldcw %0" : : "m" (__cw)) @@ -150,8 +151,8 @@ return (0); } -int fesetexceptflag(const fexcept_t *__flagp, int __excepts); -int feraiseexcept(int __excepts); +OLM_DLLEXPORT int fesetexceptflag(const fexcept_t *__flagp, int __excepts); +OLM_DLLEXPORT int feraiseexcept(int __excepts); __fenv_static inline int fetestexcept(int __excepts) @@ -206,8 +207,8 @@ return (0); } -int fegetenv(fenv_t *__envp); -int feholdexcept(fenv_t *__envp); +OLM_DLLEXPORT int fegetenv(fenv_t *__envp); +OLM_DLLEXPORT int feholdexcept(fenv_t *__envp); __fenv_static inline int fesetenv(const fenv_t *__envp) @@ -231,12 +232,12 @@ return (0); } -int feupdateenv(const fenv_t *__envp); +OLM_DLLEXPORT int feupdateenv(const fenv_t *__envp); #if __BSD_VISIBLE -int feenableexcept(int __mask); -int fedisableexcept(int __mask); +OLM_DLLEXPORT int feenableexcept(int __mask); +OLM_DLLEXPORT int fedisableexcept(int __mask); /* We currently provide no external definition of fegetexcept(). */ static inline int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/include/openlibm_fenv_riscv.h new/openlibm-0.8.1/include/openlibm_fenv_riscv.h --- old/openlibm-0.7.1/include/openlibm_fenv_riscv.h 1970-01-01 01:00:00.000000000 +0100 +++ new/openlibm-0.8.1/include/openlibm_fenv_riscv.h 2022-01-20 00:43:52.000000000 +0100 @@ -0,0 +1,261 @@ +/*- + * Copyright (c) 2004-2005 David Schultz <d...@freebsd.org> + * Copyright (c) 2015-2016 Ruslan Bukin <b...@bsdpad.com> + * All rights reserved. + * + * Portions of this software were developed by SRI International and the + * University of Cambridge Computer Laboratory under DARPA/AFRL contract + * FA8750-10-C-0237 ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Portions of this software were developed by the University of Cambridge + * Computer Laboratory as part of the CTSRD Project, with support from the + * UK Higher Education Innovation Fund (HEIF). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: head/lib/msun/riscv/fenv.h 332792 2018-04-19 20:36:15Z brooks $ + */ + +#ifndef _FENV_H_ +#define _FENV_H_ + +#include <stdint.h> +#include "cdefs-compat.h" + +#ifndef __fenv_static +#define __fenv_static static +#endif + +typedef __uint64_t fenv_t; +typedef __uint64_t fexcept_t; + +/* Exception flags */ +#define FE_INVALID 0x0010 +#define FE_DIVBYZERO 0x0008 +#define FE_OVERFLOW 0x0004 +#define FE_UNDERFLOW 0x0002 +#define FE_INEXACT 0x0001 +#define FE_ALL_EXCEPT (FE_DIVBYZERO | FE_INEXACT | \ + FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW) + +/* + * RISC-V Rounding modes + */ +#define _ROUND_SHIFT 5 +#define FE_TONEAREST (0x00 << _ROUND_SHIFT) +#define FE_TOWARDZERO (0x01 << _ROUND_SHIFT) +#define FE_DOWNWARD (0x02 << _ROUND_SHIFT) +#define FE_UPWARD (0x03 << _ROUND_SHIFT) +#define _ROUND_MASK (FE_TONEAREST | FE_DOWNWARD | \ + FE_UPWARD | FE_TOWARDZERO) + +__BEGIN_DECLS + +/* Default floating-point environment */ +extern const fenv_t __fe_dfl_env; +#define FE_DFL_ENV (&__fe_dfl_env) + +#if !defined(__riscv_float_abi_soft) && !defined(__riscv_float_abi_double) +#if defined(__riscv_float_abi_single) +#error single precision floating point ABI not supported +#else +#error compiler did not set soft/hard float macros +#endif +#endif + +#ifndef __riscv_float_abi_soft +#define __rfs(__fcsr) __asm __volatile("csrr %0, fcsr" : "=r" (__fcsr)) +#define __wfs(__fcsr) __asm __volatile("csrw fcsr, %0" :: "r" (__fcsr)) +#endif + +#ifdef __riscv_float_abi_soft +int feclearexcept(int __excepts); +int fegetexceptflag(fexcept_t *__flagp, int __excepts); +int fesetexceptflag(const fexcept_t *__flagp, int __excepts); +int feraiseexcept(int __excepts); +int fetestexcept(int __excepts); +int fegetround(void); +int fesetround(int __round); +int fegetenv(fenv_t *__envp); +int feholdexcept(fenv_t *__envp); +int fesetenv(const fenv_t *__envp); +int feupdateenv(const fenv_t *__envp); +#else +__fenv_static inline int +feclearexcept(int __excepts) +{ + + __asm __volatile("csrc fflags, %0" :: "r"(__excepts)); + + return (0); +} + +__fenv_static inline int +fegetexceptflag(fexcept_t *__flagp, int __excepts) +{ + fexcept_t __fcsr; + + __rfs(__fcsr); + *__flagp = __fcsr & __excepts; + + return (0); +} + +__fenv_static inline int +fesetexceptflag(const fexcept_t *__flagp, int __excepts) +{ + fexcept_t __fcsr; + + __fcsr = *__flagp; + __asm __volatile("csrc fflags, %0" :: "r"(__excepts)); + __asm __volatile("csrs fflags, %0" :: "r"(__fcsr & __excepts)); + + return (0); +} + +__fenv_static inline int +feraiseexcept(int __excepts) +{ + + __asm __volatile("csrs fflags, %0" :: "r"(__excepts)); + + return (0); +} + +__fenv_static inline int +fetestexcept(int __excepts) +{ + fexcept_t __fcsr; + + __rfs(__fcsr); + + return (__fcsr & __excepts); +} + +__fenv_static inline int +fegetround(void) +{ + fexcept_t __fcsr; + + __rfs(__fcsr); + + return (__fcsr & _ROUND_MASK); +} + +__fenv_static inline int +fesetround(int __round) +{ + fexcept_t __fcsr; + + if (__round & ~_ROUND_MASK) + return (-1); + + __rfs(__fcsr); + __fcsr &= ~_ROUND_MASK; + __fcsr |= __round; + __wfs(__fcsr); + + return (0); +} + +__fenv_static inline int +fegetenv(fenv_t *__envp) +{ + + __rfs(*__envp); + + return (0); +} + +__fenv_static inline int +feholdexcept(fenv_t *__envp) +{ + + /* No exception traps. */ + + return (-1); +} + +__fenv_static inline int +fesetenv(const fenv_t *__envp) +{ + + __wfs(*__envp); + + return (0); +} + +__fenv_static inline int +feupdateenv(const fenv_t *__envp) +{ + fexcept_t __fcsr; + + __rfs(__fcsr); + __wfs(*__envp); + feraiseexcept(__fcsr & FE_ALL_EXCEPT); + + return (0); +} +#endif /* !__riscv_float_abi_soft */ + +#if __BSD_VISIBLE + +/* We currently provide no external definitions of the functions below. */ + +#ifdef __riscv_float_abi_soft +int feenableexcept(int __mask); +int fedisableexcept(int __mask); +int fegetexcept(void); +#else +static inline int +feenableexcept(int __mask) +{ + + /* No exception traps. */ + + return (-1); +} + +static inline int +fedisableexcept(int __mask) +{ + + /* No exception traps. */ + + return (0); +} + +static inline int +fegetexcept(void) +{ + + /* No exception traps. */ + + return (0); +} +#endif /* !__riscv_float_abi_soft */ + +#endif /* __BSD_VISIBLE */ + +__END_DECLS + +#endif /* !_FENV_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/include/openlibm_math.h new/openlibm-0.8.1/include/openlibm_math.h --- old/openlibm-0.7.1/include/openlibm_math.h 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/include/openlibm_math.h 2022-01-20 00:43:52.000000000 +0100 @@ -174,7 +174,7 @@ #define MAXFLOAT ((float)3.40282346638528860e+38) #ifndef OPENLIBM_ONLY_THREAD_SAFE -extern int signgam; +OLM_DLLEXPORT extern int signgam; #endif #endif /* __BSD_VISIBLE || __XSI_VISIBLE */ @@ -304,6 +304,7 @@ * BSD math library entry points */ #if __BSD_VISIBLE +OLM_DLLEXPORT int isinff(float) __pure2; OLM_DLLEXPORT int isnanf(float) __pure2; /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/powerpc/fenv.c new/openlibm-0.8.1/powerpc/fenv.c --- old/openlibm-0.7.1/powerpc/fenv.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/powerpc/fenv.c 2022-01-20 00:43:52.000000000 +0100 @@ -26,7 +26,6 @@ * $FreeBSD$ */ -#define __fenv_static #include <openlibm_fenv.h> #ifdef __GNUC_GNU_INLINE__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/riscv64/Make.files new/openlibm-0.8.1/riscv64/Make.files --- old/openlibm-0.7.1/riscv64/Make.files 1970-01-01 01:00:00.000000000 +0100 +++ new/openlibm-0.8.1/riscv64/Make.files 2022-01-20 00:43:52.000000000 +0100 @@ -0,0 +1 @@ +$(CUR_SRCS) = fenv.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/riscv64/fenv.c new/openlibm-0.8.1/riscv64/fenv.c --- old/openlibm-0.7.1/riscv64/fenv.c 1970-01-01 01:00:00.000000000 +0100 +++ new/openlibm-0.8.1/riscv64/fenv.c 2022-01-20 00:43:52.000000000 +0100 @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2004 David Schultz <d...@freebsd.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: head/lib/msun/riscv/fenv.c 332792 2018-04-19 20:36:15Z brooks $ + */ + +#define __fenv_static +#include "fenv.h" + +#ifdef __GNUC_GNU_INLINE__ +#error "This file must be compiled with C99 'inline' semantics" +#endif + +/* + * Hopefully the system ID byte is immutable, so it's valid to use + * this as a default environment. + */ +const fenv_t __fe_dfl_env = 0; + +#ifdef __riscv_float_abi_soft +#define __set_env(env, flags, mask, rnd) env = ((flags) | (rnd) << 5) +#define __env_flags(env) ((env) & FE_ALL_EXCEPT) +#define __env_mask(env) (0) /* No exception traps. */ +#define __env_round(env) (((env) >> 5) & _ROUND_MASK) +#include "fenv-softfloat.h" +#endif + +extern inline int feclearexcept(int __excepts); +extern inline int fegetexceptflag(fexcept_t *__flagp, int __excepts); +extern inline int fesetexceptflag(const fexcept_t *__flagp, int __excepts); +extern inline int feraiseexcept(int __excepts); +extern inline int fetestexcept(int __excepts); +extern inline int fegetround(void); +extern inline int fesetround(int __round); +extern inline int fegetenv(fenv_t *__envp); +extern inline int feholdexcept(fenv_t *__envp); +extern inline int fesetenv(const fenv_t *__envp); +extern inline int feupdateenv(const fenv_t *__envp); +extern inline int feenableexcept(int __mask); +extern inline int fedisableexcept(int __mask); +extern inline int fegetexcept(void); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/Make.files new/openlibm-0.8.1/src/Make.files --- old/openlibm-0.7.1/src/Make.files 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/Make.files 2022-01-20 00:43:52.000000000 +0100 @@ -44,7 +44,7 @@ endif # Add in long double functions for x86, x64 and aarch64 -ifneq ($(filter $(ARCH),i387 amd64 aarch64),) +ifeq ($(LONG_DOUBLE_NOT_DOUBLE),1) # C99 long double functions $(CUR_SRCS) += s_copysignl.c s_fabsl.c s_llrintl.c s_lrintl.c s_modfl.c diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/aarch64_fpmath.h new/openlibm-0.8.1/src/aarch64_fpmath.h --- old/openlibm-0.7.1/src/aarch64_fpmath.h 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/aarch64_fpmath.h 2022-01-20 00:43:52.000000000 +0100 @@ -27,18 +27,20 @@ * $FreeBSD: head/lib/libc/aarch64/_fpmath.h 281197 2015-04-07 09:52:14Z andrew $ */ +#include <stdint.h> + union IEEEl2bits { long double e; struct { - unsigned long manl :64; - unsigned long manh :48; + uint64_t manl :64; + uint64_t manh :48; unsigned int exp :15; unsigned int sign :1; } bits; /* TODO andrew: Check the packing here */ struct { - unsigned long manl :64; - unsigned long manh :48; + uint64_t manl :64; + uint64_t manh :48; unsigned int expsign :16; } xbits; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/cdefs-compat.h new/openlibm-0.8.1/src/cdefs-compat.h --- old/openlibm-0.7.1/src/cdefs-compat.h 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/cdefs-compat.h 2022-01-20 00:43:52.000000000 +0100 @@ -59,14 +59,19 @@ #endif /* __warn_references */ #endif /* __STDC__ */ #elif defined(__clang__) /* CLANG */ +#if defined(_WIN32) && defined(_X86_) +#define openlibm_asm_symbol_prefix "_" +#else +#define openlibm_asm_symbol_prefix "" +#endif #ifdef __STDC__ #define openlibm_weak_reference(sym,alias) \ - __asm__(".weak_reference " #alias); \ - __asm__(".set " #alias ", " #sym) + __asm__(".weak_reference " openlibm_asm_symbol_prefix #alias); \ + __asm__(".set " openlibm_asm_symbol_prefix #alias ", " openlibm_asm_symbol_prefix #sym) #else #define openlibm_weak_reference(sym,alias) \ - __asm__(".weak_reference alias");\ - __asm__(".set alias, sym") + __asm__(".weak_reference openlibm_asm_symbol_prefix/**/alias");\ + __asm__(".set openlibm_asm_symbol_prefix/**/alias, openlibm_asm_symbol_prefix/**/sym") #endif #else /* !__ELF__ */ #ifdef __STDC__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_acosh.c new/openlibm-0.8.1/src/e_acosh.c --- old/openlibm-0.7.1/src/e_acosh.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_acosh.c 2022-01-20 00:43:52.000000000 +0100 @@ -29,6 +29,7 @@ * acosh(NaN) is NaN without signal. */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -61,3 +62,7 @@ return log1p(t+sqrt(2.0*t+t*t)); } } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(acosh, acoshl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_atanh.c new/openlibm-0.8.1/src/e_atanh.c --- old/openlibm-0.7.1/src/e_atanh.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_atanh.c 2022-01-20 00:43:52.000000000 +0100 @@ -33,6 +33,7 @@ * */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -61,3 +62,7 @@ t = 0.5*log1p((x+x)/(one-x)); if(hx>=0) return t; else return -t; } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(atanh, atanhl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_cosh.c new/openlibm-0.8.1/src/e_cosh.c --- old/openlibm-0.7.1/src/e_cosh.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_cosh.c 2022-01-20 00:43:52.000000000 +0100 @@ -35,6 +35,7 @@ * only cosh(0)=1 is exact for finite x. */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -78,3 +79,7 @@ /* |x| > overflowthresold, cosh(x) overflow */ return huge*huge; } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(cosh, coshl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_exp.c new/openlibm-0.8.1/src/e_exp.c --- old/openlibm-0.7.1/src/e_exp.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_exp.c 2022-01-20 00:43:52.000000000 +0100 @@ -165,3 +165,7 @@ return y*twopk*twom1000; } } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(exp, expl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_hypotl.c new/openlibm-0.8.1/src/e_hypotl.c --- old/openlibm-0.7.1/src/e_hypotl.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_hypotl.c 2022-01-20 00:43:52.000000000 +0100 @@ -82,7 +82,7 @@ man_t manh, manl; GET_LDBL_MAN(manh,manl,b); if((manh|manl)==0) return a; - t1=0; + t1=1; SET_HIGH_WORD(t1,ESW(MAX_EXP-2)); /* t1=2^(MAX_EXP-2) */ b *= t1; a *= t1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_log.c new/openlibm-0.8.1/src/e_log.c --- old/openlibm-0.7.1/src/e_log.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_log.c 2022-01-20 00:43:52.000000000 +0100 @@ -65,6 +65,7 @@ * to produce the hexadecimal values shown. */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -139,3 +140,7 @@ return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); } } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(log, logl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_log10.c new/openlibm-0.8.1/src/e_log10.c --- old/openlibm-0.7.1/src/e_log10.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_log10.c 2022-01-20 00:43:52.000000000 +0100 @@ -22,6 +22,7 @@ * in not-quite-routine extra precision. */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -86,3 +87,7 @@ return val_lo + val_hi; } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(log10, log10l); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_log2.c new/openlibm-0.8.1/src/e_log2.c --- old/openlibm-0.7.1/src/e_log2.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_log2.c 2022-01-20 00:43:52.000000000 +0100 @@ -24,6 +24,7 @@ * in not-quite-routine extra precision. */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -109,3 +110,7 @@ return val_lo + val_hi; } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(log2, log2l); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_pow.c new/openlibm-0.8.1/src/e_pow.c --- old/openlibm-0.7.1/src/e_pow.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_pow.c 2022-01-20 00:43:52.000000000 +0100 @@ -57,6 +57,7 @@ * to produce the hexadecimal values shown. */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -310,3 +311,7 @@ else SET_HIGH_WORD(z,j); return s*z; } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(pow, powl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_powf.c new/openlibm-0.8.1/src/e_powf.c --- old/openlibm-0.7.1/src/e_powf.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_powf.c 2022-01-20 00:43:52.000000000 +0100 @@ -25,6 +25,9 @@ dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */ dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */ zero = 0.0, +half = 0.5, +qrtr = 0.25, +thrd = 3.33333343e-01, /* 0x3eaaaaab */ one = 1.0, two = 2.0, two24 = 16777216.0, /* 0x4b800000 */ @@ -74,7 +77,7 @@ /* y!=zero: result is NaN if either arg is NaN */ if(ix > 0x7f800000 || iy > 0x7f800000) - return (x+0.0F)+(y+0.0F); + return nan_mix(x, y); /* determine if y is an odd int when x < 0 * yisint = 0 ... y is not an integer @@ -103,15 +106,10 @@ if(iy==0x3f800000) { /* y is +-1 */ if(hy<0) return one/x; else return x; } - if(hy==0x40000000) return x*x; /* y is 2 */ - if(hy==0x40400000) return x*x*x; /* y is 3 */ - if(hy==0x40800000) { /* y is 4 */ - u = x*x; - return u*u; - } - if(hy==0x3f000000) { /* y is 0.5 */ + if(hy==0x40000000) return x*x; /* y is 2 */ + if(hy==0x3f000000) { /* y is 0.5 */ if(hx>=0) /* x >= +0 */ - return __ieee754_sqrtf(x); + return __ieee754_sqrtf(x); } ax = fabsf(x); @@ -139,12 +137,12 @@ /* |y| is huge */ if(iy>0x4d000000) { /* if |y| > 2**27 */ /* over/underflow if x is not close to one */ - if(ix<0x3f7ffff8) return (hy<0)? sn*huge*huge:sn*tiny*tiny; + if(ix<0x3f7ffff6) return (hy<0)? sn*huge*huge:sn*tiny*tiny; if(ix>0x3f800007) return (hy>0)? sn*huge*huge:sn*tiny*tiny; /* now |1-x| is tiny <= 2**-20, suffice to compute log(x) by x-x^2/2+x^3/3-x^4/4 */ t = ax-1; /* t has 20 trailing zeros */ - w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); + w = (t*t)*(half-t*(thrd-t*qrtr)); u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ v = t*ivln2_l-w*ivln2; t1 = u+v; @@ -183,10 +181,10 @@ r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); r += s_l*(s_h+s); s2 = s_h*s_h; - t_h = (float)3.0+s2+r; + t_h = 3+s2+r; GET_FLOAT_WORD(is,t_h); SET_FLOAT_WORD(t_h,is&0xfffff000); - t_l = r-((t_h-(float)3.0)-s2); + t_l = r-((t_h-3)-s2); /* u+v = s*(1+...) */ u = s_h*t_h; v = s_l*t_h+t_l*s; @@ -198,7 +196,7 @@ z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ z_l = cp_l*p_h+p_l*cp+dp_l[k]; /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (float)n; + t = n; t1 = (((z_h+z_l)+dp_h[k])+t); GET_FLOAT_WORD(is,t1); SET_FLOAT_WORD(t1,is&0xfffff000); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/e_sinh.c new/openlibm-0.8.1/src/e_sinh.c --- old/openlibm-0.7.1/src/e_sinh.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/e_sinh.c 2022-01-20 00:43:52.000000000 +0100 @@ -32,6 +32,7 @@ * only sinh(0)=0 is exact for finite x. */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -72,3 +73,7 @@ /* |x| > overflowthresold, sinh(x) overflow */ return x*shuge; } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(sinh, sinhl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/fpmath.h new/openlibm-0.8.1/src/fpmath.h --- old/openlibm-0.7.1/src/fpmath.h 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/fpmath.h 2022-01-20 00:43:52.000000000 +0100 @@ -43,6 +43,8 @@ #include "mips_fpmath.h" #elif defined(__s390__) #include "s390_fpmath.h" +#elif defined(__riscv) +#include "riscv_fpmath.h" #endif /* Definitions provided directly by GCC and Clang. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/math_private.h new/openlibm-0.8.1/src/math_private.h --- old/openlibm-0.7.1/src/math_private.h 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/math_private.h 2022-01-20 00:43:52.000000000 +0100 @@ -203,10 +203,9 @@ } while (0) -//VBS +#ifndef __FreeBSD__ #define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval)) - -/* VBS +#else #ifdef FLT_EVAL_METHOD // Attempt to get strict C99 semantics for assignment with non-C99 compilers. #if FLT_EVAL_METHOD == 0 || __GNUC__ == 0 @@ -215,7 +214,7 @@ #define STRICT_ASSIGN(type, lval, rval) do { \ volatile type __lval; \ \ - if (sizeof(type) >= sizeof(double)) \ + if (sizeof(type) >= sizeof(long double)) \ (lval) = (rval); \ else { \ __lval = (rval); \ @@ -224,13 +223,31 @@ } while (0) #endif #endif -*/ +#endif /* * Common routine to process the arguments to nan(), nanf(), and nanl(). */ void __scan_nan(u_int32_t *__words, int __num_words, const char *__s); +/* + * Mix 1 or 2 NaNs. First add 0 to each arg. This normally just turns + * signaling NaNs into quiet NaNs by setting a quiet bit. We do this + * because we want to never return a signaling NaN, and also because we + * don't want the quiet bit to affect the result. Then mix the converted + * args using addition. The result is typically the arg whose mantissa + * bits (considered as in integer) are largest. + * + * Technical complications: the result in bits might depend on the precision + * and/or on compiler optimizations, especially when different register sets + * are used for different precisions. Try to make the result not depend on + * at least the precision by always doing the main mixing step in long double + * precision. Try to reduce dependencies on optimizations by adding the + * the 0's in different precisions (unless everything is in long double + * precision). + */ +#define nan_mix(x, y) (((x) + 0.0L) + ((y) + 0)) + #ifdef __GNUCLIKE_ASM /* Asm versions of some functions. */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/riscv_fpmath.h new/openlibm-0.8.1/src/riscv_fpmath.h --- old/openlibm-0.7.1/src/riscv_fpmath.h 1970-01-01 01:00:00.000000000 +0100 +++ new/openlibm-0.8.1/src/riscv_fpmath.h 2022-01-20 00:43:52.000000000 +0100 @@ -0,0 +1,58 @@ +/*- + * Copyright (c) 2002, 2003 David Schultz <d...@freebsd.org> + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: head/lib/libc/riscv/_fpmath.h 362788 2020-06-29 19:30:35Z mhorne $ + */ + +union IEEEl2bits { + long double e; + struct { + unsigned long manl :64; + unsigned long manh :48; + unsigned int exp :15; + unsigned int sign :1; + } bits; + struct { + unsigned long manl :64; + unsigned long manh :48; + unsigned int expsign :16; + } xbits; +}; + +#define LDBL_NBIT 0 +#define LDBL_IMPLICIT_NBIT +#define mask_nbit_l(u) ((void)0) + +#define LDBL_MANH_SIZE 48 +#define LDBL_MANL_SIZE 64 + +#define LDBL_TO_ARRAY32(u, a) do { \ + (a)[0] = (uint32_t)(u).bits.manl; \ + (a)[1] = (uint32_t)((u).bits.manl >> 32); \ + (a)[2] = (uint32_t)(u).bits.manh; \ + (a)[3] = (uint32_t)((u).bits.manh >> 32); \ +} while(0) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/s_asinh.c new/openlibm-0.8.1/src/s_asinh.c --- old/openlibm-0.7.1/src/s_asinh.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/s_asinh.c 2022-01-20 00:43:52.000000000 +0100 @@ -24,6 +24,7 @@ * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -55,3 +56,7 @@ } if(hx>0) return w; else return -w; } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(asinh, asinhl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/s_cabs.c new/openlibm-0.8.1/src/s_cabs.c --- old/openlibm-0.7.1/src/s_cabs.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/s_cabs.c 2022-01-20 00:43:52.000000000 +0100 @@ -19,6 +19,8 @@ #include <openlibm_complex.h> #include <openlibm_math.h> +#include "math_private.h" + double cabs(double complex z) { @@ -26,5 +28,5 @@ } #if LDBL_MANT_DIG == DBL_MANT_DIG -__strong_alias(cabsl, cabs); +openlibm_strong_reference(cabs, cabsl); #endif /* LDBL_MANT_DIG == DBL_MANT_DIG */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/s_ccos.c new/openlibm-0.8.1/src/s_ccos.c --- old/openlibm-0.7.1/src/s_ccos.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/s_ccos.c 2022-01-20 00:43:52.000000000 +0100 @@ -53,6 +53,8 @@ #include <openlibm_complex.h> #include <openlibm_math.h> +#include "math_private.h" + /* calculate cosh and sinh */ static void @@ -85,5 +87,5 @@ } #if LDBL_MANT_DIG == DBL_MANT_DIG -__strong_alias(ccosl, ccos); +openlibm_strong_reference(ccos, ccosl); #endif /* LDBL_MANT_DIG == DBL_MANT_DIG */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/s_csin.c new/openlibm-0.8.1/src/s_csin.c --- old/openlibm-0.7.1/src/s_csin.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/s_csin.c 2022-01-20 00:43:52.000000000 +0100 @@ -55,6 +55,8 @@ #include <openlibm_complex.h> #include <openlibm_math.h> +#include "math_private.h" + /* calculate cosh and sinh */ static void @@ -87,5 +89,5 @@ } #if LDBL_MANT_DIG == DBL_MANT_DIG -__strong_alias(csinl, csin); +openlibm_strong_reference(csin, csinl); #endif /* LDBL_MANT_DIG == DBL_MANT_DIG */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/s_ctan.c new/openlibm-0.8.1/src/s_ctan.c --- old/openlibm-0.7.1/src/s_ctan.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/s_ctan.c 2022-01-20 00:43:52.000000000 +0100 @@ -60,6 +60,8 @@ #include <openlibm_complex.h> #include <openlibm_math.h> +#include "math_private.h" + #define MACHEP 1.1e-16 #define MAXNUM 1.0e308 @@ -153,5 +155,5 @@ } #if LDBL_MANT_DIG == DBL_MANT_DIG -__strong_alias(ctanl, ctan); +openlibm_strong_reference(ctan, ctanl); #endif /* LDBL_MANT_DIG == DBL_MANT_DIG */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/s_erf.c new/openlibm-0.8.1/src/s_erf.c --- old/openlibm-0.7.1/src/s_erf.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/s_erf.c 2022-01-20 00:43:52.000000000 +0100 @@ -107,6 +107,7 @@ * erfc/erf(NaN) is NaN */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -299,3 +300,8 @@ if(hx>0) return tiny*tiny; else return two-tiny; } } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(erf, erfl); +openlibm_weak_reference(erfc, erfcl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/s_expm1.c new/openlibm-0.8.1/src/s_expm1.c --- old/openlibm-0.7.1/src/s_expm1.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/s_expm1.c 2022-01-20 00:43:52.000000000 +0100 @@ -215,3 +215,7 @@ } return y; } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(expm1, expm1l); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/s_log1p.c new/openlibm-0.8.1/src/s_log1p.c --- old/openlibm-0.7.1/src/s_log1p.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/s_log1p.c 2022-01-20 00:43:52.000000000 +0100 @@ -173,3 +173,7 @@ if(k==0) return f-(hfsq-s*(hfsq+R)); else return k*ln2_hi-((hfsq-(s*(hfsq+R)+(k*ln2_lo+c)))-f); } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(log1p, log1pl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/src/s_tanh.c new/openlibm-0.8.1/src/s_tanh.c --- old/openlibm-0.7.1/src/s_tanh.c 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/src/s_tanh.c 2022-01-20 00:43:52.000000000 +0100 @@ -37,6 +37,7 @@ * only tanh(0)=0 is exact for finite argument. */ +#include <float.h> #include <openlibm_math.h> #include "math_private.h" @@ -76,3 +77,7 @@ } return (jx>=0)? z: -z; } + +#if (LDBL_MANT_DIG == 53) +openlibm_weak_reference(tanh, tanhl); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/test/Makefile new/openlibm-0.8.1/test/Makefile --- old/openlibm-0.7.1/test/Makefile 2020-09-02 18:33:04.000000000 +0200 +++ new/openlibm-0.8.1/test/Makefile 2022-01-20 00:43:52.000000000 +0100 @@ -7,6 +7,8 @@ ifneq ($(OS),Darwin) OPENLIBM_LIB += -Wl,-rpath=$(OPENLIBM_HOME) endif +else # WINNT +CFLAGS_add += -DIMPORT_EXPORTS endif all: test-double test-float # test-double-system test-float-system diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/openlibm-0.7.1/test/test-211.c new/openlibm-0.8.1/test/test-211.c --- old/openlibm-0.7.1/test/test-211.c 1970-01-01 01:00:00.000000000 +0100 +++ new/openlibm-0.8.1/test/test-211.c 2022-01-20 00:43:52.000000000 +0100 @@ -0,0 +1,12 @@ +#include <stdio.h> +#include <math.h> +#include <assert.h> + +int +main() +{ + float x = 0xd.65874p-4f; + float y = 4.0f; + float z = powf (x, y); + assert(z==0x1.f74424p-2); +}