Skip to content

Commit

Permalink
Squashed 'openlibm/' changes from a844d58..ae2d916
Browse files Browse the repository at this point in the history
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
  • Loading branch information
TImada committed Oct 12, 2022
1 parent f5a5c31 commit a0c4537
Show file tree
Hide file tree
Showing 123 changed files with 2,648 additions and 191 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [JuliaLang]
44 changes: 44 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,38 @@ matrix:
- libc6-dev-ppc64el-cross
- qemu-user-static
- binfmt-support

- os: linux
env: FLAGS="CC=mips-linux-gnu-gcc" TEST_FLAGS="LDFLAGS=-static"
addons:
apt:
sources:
- sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
packages:
- gcc-mips-linux-gnu
- libc6-dev-mips-cross
- qemu-user-binfmt

- os: linux
env: FLAGS="CC=mipsel-linux-gnu-gcc" TEST_FLAGS="LDFLAGS=-static"
addons:
apt:
sources:
- sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
packages:
- gcc-mipsel-linux-gnu
- libc6-dev-mipsel-cross
- qemu-user-binfmt

- os: linux
env: FLAGS="CC=mips64el-linux-gnuabi64-gcc" TEST_FLAGS="LDFLAGS=-static"
addons:
apt:
sources:
- sourceline: "deb http://archive.ubuntu.com/ubuntu/ xenial main universe"
packages:
- gcc-mips64el-linux-gnuabi64
- libc6-dev-mips64el-cross
- qemu-user-binfmt
notifications:
email: false
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ are under the LGPL.
## Parts copyrighted by the Julia project (MIT License)

> Copyright (c) 2011-14 The Julia Project.
> https://github.com/JuliaLang/openlibm/graphs/contributors
> https://github.com/JuliaMath/openlibm/graphs/contributors
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
Expand Down
71 changes: 47 additions & 24 deletions Make.inc
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,44 @@ default: all
OS := $(shell uname)
# Do not forget to bump SOMINOR when changing VERSION,
# and SOMAJOR when breaking ABI in a backward-incompatible way
VERSION = 0.5.5
SOMAJOR = 2
SOMINOR = 4
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
USEGCC ?= 0
USECLANG ?= 1
endif

ifeq ($(ARCH),wasm32)
USECLANG = 1
TOOLPREFIX = llvm-
endif

AR = ar
AR ?= $(TOOLPREFIX)ar

ifeq ($(USECLANG),1)
USEGCC = 0
USEGCC ?= 0
CC = clang
CFLAGS_add += -fno-builtin -fno-strict-aliasing
endif

ifeq ($(USEGCC),1)
CC = gcc
CC ?= $(TOOLPREFIX)gcc
CFLAGS_add += -fno-gnu89-inline -fno-builtin
endif

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

# OS-specific stuff
ifeq ($(ARCH),arm64)
override ARCH := aarch64
endif
ifeq ($(findstring arm,$(ARCH)),arm)
override ARCH := arm
MARCH ?= armv7-a
Expand All @@ -60,13 +68,22 @@ endif
ifeq ($(findstring ppc,$(ARCH)),ppc)
override ARCH := powerpc
endif
ifeq ($(findstring s390,$(ARCH)),s390)
override ARCH := s390
endif
ifneq ($(filter $(ARCH),i386 i486 i586 i686 i387 i487 i587 i687),)
override ARCH := i387
MARCH ?= i686
endif
ifeq ($(ARCH),x86_64)
override ARCH := amd64
endif
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)),)
Expand All @@ -80,8 +97,7 @@ endif
#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)
Expand Down Expand Up @@ -112,6 +128,10 @@ SFLAGS_arch += -m64
LDFLAGS_arch += -m64
endif

ifeq ($(ARCH),wasm32)
CFLAGS_arch += -ffreestanding -nostdlib -nostdinc --target=wasm32-unknown-unknown
endif

# Add our "arch"-related FLAGS in. We separate arch-related flags out so that
# we can conveniently get at them for targets that don't want the rest of
# *FLAGS_add, such as the testing Makefile targets
Expand All @@ -128,13 +148,16 @@ CFLAGS_add += -I$(OPENLIBM_HOME)/ld128
endif
endif


# *int / *intf need to be built with -O0
src/%int.c.o: src/%int.c
$(CC) $(CPPFLAGS) -O0 $(CFLAGS_add) -c $< -o $@

src/%intf.c.o: src/%intf.c
$(CC) $(CPPFLAGS) -O0 $(CFLAGS_add) -c $< -o $@
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 $@
Expand Down
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ OPENLIBM_HOME=$(abspath .)
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
Expand All @@ -11,6 +12,7 @@ SUBDIRS += ld128
else
endif
endif
endif

define INC_template
TEST=test
Expand Down Expand Up @@ -44,12 +46,19 @@ else
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 \
install install-static install-shared install-pkgconfig install-headers

all: libopenlibm.a libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)

OLM_LIBS := libopenlibm.a
ifneq ($(ARCH), wasm32)
OLM_LIBS += libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
endif

all : $(OLM_LIBS)

check test: test/test-double test/test-float
test/test-double
Expand All @@ -59,7 +68,7 @@ libopenlibm.a: $(OBJS)
$(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)
Expand All @@ -72,7 +81,7 @@ test/test-float: libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT)
$(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
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

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

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)
Expand Down
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# OpenLibm

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

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

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

## Platform support

OpenLibm builds on Linux, Mac OS X, Windows, FreeBSD, OpenBSD, and DragonFly BSD.
It builds with both GCC and clang. Although largely tested and widely
used on x86 architectures, OpenLibm also supports ARM and
PowerPC.
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, riscv, and s390(x).

## Build instructions

Expand All @@ -26,7 +27,8 @@ PowerPC.
Linux and Windows.
3. Use `make USECLANG=1` to build with clang. This is the default on OS X, FreeBSD,
and OpenBSD.
4. Architectures are auto-detected. Use `make ARCH=i386` to force a
4. Use `make ARCH=wasm32` to build the wasm32 library with clang. Requires clang-8.
5. Architectures are auto-detected. Use `make ARCH=i386` to force a
build for i386. Other supported architectures are i486, i586, and
i686. GCC 4.8 is the minimum requirement for correct codegen on
older 32-bit architectures.
Expand Down
1 change: 0 additions & 1 deletion aarch64/fenv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__
Expand Down
3 changes: 2 additions & 1 deletion amd64/Make.files
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ $(CUR_SRCS) = fenv.c e_remainder.S e_remainderf.S e_remainderl.S \
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
Loading

0 comments on commit a0c4537

Please sign in to comment.