From 187ea1a0379cc0c31e52710fd0b89799d24e3f7e Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Tue, 10 May 2016 04:51:28 +0000 Subject: [PATCH] Look for fesetround in libm rather than the executable We usually get lucky because GCC's runtime library includes this functions. However, their proper place is in the math library and Clang's runtime library does not include these functions on windows, so without this change the function is not found. --- base/rounding.jl | 6 ++++-- base/sysimg.jl | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/base/rounding.jl b/base/rounding.jl index 7d8c17b40d936..cdef0b99f40a1 100644 --- a/base/rounding.jl +++ b/base/rounding.jl @@ -9,6 +9,8 @@ export rounding, setrounding, get_zero_subnormals, set_zero_subnormals +const libm = Base.libm_name + ## rounding modes ## immutable RoundingMode{T} end @@ -41,8 +43,8 @@ function from_fenv(r::Integer) end end -setrounding_raw{T<:Union{Float32,Float64}}(::Type{T},i::Integer) = ccall(:fesetround, Int32, (Int32,), i) -rounding_raw{T<:Union{Float32,Float64}}(::Type{T}) = ccall(:fegetround, Int32, ()) +setrounding_raw{T<:Union{Float32,Float64}}(::Type{T},i::Integer) = ccall((:fesetround, libm), Int32, (Int32,), i) +rounding_raw{T<:Union{Float32,Float64}}(::Type{T}) = ccall((:fegetround, libm), Int32, ()) setrounding{T<:Union{Float32,Float64}}(::Type{T},r::RoundingMode) = setrounding_raw(T,to_fenv(r)) rounding{T<:Union{Float32,Float64}}(::Type{T}) = from_fenv(rounding_raw(T)) diff --git a/base/sysimg.jl b/base/sysimg.jl index 8a9e4d264d590..bc073670d33ce 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -78,6 +78,12 @@ Array{T}(::Type{T}, m::Integer) = Array{T,1}(Int(m)) Array{T}(::Type{T}, m::Integer,n::Integer) = Array{T,2}(Int(m),Int(n)) Array{T}(::Type{T}, m::Integer,n::Integer,o::Integer) = Array{T,3}(Int(m),Int(n),Int(o)) +# For OS specific stuff +include(String(vcat(length(Core.ARGS)>=2?Core.ARGS[2].data:"".data, "build_h.jl".data))) # include($BUILDROOT/base/build_h.jl) +include(String(vcat(length(Core.ARGS)>=2?Core.ARGS[2].data:"".data, "version_git.jl".data))) # include($BUILDROOT/base/version_git.jl) +include("osutils.jl") +include("c.jl") + # numeric operations include("hashing.jl") include("rounding.jl") @@ -112,12 +118,6 @@ typealias StridedVector{T,A<:Union{DenseArray,StridedReshapedArray},I<:Tuple{Var typealias StridedMatrix{T,A<:Union{DenseArray,StridedReshapedArray},I<:Tuple{Vararg{Union{RangeIndex, NoSlice, AbstractCartesianIndex}}}} Union{DenseArray{T,2}, SubArray{T,2,A,I}, StridedReshapedArray{T,2}} typealias StridedVecOrMat{T} Union{StridedVector{T}, StridedMatrix{T}} -# For OS specific stuff -include(String(vcat(length(Core.ARGS)>=2?Core.ARGS[2].data:"".data, "build_h.jl".data))) # include($BUILDROOT/base/build_h.jl) -include(String(vcat(length(Core.ARGS)>=2?Core.ARGS[2].data:"".data, "version_git.jl".data))) # include($BUILDROOT/base/version_git.jl) -include("osutils.jl") -include("c.jl") - # Core I/O include("io.jl") include("iostream.jl")