Skip to content

Commit a0c4537

Browse files
committed
Squashed 'openlibm/' changes from a844d58..ae2d916
ae2d916 Correctly round double precision sqrt (#256) 81d5e16 Add fmod assembly version (#255) 465ca0a Update README.md 428e7af Support for riscv64 architecture (#254) ed7aea3 Bump version to 0.8 (#248) 69bb280 Another Windows ARM64 fix (#253) 3d4a902 Fixes for Windows ARM64 (#251) a9568fb [Windows] install import library to libdir (#249) f88e52a CI (Windows): set `msys2 {0}` as the default shell for all Windows steps (#247) b48a2f7 CI (Linux and macOS): Remove the `arch` variable, which currently has no effect (#246) 2a47fa5 CI: A variety of miscellaneous tweaks (#244) d0ef09a prefix symbols with _ for 32-bit x86 Windows (#242) 60dec83 msys2 ci (#243) 6ea5fa2 Merge pull request #240 from JuliaMath/vs/msys 437c139 Update ci.yml e993267 Update ci.yml 4a36c50 Update ci.yml 24cec17 Update ci.yml d26ed98 Update ci.yml 7b96025 Update ci.yml 7af65db Update ci.yml a2e053e Revert "Update ci.yml" 4a52bb0 Update ci.yml fb10fcf Update ci.yml abf5aaa Update ci.yml 98dcc48 Update ci.yml ff822f3 Update ci.yml ab8d1ad Update ci.yml 4d97e2d Update ci.yml 72caeab Update ci.yml 9dd3049 Create ci.yml 15119bc Merge pull request #239 from JuliaMath/revert-238-patch-1 4bca0f2 Revert "prefix symbols with _ for 32-bit x86 Windows" 3b9454f Merge pull request #238 from jeremyd2019/patch-1 6ae6318 Update src/cdefs-compat.h 71a8fd1 Merge pull request #233 from lephe/more-long-double-aliases 7a3ef59 prefix symbols with _ for 32-bit x86 Windows a871457 Merge pull request #230 from PetteriAimonen/master a090d3e Fix powf: JuliaMath/openlibm#212 (comment) 57dd0f9 add missing weak references for long double functions 327b1bd Replace remaining __strong_alias uses f052f42 Merge pull request #228 from JuliaMath/aa/hypotl 711654e Fix incorrect results in `hypotl` near underflow aeab19f Fix for #211 Co-authored by: @kargl 5449705 Merge pull request #227 from JuliaMath/vs/powf 98f8713 Fix #211 Patched by importing latest msun version 6a85b33 Merge pull request #225 from JuliaMath/vs/strict_assign 40dac9d Restore STRICT_ASSIGN on FreeBSD as suggested in #215 2d10c90 Merge pull request #218 from jcestibariz/fix-wasm32 5d70ac5 Merge pull request #221 from maleadt/tb/static_fenv 63aa875 Make fenv methods static on additional platforms. 9152b0d Fix compilation errors on wasm32 3cb8045 Merge pull request #217 from epsilon-0/master c856101 Merge pull request #219 from maleadt/tb/dont_export_fenv be31bff Revert "Export `fenv` functions on all platforms (#213)" eb21e8a don't alter toolchain vars if already provided b34f107 Fix Apple Silicon build (#214) 5a27b4c Export `fenv` functions on all platforms (#213) 878948d Update list of libm libraries 508603d Update index.html 0276147 Merge pull request #209 from embeddedartistry/master f2a8b36 Update download links to point to releases 1d6befd Merge pull request #208 from cndesantana/patch-1 4f559d4 Replace a few remaining __strong_reference uses (#210) 0418324 Refactor: OLM_DLLEXPORT definition now lives in a standalone header. 861b2ad Fix small typo 5b0e7e9 Update FUNDING.yml 382b8e9 Add musl-libc math library to resources. f6ad75a update openlibm website. 5efed30 Bump SONAME as discussed in #200 e6ac7d7 Update README with new OS and arch support f731481 Merge pull request #199 from llucinat/wasm32-weakref f952e16 Fix weak reference macro redefinition in wasm32 target 97de1a4 Merge pull request #198 from gufe44/netbsd-fix-openlibm_weak_reference c4dca1e Add files via upload d4077aa Suggestions ea065f9 Update src/cdefs-compat.h 2080b23 NetBSD fix 14bf902 Merge pull request #195 from ode33/patch-1 3bb2215 Update README.md 33c8313 Create FUNDING.yml 72f33a3 wasm32 support (#192) f24b1bf Fix compilation of gcc when using openlibm as system libm (#190) 0f22aeb Create CNAME c68e7d2 Delete CNAME b524581 Rename doc -> docs ebbba43 Move website to doc/ on master instead of gh-pages branch 4e3d709 update ULPs for s390 (#187) 65d7406 Merge pull request #185 from sharkcz/s390x 2a1e568 s390(x) port cca41bc Merge branch 'master' of github.com:JuliaMath/openlibm 74b54c7 Add MIPS ce69bf1 Update references to JuliaLang to point to JuliaMath (#182) a96f074 Merge pull request mirage#130 from ginggs/enable-optimization-again c782ca2 Merge pull request #177 from JuliaMath/aa/windows 52df60b Update appveyor.yml ce33de1 Add Windows testing with AppVeyor 4971b56 Update Make.inc ca996ac Merge pull request #180 from JuliaLang/ginggs-0.5.6 73b3d88 Merge pull request #181 from CDLuminate/mipsport 3aa5c3b Merge pull request #174 from iniserve/master 4b4b41c Merge pull request #178 from JuliaLang/aa/upstream a4b3fde travis: Add mips, mipsel, mips64el build. ad9673e Makefile: clean mips/*.o 4dcc76e Using cdefs-compat.h and stdint.h instead <sys/types.h> fenv-softfloat.h file added SOFTFLOAT code parts are not tested. 4f5112e Support for mips architectures a24a5eb Enable optimization again for *int.c and *intf.c a40570b Bump version to 0.5.6 787652b msun: signed overflow in atan2 8d91ecb Add TOOLPREFIX git-subtree-dir: openlibm git-subtree-split: ae2d91698508701c83cab83714d42a1146dccf85
1 parent f5a5c31 commit a0c4537

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+2648
-191
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: [JuliaLang]

.github/workflows/ci.yml

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
push:
7+
branches:
8+
- master
9+
tags: '*'
10+
jobs:
11+
test-unix:
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
os:
17+
- ubuntu-latest
18+
- macos-latest
19+
steps:
20+
- uses: actions/checkout@v2
21+
- run: make
22+
- run: make test
23+
windows:
24+
runs-on: windows-latest
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
include:
29+
- { sys: mingw64, env: x86_64 }
30+
- { sys: mingw32, env: i686 }
31+
- { sys: ucrt64, env: ucrt-x86_64 } # Experimental!
32+
- { sys: clang64, env: clang-x86_64 } # Experimental!
33+
defaults:
34+
run:
35+
shell: msys2 {0}
36+
steps:
37+
- uses: actions/checkout@v2
38+
- name: Set up the desired MSYS2 environment
39+
uses: msys2/setup-msys2@v2
40+
with:
41+
msystem: ${{matrix.sys}}
42+
install: base-devel mingw-w64-${{matrix.env}}-toolchain
43+
- run: make
44+
- run: make test

.travis.yml

+33
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,38 @@ matrix:
6969
- libc6-dev-ppc64el-cross
7070
- qemu-user-static
7171
- binfmt-support
72+
73+
- os: linux
74+
env: FLAGS="CC=mips-linux-gnu-gcc" TEST_FLAGS="LDFLAGS=-static"
75+
addons:
76+
apt:
77+
sources:
78+
- sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
79+
packages:
80+
- gcc-mips-linux-gnu
81+
- libc6-dev-mips-cross
82+
- qemu-user-binfmt
83+
84+
- os: linux
85+
env: FLAGS="CC=mipsel-linux-gnu-gcc" TEST_FLAGS="LDFLAGS=-static"
86+
addons:
87+
apt:
88+
sources:
89+
- sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
90+
packages:
91+
- gcc-mipsel-linux-gnu
92+
- libc6-dev-mipsel-cross
93+
- qemu-user-binfmt
94+
95+
- os: linux
96+
env: FLAGS="CC=mips64el-linux-gnuabi64-gcc" TEST_FLAGS="LDFLAGS=-static"
97+
addons:
98+
apt:
99+
sources:
100+
- sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
101+
packages:
102+
- gcc-mips64el-linux-gnuabi64
103+
- libc6-dev-mips64el-cross
104+
- qemu-user-binfmt
72105
notifications:
73106
email: false

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ are under the LGPL.
1616
## Parts copyrighted by the Julia project (MIT License)
1717

1818
> Copyright (c) 2011-14 The Julia Project.
19-
> https://github.com/JuliaLang/openlibm/graphs/contributors
19+
> https://github.com/JuliaMath/openlibm/graphs/contributors
2020
>
2121
> Permission is hereby granted, free of charge, to any person obtaining
2222
> a copy of this software and associated documentation files (the

Make.inc

+47-24
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,44 @@ default: all
66
OS := $(shell uname)
77
# Do not forget to bump SOMINOR when changing VERSION,
88
# and SOMAJOR when breaking ABI in a backward-incompatible way
9-
VERSION = 0.5.5
10-
SOMAJOR = 2
11-
SOMINOR = 4
9+
VERSION = 0.8.0
10+
SOMAJOR = 4
11+
SOMINOR = 0
1212
DESTDIR =
13-
prefix = /usr/local
14-
bindir = $(prefix)/bin
15-
libdir = $(prefix)/lib
16-
includedir = $(prefix)/include
13+
prefix ?= /usr/local
14+
bindir ?= $(prefix)/bin
15+
libdir ?= $(prefix)/lib
16+
includedir ?= $(prefix)/include
1717

1818
ifeq ($(OS), FreeBSD)
19-
pkgconfigdir = $(prefix)/libdata/pkgconfig
19+
pkgconfigdir ?= $(prefix)/libdata/pkgconfig
2020
else
21-
pkgconfigdir = $(libdir)/pkgconfig
21+
pkgconfigdir ?= $(libdir)/pkgconfig
2222
endif
2323

24-
USEGCC = 1
25-
USECLANG = 0
24+
USEGCC ?= 1
25+
USECLANG ?= 0
2626

2727
ifneq (,$(findstring $(OS),Darwin FreeBSD OpenBSD))
28-
USEGCC = 0
28+
USEGCC ?= 0
29+
USECLANG ?= 1
30+
endif
31+
32+
ifeq ($(ARCH),wasm32)
2933
USECLANG = 1
34+
TOOLPREFIX = llvm-
3035
endif
3136

32-
AR = ar
37+
AR ?= $(TOOLPREFIX)ar
3338

3439
ifeq ($(USECLANG),1)
35-
USEGCC = 0
40+
USEGCC ?= 0
3641
CC = clang
3742
CFLAGS_add += -fno-builtin -fno-strict-aliasing
3843
endif
3944

4045
ifeq ($(USEGCC),1)
41-
CC = gcc
46+
CC ?= $(TOOLPREFIX)gcc
4247
CFLAGS_add += -fno-gnu89-inline -fno-builtin
4348
endif
4449

@@ -49,6 +54,9 @@ $(error "the mingw32 compiler you are using fails the openblas testsuite. please
4954
endif
5055

5156
# OS-specific stuff
57+
ifeq ($(ARCH),arm64)
58+
override ARCH := aarch64
59+
endif
5260
ifeq ($(findstring arm,$(ARCH)),arm)
5361
override ARCH := arm
5462
MARCH ?= armv7-a
@@ -60,13 +68,22 @@ endif
6068
ifeq ($(findstring ppc,$(ARCH)),ppc)
6169
override ARCH := powerpc
6270
endif
71+
ifeq ($(findstring s390,$(ARCH)),s390)
72+
override ARCH := s390
73+
endif
6374
ifneq ($(filter $(ARCH),i386 i486 i586 i686 i387 i487 i587 i687),)
6475
override ARCH := i387
6576
MARCH ?= i686
6677
endif
6778
ifeq ($(ARCH),x86_64)
6879
override ARCH := amd64
6980
endif
81+
ifeq ($(findstring mips,$(ARCH)),mips)
82+
override ARCH := mips
83+
endif
84+
ifeq ($(findstring riscv64,$(ARCH)),riscv64)
85+
override ARCH := riscv64
86+
endif
7087

7188
# If CFLAGS does not contain a -O optimization flag, default to -O3
7289
ifeq ($(findstring -O,$(CFLAGS)),)
@@ -80,8 +97,7 @@ endif
8097
#keep these if statements separate
8198
ifeq ($(OS), WINNT)
8299
SHLIB_EXT = dll
83-
SONAME_FLAG = -soname
84-
CFLAGS_add += -nodefaultlibs
100+
SONAME_FLAG =
85101
shlibdir = $(bindir)
86102
else
87103
ifeq ($(OS), Darwin)
@@ -112,6 +128,10 @@ SFLAGS_arch += -m64
112128
LDFLAGS_arch += -m64
113129
endif
114130

131+
ifeq ($(ARCH),wasm32)
132+
CFLAGS_arch += -ffreestanding -nostdlib -nostdinc --target=wasm32-unknown-unknown
133+
endif
134+
115135
# Add our "arch"-related FLAGS in. We separate arch-related flags out so that
116136
# we can conveniently get at them for targets that don't want the rest of
117137
# *FLAGS_add, such as the testing Makefile targets
@@ -128,13 +148,16 @@ CFLAGS_add += -I$(OPENLIBM_HOME)/ld128
128148
endif
129149
endif
130150

131-
132-
# *int / *intf need to be built with -O0
133-
src/%int.c.o: src/%int.c
134-
$(CC) $(CPPFLAGS) -O0 $(CFLAGS_add) -c $< -o $@
135-
136-
src/%intf.c.o: src/%intf.c
137-
$(CC) $(CPPFLAGS) -O0 $(CFLAGS_add) -c $< -o $@
151+
ifneq ($(filter $(ARCH),i387 amd64),)
152+
# Determines whether `long double` is the same as `double` on this arch.
153+
# linux x86_64, for instance, `long double` is 80 bits wide, whereas on macOS aarch64,
154+
# `long double` is the same as `double`.
155+
LONG_DOUBLE_NOT_DOUBLE := 1
156+
else ifeq ($(ARCH), aarch64)
157+
ifeq ($(filter $(OS),Darwin WINNT),)
158+
LONG_DOUBLE_NOT_DOUBLE := 1
159+
endif
160+
endif
138161

139162
%.c.o: %.c
140163
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_add) -c $< -o $@

Makefile

+18-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ OPENLIBM_HOME=$(abspath .)
22
include ./Make.inc
33

44
SUBDIRS = src $(ARCH) bsdsrc
5+
ifeq ($(LONG_DOUBLE_NOT_DOUBLE),1)
56
# Add ld80 directory on x86 and x64
67
ifneq ($(filter $(ARCH),i387 amd64),)
78
SUBDIRS += ld80
@@ -11,6 +12,7 @@ SUBDIRS += ld128
1112
else
1213
endif
1314
endif
15+
endif
1416

1517
define INC_template
1618
TEST=test
@@ -44,12 +46,19 @@ else
4446
OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR).$(SOMINOR)
4547
OLM_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR)
4648
endif
49+
LDFLAGS_add += -Wl,$(SONAME_FLAG),libopenlibm.$(OLM_MAJOR_SHLIB_EXT)
4750
endif
4851

4952
.PHONY: all check test clean distclean \
5053
install install-static install-shared install-pkgconfig install-headers
5154

52-
all: libopenlibm.a libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
55+
56+
OLM_LIBS := libopenlibm.a
57+
ifneq ($(ARCH), wasm32)
58+
OLM_LIBS += libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
59+
endif
60+
61+
all : $(OLM_LIBS)
5362

5463
check test: test/test-double test/test-float
5564
test/test-double
@@ -59,7 +68,7 @@ libopenlibm.a: $(OBJS)
5968
$(AR) -rcs libopenlibm.a $(OBJS)
6069

6170
libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT): $(OBJS)
62-
$(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -Wl,$(SONAME_FLAG),libopenlibm.$(OLM_MAJOR_SHLIB_EXT) -o $@
71+
$(CC) -shared $(OBJS) $(LDFLAGS) $(LDFLAGS_add) -o $@
6372
ifneq ($(OS),WINNT)
6473
ln -sf $@ libopenlibm.$(OLM_MAJOR_SHLIB_EXT)
6574
ln -sf $@ libopenlibm.$(SHLIB_EXT)
@@ -72,7 +81,7 @@ test/test-float: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
7281
$(MAKE) -C test test-float
7382

7483
clean:
75-
rm -f aarch64/*.o amd64/*.o arm/*.o bsdsrc/*.o i387/*.o ld80/*.o ld128/*.o src/*.o powerpc/*.o
84+
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
7685
rm -f libopenlibm.a libopenlibm.*$(SHLIB_EXT)*
7786
$(MAKE) -C test clean
7887

@@ -87,7 +96,13 @@ install-static: libopenlibm.a
8796

8897
install-shared: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
8998
mkdir -p $(DESTDIR)$(shlibdir)
99+
ifeq ($(OS), WINNT)
100+
mkdir -p $(DESTDIR)$(libdir)
101+
cp -RpP -f libopenlibm.*$(SHLIB_EXT) $(DESTDIR)$(shlibdir)/
102+
cp -RpP -f libopenlibm.*$(SHLIB_EXT).a $(DESTDIR)$(libdir)/
103+
else
90104
cp -RpP -f libopenlibm.*$(SHLIB_EXT)* $(DESTDIR)$(shlibdir)/
105+
endif
91106

92107
install-pkgconfig: openlibm.pc
93108
mkdir -p $(DESTDIR)$(pkgconfigdir)

README.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
11
# OpenLibm
22

3-
[![Build Status](https://travis-ci.org/JuliaLang/openlibm.svg?branch=master)](https://travis-ci.org/JuliaLang/openlibm)
3+
[![Travis](https://travis-ci.org/JuliaMath/openlibm.svg?branch=master)](https://travis-ci.org/JuliaMath/openlibm)
4+
[![AppVeyor](https://ci.appveyor.com/api/projects/status/sia04r4089rr19uc/branch/master?svg=true)](https://ci.appveyor.com/project/ararslan/openlibm-19152/branch/master)
45

5-
[OpenLibm](http://www.openlibm.org) is an effort to have a high quality, portable, standalone
6+
[OpenLibm](https://openlibm.org/) is an effort to have a high quality, portable, standalone
67
C mathematical library ([`libm`](http://en.wikipedia.org/wiki/libm)).
78
It can be used standalone in applications and programming language
89
implementations.
910

1011
The project was born out of a need to have a good `libm` for the
11-
[Julia programming langage](http://www.julialang.org) that worked
12+
[Julia programming language](http://www.julialang.org) that worked
1213
consistently across compilers and operating systems, and in 32-bit and
1314
64-bit environments.
1415

1516
## Platform support
1617

17-
OpenLibm builds on Linux, Mac OS X, Windows, FreeBSD, OpenBSD, and DragonFly BSD.
18-
It builds with both GCC and clang. Although largely tested and widely
19-
used on x86 architectures, OpenLibm also supports ARM and
20-
PowerPC.
18+
OpenLibm builds on Linux, macOS, Windows, FreeBSD, OpenBSD, NetBSD, and
19+
DragonFly BSD. It builds with both GCC and clang. Although largely
20+
tested and widely used on the x86 and x86-64 architectures, OpenLibm
21+
also supports arm, aarch64, ppc64le, mips, wasm32, riscv, and s390(x).
2122

2223
## Build instructions
2324

@@ -26,7 +27,8 @@ PowerPC.
2627
Linux and Windows.
2728
3. Use `make USECLANG=1` to build with clang. This is the default on OS X, FreeBSD,
2829
and OpenBSD.
29-
4. Architectures are auto-detected. Use `make ARCH=i386` to force a
30+
4. Use `make ARCH=wasm32` to build the wasm32 library with clang. Requires clang-8.
31+
5. Architectures are auto-detected. Use `make ARCH=i386` to force a
3032
build for i386. Other supported architectures are i486, i586, and
3133
i686. GCC 4.8 is the minimum requirement for correct codegen on
3234
older 32-bit architectures.

aarch64/fenv.c

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
* $FreeBSD: src/lib/msun/arm/fenv.c,v 1.3 2011/10/16 05:37:56 das Exp $
2727
*/
2828

29-
#define __fenv_static
3029
#include <openlibm_fenv.h>
3130

3231
#ifdef __GNUC_GNU_INLINE__

amd64/Make.files

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ $(CUR_SRCS) = fenv.c e_remainder.S e_remainderf.S e_remainderl.S \
33
s_llrint.S s_llrintf.S s_llrintl.S \
44
s_logbl.S s_lrint.S s_lrintf.S s_lrintl.S \
55
s_remquo.S s_remquof.S s_remquol.S \
6-
s_rintl.S s_scalbn.S s_scalbnf.S s_scalbnl.S
6+
s_rintl.S s_scalbn.S s_scalbnf.S s_scalbnl.S \
7+
e_fmod.S e_fmodf.S e_fmodl.S

0 commit comments

Comments
 (0)