* add msys2 ci job

* run CI on any branch

* install base-devel on msys2

* remove soname and nodefaultlibs flags from mingw

* avoid soname on Windows

* add OLM_DLLEXPORT to signgam

it needs to be exported from the DLL also

* define IMPORT_EXPORTS on WINNT

While there are function export thunks in the import library that allow the linker to do the right thing for functions even if this is not set, it is required for the linker to do the right thing with variables being imported from a DLL (namely, signgam)

* add OLM_DLLEXPORT to openlibm_fenv_i387.h

seems this whole header was overlooked

* Update openlibm_fenv_i387.h

include openlibm_defs.h for OLM_DLLEXPORT
This commit is contained in:
jeremyd2019 2021-09-09 15:49:37 -07:00 committed by GitHub
parent 6ea5fa2408
commit 60dec83e33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 35 deletions

View File

@ -2,12 +2,11 @@ name: OpenLibm CI
on: on:
push: push:
branches: [ master ]
pull_request: pull_request:
branches: [ master ] branches: [ master ]
jobs: jobs:
build: build-nix:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:
fail-fast: false fail-fast: false
@ -15,19 +14,12 @@ jobs:
os: os:
- ubuntu-latest - ubuntu-latest
- macos-latest - macos-latest
- windows-latest
arch: arch:
- x64 - x64
- x86 - x86
- armv7 - armv7
- aarch64 - aarch64
exclude: exclude:
- os: windows-latest
arch: aarch64
- os: windows-latest
arch: armv7
- os: windows-latest
arch: x86
- os: macos-latest - os: macos-latest
arch: armv7 arch: armv7
- os: macos-latest - os: macos-latest
@ -35,17 +27,26 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Install i686-w64-mingw32-gcc
if: ${{ matrix.os == 'windows-latest' && matrix.arch == 'x86' }}
shell: bash
run: |
choco install mingw -y --x86 --force --params "/exception:sjlj"
choco install make -y
echo "CC=i686-w64-mingw32-gcc" >> "${GITHUB_ENV}"
- name: Set compiler for 64-bit Windows
if: ${{ matrix.os == 'windows-latest' && matrix.arch == 'x64' }}
shell: bash
run: |
echo "CC=x86_64-w64-mingw32-gcc" >> "${GITHUB_ENV}"
- name: Build and run tests - name: Build and run tests
run: make && make test run: make && make test
build-msys2:
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!
steps:
- uses: actions/checkout@v2
- uses: msys2/setup-msys2@v2
with:
msystem: ${{matrix.sys}}
install: base-devel mingw-w64-${{matrix.env}}-toolchain
- name: Build and run tests
shell: msys2 {0}
run: make && make test

View File

@ -94,8 +94,7 @@ endif
#keep these if statements separate #keep these if statements separate
ifeq ($(OS), WINNT) ifeq ($(OS), WINNT)
SHLIB_EXT = dll SHLIB_EXT = dll
SONAME_FLAG = -soname SONAME_FLAG =
CFLAGS_add += -nodefaultlibs
shlibdir = $(bindir) shlibdir = $(bindir)
else else
ifeq ($(OS), Darwin) ifeq ($(OS), Darwin)

View File

@ -46,6 +46,7 @@ else
OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) OLM_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR).$(SOMINOR)
OLM_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR) OLM_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR)
endif endif
LDFLAGS_add += -Wl,$(SONAME_FLAG),libopenlibm.$(OLM_MAJOR_SHLIB_EXT)
endif endif
.PHONY: all check test clean distclean \ .PHONY: all check test clean distclean \
@ -67,7 +68,7 @@ libopenlibm.a: $(OBJS)
$(AR) -rcs libopenlibm.a $(OBJS) $(AR) -rcs libopenlibm.a $(OBJS)
libopenlibm.$(OLM_MAJOR_MINOR_SHLIB_EXT): $(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) ifneq ($(OS),WINNT)
ln -sf $@ libopenlibm.$(OLM_MAJOR_SHLIB_EXT) ln -sf $@ libopenlibm.$(OLM_MAJOR_SHLIB_EXT)
ln -sf $@ libopenlibm.$(SHLIB_EXT) ln -sf $@ libopenlibm.$(SHLIB_EXT)

View File

@ -29,6 +29,7 @@
#ifndef _FENV_H_ #ifndef _FENV_H_
#define _FENV_H_ #define _FENV_H_
#include "openlibm_defs.h"
#include "cdefs-compat.h" #include "cdefs-compat.h"
#include "types-compat.h" #include "types-compat.h"
@ -88,8 +89,8 @@ __BEGIN_DECLS
/* After testing for SSE support once, we cache the result in __has_sse. */ /* After testing for SSE support once, we cache the result in __has_sse. */
enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK }; enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK };
extern enum __sse_support __has_sse; OLM_DLLEXPORT extern enum __sse_support __has_sse;
int __test_sse(void); OLM_DLLEXPORT int __test_sse(void);
#ifdef __SSE__ #ifdef __SSE__
#define __HAS_SSE() 1 #define __HAS_SSE() 1
#else #else
@ -98,7 +99,7 @@ int __test_sse(void);
#endif #endif
/* Default floating-point environment */ /* 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 FE_DFL_ENV (&__fe_dfl_env)
#define __fldcw(__cw) __asm __volatile("fldcw %0" : : "m" (__cw)) #define __fldcw(__cw) __asm __volatile("fldcw %0" : : "m" (__cw))
@ -150,8 +151,8 @@ fegetexceptflag(fexcept_t *__flagp, int __excepts)
return (0); return (0);
} }
int fesetexceptflag(const fexcept_t *__flagp, int __excepts); OLM_DLLEXPORT int fesetexceptflag(const fexcept_t *__flagp, int __excepts);
int feraiseexcept(int __excepts); OLM_DLLEXPORT int feraiseexcept(int __excepts);
__fenv_static inline int __fenv_static inline int
fetestexcept(int __excepts) fetestexcept(int __excepts)
@ -206,8 +207,8 @@ fesetround(int __round)
return (0); return (0);
} }
int fegetenv(fenv_t *__envp); OLM_DLLEXPORT int fegetenv(fenv_t *__envp);
int feholdexcept(fenv_t *__envp); OLM_DLLEXPORT int feholdexcept(fenv_t *__envp);
__fenv_static inline int __fenv_static inline int
fesetenv(const fenv_t *__envp) fesetenv(const fenv_t *__envp)
@ -231,12 +232,12 @@ fesetenv(const fenv_t *__envp)
return (0); return (0);
} }
int feupdateenv(const fenv_t *__envp); OLM_DLLEXPORT int feupdateenv(const fenv_t *__envp);
#if __BSD_VISIBLE #if __BSD_VISIBLE
int feenableexcept(int __mask); OLM_DLLEXPORT int feenableexcept(int __mask);
int fedisableexcept(int __mask); OLM_DLLEXPORT int fedisableexcept(int __mask);
/* We currently provide no external definition of fegetexcept(). */ /* We currently provide no external definition of fegetexcept(). */
static inline int static inline int

View File

@ -174,7 +174,7 @@ extern const union __nan_un {
#define MAXFLOAT ((float)3.40282346638528860e+38) #define MAXFLOAT ((float)3.40282346638528860e+38)
#ifndef OPENLIBM_ONLY_THREAD_SAFE #ifndef OPENLIBM_ONLY_THREAD_SAFE
extern int signgam; OLM_DLLEXPORT extern int signgam;
#endif #endif
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */ #endif /* __BSD_VISIBLE || __XSI_VISIBLE */

View File

@ -7,6 +7,8 @@ ifneq ($(OS),WINNT)
ifneq ($(OS),Darwin) ifneq ($(OS),Darwin)
OPENLIBM_LIB += -Wl,-rpath=$(OPENLIBM_HOME) OPENLIBM_LIB += -Wl,-rpath=$(OPENLIBM_HOME)
endif endif
else # WINNT
CFLAGS_add += -DIMPORT_EXPORTS
endif endif
all: test-double test-float # test-double-system test-float-system all: test-double test-float # test-double-system test-float-system