mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-20 09:46:20 +00:00
libm: use libm from libc and remove openlibm
- enable libm for x86/arm - update ieee754 to slightly changed output - remove openlibm from port fixes #4213
This commit is contained in:
parent
4b10aa94ec
commit
4d4cc4fd02
@ -1,55 +1,65 @@
|
||||
PORT_DIR := $(call select_from_ports,libc)
|
||||
|
||||
# Depot hack
|
||||
ifneq ($(PORT_DIR),)
|
||||
LIBM_PORT_DIR = $(PORT_DIR)/
|
||||
endif
|
||||
|
||||
LIBM_SRC_DIR := $(LIBM_PORT_DIR)src/lib/openlibm
|
||||
LIBC_PORT_DIR := $(call select_from_ports,libc)
|
||||
LIBC_DIR := $(LIBC_PORT_DIR)/src/lib/libc
|
||||
LIBM_DIR := $(LIBC_DIR)/lib/msun
|
||||
|
||||
SHARED_LIB = yes
|
||||
LIBS += libc
|
||||
|
||||
CC_C_OPT += -fno-gnu89-inline
|
||||
CC_C_OPT += -std=c99 -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration
|
||||
LIBS = libc
|
||||
|
||||
CC_OPT += -include sys/cdefs.h
|
||||
#
|
||||
# finding 'math_private.h'
|
||||
#
|
||||
INC_DIR += $(LIBM_DIR)/src
|
||||
|
||||
INC_DIR += $(REP_DIR)/include/openlibm
|
||||
INC_DIR += $(LIBM_SRC_DIR)
|
||||
INC_DIR += $(LIBM_SRC_DIR)/src
|
||||
INC_DIR += $(LIBM_PORT_DIR)include/openlibm
|
||||
INC_DIR += $(LIBM_SRC_DIR)/include
|
||||
#
|
||||
# finding 'fpmath.h', included by 'invtrig.h'
|
||||
#
|
||||
INC_DIR += $(LIBC_DIR)/lib/libc/include
|
||||
|
||||
SUBDIRS = src $(ARCH) bsdsrc
|
||||
# Add ld80 directory on x86 and x64
|
||||
ifneq ($(filter $(ARCH),i387 amd64),)
|
||||
SUBDIRS += ld80
|
||||
else
|
||||
ifneq ($(filter $(ARCH),aarch64),)
|
||||
SUBDIRS += ld128
|
||||
else
|
||||
endif
|
||||
FILTER_OUT += s_exp2l.c
|
||||
|
||||
#
|
||||
# Files that are included by other sources (e.g., 's_sin.c'). Hence, we need
|
||||
# to remove them from the build. Otherwise, we would end up with doubly
|
||||
# defined symbols (and compiler warnings since those files are apparently
|
||||
# not meant to be compiled individually).
|
||||
#
|
||||
FILTER_OUT += e_rem_pio2.c e_rem_pio2f.c
|
||||
|
||||
#
|
||||
# Use default warning level rather than -Wall because we do not want to touch
|
||||
# the imported source code to improve build aesthetics.
|
||||
#
|
||||
CC_WARN =
|
||||
|
||||
SRC_C = $(wildcard $(LIBM_DIR)/src/*.c) \
|
||||
$(wildcard $(LIBM_DIR)/bsdsrc/*.c)
|
||||
|
||||
#
|
||||
# 128 bit quadruple precision format
|
||||
#
|
||||
ifeq ($(LIBM_LD128),yes)
|
||||
INC_DIR += $(LIBM_DIR)/ld128
|
||||
SRC_C += $(wildcard $(LIBM_DIR)/ld128/*.c)
|
||||
|
||||
vpath %.c $(LIBM_DIR)/ld128
|
||||
endif
|
||||
|
||||
define INC_template
|
||||
TEST=test
|
||||
override CUR_SRCS = $(1)_SRCS
|
||||
-include $(LIBM_SRC_DIR)/$(1)/Make.files
|
||||
SRCS += $$(addprefix $(1)/,$$($(1)_SRCS))
|
||||
endef
|
||||
#
|
||||
# 80 bit extented precision format
|
||||
#
|
||||
ifeq ($(LIBM_LD80),yes)
|
||||
INC_DIR += $(LIBM_DIR)/ld80
|
||||
SRC_C += $(wildcard $(LIBM_DIR)/ld80/*.c)
|
||||
|
||||
$(foreach dir,$(SUBDIRS),$(eval $(call INC_template,$(dir))))
|
||||
vpath %.c $(LIBM_DIR)/ld80
|
||||
endif
|
||||
|
||||
DUPLICATE_NAMES = $(filter $(patsubst %.S,%,$($(ARCH)_SRCS)),$(patsubst %.c,%,$(src_SRCS)))
|
||||
DUPLICATE_SRCS = $(addsuffix .c,$(DUPLICATE_NAMES))
|
||||
SRC_C := $(filter-out $(FILTER_OUT),$(notdir $(SRC_C)))
|
||||
|
||||
CLEAN_SRCS = $(filter-out $(DUPLICATE_SRCS),$(notdir $(SRCS)))
|
||||
vpath %.c $(LIBM_DIR)/src
|
||||
vpath %.c $(LIBM_DIR)/bsdsrc
|
||||
|
||||
SRC_C += $(filter %.c,$(CLEAN_SRCS))
|
||||
SRC_S += $(filter %.S,$(CLEAN_SRCS))
|
||||
CC_CXX_WARN_STRICT =
|
||||
|
||||
$(foreach dir,$(SUBDIRS),$(eval vpath %.c $(LIBM_SRC_DIR)/$(dir)))
|
||||
$(foreach dir,$(SUBDIRS),$(eval vpath %.S $(LIBM_SRC_DIR)/$(dir)))
|
||||
|
||||
$(foreach dir,$(SUBDIRS),$(eval INC_DIR += $(LIBM_SRC_DIR)/$(dir)))
|
||||
# vi: set ft=make :
|
||||
|
@ -1,2 +1,25 @@
|
||||
ARCH = arm
|
||||
#
|
||||
# Requires ld80/ld128 not supported on arm
|
||||
#
|
||||
FILTER_OUT = catrigl.c e_atan2l.c e_coshl.c e_sinhl.c \
|
||||
s_atanl.c s_fmal.c s_tanhl.c
|
||||
|
||||
#
|
||||
# Unsupported long double format
|
||||
#
|
||||
FILTER_OUT += e_acosl.c e_asinl.c e_acoshl.c e_atanhl.c \
|
||||
s_asinhl.c s_clogl.c s_cosl.c s_csqrtl.c \
|
||||
s_frexpl.c s_nextafterl.c s_nexttoward.c \
|
||||
s_rintl.c s_scalbnl.c s_sincosl.c s_sinl.c \
|
||||
s_tanl.c
|
||||
|
||||
#
|
||||
# Unsupported 'xbits' in 'IEEEl2bits'
|
||||
#
|
||||
FILTER_OUT += e_hypotl.c s_cbrtl.c s_roundl.c
|
||||
|
||||
include $(REP_DIR)/lib/mk/libm.inc
|
||||
|
||||
SRC_C += msun/arm/fenv.c
|
||||
|
||||
vpath msun/arm/fenv.c $(LIBC_DIR)/lib
|
||||
|
@ -1,2 +1,7 @@
|
||||
ARCH = aarch64
|
||||
LIBM_LD128 = yes
|
||||
|
||||
include $(REP_DIR)/lib/mk/libm.inc
|
||||
|
||||
SRC_C += msun/aarch64/fenv.c
|
||||
|
||||
vpath msun/aarch64/fenv.c $(LIBC_DIR)/lib
|
||||
|
@ -3,7 +3,4 @@ include $(REP_DIR)/lib/mk/libc.mk
|
||||
INC_DIR += $(REP_DIR)/src/lib/libc/spec/x86_32
|
||||
INC_DIR += $(LIBC_DIR)/include/spec/x86_32
|
||||
|
||||
SRC_C += msun/i387/fenv.c
|
||||
vpath msun/i387/fenv.c $(LIBC_DIR)/lib
|
||||
|
||||
CC_CXX_WARN_STRICT =
|
||||
|
@ -1,2 +1,7 @@
|
||||
ARCH = i387
|
||||
LIBM_LD80 = yes
|
||||
|
||||
include $(REP_DIR)/lib/mk/libm.inc
|
||||
|
||||
SRC_C += msun/i387/fenv.c
|
||||
|
||||
vpath msun/i387/fenv.c $(LIBC_DIR)/lib
|
||||
|
@ -1,2 +1,7 @@
|
||||
ARCH = amd64
|
||||
LIBM_LD80 = yes
|
||||
|
||||
include $(REP_DIR)/lib/mk/libm.inc
|
||||
|
||||
SRC_C += msun/amd64/fenv.c
|
||||
|
||||
vpath msun/amd64/fenv.c $(LIBC_DIR)/lib
|
||||
|
@ -1 +1 @@
|
||||
3ec28a350593879749a015a584ed24ffd7d3edce
|
||||
368270b192622fe7c23d0318e737d3370663d52c
|
||||
|
@ -1,6 +1,6 @@
|
||||
LICENSE = BSD
|
||||
VERSION = 12.0.0
|
||||
DOWNLOADS = libc.archive openlibm.archive
|
||||
DOWNLOADS = libc.archive
|
||||
|
||||
D = src/lib/libc
|
||||
|
||||
@ -8,14 +8,6 @@ URL(libc) = http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.0-RELEASE/src.t
|
||||
SHA(libc) = 0da393ac2174168a71c1c527d1453e07372295187d05c288250800cb152a889b
|
||||
DIR(libc) = $(D)
|
||||
|
||||
OWNER := JuliaMath
|
||||
REPO := openlibm
|
||||
REV := a96f0740e32c3d8aaa0a34c3988201018dfa90ce
|
||||
|
||||
URL(openlibm) := https://github.com/$(OWNER)/$(REPO)/archive/$(REV).tar.gz
|
||||
SHA(openlibm) := a9c7d4450c3e9a8b92ec1e20c7a9fd2682e900743dff37f163c9a9ac68b4f471
|
||||
DIR(openlibm) := src/lib/openlibm
|
||||
|
||||
TAR_OPT(libc) = --strip-components=2
|
||||
|
||||
TAR_OPT(libc) += usr/src/contrib/gdtoa
|
||||
@ -53,10 +45,7 @@ PATCHES := $(sort $(wildcard $(REP_DIR)/$(D)/patches/*.patch))
|
||||
#
|
||||
# Generic headers
|
||||
#
|
||||
|
||||
DIRS := include/libc include/openlibm
|
||||
|
||||
DIR_CONTENT(include/openlibm) = src/lib/openlibm/include/*
|
||||
DIRS := include/libc
|
||||
|
||||
DIR_CONTENT(include/libc) := \
|
||||
$(addprefix $(D)/include/,\
|
||||
@ -215,7 +204,7 @@ DIR_CONTENT(include/spec/arm/libc) := \
|
||||
DIRS += include/spec/arm/libc/machine
|
||||
DIR_CONTENT(include/spec/arm/libc/machine) := \
|
||||
$(call common_include_libc_arch_machine_content,arm) \
|
||||
$(addprefix $(D)/sys/arm/include/, armreg.h atomic-v6.h ieee.h sysreg.h sigframe.h)
|
||||
$(addprefix $(D)/sys/arm/include/, acle-compat.h armreg.h atomic-v6.h ieee.h sysreg.h sigframe.h)
|
||||
|
||||
|
||||
#
|
||||
|
@ -1,4 +1,4 @@
|
||||
content: include/libc-plugin src/lib/libc/target.mk lib/mk LICENSE src/lib/openlibm
|
||||
content: include/libc-plugin src/lib/libc/target.mk lib/mk LICENSE
|
||||
|
||||
LIBC_PORT_DIR := $(call port_dir,$(REP_DIR)/ports/libc)
|
||||
LIBM_PORT_DIR := $(LIBC_PORT_DIR)
|
||||
@ -8,10 +8,6 @@ src/lib/libc:
|
||||
cp -r $(LIBC_PORT_DIR)/src/lib/libc/* $@
|
||||
cp -r $(REP_DIR)/src/lib/libc/* $@
|
||||
|
||||
src/lib/openlibm:
|
||||
mkdir -p $@
|
||||
cp -r $(LIBM_PORT_DIR)/$@/* $@
|
||||
|
||||
# target.mk for triggering the build of both libraries libc and libm
|
||||
src/lib/libc/target.mk: src/lib/libc
|
||||
echo "LIBS += libc libm" > $@
|
||||
|
@ -1480,16 +1480,16 @@ DBL_MAX_EXP = 1024
|
||||
LDBL_MAX_EXP = 16384
|
||||
|
||||
FLT_EPSILON = 1.19209e-07 = 0x1p-23
|
||||
DBL_EPSILON = 2.22044e-16 = 0x1p-52
|
||||
LDBL_EPSILON = 1.92592e-34 = 0x1p-112
|
||||
DBL_EPSILON = 2.22045e-16 = 0x1p-52
|
||||
LDBL_EPSILON = 1.92593e-34 = 0x1p-112
|
||||
|
||||
FLT_MIN = 1.1755e-38 = 0x1p-126
|
||||
DBL_MIN = 2.22508e-308 = 0x1p-1022
|
||||
LDBL_MIN = 3.36211e-4932 = 0x1p-16382
|
||||
FLT_MIN = 1.17549e-38 = 0x1p-126
|
||||
DBL_MIN = 2.22507e-308 = 0x1p-1022
|
||||
LDBL_MIN = 3.3621e-4932 = 0x1p-16382
|
||||
|
||||
FLT_MAX = 3.40283e+38 = 0x1.fffffep+127
|
||||
DBL_MAX = 1.7977e+308 = 0x1.fffffffffffffp+1023
|
||||
LDBL_MAX = 1.18974e+4932 = 0x1.ffffffffffffffffffffffffffffp+16383
|
||||
FLT_MAX = 3.40282e+38 = 0x1.fffffep+127
|
||||
DBL_MAX = 1.79769e+308 = 0x1.fffffffffffffp+1023
|
||||
LDBL_MAX = 1.18973e+4932 = 0x1.ffffffffffffffffffffffffffffp+16383
|
||||
|
||||
sizeof(float) = 4
|
||||
sizeof(double) = 8
|
||||
@ -1498,7 +1498,7 @@ sizeof(long double) = 16
|
||||
x + y, with x = 9007199254740994.0 and y = 1.0 - 1/65536.0 (type double).
|
||||
The IEEE-754 result is 9007199254740994 with double precision.
|
||||
The IEEE-754 result is 9007199254740996 with extended precision.
|
||||
The obtained result is 9007199254740996.
|
||||
The obtained result is 9007199254740994.
|
||||
|
||||
NAN != NAN --> 1 (should be 1)
|
||||
isnan(NAN) --> 1 (should be 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user