-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make: link with openlibm * libm: use openlibm Replace include: + `<math.h>` => `<openlibm_math.h>` + `<fenv.h>` => `<openlibm_fenv.h>` + `<complex.h>` => `<openlibm_complex.h>` * ci: add Openlibm * ci: skip when modify non-source
- Loading branch information
inky
authored
Feb 24, 2024
1 parent
7e0ceaf
commit abde35c
Showing
12 changed files
with
135 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Openlibm | ||
on: | ||
push: | ||
paths: | ||
- '.github/workflows/openlibm.yml' | ||
- 'src/**' | ||
- 'config.mak.def' | ||
- 'Makefile' | ||
- 'openlibm.mk' | ||
branches: | ||
- main | ||
tags: ['*'] | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
# Skip intermediate builds: always. | ||
# Cancel intermediate builds: only if it is a pull request build. | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} | ||
|
||
jobs: | ||
test: | ||
name: ubuntu | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout Openlibm | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: 'JuliaMath/openlibm' | ||
path: 'libm/openlibm' | ||
- name: Env Version | ||
run: | | ||
gcc --version | ||
ld --version | ||
ldd --version | ||
- name: Build Openlibm | ||
run: make -C libm/openlibm -j`nproc` | ||
- name: Run Test | ||
run: make -j`nproc` USE_OPENLIBM=1 | ||
- name: Show Test Result | ||
run: cat src/REPORT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ | |
config.mak | ||
options.h | ||
REPORT | ||
|
||
libm/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
# Use openlibm, otherwise use system libm | ||
USE_OPENLIBM:=0 | ||
|
||
# Build and link flags | ||
CFLAGS += -pipe -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wno-unused-function -Wno-missing-braces -Wno-unused -Wno-overflow | ||
CFLAGS += -Wno-unknown-pragmas -fno-builtin -frounding-math | ||
CFLAGS += -Werror=implicit-function-declaration -Werror=implicit-int -Werror=pointer-sign -Werror=pointer-arith | ||
CFLAGS += -g | ||
LDFLAGS += -g | ||
LDLIBS += -lpthread -lm -lrt | ||
LDLIBS += -lpthread -lrt | ||
|
||
# Choose libm | ||
ifneq ($(USE_OPENLIBM), 1) | ||
LDLIBS += -lm | ||
# glibc specific settings | ||
CFLAGS += -D_FILE_OFFSET_BITS=64 | ||
LDLIBS += -lcrypt -ldl -lresolv -lutil -lpthread | ||
else # Use openlibm | ||
include openlibm.mk | ||
|
||
CFLAGS += $(CFLAGS_add) | ||
LDFLAGS += $(LDFLAGS_add) | ||
LDLIBS += $(OPENLIBM_LIB) | ||
endif # USE_OPENLIBM | ||
|
||
# glibc specific settings | ||
CFLAGS += -D_FILE_OFFSET_BITS=64 | ||
LDLIBS += -lcrypt -ldl -lresolv -lutil -lpthread | ||
|
||
# Makefile debugging trick: | ||
# call print-VARIABLE to see the runtime value of any variable | ||
# (hardened against any special characters appearing in the output) | ||
print-%: | ||
@echo '$*=$(subst ','\'',$(subst $(newline),\n,$($*)))' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# config for build openlibm | ||
# export: | ||
# - CFLAGS_add | ||
# - LDFLAGS_add | ||
# - OPENLIBM_LIB | ||
|
||
# ---- OpenlibM settings | ||
OPENLIBM_HOME?=$(abspath libm/openlibm) | ||
include $(OPENLIBM_HOME)/Make.inc | ||
|
||
# Set rpath of tests to builddir for loading shared library | ||
OPENLIBM_LIB = -L$(OPENLIBM_HOME) -lopenlibm | ||
ifneq ($(OS),WINNT) | ||
ifneq ($(OS),Darwin) | ||
OPENLIBM_LIB += -Wl,-rpath=$(OPENLIBM_HOME) | ||
endif | ||
else # WINNT | ||
CFLAGS_add += -DIMPORT_EXPORTS | ||
endif | ||
|
||
CFLAGS_add += -DUSE_OPENLIBM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
#include <math.h> | ||
#include "mtest.h" | ||
#include "test.h" | ||
|
||
|