Skip to content

Commit 0a5f010

Browse files
authored
Force hard-float ABI for 32-bit platforms (#99)
1 parent 5283aa8 commit 0a5f010

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/Platforms.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ const ARCHITECTURE_FLAGS = Dict(
100100
),
101101
"armv6l" => Dict(
102102
# This is the only known armv6l chip that runs Julia, so it's the only one we care about.
103-
"arm1176jzfs" => ["-mcpu=arm1176jzf-s", "-mfpu=vfp"],
103+
"arm1176jzfs" => ["-mcpu=arm1176jzf-s", "-mfpu=vfp", "-mfloat-abi=hard"],
104104
),
105105
"armv7l" => Dict(
106106
# Base armv7l architecture, with the most basic of FPU's
107-
"armv7l" => ["-march=armv7-a", "-mtune=generic-armv7-a", "-mfpu=vfpv3"],
107+
"armv7l" => ["-march=armv7-a", "-mtune=generic-armv7-a", "-mfpu=vfpv3", "-mfloat-abi=hard"],
108108
# armv7l plus NEON and vfpv4, (Raspberry Pi 2B+, RK3328, most boards Elliot has access to)
109-
"neonvfpv4" => ["-march=armv7-a", "-mtune=cortex-a53", "-mfpu=neon-vfpv4"],
109+
"neonvfpv4" => ["-march=armv7-a", "-mtune=cortex-a53", "-mfpu=neon-vfpv4", "-mfloat-abi=hard"],
110110
),
111111
"aarch64" => Dict(
112112
# Base armv8.0-a architecture, tune for generic cortex-a57
@@ -139,4 +139,4 @@ const ARCHITECTURE_FLAGS = Dict(
139139
),
140140
),
141141
)
142-
march(p::AbstractPlatform; default=nothing) = get(tags(p), "march", default)
142+
march(p::AbstractPlatform; default=nothing) = get(tags(p), "march", default)

src/Runner.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
8383
# Flags that are postpended if we think we're linking (e.g. no `-c`)
8484
link_only_flags::Vector = String[],
8585
allow_ccache::Bool = true,
86+
no_soft_float::Bool = false,
8687
hash_args::Bool = false,
8788
extra_cmds::String = "",
8889
env::Dict{String,String} = Dict{String,String}(),
@@ -161,6 +162,16 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
161162
println(io)
162163
end
163164

165+
if no_soft_float
166+
write(io, raw"""
167+
if [[ " ${ARGS[@]} " == *"-mfloat-abi=soft"* ]]; then
168+
echo "${target} platform does not support soft-float ABI" >&2
169+
exit 1
170+
fi
171+
""")
172+
println(io)
173+
end
174+
164175
if length(unsafe_flags) >= 1
165176
write(io, """
166177
if [[ "\${ARGS[@]}" =~ \"$(join(unsafe_flags, "\"|\""))\" ]]; then
@@ -351,6 +362,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
351362
unsafe_flags=gcc_unsafe_flags!(p),
352363
hash_args = true,
353364
allow_ccache,
365+
no_soft_float=arch(p) in ("armv6l", "armv7l"),
354366
)
355367
end
356368

@@ -362,6 +374,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
362374
flags=flags,
363375
compile_only_flags=clang_compile_flags!(p),
364376
link_only_flags=clang_link_flags!(p),
377+
no_soft_float=arch(p) in ("armv6l", "armv7l"),
365378
)
366379
end
367380

0 commit comments

Comments
 (0)