Comment 0 for bug 1949092

Revision history for this message
Kristof Havasi (lnksz) wrote :

I would like to update from the old linaro v6.5-latest GCC to the current 10.3 ARM-GCC (arm-linux-none-gnueabihf).

If I compile the following program:

#include <map>
#include <iostream>

using namespace std;

int main() {
 const map<const char*,int> m = {
  {"foo",1},
  {"bar",2},
 };
 for (const auto &[s, i] : m) {
  cout << s << " " << i << '\n';
 }
 return 0;
}

// arm-linux-none-gnueabihf-g++ -static -mfpu=vfpv3-d16 -mcpu=cortex-a5+nosimd -mtune=cortex-a5 -std=gnu++17 main.c

The generated code has a VLD instruction, which triggers a SIGILL on the target (SAMA5D3 based board, Cortex-A5). From the datasheet:

The Floating-Point Unit (FPU) supports the ARMv7 VFPv4-D16 architecture without Advanced SIMD extensions (NEON).

I couldn't find any (combination of) options of mtune mcpu march mfpu, with which I could compile a program without the illegal instruction in it.

I have seen that between v6.5 and v10.x the defaults during compiler compilation were changed to --with-fpu=neon.

But based on the GCC-ARM option documentation, I would expect that -mcpu=cortex-a5+nosimd turns off SIMD instructions.

From https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

For example, ‘cortex-a9’ can be found in three major configurations: integer only, with just a floating-point unit or with floating-point and Advanced SIMD. The default is to enable all the instructions, but the extensions ‘+nosimd’ and ‘+nofp’ can be used to disable just the SIMD or both the SIMD and floating-point instructions respectively.

If I overlooked something, also thanks for pointing that out.