diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 63ea55230ddd8..6b3979460fad3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -189,7 +189,7 @@ Note: These instructions are for adding to or improving functionality in the bas Add new code to Julia's base libraries as follows (this is the "basic" approach; see a more efficient approach in the next section): - 1. Edit the appropriate file in the `base/` directory, or add new files if necessary. Create tests for your functionality and add them to files in the `test/` directory. If you're editing C or Scheme code, most likely it lives in `src/` or one of its subdirectories, although some aspects of Julia's REPL initialization live in `ui/`. + 1. Edit the appropriate file in the `base/` directory, or add new files if necessary. Create tests for your functionality and add them to files in the `test/` directory. If you're editing C or Scheme code, most likely it lives in `src/` or one of its subdirectories, although some aspects of Julia's REPL initialization live in `cli/`. 2. Add any new files to `sysimg.jl` in order to build them into the Julia system image. diff --git a/HISTORY.md b/HISTORY.md index 3e9142291dc91..ea221cf5c8ef2 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -4860,7 +4860,7 @@ New language features shell. For example: julia> ;ls - CONTRIBUTING.md Makefile VERSION deps/ julia@ ui/ + CONTRIBUTING.md Makefile VERSION cli/ deps/ julia@ DISTRIBUTING.md NEWS.md Windows.inc doc/ src/ usr/ LICENSE.md README.md base/ etc/ test/ Make.inc README.windows.md contrib/ examples/ tmp/ diff --git a/Make.inc b/Make.inc index df2e522cad09f..f9360b330a27a 100644 --- a/Make.inc +++ b/Make.inc @@ -605,10 +605,29 @@ else endif # On Windows, we want shared library files to end up in $(build_bindir), instead of $(build_libdir) +# We also don't really have a private bindir on windows right now, due to lack of RPATH. ifeq ($(OS),WINNT) build_shlibdir := $(build_bindir) +shlibdir := $(bindir) +private_shlibdir := $(bindir) else build_shlibdir := $(build_libdir) +shlibdir := $(libdir) +private_shlibdir := $(private_libdir) +endif + +# If we're on windows, don't do versioned shared libraries. If we're on OSX, +# put the version number before the .dylib. Otherwise, put it after. +ifeq ($(OS), WINNT) +JL_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT) +else +ifeq ($(OS), Darwin) +JL_MAJOR_MINOR_SHLIB_EXT := $(SOMAJOR).$(SOMINOR).$(SHLIB_EXT) +JL_MAJOR_SHLIB_EXT := $(SOMAJOR).$(SHLIB_EXT) +else +JL_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) +JL_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR) +endif endif ifeq ($(OS), FreeBSD) @@ -1451,6 +1470,52 @@ JULIA_SYSIMG_debug := $(build_private_libdir)/sys-debug.$(SHLIB_EXT) JULIA_SYSIMG_release := $(build_private_libdir)/sys.$(SHLIB_EXT) JULIA_SYSIMG := $(JULIA_SYSIMG_$(JULIA_BUILD_MODE)) +define dep_lib_path +$$($(PYTHON) $(call python_cygpath,$(JULIAHOME)/contrib/relative_path.py) $(1) $(2)) +endef + +LIBJULIA_BUILD_DEPLIB := $(call dep_lib_path,$(build_bindir),$(build_shlibdir)/libjulia.$(JL_MAJOR_MINOR_SHLIB_EXT)) +LIBJULIA_INSTALL_DEPLIB := $(call dep_lib_path,$(bindir),$(shlibdir)/libjulia.$(JL_MAJOR_MINOR_SHLIB_EXT)) + +LIBJULIA_DEBUG_BUILD_DEPLIB := $(call dep_lib_path,$(build_bindir),$(build_shlibdir)/libjulia-debug.$(JL_MAJOR_MINOR_SHLIB_EXT)) +LIBJULIA_DEBUG_INSTALL_DEPLIB := $(call dep_lib_path,$(bindir),$(shlibdir)/libjulia-debug.$(JL_MAJOR_MINOR_SHLIB_EXT)) + +ifeq ($(OS),WINNT) +ifeq ($(BINARY),32) +LIBGCC_NAME := libgcc_s_sjlj-1.$(SHLIB_EXT) +else +LIBGCC_NAME := libgcc_s_seh-1.$(SHLIB_EXT) +endif +LIBOPENLIBM_NAME := libopenlibm.$(SHLIB_EXT) +endif +ifeq ($(OS),Darwin) +LIBGCC_NAME := libgcc_s.1.$(SHLIB_EXT) +LIBOPENLIBM_NAME := libopenlibm.3.$(SHLIB_EXT) +endif +ifneq ($(findstring $(OS),Linux FreeBSD),) +LIBGCC_NAME := libgcc_s.$(SHLIB_EXT).1 +LIBOPENLIBM_NAME := libopenlibm.$(SHLIB_EXT).3 +endif + +LIBGCC_BUILD_DEPLIB := $(call dep_lib_path,$(build_bindir),$(build_shlibdir)/$(LIBGCC_NAME)) +LIBGCC_INSTALL_DEPLIB := $(call dep_lib_path,$(bindir),$(private_shlibdir)/$(LIBGCC_NAME)) +LIBOPENLIBM_BUILD_DEPLIB := $(call dep_lib_path,$(build_bindir),$(build_shlibdir)/$(LIBOPENLIBM_NAME)) +LIBOPENLIBM_INSTALL_DEPLIB := $(call dep_lib_path,$(bindir),$(private_shlibdir)/$(LIBOPENLIBM_NAME)) + +# We list: +# * libgcc_s, because FreeBSD needs to load ours, not the system one. +# * libopenlibm, because Windows has an untrustworthy libm, and we want to use ours more than theirs +# * libjulia, which must always come last. +# +# We need these four separate variables because: +# * debug builds must link against libjuliadebug, not libjulia +# * install time relative paths are not equal to build time relative paths (../lib vs. ../lib/julia) +# That second point will no longer be true for most deps once they are placed within Artifacts directories. +LOADER_BUILD_DEP_LIBS = $(LIBGCC_BUILD_DEPLIB):$(LIBOPENLIBM_BUILD_DEPLIB):$(LIBJULIA_BUILD_DEPLIB) +LOADER_DEBUG_BUILD_DEP_LIBS = $(LIBGCC_BUILD_DEPLIB):$(LIBOPENLIBM_BUILD_DEPLIB):$(LIBJULIA_DEBUG_BUILD_DEPLIB) +LOADER_INSTALL_DEP_LIBS = $(LIBGCC_INSTALL_DEPLIB):$(LIBOPENLIBM_INSTALL_DEPLIB):$(LIBJULIA_INSTALL_DEPLIB) +LOADER_DEBUG_INSTALL_DEP_LIBS = $(LIBGCC_INSTALL_DEPLIB):$(LIBOPENLIBM_INSTALL_DEPLIB):$(LIBJULIA_DEBUG_INSTALL_DEPLIB) + # Colors for make ifndef VERBOSE VERBOSE := 0 diff --git a/Makefile b/Makefile index 30dfac383bed8..72c910d924b0e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ all: debug release # sort is used to remove potential duplicates DIRS := $(sort $(build_bindir) $(build_depsbindir) $(build_libdir) $(build_private_libdir) $(build_libexecdir) $(build_includedir) $(build_includedir)/julia $(build_sysconfdir)/julia $(build_datarootdir)/julia $(build_datarootdir)/julia/stdlib $(build_man1dir)) ifneq ($(BUILDROOT),$(JULIAHOME)) -BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src src/flisp src/support src/clangsa ui doc deps stdlib test test/embedding test/llvmpasses) +BUILDDIRS := $(BUILDROOT) $(addprefix $(BUILDROOT)/,base src src/flisp src/support src/clangsa cli doc deps stdlib test test/embedding test/llvmpasses) BUILDDIRMAKE := $(addsuffix /Makefile,$(BUILDDIRS)) $(BUILDROOT)/sysimage.mk DIRS := $(DIRS) $(BUILDDIRS) $(BUILDDIRMAKE): | $(BUILDDIRS) @@ -46,7 +46,7 @@ julia_flisp.boot.inc.phony: julia-deps $(BUILDROOT)/doc/_build/html/en/index.html: $(shell find $(BUILDROOT)/base $(BUILDROOT)/doc \( -path $(BUILDROOT)/doc/_build -o -path $(BUILDROOT)/doc/deps -o -name *_constants.jl -o -name *_h.jl -o -name version_git.jl \) -prune -o -type f -print) @$(MAKE) docs -julia-symlink: julia-ui-$(JULIA_BUILD_MODE) +julia-symlink: julia-cli-$(JULIA_BUILD_MODE) ifeq ($(OS),WINNT) @echo '@"%~dp0"\'"$$(echo $(call rel_path,$(BUILDROOT),$(JULIA_EXECUTABLE)) | tr / '\\')" '%*' > $(BUILDROOT)/julia.bat chmod a+x $(BUILDROOT)/julia.bat @@ -74,16 +74,16 @@ julia-libllvmcalltest: julia-deps julia-src-release julia-src-debug : julia-src-% : julia-deps julia_flisp.boot.inc.phony @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/src libjulia-$* -julia-ui-release julia-ui-debug : julia-ui-% : julia-src-% - @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/ui julia-$* +julia-cli-release julia-cli-debug : julia-cli-% : julia-src-% + @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT)/cli julia-$* -julia-sysimg-ji : julia-stdlib julia-base julia-ui-$(JULIA_BUILD_MODE) | $(build_private_libdir) +julia-sysimg-ji : julia-stdlib julia-base julia-cli-$(JULIA_BUILD_MODE) | $(build_private_libdir) @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-ji JULIA_EXECUTABLE='$(JULIA_EXECUTABLE)' -julia-sysimg-bc : julia-stdlib julia-base julia-ui-$(JULIA_BUILD_MODE) | $(build_private_libdir) +julia-sysimg-bc : julia-stdlib julia-base julia-cli-$(JULIA_BUILD_MODE) | $(build_private_libdir) @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-bc JULIA_EXECUTABLE='$(JULIA_EXECUTABLE)' -julia-sysimg-release julia-sysimg-debug : julia-sysimg-% : julia-sysimg-ji julia-ui-% +julia-sysimg-release julia-sysimg-debug : julia-sysimg-% : julia-sysimg-ji julia-cli-% @$(MAKE) $(QUIET_MAKE) -C $(BUILDROOT) -f sysimage.mk sysimg-$* julia-debug julia-release : julia-% : julia-sysimg-% julia-symlink julia-libccalltest julia-libllvmcalltest julia-base-cache @@ -154,9 +154,9 @@ julia-base-cache: julia-sysimg-$(JULIA_BUILD_MODE) | $(DIRS) $(build_datarootdir $(call cygpath_w,$(build_datarootdir)/julia/base.cache)) # public libraries, that are installed in $(prefix)/lib -JL_TARGETS := julia +JL_TARGETS := julia julialoader ifeq ($(BUNDLE_DEBUG_LIBS),1) -JL_TARGETS += julia-debug +JL_TARGETS += julia-debug julialoader-debug endif # private libraries, that are installed in $(prefix)/lib/julia @@ -268,7 +268,7 @@ endif define stringreplace - $(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep '$2' | awk '{print $$1;}') '$3' 255 "$(call cygpath_w,$1)" + $(build_depsbindir)/stringreplace $$(strings -t x - $1 | grep $2 | awk '{print $$1;}') $3 255 "$(call cygpath_w,$1)" endef # Run fixup-libgfortran on all platforms but Windows and FreeBSD. On FreeBSD we @@ -413,8 +413,19 @@ endif if [ $(BUNDLE_DEBUG_LIBS) = 1 ]; then \ $(call stringreplace,$${DEBUG_TARGET},sys-debug.$(SHLIB_EXT)$$,$(private_libdir_rel)/sys-debug.$(SHLIB_EXT)); \ fi; +endif + +ifneq ($(LOADER_BUILD_DEP_LIBS),$(LOADER_INSTALL_DEP_LIBS)) + # Next, overwrite relative path to libjulia in our loaders if $(LOADER_BUILD_DEP_LIBS) != $(LOADER_INSTALL_DEP_LIBS) + $(call stringreplace,$(DESTDIR)$(bindir)/julia,$(LOADER_BUILD_DEP_LIBS)$$,$(LOADER_INSTALL_DEP_LIBS)) + $(call stringreplace,$(DESTDIR)$(shlibdir)/libjulialoader.$(JL_MAJOR_MINOR_SHLIB_EXT),$(LOADER_BUILD_DEP_LIBS)$$,$(LOADER_INSTALL_DEP_LIBS)) +ifeq ($(BUNDLE_DEBUG_LIBS),1) + $(call stringreplace,$(DESTDIR)$(bindir)/julia-debug,$(LOADER_DEBUG_BUILD_DEP_LIBS)$$,$(LOADER_DEBUG_INSTALL_DEP_LIBS)) + $(call stringreplace,$(DESTDIR)$(shlibdir)/libjulialoader-debug.$(JL_MAJOR_MINOR_SHLIB_EXT),$(LOADER_DEBUG_BUILD_DEP_LIBS)$$,$(LOADER_DEBUG_INSTALL_DEP_LIBS)) endif +endif + # On FreeBSD, remove the build's libdir from each library's RPATH ifeq ($(OS),FreeBSD) $(JULIAHOME)/contrib/fixup-rpath.sh "$(PATCHELF)" $(DESTDIR)$(libdir) $(build_libdir) @@ -435,6 +446,12 @@ endif ifeq ($(DARWIN_FRAMEWORK),1) $(MAKE) -C $(JULIAHOME)/contrib/mac/framework frameworknoinstall endif +ifeq ($(OS),Linux) +ifeq ($(prefix),$(abspath julia-$(JULIA_COMMIT))) + # Only fixup libstdc++ if `prefix` is not set. + -$(JULIAHOME)/contrib/fixup-libstdc++.sh $(DESTDIR)$(libdir) $(DESTDIR)$(private_libdir) +endif +endif distclean: -rm -fr $(BUILDROOT)/julia-*.tar.gz $(BUILDROOT)/julia*.exe $(BUILDROOT)/julia-$(JULIA_COMMIT) @@ -457,9 +474,7 @@ endif @$(MAKE) -C $(BUILDROOT) -f $(JULIAHOME)/Makefile install cp $(JULIAHOME)/LICENSE.md $(BUILDROOT)/julia-$(JULIA_COMMIT) ifeq ($(OS), Linux) - -$(JULIAHOME)/contrib/fixup-libstdc++.sh $(DESTDIR)$(libdir) $(DESTDIR)$(private_libdir) - - # Copy over any bundled ca certs we picked up from the system during buildi + # Copy over any bundled ca certs we picked up from the system during build -cp $(build_datarootdir)/julia/cert.pem $(DESTDIR)$(datarootdir)/julia/ endif ifeq ($(OS), WINNT) @@ -531,7 +546,7 @@ clean: | $(CLEAN_TARGETS) @-$(MAKE) -C $(BUILDROOT)/base clean @-$(MAKE) -C $(BUILDROOT)/doc clean @-$(MAKE) -C $(BUILDROOT)/src clean - @-$(MAKE) -C $(BUILDROOT)/ui clean + @-$(MAKE) -C $(BUILDROOT)/cli clean @-$(MAKE) -C $(BUILDROOT)/test clean @-$(MAKE) -C $(BUILDROOT)/stdlib clean -rm -f $(BUILDROOT)/julia @@ -555,7 +570,7 @@ distcleanall: cleanall .PHONY: default debug release check-whitespace release-candidate \ julia-debug julia-release julia-stdlib julia-deps julia-deps-libs \ - julia-ui-release julia-ui-debug julia-src-release julia-src-debug \ + julia-cli-release julia-cli-debug julia-src-release julia-src-debug \ julia-symlink julia-base julia-sysimg julia-sysimg-ji julia-sysimg-release julia-sysimg-debug \ test testall testall1 test test-* test-revise-* \ clean distcleanall cleanall clean-* \ diff --git a/README.md b/README.md index a600f0f43fd83..de88f541e0c25 100644 --- a/README.md +++ b/README.md @@ -121,13 +121,13 @@ The Julia source code is organized as follows: | - | - | | `base/` | source code for the Base module (part of Julia's standard library) | | `stdlib/` | source code for other standard library packages | +| `cli/` | source for the command line interface/REPL | | `contrib/` | editor support for Julia source, miscellaneous scripts | | `deps/` | external dependencies | | `doc/src/manual/` | source for the user manual | | `doc/build/` | detailed notes for building Julia | | `src/` | source for Julia language core | | `test/` | test suites | -| `ui/` | source for various front ends | | `usr/` | binaries and shared libraries loaded by Julia's standard libraries | ## Terminal, Editors and IDEs diff --git a/base/Base.jl b/base/Base.jl index 2fbba2a3468ae..3c8c848cf1306 100644 --- a/base/Base.jl +++ b/base/Base.jl @@ -115,6 +115,20 @@ using .Iterators: Flatten, Filter, product # for generators include("namedtuple.jl") +# For OS specific stuff +# We need to strcat things here, before strings are really defined +function strcat(x::String, y::String) + out = ccall(:jl_alloc_string, Ref{String}, (Csize_t,), Core.sizeof(x) + Core.sizeof(y)) + GC.@preserve x y out begin + out_ptr = unsafe_convert(Ptr{UInt8}, out) + unsafe_copyto!(out_ptr, unsafe_convert(Ptr{UInt8}, x), Core.sizeof(x)) + unsafe_copyto!(out_ptr + Core.sizeof(x), unsafe_convert(Ptr{UInt8}, y), Core.sizeof(y)) + end + return out +end +include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "build_h.jl")) # include($BUILDROOT/base/build_h.jl) +include(strcat((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "version_git.jl")) # include($BUILDROOT/base/version_git.jl) + # numeric operations include("hashing.jl") include("rounding.jl") @@ -163,10 +177,6 @@ include("strings/basic.jl") include("strings/string.jl") include("strings/substring.jl") -# For OS specific stuff -include(string((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "build_h.jl")) # include($BUILDROOT/base/build_h.jl) -include(string((length(Core.ARGS)>=2 ? Core.ARGS[2] : ""), "version_git.jl")) # include($BUILDROOT/base/version_git.jl) - # Initialize DL_LOAD_PATH as early as possible. We are defining things here in # a slightly more verbose fashion than usual, because we're running so early. const DL_LOAD_PATH = String[] diff --git a/base/rounding.jl b/base/rounding.jl index 1628d7a01ec1d..46c359ad54459 100644 --- a/base/rounding.jl +++ b/base/rounding.jl @@ -151,8 +151,8 @@ See [`RoundingMode`](@ref) for available modes. """ :rounding -setrounding_raw(::Type{<:Union{Float32,Float64}}, i::Integer) = ccall(:fesetround, Int32, (Int32,), i) -rounding_raw(::Type{<:Union{Float32,Float64}}) = ccall(:fegetround, Int32, ()) +setrounding_raw(::Type{<:Union{Float32,Float64}}, i::Integer) = ccall((:fesetround, Base.libm_name), Int32, (Int32,), i) +rounding_raw(::Type{<:Union{Float32,Float64}}) = ccall((:fegetround, Base.libm_name), Int32, ()) rounding(::Type{T}) where {T<:Union{Float32,Float64}} = from_fenv(rounding_raw(T)) diff --git a/ui/.gitignore b/cli/.gitignore similarity index 100% rename from ui/.gitignore rename to cli/.gitignore diff --git a/ui/Makefile b/cli/Makefile similarity index 50% rename from ui/Makefile rename to cli/Makefile index 6ccb8c1fafb03..39cabecf1be81 100644 --- a/ui/Makefile +++ b/cli/Makefile @@ -5,44 +5,46 @@ include $(JULIAHOME)/deps/Versions.make include $(JULIAHOME)/Make.inc include $(JULIAHOME)/deps/llvm-ver.make -override CFLAGS += $(JCFLAGS) -override CXXFLAGS += $(JCXXFLAGS) -override CPPFLAGS += $(JCPPFLAGS) - -SRCS := repl HEADERS := $(addprefix $(JULIAHOME)/src/,julia.h julia_assert.h julia_threads.h julia_internal.h options.h) \ $(BUILDDIR)/../src/julia_version.h $(wildcard $(JULIAHOME)/src/support/*.h) $(LIBUV_INC)/uv.h -FLAGS := -I$(BUILDROOT)/src -I$(JULIAHOME)/src -I$(JULIAHOME)/src/support -I$(build_includedir) -ifneq ($(USEMSVC), 1) -FLAGS += -Wall -Wno-strict-aliasing -fno-omit-frame-pointer -Wc++-compat -endif +LOADER_CFLAGS = $(JCFLAGS) -I$(BUILDROOT)/src -I$(JULIAHOME)/src -I$(JULIAHOME)/src/support -I$(build_includedir) -ffreestanding +LOADER_LDFLAGS = $(JLDFLAGS) -ffreestanding -OBJS := $(SRCS:%=$(BUILDDIR)/%.o) -DOBJS := $(SRCS:%=$(BUILDDIR)/%.dbg.obj) -DEBUGFLAGS += $(FLAGS) -SHIPFLAGS += $(FLAGS) -JLDFLAGS += $(LDFLAGS) $(NO_WHOLE_ARCHIVE) $(OSLIBS) $(RPATH) - -ifeq ($(USE_SYSTEM_LIBM),0) -ifneq ($(UNTRUSTED_SYSTEM_LIBM),0) -JLDFLAGS += $(WHOLE_ARCHIVE) $(build_libdir)/libopenlibm.a $(NO_WHOLE_ARCHIVE) -endif +ifeq ($(OS),WINNT) +LOADER_CFLAGS += -municode -mconsole -nostdlib -fno-stack-check -fno-stack-protector -mno-stack-arg-probe endif ifeq ($(OS),WINNT) -JLDFLAGS += -municode +LOADER_LDFLAGS += -municode -mconsole -nostdlib --disable-auto-import \ + --disable-runtime-pseudo-reloc -lntdll -lkernel32 -lpsapi +else ifeq ($(OS),Linux) +LOADER_LDFLAGS += -Wl,--no-as-needed -ldl -lpthread -rdynamic -lc -Wl,--as-needed +else ifeq ($(OS),FreeBSD) +LOADER_LDFLAGS += -Wl,--no-as-needed -ldl -lpthread -rdynamic -lc -Wl,--as-needed +else ifeq ($(OS),Darwin) +LOADER_LDFLAGS += -lSystem endif +# Build list of dependent libraries that must be opened +SHIPFLAGS += -DDEP_LIBS="\"$(LOADER_BUILD_DEP_LIBS)\"" +DEBUGFLAGS += -DDEP_LIBS="\"$(LOADER_DEBUG_BUILD_DEP_LIBS)\"" + +SRCS := loader_exe loader_lib +OBJS := $(SRCS:%=$(BUILDDIR)/%.o) +DOBJS := $(SRCS:%=$(BUILDDIR)/%.dbg.obj) +LIB_OBJS := $(BUILDDIR)/loader_lib.o +LIB_DOBJS := $(BUILDDIR)/loader_lib.dbg.obj + default: release all: release debug release debug : % : julia-% $(BUILDDIR)/%.o: $(SRCDIR)/%.c $(HEADERS) - @$(call PRINT_CC, $(CC) $(CPPFLAGS) $(CFLAGS) $(SHIPFLAGS) -c $< -o $@) + @$(call PRINT_CC, $(CC) $(SHIPFLAGS) $(LOADER_CFLAGS) -c $< -o $@) $(BUILDDIR)/%.dbg.obj: $(SRCDIR)/%.c $(HEADERS) - @$(call PRINT_CC, $(CC) $(CPPFLAGS) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@) + @$(call PRINT_CC, $(CC) $(DEBUGFLAGS) $(LOADER_CFLAGS) -c $< -o $@) ifeq ($(OS),WINNT) ifneq ($(USEMSVC), 1) @@ -57,8 +59,8 @@ DOBJS += julia_res.o endif endif -julia-release: $(build_bindir)/julia$(EXE) -julia-debug: $(build_bindir)/julia-debug$(EXE) +julia-release: $(build_bindir)/julia$(EXE) $(build_shlibdir)/libjulialoader.$(JL_MAJOR_MINOR_SHLIB_EXT) +julia-debug: $(build_bindir)/julia-debug$(EXE) $(build_shlibdir)/libjulialoader-debug.$(JL_MAJOR_MINOR_SHLIB_EXT) # Embed an Info.plist in the julia executable # Create an intermediate target Info.plist for Darwin code signing. @@ -76,16 +78,27 @@ $(build_bindir)/julia$(EXE): $(BUILDDIR)/Info.plist $(build_bindir)/julia-debug$(EXE): $(BUILDDIR)/Info.plist endif -ifneq ($(USEMSVC), 1) -CXXLD := $(CXX) -else -CXXLD := $(LD) +$(build_shlibdir)/libjulialoader.$(JL_MAJOR_MINOR_SHLIB_EXT): $(LIB_OBJS) + @$(call PRINT_LINK, $(CC) $(LOADER_CFLAGS) -shared $(SHIPFLAGS) $^ -o $@ $(LOADER_LDFLAGS) $(RPATH_LIB)) +ifneq ($(OS), WINNT) + @ln -sf $(notdir $@) $(build_shlibdir)/libjulialoader.$(JL_MAJOR_SHLIB_EXT) + @ln -sf $(notdir $@) $(build_shlibdir)/libjulialoader.$(SHLIB_EXT) +endif + + +$(build_shlibdir)/libjulialoader-debug.$(JL_MAJOR_MINOR_SHLIB_EXT): $(LIB_DOBJS) + @$(call PRINT_LINK, $(CC) $(LOADER_CFLAGS) -shared $(DEBUGFLAGS) $^ -o $@ $(LOADER_LDFLAGS) $(RPATH_LIB)) +ifneq ($(OS), WINNT) + @ln -sf $(notdir $@) $(build_shlibdir)/libjulialoader-debug.$(JL_MAJOR_SHLIB_EXT) + @ln -sf $(notdir $@) $(build_shlibdir)/libjulialoader-debug.$(SHLIB_EXT) endif $(build_bindir)/julia$(EXE): $(OBJS) - @$(call PRINT_LINK, $(CXXLD) $(CXXFLAGS) $(CXXLDFLAGS) $(LINK_FLAGS) $(SHIPFLAGS) $(OBJS) -o $@ -L$(build_private_libdir) -L$(build_libdir) -L$(build_shlibdir) -ljulia $(JLDFLAGS) $(CXXLDFLAGS)) + @$(call PRINT_LINK, $(CC) $(LOADER_CFLAGS) $(SHIPFLAGS) $^ -o $@ $(LOADER_LDFLAGS) $(RPATH)) + $(build_bindir)/julia-debug$(EXE): $(DOBJS) - @$(call PRINT_LINK, $(CXXLD) $(CXXFLAGS) $(CXXLDFLAGS) $(LINK_FLAGS) $(DEBUGFLAGS) $(DOBJS) -o $@ -L$(build_private_libdir) -L$(build_libdir) -L$(build_shlibdir) -ljulia-debug $(JLDFLAGS) $(CXXLDFLAGS)) + @$(call PRINT_LINK, $(CC) $(LOADER_CFLAGS) $(DEBUGFLAGS) $^ -o $@ $(LOADER_LDFLAGS) $(RPATH)) + clean: | $(CLEAN_TARGETS) rm -f *.o *.dbg.obj diff --git a/cli/loader.h b/cli/loader.h new file mode 100644 index 0000000000000..42b777a623077 --- /dev/null +++ b/cli/loader.h @@ -0,0 +1,64 @@ +/* Bring in definitions for `_OS_X_`, `PATH_MAX` and `PATHSEPSTRING`, `jl_ptls_t`, etc... */ +#include "../src/support/platform.h" +#include "../src/support/dirpath.h" + +#ifdef _OS_WINDOWS_ +/* We need to reimplement a bunch of standard library stuff on windows, + * but we want to make sure that it doesn't conflict with the actual implementations + * once those get linked into this process. */ +#define fwrite loader_fwrite +#define fputs loader_fputs +#define exit loader_exit +#define strlen loader_strlen +#define wcslen loader_wcslen +#define strncat loader_strncat +#define memcpy loader_memcpy +#define dirname loader_dirname +#define strchr loader_strchr +#define malloc loader_malloc +#define realloc loader_realloc +#endif + +#ifdef _OS_WINDOWS_ +#define WIN32_LEAN_AND_MEAN +#include +#else +#ifdef _OS_DARWIN_ +#include +#endif +#ifdef _OS_FREEBSD_ +#include +#include +#endif +#include +#include +#include +#include +#include + +#include +#include +#endif + +// Borrow definitions from `julia.h` +#if defined(__GNUC__) +# define JL_CONST_FUNC __attribute__((const)) +#elif defined(_COMPILER_MICROSOFT_) +# define JL_CONST_FUNC __declspec(noalias) +#else +# define JL_CONST_FUNC +#endif + + +// Declarations from `loader_lib.c` and `loader_win_utils.c` +extern const char * get_exe_dir(); +extern int load_repl(const char *, int, char **); +void print_stderr(const char * msg); +void print_stderr3(const char * msg1, const char * msg2, const char * msg3); + +#ifdef _OS_WINDOWS_ +LPWSTR *CommandLineToArgv(LPWSTR lpCmdLine, int *pNumArgs); +int wchar_to_utf8(const wchar_t * wstr, char *str, size_t maxlen); +int utf8_to_wchar(const char * str, wchar_t *wstr, size_t maxlen); +void setup_stdio(void); +#endif diff --git a/cli/loader_exe.c b/cli/loader_exe.c new file mode 100644 index 0000000000000..74d8a150dc639 --- /dev/null +++ b/cli/loader_exe.c @@ -0,0 +1,55 @@ +#include "loader.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Define ptls getter, as this cannot be defined within a shared library. */ +#if !defined(_OS_WINDOWS_) && !defined(_OS_DARWIN_) +__attribute__ ((visibility("default"))) JL_CONST_FUNC void * jl_get_ptls_states_static(void) +{ + /* Because we can't #include in this file, we define a TLS state object with + * hopefully enough room; at last check, the `jl_tls_states_t` struct was <16KB. */ + static __attribute__((tls_model("local-exec"))) __thread char tls_states[32768]; + return &tls_states; +} +#endif + +#ifdef _OS_WINDOWS_ +int mainCRTStartup(void) +{ + int argc; + LPWSTR * wargv = CommandLineToArgv(GetCommandLine(), &argc); + char ** argv = (char **)malloc(sizeof(char *)*(argc+ 1)); + setup_stdio(); +#else +int main(int argc, char * argv[]) +{ +#endif + // Immediately get the current exe dir, allowing us to calculate relative paths. + const char * exe_dir = get_exe_dir(); + +#ifdef _OS_WINDOWS_ + // Convert Windows wchar_t values to UTF8 + for (int i=0; iisconsole) { + if (WriteConsole(out->fd, str, nchars, &written, NULL)) + return written; + } else { + if (WriteFile(out->fd, str, sizeof(WCHAR) * nchars, &written, NULL)) + return written; + } + return -1; +} + +int loader_fputs(const char *str, FILE *out) { + wchar_t wstr[1024]; + utf8_to_wchar(str, wstr, 1024); + return fwrite(wstr, wcslen(wstr), out); +} + +void * loader_malloc(const size_t size) { + return HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, size); +} + +void * loader_realloc(void * mem, const size_t size) { + return HeapReAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, mem, size); +} + +LPWSTR *CommandLineToArgv(LPWSTR lpCmdLine, int *pNumArgs) { + LPWSTR out = lpCmdLine; + LPWSTR cmd = out; + unsigned MaxEntries = 4; + unsigned backslashes = 0; + int in_quotes = 0; + int empty = 1; + LPWSTR *cmds; + *pNumArgs = 0; + cmds = (LPWSTR*)malloc(sizeof(LPWSTR) * MaxEntries); + while (1) { + WCHAR c = *lpCmdLine++; + switch (c) { + case 0: + if (!empty) { + *out++ = '\0'; + cmds[(*pNumArgs)++] = cmd; + } + cmds[*pNumArgs] = NULL; + return cmds; + default: + *out++ = c; + empty = 0; + break; + case '"': + out -= backslashes / 2; // remove half of the backslashes + if (backslashes % 2) + *(out - 1) = '"'; // replace \ with " + else + in_quotes = !in_quotes; // treat as quote delimater + empty = 0; + break; + case '\t': + case ' ': + if (in_quotes) { + *out++ = c; + } else if (!empty) { + *out++ = '\0'; + cmds[(*pNumArgs)++] = cmd; + cmd = out; + empty = 1; + if (*pNumArgs >= MaxEntries - 1) { + MaxEntries *= 2; + cmds = (LPWSTR*)realloc(cmds, sizeof(LPWSTR) * MaxEntries); + } + } + } + if (c == '\\') + backslashes++; + else + backslashes = 0; + } +} + +void setup_stdio() { + DWORD mode = 0; + _stdout.fd = GetStdHandle(STD_OUTPUT_HANDLE); + _stdout.isconsole = GetConsoleMode(_stdout.fd, &mode); + _stderr.fd = GetStdHandle(STD_ERROR_HANDLE); + _stderr.isconsole = GetConsoleMode(_stderr.fd, &mode); +} + +void loader_exit(int code) { + ExitProcess(code); +} + + +/* Utilities to convert from Windows' wchar_t stuff to UTF-8 */ +int wchar_to_utf8(const wchar_t * wstr, char *str, size_t maxlen) { + /* Fast-path empty strings, as WideCharToMultiByte() returns zero for them. */ + if (wstr[0] == L'\0') { + str[0] = '\0'; + return 1; + } + size_t len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL); + if (!len) + return 0; + if (len > maxlen) + return 0; + if (!WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL)) + return 0; + return 1; +} + +int utf8_to_wchar(const char * str, wchar_t * wstr, size_t maxlen) { + /* Fast-path empty strings, as WideCharToMultiByte() returns zero for them. */ + if (str[0] == '\0') { + wstr[0] = L'\0'; + return 1; + } + size_t len = MultiByteToWideChar(CP_UTF8, 0, str, -1, NULL, 0); + if (!len) + return 0; + if (len > maxlen) + return 0; + if (!MultiByteToWideChar(CP_UTF8, 0, str, -1, wstr, len)) + return 0; + return 1; +} + +size_t loader_strlen(const char * x) { + int idx = 0; + while (x[idx] != 0) + idx++; + return idx; +} + +size_t loader_wcslen(const wchar_t * x) { + int idx = 0; + while (x[idx] != 0) + idx++; + return idx; +} + +char * loader_strncat(char * base, const char * tail, size_t maxlen) { + int base_len = strlen(base); + int tail_len = strlen(tail); + for (int idx=base_len; idx 0 && x[idx] != PATHSEPSTRING[0]) { + idx -= 1; + } + if (x[idx] == PATHSEPSTRING[0]) { + // Special-case x == "/" + if (idx == 0) { + x[1] = '\0'; + return x; + } else { + x[idx] = '\0'; + return x; + } + } + x[0] = '.'; + x[1] = '\0'; + return x; +} + +char * loader_strchr(const char * haystack, int needle) { + int idx=0; + while (haystack[idx] != needle) { + if (haystack[idx] == 0) { + return NULL; + } + idx++; + } + return (char *)haystack + idx; +} diff --git a/contrib/mac/framework/Makefile b/contrib/mac/framework/Makefile index 4449436ac6fd2..1d8691151397d 100644 --- a/contrib/mac/framework/Makefile +++ b/contrib/mac/framework/Makefile @@ -159,7 +159,7 @@ endif #NB: must be the last lines of the recipe, else signature may be invalidated. # Codesign should look at the embedded Info.plist to get the signing identifier. - # See JLDFLAGS in Make.inc for Darwin platform and Info.plist target in ui/Makefile. + # See JLDFLAGS in Make.inc for Darwin platform and Info.plist target in cli/Makefile. codesign -s "$(DARWIN_CODESIGN_KEYCHAIN_IDENTITY)" -v $(darwin_codesign_options) $(darwin_codesign_julia_options) $(DESTDIR)$(prefix)/$(framework_helpers)/julia ifeq ($(BUNDLE_DEBUG_LIBS),1) codesign -s "$(DARWIN_CODESIGN_KEYCHAIN_IDENTITY)" -v $(darwin_codesign_options) $(darwin_codesign_julia_options) $(DESTDIR)$(prefix)/$(framework_helpers)/julia-debug diff --git a/deps/Versions.make b/deps/Versions.make index 6ed63798bccd2..dcf387895fed6 100644 --- a/deps/Versions.make +++ b/deps/Versions.make @@ -9,7 +9,7 @@ OPENBLAS_BB_REL = 0 LAPACK_VER = 3.9.0 SUITESPARSE_VER = 5.4.0 SUITESPARSE_BB_REL = 6 -OPENLIBM_VER = 0.7.0 +OPENLIBM_VER = 0.7.1 OPENLIBM_BB_REL = 0 UNWIND_VER = 1.3.1 UNWIND_BB_REL = 4 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-gnu.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-gnu.tar.gz/md5 deleted file mode 100644 index 10c01865c80d7..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-gnu.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -3f445fab4bbc703837fce894c31483f3 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-gnu.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-gnu.tar.gz/sha512 deleted file mode 100644 index c9d5e8a483160..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-gnu.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -7d3dcd96ab672e2c4323d7ba4e7b44f1cf0e8283fe3df13d0add40f0a5ed31176bd5cf0f222720e08f1fb9368027527bd495d72d54195330fb0671e004b30096 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-musl.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-musl.tar.gz/md5 deleted file mode 100644 index b482e64c91e26..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-musl.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -b73fc13eb967d8f7502ffd5b314e80b2 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-musl.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-musl.tar.gz/sha512 deleted file mode 100644 index 3ae7e129256b1..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.aarch64-linux-musl.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -bd46a21fc6308a1bbc626b5002c4ff029f50d738fac4d58391afc3301ec13feb4e781bfe6d664c962d02a84e970221aa2e7e17a9328d4cf5e3db7b4b6fcbbe7b diff --git a/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-gnueabihf.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-gnueabihf.tar.gz/md5 deleted file mode 100644 index 8ac7ccced578a..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-gnueabihf.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -78dc354ee31636c3bdc6bd59bd0254cc diff --git a/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-gnueabihf.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-gnueabihf.tar.gz/sha512 deleted file mode 100644 index 2bdc2f57a7cbb..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-gnueabihf.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -161cfad57e4adb911895c548e38a722d7b8245741b0cc147d10a4656c0bbe1c5ed2b7b1450d88dbef666dc9882bc9f32897b584e306f96e1ced71cc8d8365699 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-musleabihf.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-musleabihf.tar.gz/md5 deleted file mode 100644 index 6a28da64c4ab4..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-musleabihf.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -926a9897fc997ef5b316e49d7ff64f2a diff --git a/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-musleabihf.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-musleabihf.tar.gz/sha512 deleted file mode 100644 index b69e57a946164..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.armv7l-linux-musleabihf.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -e47af6f94def69faf48fd356057643a197b48c19b9f76ee46894abb53a48c93a4bc32d3ce85d68e271e387b9ad1478d31a2f0eb9bfa13d4e9f02885f3ae610b4 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-gnu.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-gnu.tar.gz/md5 deleted file mode 100644 index 5b3039151c618..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-gnu.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -bd5f5add68aff856744ffcfe2f4546fe diff --git a/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-gnu.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-gnu.tar.gz/sha512 deleted file mode 100644 index bb84b8cfa27ae..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-gnu.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -8b1364665b0a2d18fe9c9fef3865790bc96679b665aecf7852decab7ca3ef1ebdbffb464b7c32806bedd74f770f1116aebf4c135dd35483bfdf4cef0fab32f40 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-musl.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-musl.tar.gz/md5 deleted file mode 100644 index 8a2f87ceed105..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-musl.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -13d9c4562fc22b840c2e6f5756dc91ab diff --git a/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-musl.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-musl.tar.gz/sha512 deleted file mode 100644 index a47a57a3a95a1..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.i686-linux-musl.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -20ab2007fac054a9231b06634fe2a368ffee6a5a5c6db80c8e44b033abefbcd5058008b694d3a0c5bdb360bd4ff1ee7be564da3c783084599c602077da966e36 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.i686-w64-mingw32.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.i686-w64-mingw32.tar.gz/md5 deleted file mode 100644 index 171610b8781c7..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.i686-w64-mingw32.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -76b2cf1608c3fd4f41383ccc9e921925 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.i686-w64-mingw32.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.i686-w64-mingw32.tar.gz/sha512 deleted file mode 100644 index 05a0b9644d62b..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.i686-w64-mingw32.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -cfc878c19d27f75d6b2d5c659d2b9acd527f6eca1aa1a8dc8528eac49da87785730807fe30955ee313d53fd074ff261e630935d882c93922f80612eb20dd07a2 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.powerpc64le-linux-gnu.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.powerpc64le-linux-gnu.tar.gz/md5 deleted file mode 100644 index 3c999649a9f83..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.powerpc64le-linux-gnu.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -7c9aaaf1b6cd7e5254fc04db07b7335c diff --git a/deps/checksums/OpenLibm.v0.7.0-0.powerpc64le-linux-gnu.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.powerpc64le-linux-gnu.tar.gz/sha512 deleted file mode 100644 index 32d485d54b6fa..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.powerpc64le-linux-gnu.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -e29d8c43768d8673c7491ad566aef4571b0540bac948ec414ca54269453e5c702afb74ac942f755be0a9adf33120a439b591926ba0ebab46ba2b325fa77c25cf diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-apple-darwin14.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-apple-darwin14.tar.gz/md5 deleted file mode 100644 index e814d7abd0117..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-apple-darwin14.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -02a808e8940dfe0233a32ea10629a2df diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-apple-darwin14.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-apple-darwin14.tar.gz/sha512 deleted file mode 100644 index 238f6cf72b57a..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-apple-darwin14.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -c6ecbc8667995859cc16e89551cb826627af70cb019729afd7277003150eb61e673eda812ebbb4fd592a3f2c9da960d833b69ff5faa148674779446cf277c31c diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-gnu.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-gnu.tar.gz/md5 deleted file mode 100644 index 7b52ca7e5a6e6..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-gnu.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -2526f73a38ef407ec118ae3ea4e5f8d8 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-gnu.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-gnu.tar.gz/sha512 deleted file mode 100644 index f0fe38b143cb0..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-gnu.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -79f495b9a5332eabae4742cd6f5233403f69ffb30e6fff30d8dee5cc10e4a278e9e00c82fc32936a4b42e3446ecad208a96fbfe2b2e9d91db15b52195f5e1fe8 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-musl.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-musl.tar.gz/md5 deleted file mode 100644 index 9ad3a577b1076..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-musl.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -08b36c9c40568e64f76a87484ff4736c diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-musl.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-musl.tar.gz/sha512 deleted file mode 100644 index 4ae29337145f7..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-linux-musl.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -8ed05913066a39338e487833574b895e3d88ae79eaa9038972e33f94ec2afab93a84a8833ecc90bacc0940f5bb6f22af8b9117bcf7e943fe1f9114ba2576f698 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-unknown-freebsd11.1.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-unknown-freebsd11.1.tar.gz/md5 deleted file mode 100644 index 30ae0420d9d84..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-unknown-freebsd11.1.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -f037929da10ae741953fcc8ffcf3802c diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-unknown-freebsd11.1.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-unknown-freebsd11.1.tar.gz/sha512 deleted file mode 100644 index 55c1b9024d2eb..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-unknown-freebsd11.1.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -bf802cc44e8638fcd8d263070e56c3bdea37899405ffe8a67d8bc16a70dba46985d6e32e5651b5596e47608db272d1e0b53a23b23633b84d6dd3a51a5b52eb88 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-w64-mingw32.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-w64-mingw32.tar.gz/md5 deleted file mode 100644 index a89d30876186a..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-w64-mingw32.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -6e8c1ee1b5733301aacd19165d8376c1 diff --git a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-w64-mingw32.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.0-0.x86_64-w64-mingw32.tar.gz/sha512 deleted file mode 100644 index 9e971b9c319ee..0000000000000 --- a/deps/checksums/OpenLibm.v0.7.0-0.x86_64-w64-mingw32.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -d24463200b065bd0137c5c87c78cc36bf8c157fca7c6b07e44f0763eb580a2fecb5aed80433a942f2ed528d0807ad045c05d73516f8f6e84e9d5cb8255deefb9 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-gnu.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-gnu.tar.gz/md5 new file mode 100644 index 0000000000000..030839e3182ce --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-gnu.tar.gz/md5 @@ -0,0 +1 @@ +e7d6ea44580dba329e993449c1f545a4 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-gnu.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-gnu.tar.gz/sha512 new file mode 100644 index 0000000000000..d5ef95d214ad2 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-gnu.tar.gz/sha512 @@ -0,0 +1 @@ +5f291ae0ff7683841cdfb95be920a7b766d5d01fb9e74af351f85c543d553f9b440fc8694ea54af1ced68f2726f75060eed316b3f066a2d934c2598f771f50fb diff --git a/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-musl.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-musl.tar.gz/md5 new file mode 100644 index 0000000000000..dbef9eccac60b --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-musl.tar.gz/md5 @@ -0,0 +1 @@ +66aa828e05e574cf42fe3c06ac269444 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-musl.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-musl.tar.gz/sha512 new file mode 100644 index 0000000000000..794202094dbaa --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.aarch64-linux-musl.tar.gz/sha512 @@ -0,0 +1 @@ +cda9488931482bbc80a2cc36a79f32c1577ccafa374d2870b3c8325d00c5b0431089749558a66e12fa70c3b6ef15c650605843b5341beeae78b0c9f4ed58e44c diff --git a/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-gnueabihf.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-gnueabihf.tar.gz/md5 new file mode 100644 index 0000000000000..6872718cfedb1 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-gnueabihf.tar.gz/md5 @@ -0,0 +1 @@ +a284d83c0061592ac6ab2a166c547fee diff --git a/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-gnueabihf.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-gnueabihf.tar.gz/sha512 new file mode 100644 index 0000000000000..1afb4bb9b58d2 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-gnueabihf.tar.gz/sha512 @@ -0,0 +1 @@ +e60853ecbeb317df1c9c0cc4e6066c67336f6fe6c03bd57317c544cd33efefd3f82f9fbbe594e767e30562cbfde2d355e6efec0bbfb9543d0be13629a89d21ef diff --git a/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-musleabihf.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-musleabihf.tar.gz/md5 new file mode 100644 index 0000000000000..5aaf6127ed107 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-musleabihf.tar.gz/md5 @@ -0,0 +1 @@ +9860ece90df52aa0575657d894b4a854 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-musleabihf.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-musleabihf.tar.gz/sha512 new file mode 100644 index 0000000000000..cac9bb94af02e --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.armv7l-linux-musleabihf.tar.gz/sha512 @@ -0,0 +1 @@ +a412cd8a2f7718e43c52183d9d548f4296efbbf555602fa6b6694c78a1f86c427906708e340188c09abe416dfb171fbc8078aaf62e3d170b44c40251c4328acd diff --git a/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-gnu.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-gnu.tar.gz/md5 new file mode 100644 index 0000000000000..08541fbad8701 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-gnu.tar.gz/md5 @@ -0,0 +1 @@ +4fce1fbf3e33dbfd9e949ad446d70e45 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-gnu.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-gnu.tar.gz/sha512 new file mode 100644 index 0000000000000..39ec176145f89 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-gnu.tar.gz/sha512 @@ -0,0 +1 @@ +a51f9f38f84e02de641b90ee54360578b4e14ca6a06023f6ae1a90feebfdcc9fb53b0811d7727015e8cc7ffb0b74e6f6d05b20bb901694652801baf6c85c28d7 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-musl.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-musl.tar.gz/md5 new file mode 100644 index 0000000000000..3d8e4767708a2 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-musl.tar.gz/md5 @@ -0,0 +1 @@ +5f6cb7baa6d6380eba0fede4f16d4a8b diff --git a/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-musl.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-musl.tar.gz/sha512 new file mode 100644 index 0000000000000..c3533cefc3fc8 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.i686-linux-musl.tar.gz/sha512 @@ -0,0 +1 @@ +8f9993835a62f51402004be79e21ffdb827e824ead3b613bfff136f2f268635126b320cb3f9cd071fe21c5f96fc77e6fd5c8237158bb3c29866d256a286f7ec9 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.i686-w64-mingw32.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.i686-w64-mingw32.tar.gz/md5 new file mode 100644 index 0000000000000..c50dbd1b8d486 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.i686-w64-mingw32.tar.gz/md5 @@ -0,0 +1 @@ +4850602415cf2172c10127b9c4fc3c85 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.i686-w64-mingw32.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.i686-w64-mingw32.tar.gz/sha512 new file mode 100644 index 0000000000000..f3e63eb1aa0f6 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.i686-w64-mingw32.tar.gz/sha512 @@ -0,0 +1 @@ +e4dfe3181362c685ef4e5f9c952a730942a408f650c6428b85788bbac831ef8148e1a8f6d9eccfa8d2dc10213d5e535ce20b72ca4cc81390e2702bb272647492 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.powerpc64le-linux-gnu.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.powerpc64le-linux-gnu.tar.gz/md5 new file mode 100644 index 0000000000000..fc6a34df8958b --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.powerpc64le-linux-gnu.tar.gz/md5 @@ -0,0 +1 @@ +dfa12909bd6a7cd4b5010c44b165dc72 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.powerpc64le-linux-gnu.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.powerpc64le-linux-gnu.tar.gz/sha512 new file mode 100644 index 0000000000000..8bd69aaf1849e --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.powerpc64le-linux-gnu.tar.gz/sha512 @@ -0,0 +1 @@ +4b3f586c71c0ccb5f8016cbfd07a57dec4e526ca758b039edffb91b0a4fef47b37a6273b4db25e2565c272bb740a532342d276cae24adade3f4592b2c812320b diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-apple-darwin14.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-apple-darwin14.tar.gz/md5 new file mode 100644 index 0000000000000..8abd16fb471ff --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-apple-darwin14.tar.gz/md5 @@ -0,0 +1 @@ +5ba370e92755dd23c3028e3d75af5307 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-apple-darwin14.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-apple-darwin14.tar.gz/sha512 new file mode 100644 index 0000000000000..ae036f8e54b59 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-apple-darwin14.tar.gz/sha512 @@ -0,0 +1 @@ +b1b3a631537c7e22c3dd2204fcefb76df8bd2f296358f00d086541faf66395deaedc0c2a46c8159e3bb140f747466c4d3d48fd1a92f25af85e9c97a0c536ade7 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-gnu.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-gnu.tar.gz/md5 new file mode 100644 index 0000000000000..ddae8fca617d3 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-gnu.tar.gz/md5 @@ -0,0 +1 @@ +53f51f77ad951454fd17c9211d667790 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-gnu.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-gnu.tar.gz/sha512 new file mode 100644 index 0000000000000..9bdda9b64c171 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-gnu.tar.gz/sha512 @@ -0,0 +1 @@ +2167d5197685f7395eb3b78ee54f4c5806b5682f31ed9a5e7acc0d95d34db5478e37a7da0d21e4b54011a1794b192d4d4cd14e7b91a1aeecc09a020bdf6c3ab7 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-musl.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-musl.tar.gz/md5 new file mode 100644 index 0000000000000..eeb2389261a9f --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-musl.tar.gz/md5 @@ -0,0 +1 @@ +d709932a1f4f041bec390530e11b1e67 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-musl.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-musl.tar.gz/sha512 new file mode 100644 index 0000000000000..11ce75a7f2b6f --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-linux-musl.tar.gz/sha512 @@ -0,0 +1 @@ +2fdb5984250d7320e69a8f3854922955e905b8cac5afbca576ce7cec772a7848747fb3006092067c1c88fa88c249388c8bde5ea2989070cb4ef4e0667df072bb diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-unknown-freebsd11.1.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-unknown-freebsd11.1.tar.gz/md5 new file mode 100644 index 0000000000000..ce4871778b931 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-unknown-freebsd11.1.tar.gz/md5 @@ -0,0 +1 @@ +e1f9f4732c0964d32af87bb3077acefe diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-unknown-freebsd11.1.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-unknown-freebsd11.1.tar.gz/sha512 new file mode 100644 index 0000000000000..7fafdf2f7de6c --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-unknown-freebsd11.1.tar.gz/sha512 @@ -0,0 +1 @@ +4823a6068ccc995d95b4f3a134e6b19489e0041d1d73c95af07ae15abb8697750ebefc9c17f81962a2d1dff19e22b3343a594a4fe01d4e1b21d6ec5275ba17d7 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-w64-mingw32.tar.gz/md5 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-w64-mingw32.tar.gz/md5 new file mode 100644 index 0000000000000..ede96a608e2b5 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-w64-mingw32.tar.gz/md5 @@ -0,0 +1 @@ +a86d1517180b7bc472d725c36f9697a1 diff --git a/deps/checksums/OpenLibm.v0.7.1-0.x86_64-w64-mingw32.tar.gz/sha512 b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-w64-mingw32.tar.gz/sha512 new file mode 100644 index 0000000000000..9fe31b69b01e4 --- /dev/null +++ b/deps/checksums/OpenLibm.v0.7.1-0.x86_64-w64-mingw32.tar.gz/sha512 @@ -0,0 +1 @@ +49135af4db11aad919df12bdef54b25ea5c68236d6ff8f3d67b47ec36d492d37725bd9ec499fadaf4f9d9ec9e15d72559321e92ad94ba5ce18b6a792bfef4060 diff --git a/deps/checksums/openblas-63b03efc2af332c88b86d4fd8079d00f4b439adf.tar.gz/md5 b/deps/checksums/openblas-63b03efc2af332c88b86d4fd8079d00f4b439adf.tar.gz/md5 deleted file mode 100644 index a9f2bfd1d7061..0000000000000 --- a/deps/checksums/openblas-63b03efc2af332c88b86d4fd8079d00f4b439adf.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -3d692acc6927454f620a4c493bdb159d diff --git a/deps/checksums/openblas-63b03efc2af332c88b86d4fd8079d00f4b439adf.tar.gz/sha512 b/deps/checksums/openblas-63b03efc2af332c88b86d4fd8079d00f4b439adf.tar.gz/sha512 deleted file mode 100644 index 14fbd0e32f8a4..0000000000000 --- a/deps/checksums/openblas-63b03efc2af332c88b86d4fd8079d00f4b439adf.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -cf89f6db1b6366833d29a1dc718ea0b8f61d162f70695c33fc94afbaba232605630a7a7cc3d3b9bed7493ec85402b65180ca99c3101de7141d6f2919318f55c1 diff --git a/deps/checksums/openlibm-5a27b4c0c0a5befc2b7622ff8517743963c1f1d2.tar.gz/md5 b/deps/checksums/openlibm-5a27b4c0c0a5befc2b7622ff8517743963c1f1d2.tar.gz/md5 new file mode 100644 index 0000000000000..58d4194e5c536 --- /dev/null +++ b/deps/checksums/openlibm-5a27b4c0c0a5befc2b7622ff8517743963c1f1d2.tar.gz/md5 @@ -0,0 +1 @@ +bed6e01af1f7d5beb30b404dc7d14b1a diff --git a/deps/checksums/openlibm-5a27b4c0c0a5befc2b7622ff8517743963c1f1d2.tar.gz/sha512 b/deps/checksums/openlibm-5a27b4c0c0a5befc2b7622ff8517743963c1f1d2.tar.gz/sha512 new file mode 100644 index 0000000000000..7bd3e48e2588c --- /dev/null +++ b/deps/checksums/openlibm-5a27b4c0c0a5befc2b7622ff8517743963c1f1d2.tar.gz/sha512 @@ -0,0 +1 @@ +d9d8716897428af7867ce2b4792c15c01258fcc26e5638a45db7216f69f2508e2764245c1b44c4a58cba49350127d3ae8ae9bd7c00fc2d566858793c28bf569e diff --git a/deps/openlibm.version b/deps/openlibm.version index 06eed6d965c52..4037ade2b9704 100644 --- a/deps/openlibm.version +++ b/deps/openlibm.version @@ -1,2 +1,2 @@ -OPENLIBM_BRANCH=v0.7.0 -OPENLIBM_SHA1=5efed306d509905714e3c43fc3a43fb26f3df743 +OPENLIBM_BRANCH=v0.7.1 +OPENLIBM_SHA1=5a27b4c0c0a5befc2b7622ff8517743963c1f1d2 diff --git a/doc/build/windows.md b/doc/build/windows.md index b90295d9f42e8..0427212a16c0f 100644 --- a/doc/build/windows.md +++ b/doc/build/windows.md @@ -195,7 +195,7 @@ zypper -n install mingw$BITS-cross-gcc-c++ mingw$BITS-cross-gcc-fortran \ cp /usr/$XC_HOST/sys-root/mingw/bin/*.dll /usr/lib*/gcc/$XC_HOST/*/ git clone git://github.com/JuliaLang/julia.git julia cd julia -make -j4 win-extras julia-ui-release +make -j4 win-extras julia-cli-release export WINEDEBUG=-all # suppress wine fixme's # this last step may need to be run interactively make -j4 binary-dist diff --git a/doc/src/devdocs/eval.md b/doc/src/devdocs/eval.md index e04035a3d49e6..c3a9cd0fc1865 100644 --- a/doc/src/devdocs/eval.md +++ b/doc/src/devdocs/eval.md @@ -23,7 +23,7 @@ function, and primitive function, before turning into the desired result (hopefu The 10,000 foot view of the whole process is as follows: 1. The user starts `julia`. -2. The C function `main()` from `ui/repl.c` gets called. This function processes the command line +2. The C function `main()` from `cli/loader_exe.c` gets called. This function processes the command line arguments, filling in the `jl_options` struct and setting the variable `ARGS`. It then initializes Julia (by calling [`julia_init` in `task.c`](https://github.com/JuliaLang/julia/blob/master/src/task.c), which may load a previously compiled [sysimg](@ref dev-sysimg)). Finally, it passes off control to Julia diff --git a/doc/src/devdocs/init.md b/doc/src/devdocs/init.md index 03d4433c4be29..18cd9e0b8e26d 100644 --- a/doc/src/devdocs/init.md +++ b/doc/src/devdocs/init.md @@ -4,9 +4,11 @@ How does the Julia runtime execute `julia -e 'println("Hello World!")'` ? ## `main()` -Execution starts at [`main()` in `ui/repl.c`](https://github.com/JuliaLang/julia/blob/master/ui/repl.c). +Execution starts at [`main()` in `cli/loader_exe.c`](https://github.com/JuliaLang/julia/blob/master/cli/loader_exe.c), +which calls `load_repl()` in [`cli/loader_lib.c`](https://github.com/JuliaLang/julia/blob/master/cli/loader_lib.c) +which loads a few libraries, eventually calling [`repl_entrypoint()` in `src/jlapi.c`](https://github.com/JuliaLang/julia/blob/master/src/jlapi.c). -`main()` calls [`libsupport_init()`](https://github.com/JuliaLang/julia/blob/master/src/support/libsupportinit.c) +`repl_entrypoint()` calls [`libsupport_init()`](https://github.com/JuliaLang/julia/blob/master/src/support/libsupportinit.c) to set the C library locale and to initialize the "ios" library (see [`ios_init_stdstreams()`](https://github.com/JuliaLang/julia/blob/master/src/support/ios.c) and [Legacy `ios.c` library](@ref)). @@ -123,8 +125,8 @@ each deserialized module to run the `__init__()` function. Finally [`sigint_handler()`](https://github.com/JuliaLang/julia/blob/master/src/signals-unix.c) is hooked up to `SIGINT` and calls `jl_throw(jl_interrupt_exception)`. -`_julia_init()` then returns [back to `main()` in `ui/repl.c`](https://github.com/JuliaLang/julia/blob/master/ui/repl.c) -and `main()` calls `true_main(argc, (char**)argv)`. +`_julia_init()` then returns [back to `main()` in `cli/loader_exe.c`](https://github.com/JuliaLang/julia/blob/master/cli/loader_exe.c) +and `main()` calls `repl_entrypoint(argc, (char**)argv)`. !!! sidebar "sysimg" If there is a sysimg file, it contains a pre-cooked image of the `Core` and `Main` modules (and @@ -137,12 +139,12 @@ and `main()` calls `true_main(argc, (char**)argv)`. Note: [`jl_restore_system_image()` (and `staticdata.c` in general)](https://github.com/JuliaLang/julia/blob/master/src/staticdata.c) uses the [Legacy `ios.c` library](@ref). -## `true_main()` +## `repl_entrypoint()` -[`true_main()`](https://github.com/JuliaLang/julia/blob/master/ui/repl.c) loads the contents of +[`repl_entrypoint()`](https://github.com/JuliaLang/julia/blob/master/src/jlapi.c) loads the contents of `argv[]` into [`Base.ARGS`](@ref). -If a `.jl` "program" file was supplied on the command line, then [`exec_program()`](https://github.com/JuliaLang/julia/blob/master/ui/repl.c) +If a `.jl` "program" file was supplied on the command line, then [`exec_program()`](https://github.com/JuliaLang/julia/blob/master/src/jlapi.c) calls [`jl_load(program,len)`](https://github.com/JuliaLang/julia/blob/master/src/toplevel.c) which calls [`jl_parse_eval_all`](https://github.com/JuliaLang/julia/blob/master/src/ast.c) which repeatedly calls [`jl_toplevel_eval_flex()`](https://github.com/JuliaLang/julia/blob/master/src/toplevel.c) diff --git a/doc/src/devdocs/stdio.md b/doc/src/devdocs/stdio.md index d17f7abc06bb9..879c3d048343b 100644 --- a/doc/src/devdocs/stdio.md +++ b/doc/src/devdocs/stdio.md @@ -17,7 +17,7 @@ int jl_printf(uv_stream_t *s, const char *format, ...); int jl_vprintf(uv_stream_t *s, const char *format, va_list args); ``` -These `printf` functions are used by the `.c` files in the `src/` and `ui/` directories wherever stdio is +These `printf` functions are used by the `.c` files in the `src/` and `cli/` directories wherever stdio is needed to ensure that output buffering is handled in a unified way. In special cases, like signal handlers, where the full libuv infrastructure is too heavy, `jl_safe_printf()` diff --git a/doc/src/manual/embedding.md b/doc/src/manual/embedding.md index 1eb42a693f321..fcc9f06536ab3 100644 --- a/doc/src/manual/embedding.md +++ b/doc/src/manual/embedding.md @@ -45,7 +45,7 @@ gcc -o test -fPIC -I$JULIA_DIR/include/julia -L$JULIA_DIR/lib -Wl,-rpath,$JULIA_ ``` Alternatively, look at the `embedding.c` program in the Julia source tree in the `test/embedding/` folder. -The file `ui/repl.c` program is another simple example of how to set `jl_options` options while +The file `cli/loader_exe.c` program is another simple example of how to set `jl_options` options while linking against `libjulia`. The first thing that has to be done before calling any other Julia C function is to initialize diff --git a/src/Makefile b/src/Makefile index 578677b3e1b9b..835c2bf60b55a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -293,20 +293,6 @@ else CXXLD = $(LD) -dll -export:jl_setjmp -export:jl_longjmp endif -# If we're on windows, don't do versioned shared libraries. If we're on OSX, -# put the version number before the .dylib. Otherwise, put it after. -ifeq ($(OS), WINNT) -JL_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT) -else -ifeq ($(OS), Darwin) -JL_MAJOR_MINOR_SHLIB_EXT := $(SOMAJOR).$(SOMINOR).$(SHLIB_EXT) -JL_MAJOR_SHLIB_EXT := $(SOMAJOR).$(SHLIB_EXT) -else -JL_MAJOR_MINOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR).$(SOMINOR) -JL_MAJOR_SHLIB_EXT := $(SHLIB_EXT).$(SOMAJOR) -endif -endif - ifeq ($(SHLIB_EXT), so) SONAME := -Wl,-soname=libjulia.$(JL_MAJOR_SHLIB_EXT) SONAME_DEBUG := -Wl,-soname=libjulia-debug.$(JL_MAJOR_SHLIB_EXT) diff --git a/src/jlapi.c b/src/jlapi.c index d52489a865d1d..8fa9d0bbd353e 100644 --- a/src/jlapi.c +++ b/src/jlapi.c @@ -475,6 +475,205 @@ JL_DLLEXPORT void jl_get_fenv_consts(int *ret) ret[8] = FE_TOWARDZERO; } + +#ifdef JL_ASAN_ENABLED +JL_DLLEXPORT const char* __asan_default_options() +{ + return "allow_user_segv_handler=1:detect_leaks=0"; + // FIXME: enable LSAN after fixing leaks & defining __lsan_default_suppressions(), + // or defining __lsan_default_options = exitcode=0 once publicly available + // (here and in flisp/flmain.c) +} +#endif + +static int exec_program(char *program) +{ + JL_TRY { + jl_load(jl_main_module, program); + } + JL_CATCH { + jl_value_t *errs = jl_stderr_obj(); + JL_GC_PUSH1(&errs); + volatile int shown_err = 0; + jl_printf(JL_STDERR, "error during bootstrap:\n"); + JL_TRY { + if (errs) { + jl_value_t *showf = jl_get_function(jl_base_module, "show"); + if (showf != NULL) { + jl_call2(showf, errs, jl_current_exception()); + jl_printf(JL_STDERR, "\n"); + shown_err = 1; + } + } + } + JL_CATCH { + } + JL_GC_POP(); + if (!shown_err) { + jl_static_show(JL_STDERR, jl_current_exception()); + jl_printf(JL_STDERR, "\n"); + } + jlbacktrace(); + jl_printf(JL_STDERR, "\n"); + return 1; + } + return 0; +} + +#ifdef JL_GF_PROFILE +static void print_profile(void) +{ + size_t i; + void **table = jl_base_module->bindings.table; + for(i=1; i < jl_base_module->bindings.size; i+=2) { + if (table[i] != HT_NOTFOUND) { + jl_binding_t *b = (jl_binding_t*)table[i]; + if (b->value != NULL && jl_is_function(b->value) && + jl_is_gf(b->value)) { + jl_printf(JL_STDERR, "%d\t%s\n", + jl_gf_mtable(b->value)->ncalls, + jl_gf_name(b->value)->name); + } + } + } +} +#endif + +static NOINLINE int true_main(int argc, char *argv[]) +{ + jl_set_ARGS(argc, argv); + + jl_function_t *start_client = jl_base_module ? + (jl_function_t*)jl_get_global(jl_base_module, jl_symbol("_start")) : NULL; + + if (start_client) { + JL_TRY { + size_t last_age = jl_get_ptls_states()->world_age; + jl_get_ptls_states()->world_age = jl_get_world_counter(); + jl_apply(&start_client, 1); + jl_get_ptls_states()->world_age = last_age; + } + JL_CATCH { + jl_no_exc_handler(jl_current_exception()); + } + return 0; + } + + // run program if specified, otherwise enter REPL + if (argc > 0) { + if (strcmp(argv[0], "-")) { + return exec_program(argv[0]); + } + } + + ios_puts("WARNING: Base._start not defined, falling back to economy mode repl.\n", ios_stdout); + if (!jl_errorexception_type) + ios_puts("WARNING: jl_errorexception_type not defined; any errors will be fatal.\n", ios_stdout); + + while (!ios_eof(ios_stdin)) { + char *volatile line = NULL; + JL_TRY { + ios_puts("\njulia> ", ios_stdout); + ios_flush(ios_stdout); + line = ios_readline(ios_stdin); + jl_value_t *val = (jl_value_t*)jl_eval_string(line); + JL_GC_PUSH1(&val); + if (jl_exception_occurred()) { + jl_printf(JL_STDERR, "error during run:\n"); + jl_static_show(JL_STDERR, jl_exception_occurred()); + jl_exception_clear(); + } + else if (val) { + jl_static_show(JL_STDOUT, val); + } + JL_GC_POP(); + jl_printf(JL_STDOUT, "\n"); + free(line); + line = NULL; + uv_run(jl_global_event_loop(),UV_RUN_NOWAIT); + } + JL_CATCH { + if (line) { + free(line); + line = NULL; + } + jl_printf(JL_STDERR, "\nparser error:\n"); + jl_static_show(JL_STDERR, jl_current_exception()); + jl_printf(JL_STDERR, "\n"); + jlbacktrace(); + } + } + return 0; +} + +static void lock_low32(void) +{ +#if defined(_OS_WINDOWS_) && defined(_P64) && defined(JL_DEBUG_BUILD) + // Wine currently has a that causes it to answer VirtualQuery incorrectly. + // block usage of the 32-bit address space on win64, to catch pointer cast errors + char *const max32addr = (char*)0xffffffffL; + SYSTEM_INFO info; + MEMORY_BASIC_INFORMATION meminfo; + GetNativeSystemInfo(&info); + memset(&meminfo, 0, sizeof(meminfo)); + meminfo.BaseAddress = info.lpMinimumApplicationAddress; + while ((char*)meminfo.BaseAddress < max32addr) { + size_t nbytes = VirtualQuery(meminfo.BaseAddress, &meminfo, sizeof(meminfo)); + assert(nbytes == sizeof(meminfo)); + if (meminfo.State == MEM_FREE) { // reserve all free pages in the first 4GB of memory + char *first = (char*)meminfo.BaseAddress; + char *last = first + meminfo.RegionSize; + if (last > max32addr) + last = max32addr; + // adjust first up to the first allocation granularity boundary + // adjust last down to the last allocation granularity boundary + first = (char*)(((long long)first + info.dwAllocationGranularity - 1) & ~(info.dwAllocationGranularity - 1)); + last = (char*)((long long)last & ~(info.dwAllocationGranularity - 1)); + if (last != first) { + void *p = VirtualAlloc(first, last - first, MEM_RESERVE, PAGE_NOACCESS); // reserve all memory in between + if ((char*)p != first) + // Wine and Windows10 seem to have issues with reporting memory access information correctly + // so we sometimes end up with unexpected results - this is just ignore those and continue + // this is just a debugging aid to help find accidental pointer truncation anyways, so it's not critical + VirtualFree(p, 0, MEM_RELEASE); + } + } + meminfo.BaseAddress += meminfo.RegionSize; + } +#endif + return; +} + +// Actual definition in `ast.c` +void jl_lisp_prompt(void); + +JL_DLLEXPORT int repl_entrypoint(int argc, char *argv[]) +{ + // no-op on Windows, note that the caller must have already converted + // from `wchar_t` to `UTF-8` already if we're running on Windows. + uv_setup_args(argc, argv); + + // No-op on non-windows + lock_low32(); + + libsupport_init(); + int lisp_prompt = (argc >= 2 && strcmp((char*)argv[1],"--lisp") == 0); + if (lisp_prompt) { + memmove(&argv[1], &argv[2], (argc-2)*sizeof(void*)); + argc--; + } + jl_parse_opts(&argc, (char***)&argv); + julia_init(jl_options.image_file_specified ? JL_IMAGE_CWD : JL_IMAGE_JULIA_HOME); + if (lisp_prompt) { + jl_get_ptls_states()->world_age = jl_get_world_counter(); + jl_lisp_prompt(); + return 0; + } + int ret = true_main(argc, (char**)argv); + jl_atexit_hook(ret); + return ret; +} + #ifdef __cplusplus } #endif diff --git a/src/julia.expmap b/src/julia.expmap index daf3a01749ed9..aa77f4c8cff31 100644 --- a/src/julia.expmap +++ b/src/julia.expmap @@ -36,6 +36,7 @@ _IO_stdin_used; __ZN4llvm23createLowerSimdLoopPassEv; LLVMExtra*; + repl_entrypoint; /* freebsd */ environ; diff --git a/ui/repl.c b/ui/repl.c deleted file mode 100644 index 07e1949f93e1e..0000000000000 --- a/ui/repl.c +++ /dev/null @@ -1,234 +0,0 @@ -// This file is a part of Julia. License is MIT: https://julialang.org/license - -/* - repl.c - system startup, main(), and console interaction -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "uv.h" -#include "../src/julia.h" -#include "../src/options.h" -#include "../src/julia_assert.h" - -JULIA_DEFINE_FAST_TLS() - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef JL_ASAN_ENABLED -JL_DLLEXPORT const char* __asan_default_options() { - return "allow_user_segv_handler=1:detect_leaks=0"; - // FIXME: enable LSAN after fixing leaks & defining __lsan_default_suppressions(), - // or defining __lsan_default_options = exitcode=0 once publicly available - // (here and in flisp/flmain.c) -} -#endif - -static int exec_program(char *program) -{ - JL_TRY { - jl_load(jl_main_module, program); - } - JL_CATCH { - jl_value_t *errs = jl_stderr_obj(); - volatile int shown_err = 0; - jl_printf(JL_STDERR, "error during bootstrap:\n"); - JL_TRY { - if (errs) { - jl_value_t *showf = jl_get_function(jl_base_module, "show"); - if (showf != NULL) { - jl_call2(showf, errs, jl_current_exception()); - jl_printf(JL_STDERR, "\n"); - shown_err = 1; - } - } - } - JL_CATCH { - } - if (!shown_err) { - jl_static_show(JL_STDERR, jl_current_exception()); - jl_printf(JL_STDERR, "\n"); - } - jlbacktrace(); - jl_printf(JL_STDERR, "\n"); - return 1; - } - return 0; -} - -void jl_lisp_prompt(); - -#ifdef JL_GF_PROFILE -static void print_profile(void) -{ - size_t i; - void **table = jl_base_module->bindings.table; - for(i=1; i < jl_base_module->bindings.size; i+=2) { - if (table[i] != HT_NOTFOUND) { - jl_binding_t *b = (jl_binding_t*)table[i]; - if (b->value != NULL && jl_is_function(b->value) && - jl_is_gf(b->value)) { - jl_printf(JL_STDERR, "%d\t%s\n", - jl_gf_mtable(b->value)->ncalls, - jl_gf_name(b->value)->name); - } - } - } -} -#endif - -static NOINLINE int true_main(int argc, char *argv[]) -{ - jl_set_ARGS(argc, argv); - - jl_function_t *start_client = jl_base_module ? - (jl_function_t*)jl_get_global(jl_base_module, jl_symbol("_start")) : NULL; - - if (start_client) { - JL_TRY { - size_t last_age = jl_get_ptls_states()->world_age; - jl_get_ptls_states()->world_age = jl_get_world_counter(); - jl_apply(&start_client, 1); - jl_get_ptls_states()->world_age = last_age; - } - JL_CATCH { - jl_no_exc_handler(jl_current_exception()); - } - return 0; - } - - // run program if specified, otherwise enter REPL - if (argc > 0) { - if (strcmp(argv[0], "-")) { - return exec_program(argv[0]); - } - } - - ios_puts("WARNING: Base._start not defined, falling back to economy mode repl.\n", ios_stdout); - if (!jl_errorexception_type) - ios_puts("WARNING: jl_errorexception_type not defined; any errors will be fatal.\n", ios_stdout); - - while (!ios_eof(ios_stdin)) { - char *volatile line = NULL; - JL_TRY { - ios_puts("\njulia> ", ios_stdout); - ios_flush(ios_stdout); - line = ios_readline(ios_stdin); - jl_value_t *val = (jl_value_t*)jl_eval_string(line); - if (jl_exception_occurred()) { - jl_printf(JL_STDERR, "error during run:\n"); - jl_static_show(JL_STDERR, jl_exception_occurred()); - jl_exception_clear(); - } - else if (val) { - jl_static_show(JL_STDOUT, val); - } - jl_printf(JL_STDOUT, "\n"); - free(line); - line = NULL; - uv_run(jl_global_event_loop(),UV_RUN_NOWAIT); - } - JL_CATCH { - if (line) { - free(line); - line = NULL; - } - jl_printf(JL_STDERR, "\nparser error:\n"); - jl_static_show(JL_STDERR, jl_current_exception()); - jl_printf(JL_STDERR, "\n"); - jlbacktrace(); - } - } - return 0; -} - -#ifndef _OS_WINDOWS_ -int main(int argc, char *argv[]) -{ - uv_setup_args(argc, argv); // no-op on Windows -#else - -static void lock_low32() { -#if defined(_P64) && defined(JL_DEBUG_BUILD) - // Wine currently has a that causes it to answer VirtualQuery incorrectly. - // block usage of the 32-bit address space on win64, to catch pointer cast errors - char *const max32addr = (char*)0xffffffffL; - SYSTEM_INFO info; - MEMORY_BASIC_INFORMATION meminfo; - GetNativeSystemInfo(&info); - memset(&meminfo, 0, sizeof(meminfo)); - meminfo.BaseAddress = info.lpMinimumApplicationAddress; - while ((char*)meminfo.BaseAddress < max32addr) { - size_t nbytes = VirtualQuery(meminfo.BaseAddress, &meminfo, sizeof(meminfo)); - assert(nbytes == sizeof(meminfo)); - if (meminfo.State == MEM_FREE) { // reserve all free pages in the first 4GB of memory - char *first = (char*)meminfo.BaseAddress; - char *last = first + meminfo.RegionSize; - if (last > max32addr) - last = max32addr; - // adjust first up to the first allocation granularity boundary - // adjust last down to the last allocation granularity boundary - first = (char*)(((long long)first + info.dwAllocationGranularity - 1) & ~(info.dwAllocationGranularity - 1)); - last = (char*)((long long)last & ~(info.dwAllocationGranularity - 1)); - if (last != first) { - void *p = VirtualAlloc(first, last - first, MEM_RESERVE, PAGE_NOACCESS); // reserve all memory in between - if ((char*)p != first) - // Wine and Windows10 seem to have issues with reporting memory access information correctly - // so we sometimes end up with unexpected results - this is just ignore those and continue - // this is just a debugging aid to help find accidental pointer truncation anyways, so it's not critical - VirtualFree(p, 0, MEM_RELEASE); - } - } - meminfo.BaseAddress += meminfo.RegionSize; - } -#endif -} -int wmain(int argc, wchar_t *argv[], wchar_t *envp[]) -{ - int i; - lock_low32(); - for (i=0; i= 2 && strcmp((char*)argv[1],"--lisp") == 0); - if (lisp_prompt) { - memmove(&argv[1], &argv[2], (argc-2)*sizeof(void*)); - argc--; - } - jl_parse_opts(&argc, (char***)&argv); - julia_init(jl_options.image_file_specified ? JL_IMAGE_CWD : JL_IMAGE_JULIA_HOME); - if (lisp_prompt) { - jl_get_ptls_states()->world_age = jl_get_world_counter(); - jl_lisp_prompt(); - return 0; - } - int ret = true_main(argc, (char**)argv); - jl_atexit_hook(ret); - return ret; -} - -#ifdef __cplusplus -} -#endif