https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104455
Bug ID: 104455 Summary: Cannot select -march=armv7-a using GCC 11 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: noloader at gmail dot com Target Milestone: --- Hi Everyone, We are trying to fix a compile problem Debian encountered on Sid [1,2]. The machine is armhf, but I don't have access to it. Sid is using GCC 11, but I am not sure which version. The problem does not exist in GCC 10 and below. I think this is the test case. Below, test.S is mostly armv4 but has some armv7 instructions. I used movw and movt as an example since they are armv7. $ cat test.S .globl return_magic .type return_magic,%function return_magic: movw r0, #0x1234 movt r0, #0x5678 bl 0 $ g++ -g2 -O3 -Wa,--noexecstack -march=armv7-a test.S -c When Debian compiles with GCC 11, it results in: cc1: error: ‘-mfloat-abi=hard’: selected architecture lacks an FPU test.S does not use floating point or neon instructions. This source file does not need a fpu. We don't care what the platform default is because we don't use it. But in this case, the machine is armhf so GCC should know it should use hard floats. When I attempt to add -mfpu=auto per [3], it results in another error: cc1: sorry, unimplemented: -mfpu=auto not currently supported without an explicit CPU. cc1: error: -mfloat-abi=hard: selected processor lacks an FPU test.S does not use floating point or neon instructions. This source file does not need a fpu. I also tried -mfpu=none, but it results in: g++: error: unrecognized argument in option ‘-mfpu=none’ g++: note: valid arguments to ‘-mfpu=’ are: auto crypto-neon-fp-armv8 fp-armv8 fpv4-sp-d16 fpv5-d16 fpv5-sp-d16 neon neon-fp-armv8 neon-fp16 neon-vfpv3 neon-vfpv4 vfp vfp3 vfpv2 vfpv3 vfpv3-d16 vfpv3-d16-fp16 vfpv3-fp16 vfpv3xd vfpv3xd-fp16 vfpv4 vfpv4-d16; did you mean ‘neon’? In the past we avoided specifying a -mfpu option because the code [used to] work with GCC 4 and above, Clang 3 and above, armel, armhf and Android with soft floats. The compiler always knew what float abi it should use. I would like to drop -march=armv7-a, but GCC requires me to use an ISA option before I use instructions from the ISA. I've never liked the rule, but it is what it is. (Microsoft's C/C++ compiler got this right). [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1001995 [2] https://github.com/weidai11/cryptopp/issues/1094 [3] https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html