Skip to content

Commit 18799f8

Browse files
committed
Remove OpenLibm and leverage native Julia implementations
Link to the system libm
1 parent ddd7afb commit 18799f8

File tree

22 files changed

+16
-230
lines changed

22 files changed

+16
-230
lines changed

Make.inc

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ USE_SYSTEM_LLVM:=0
4545
USE_SYSTEM_LIBUNWIND:=0
4646
DISABLE_LIBUNWIND:=0
4747
USE_SYSTEM_PCRE:=0
48-
USE_SYSTEM_LIBM:=0
49-
USE_SYSTEM_OPENLIBM:=0
50-
UNTRUSTED_SYSTEM_LIBM:=0
5148
USE_SYSTEM_DSFMT:=0
5249
USE_SYSTEM_LIBBLASTRAMPOLINE:=0
5350
USE_SYSTEM_BLAS:=0
@@ -1177,14 +1174,6 @@ LIBLAPACKNAME := liblapack
11771174
endif
11781175
endif
11791176

1180-
ifeq ($(USE_SYSTEM_LIBM), 1)
1181-
LIBM := -lm
1182-
LIBMNAME := libm
1183-
else
1184-
LIBM := -lopenlibm
1185-
LIBMNAME := libopenlibm
1186-
endif
1187-
11881177
ifeq ($(USE_SYSTEM_LIBUV), 1)
11891178
LIBUV := $(LOCALBASE)/lib/libuv-julia.a
11901179
LIBUV_INC := $(LOCALBASE)/include
@@ -1268,7 +1257,7 @@ CSL_NEXT_GLIBCXX_VERSION=GLIBCXX_3\.4\.33|GLIBCXX_3\.5\.|GLIBCXX_4\.
12681257
# Note: we explicitly _do not_ define `CSL` here, since it requires some more
12691258
# advanced techniques to decide whether it should be installed from a BB source
12701259
# or not. See `deps/csl.mk` for more detail.
1271-
BB_PROJECTS := BLASTRAMPOLINE OPENBLAS LLVM LIBSUITESPARSE OPENLIBM GMP MBEDTLS LIBSSH2 NGHTTP2 MPFR CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV ZLIB P7ZIP LLD LIBTRACYCLIENT
1260+
BB_PROJECTS := BLASTRAMPOLINE OPENBLAS LLVM LIBSUITESPARSE GMP MBEDTLS LIBSSH2 NGHTTP2 MPFR CURL LIBGIT2 PCRE LIBUV LIBUNWIND DSFMT OBJCONV ZLIB P7ZIP LLD LIBTRACYCLIENT
12721261
define SET_BB_DEFAULT
12731262
# First, check to see if BB is disabled on a global setting
12741263
ifeq ($$(USE_BINARYBUILDER),0)
@@ -1398,7 +1387,6 @@ ifeq ($(ARCH),i686)
13981387
JLDFLAGS += -Wl,--large-address-aware
13991388
endif
14001389
JCPPFLAGS += -D_WIN32_WINNT=0x0502
1401-
UNTRUSTED_SYSTEM_LIBM := 1
14021390
# Use hard links for files on windows, rather than soft links
14031391
# https://stackoverflow.com/questions/3648819/how-to-make-a-symbolic-link-with-cygwin-in-windows-7
14041392
# Usage: $(WIN_MAKE_HARD_LINK) <source> <target>
@@ -1473,12 +1461,6 @@ USE_BINARYBUILDER_OPENBLAS := 0
14731461
USE_BINARYBUILDER_LIBSUITESPARSE := 0
14741462
endif
14751463

1476-
ifeq ($(USE_SYSTEM_LIBM),1)
1477-
# If we're using system libm, disable BB OpenLibm
1478-
USE_BINARYBUILDER_OPENLIBM := 0
1479-
endif
1480-
1481-
14821464
# Note: we're passing *FLAGS here computed based on your system compiler to
14831465
# clang. If that causes you problems, you might want to build and/or run
14841466
# specific clang-sa-* files with clang explicitly selected:
@@ -1634,20 +1616,13 @@ endif
16341616
LIBSTDCXX_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/$(LIBSTDCXX_NAME))
16351617
endif
16361618

1637-
1638-
# USE_SYSTEM_LIBM and USE_SYSTEM_OPENLIBM causes it to get symlinked into build_private_shlibdir
1639-
ifeq ($(USE_SYSTEM_LIBM),1)
1640-
LIBM_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_private_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
1641-
else ifeq ($(USE_SYSTEM_OPENLIBM),1)
1642-
LIBM_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_private_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
1643-
else
1644-
LIBM_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
1645-
endif
1646-
LIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
1619+
# Symlink system libm
1620+
LIBMNAME := libm
1621+
#LIBM_BUILD_DEPLIB := $(call dep_lib_path,$(build_libdir),$(build_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
1622+
#LIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(libdir),$(private_shlibdir)/$(LIBMNAME).$(SHLIB_EXT))
16471623

16481624
# We list:
16491625
# * libgcc_s, because FreeBSD needs to load ours, not the system one.
1650-
# * libopenlibm, because Windows has an untrustworthy libm, and we want to use ours more than theirs
16511626
# * libstdc++, because while performing `libstdc++` probing we need to
16521627
# know the path to the bundled `libstdc++` library.
16531628
# * libjulia-internal, which must always come second-to-last.
@@ -1669,30 +1644,26 @@ endef
16691644

16701645
LOADER_BUILD_DEP_LIBS = $(call build_deplibs, \
16711646
$(LIBGCC_BUILD_DEPLIB) \
1672-
$(LIBM_BUILD_DEPLIB) \
16731647
@$(LIBSTDCXX_BUILD_DEPLIB) \
16741648
@$(LIBJULIAINTERNAL_BUILD_DEPLIB) \
16751649
@$(LIBJULIACODEGEN_BUILD_DEPLIB) \
16761650
)
16771651

16781652
LOADER_DEBUG_BUILD_DEP_LIBS = $(call build_deplibs, \
16791653
$(LIBGCC_BUILD_DEPLIB) \
1680-
$(LIBM_BUILD_DEPLIB) \
16811654
@$(LIBSTDCXX_BUILD_DEPLIB) \
16821655
@$(LIBJULIAINTERNAL_DEBUG_BUILD_DEPLIB) \
16831656
@$(LIBJULIACODEGEN_DEBUG_BUILD_DEPLIB) \
16841657
)
16851658

16861659
LOADER_INSTALL_DEP_LIBS = $(call build_deplibs, \
16871660
$(LIBGCC_INSTALL_DEPLIB) \
1688-
$(LIBM_INSTALL_DEPLIB) \
16891661
@$(LIBSTDCXX_INSTALL_DEPLIB) \
16901662
@$(LIBJULIAINTERNAL_INSTALL_DEPLIB) \
16911663
@$(LIBJULIACODEGEN_INSTALL_DEPLIB) \
16921664
)
16931665
LOADER_DEBUG_INSTALL_DEP_LIBS = $(call build_deplibs, \
16941666
$(LIBGCC_INSTALL_DEPLIB) \
1695-
$(LIBM_INSTALL_DEPLIB) \
16961667
@$(LIBSTDCXX_INSTALL_DEPLIB) \
16971668
@$(LIBJULIAINTERNAL_DEBUG_INSTALL_DEPLIB) \
16981669
@$(LIBJULIACODEGEN_DEBUG_INSTALL_DEPLIB) \

Makefile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,6 @@ JL_PRIVATE_LIBS-$(USE_SYSTEM_LLVM) += libLLVM $(LLVM_SHARED_LIB_NAME)
226226
endif
227227
JL_PRIVATE_LIBS-$(USE_SYSTEM_LIBUNWIND) += libunwind
228228

229-
ifeq ($(USE_SYSTEM_LIBM),0)
230-
JL_PRIVATE_LIBS-$(USE_SYSTEM_OPENLIBM) += libopenlibm
231-
endif
232-
233229
JL_PRIVATE_LIBS-$(USE_SYSTEM_BLAS) += $(LIBBLASNAME)
234230
ifneq ($(LIBLAPACKNAME),$(LIBBLASNAME))
235231
JL_PRIVATE_LIBS-$(USE_SYSTEM_LAPACK) += $(LIBLAPACKNAME)
@@ -293,7 +289,6 @@ endif
293289
# We have a single exception; we want 7z.dll to live in private_libexecdir,
294290
# not bindir, so that 7z.exe can find it.
295291
-mv $(DESTDIR)$(bindir)/7z.dll $(DESTDIR)$(private_libexecdir)/
296-
-$(INSTALL_M) $(build_bindir)/libopenlibm.dll.a $(DESTDIR)$(libdir)/
297292
-$(INSTALL_M) $(build_libdir)/libssp.dll.a $(DESTDIR)$(libdir)/
298293
else
299294

THIRDPARTY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ and optionally:
3232
Julia's `stdlib` uses the following external libraries, which have their own licenses:
3333

3434
- [DSFMT](https://github.com/MersenneTwister-Lab/dSFMT/blob/master/LICENSE.txt) [BSD-3]
35-
- [OPENLIBM](https://github.com/JuliaMath/openlibm/blob/master/LICENSE.md) [MIT, BSD-2, ISC]
3635
- [GMP](https://gmplib.org/manual/Copying.html#Copying) [LGPL3+ or GPL2+]
3736
- [LIBGIT2](https://github.com/libgit2/libgit2/blob/development/COPYING) [GPL2+ with unlimited linking exception]
3837
- [CURL](https://curl.haxx.se/docs/copyright.html) [MIT/X derivative]

base/Makefile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ ifeq ($(XC_HOST),)
4848
else
4949
@echo "const MACHINE = \"$(XC_HOST)\"" >> $@
5050
endif
51-
@echo "const libm_name = \"$(LIBMNAME)\"" >> $@
5251
ifeq ($(USE_BLAS64), 1)
5352
@echo "const USE_BLAS64 = true" >> $@
5453
else
@@ -224,13 +223,7 @@ $(build_depsbindir)/dsymutil$(EXE):
224223
ln -svf "$(DSYMUTIL_PATH)" "$@"
225224

226225
# the following excludes: libuv.a, libutf8proc.a
227-
228-
ifneq ($(USE_SYSTEM_LIBM),0)
229-
$(eval $(call symlink_system_library,LIBM,$(LIBMNAME)))
230-
else ifneq ($(USE_SYSTEM_OPENLIBM),0)
231-
$(eval $(call symlink_system_library,OPENLIBM,$(LIBMNAME)))
232-
endif
233-
226+
#$(eval $(call symlink_system_library,LIBM,$(LIBMNAME)))
234227
# On macOS, libgcc_s has soversion 1.1 always on aarch64 and only for GCC 12+
235228
# (-> libgfortran 5) on x86_64
236229
ifeq ($(OS),Darwin)

base/fastmath.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ sub_fast(x::T, y::T) where {T<:FloatTypes} = sub_float_fast(x, y)
165165
mul_fast(x::T, y::T) where {T<:FloatTypes} = mul_float_fast(x, y)
166166
div_fast(x::T, y::T) where {T<:FloatTypes} = div_float_fast(x, y)
167167

168+
168169
add_fast(x::T, y::T, zs::T...) where {T<:FloatTypes} =
169170
add_fast(add_fast(x, y), zs...)
170171
mul_fast(x::T, y::T, zs::T...) where {T<:FloatTypes} =

base/linking.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ function link_image_cmd(path, out)
155155
LIBS = is_debug() ? ("-ljulia-debug", "-ljulia-internal-debug") :
156156
("-ljulia", "-ljulia-internal")
157157
@static if Sys.iswindows()
158-
LIBS = (LIBS..., "-lopenlibm", "-lssp", "-lgcc_s", "-lgcc", "-lmsvcrt")
158+
LIBS = (LIBS..., "-lssp", "-lgcc_s", "-lgcc", "-lucrt")
159159
end
160160

161161
V = VERBOSE[] ? "--verbose" : ""

base/math.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,6 @@ log(b::Number, x::Number) = log(promote(b,x)...)
401401

402402
# type specific math functions
403403

404-
const libm = Base.libm_name
405-
406404
# functions with no domain error
407405
"""
408406
sinh(x)
@@ -1207,7 +1205,6 @@ function rem(x::T, p::T, ::RoundingMode{:Nearest}) where T<:IEEEFloat
12071205
return flipsign(x, oldx)
12081206
end
12091207

1210-
12111208
"""
12121209
modf(x)
12131210

contrib/julia-config.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ function ldlibs(doframework)
7171
(Sys.isapple() ? string() : "-Wl,-rpath,$(shell_escape(private_libDir())) ") *
7272
"-l$libname"
7373
else
74-
return "-l$libname -lopenlibm"
74+
return "-l$libname -lm"
7575
end
7676
end
7777

contrib/refresh_checksums.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CLANG_TRIPLETS=$(filter %-darwin %-freebsd,$(TRIPLETS))
2424
NON_CLANG_TRIPLETS=$(filter-out %-darwin %-freebsd,$(TRIPLETS))
2525

2626
# These are the projects currently using BinaryBuilder; both GCC-expanded and non-GCC-expanded:
27-
BB_PROJECTS=mbedtls libssh2 nghttp2 mpfr curl libgit2 pcre libuv unwind llvmunwind dsfmt objconv p7zip zlib libsuitesparse openlibm blastrampoline libtracyclient
27+
BB_PROJECTS=mbedtls libssh2 nghttp2 mpfr curl libgit2 pcre libuv unwind llvmunwind dsfmt objconv p7zip zlib libsuitesparse blastrampoline libtracyclient
2828
BB_GCC_EXPANDED_PROJECTS=openblas csl
2929
BB_CXX_EXPANDED_PROJECTS=gmp llvm clang llvm-tools lld
3030
# These are non-BB source-only deps

deps/Makefile

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ BUILDDIR := $(BUILDDIR)$(MAYBE_HOST)
2323
# if you are adding a new target, it can help to copy an similar, existing target
2424
#
2525
# autoconf configure-driven scripts: pcre unwind gmp mpfr patchelf libuv curl
26-
# custom Makefile rules: openlibm dsfmt libsuitesparse lapack blastrampoline openblas utf8proc objconv libwhich
26+
# custom Makefile rules: dsfmt libsuitesparse lapack blastrampoline openblas utf8proc objconv libwhich
2727
# CMake libs: llvm llvmunwind libgit2 libssh2 mbedtls libtracyclient
2828
#
29-
# downloadable via git: llvm-svn, libuv, libopenlibm, utf8proc, libgit2, libssh2, libtracyclient
29+
# downloadable via git: llvm-svn, libuv, utf8proc, libgit2, libssh2, libtracyclient
3030
#
3131
# to debug 'define' rules, replace eval at the usage site with info or error
3232

@@ -82,12 +82,6 @@ PATCHELF_BIN := $(CUSTOM_LD_LIBRARY_PATH) $(PATCHELF)
8282

8383
## USE_SYSTEM_LIBS options
8484

85-
ifeq ($(USE_SYSTEM_OPENLIBM), 0)
86-
ifeq ($(USE_SYSTEM_LIBM), 0)
87-
DEP_LIBS += openlibm
88-
endif
89-
endif
90-
9185
ifeq ($(USE_SYSTEM_DSFMT), 0)
9286
DEP_LIBS += dsfmt
9387
endif
@@ -190,7 +184,7 @@ DEP_LIBS_STAGED := $(DEP_LIBS)
190184

191185
# list all targets
192186
DEP_LIBS_STAGED_ALL := llvm llvm-tools clang llvmunwind unwind libuv pcre \
193-
openlibm dsfmt blastrampoline openblas lapack gmp mpfr patchelf utf8proc \
187+
dsfmt blastrampoline openblas lapack gmp mpfr patchelf utf8proc \
194188
objconv mbedtls libssh2 nghttp2 curl libgit2 libwhich zlib p7zip csl \
195189
sanitizers libsuitesparse lld libtracyclient ittapi JuliaSyntax
196190
DEP_LIBS_ALL := $(DEP_LIBS_STAGED_ALL)
@@ -232,7 +226,6 @@ include $(SRCDIR)/ittapi.mk
232226
include $(SRCDIR)/llvm.mk
233227
include $(SRCDIR)/libuv.mk
234228
include $(SRCDIR)/pcre.mk
235-
include $(SRCDIR)/openlibm.mk
236229
include $(SRCDIR)/dsfmt.mk
237230
include $(SRCDIR)/objconv.mk
238231
include $(SRCDIR)/blastrampoline.mk

0 commit comments

Comments
 (0)