Skip to content

Commit 632c676

Browse files
committed
Linux ARM natives: add FP requirement to arch.
Without this change, compilation on newer versions of GCC fails: cc1: error: ‘-mfloat-abi=hard’: selected architecture lacks an FPU The [GCC 8 ARM changes] note that “`-mfpu=auto` is now the default setting unless the compiler has been configured with an explicit `--with-fpu` option.” We were setting `-mfpu` to something other than `auto`, but one possible interpretation of that sentence is “the value of this option is now ignored unless you pass `--with-fpu`”. And of course, didn't, so on architectures where an FPU is optional (ARMv6 and ARMv7), we were being pushed onto a compile path that assumed the absence. A quick search uncovers a few other people dealing with this. Some distro developers discussing [how to handle the switch] refer to GCC 8, but the general consensus seems to be that the breaking change was introduced [with GCC 11] in Debian/Ubuntu. The GitHub Actions runners for Ubuntu 18.04 are now dead, but the last [installed software list] indicates that they included GCC v7.5.0, v9.4.0, and v10.3.0; presumably v7.5.0 was the default, which is why we didn't run into this before now. (The logs and artifacts from the last successful CI build are long expired.) I expect that this breaks compilation on GCC <v8. [GCC 8 ARM changes]: https://gcc.gnu.org/gcc-8/changes.html#arm [installed software list]: https://github.com/actions/runner-images/blob/425daf97b4452130f0065e4fc58b5c8b34ab1941/images/linux/Ubuntu1804-Readme.md [how to handle the switch]: https://gcc.gnu.org/pipermail/gcc/2021-September/237363.html [with GCC 11]: https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1939379#yui_3_10_3_1_1692749691943_147
1 parent 22333b2 commit 632c676

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/c/Makefile

+8-8
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ arm32v6:
146146

147147
# Requires gcc-arm-linux-gnueabihf.
148148
arm32v6HF: export CC := arm-linux-gnueabihf-gcc
149-
arm32v6HF: export CFLAGS += $(LINUX_CFLAGS) -march=armv6 -mfpu=vfp -marm
150-
arm32v6HF: export LDFLAGS += -march=armv6 -mfpu=vfp -marm
149+
arm32v6HF: export CFLAGS += $(LINUX_CFLAGS) -march=armv6+fp -marm
150+
arm32v6HF: export LDFLAGS += -march=armv6+fp -marm
151151
arm32v6HF: export platform := linux/ARM_32
152152
arm32v6HF: export variant := v6_HF
153153
arm32v6HF:
@@ -164,8 +164,8 @@ arm32v7:
164164

165165
# Requires gcc-arm-linux-gnueabihf.
166166
arm32v7HF: export CC := arm-linux-gnueabihf-gcc
167-
arm32v7HF: export CFLAGS += $(LINUX_CFLAGS) -march=armv7-a
168-
arm32v7HF: export LDFLAGS += -march=armv7-a
167+
arm32v7HF: export CFLAGS += $(LINUX_CFLAGS) -march=armv7-a+fp
168+
arm32v7HF: export LDFLAGS += -march=armv7-a+fp
169169
arm32v7HF: export platform := linux/ARM_32
170170
arm32v7HF: export variant := v7_HF
171171
arm32v7HF:
@@ -182,17 +182,17 @@ arm32v8:
182182

183183
# Requires gcc-arm-linux-gnueabihf.
184184
arm32v8HF: export CC := arm-linux-gnueabihf-gcc
185-
arm32v8HF: export CFLAGS += $(LINUX_CFLAGS) -march=armv8-a
186-
arm32v8HF: export LDFLAGS += -march=armv8-a
185+
arm32v8HF: export CFLAGS += $(LINUX_CFLAGS) -march=armv8-a -mfpu=neon-fp-armv8
186+
arm32v8HF: export LDFLAGS += -march=armv8-a -mfpu=neon-fp-armv8
187187
arm32v8HF: export platform := linux/ARM_32
188188
arm32v8HF: export variant := v8_HF
189189
arm32v8HF:
190190
$(MAKE) -f natives.mk
191191

192192
# Requires gcc-aarch64-linux-gnu.
193193
arm64v8: export CC := aarch64-linux-gnu-gcc
194-
arm64v8: export CFLAGS += $(LINUX_CFLAGS) -march=armv8-a
195-
arm64v8: export LDFLAGS += -march=armv8-a
194+
arm64v8: export CFLAGS += $(LINUX_CFLAGS) -march=armv8-a+fp
195+
arm64v8: export LDFLAGS += -march=armv8-a+fp
196196
arm64v8: export platform := linux/ARM_64
197197
arm64v8: export variant := v8
198198
arm64v8:

0 commit comments

Comments
 (0)