There is an ABI for ARM with hard floats and one for soft floats (as well as one for a sort of mix between hard & soft). For the hard fp, the preprocessor symbol '__ARM_PCS_VFP' needs to be defined. This is added as an additional check in the code returning the 'specs' for ARM. To facilitate some incoming changes and code reuses here, create a pseudo-arch 'arm+hf' for define the symbol. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- cgcc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cgcc b/cgcc index 7ae6e5c6d..5336ae3ce 100755 --- a/cgcc +++ b/cgcc @@ -326,15 +326,10 @@ sub add_specs { &define_size_t ("long unsigned int") . ' -D__SIZEOF_POINTER__=' . ($m64 ? '8' : '4')); } elsif ($spec eq 'arm') { - chomp (my $gccmachine = `$ccom -dumpmachine`); - my $cppsymbols = ' -m32'; - - if ($gccmachine eq 'arm-linux-gnueabihf') { - $cppsymbols .= ' -mfloat-abi=hard'; - } - - return ($cppsymbols . + return (' -m32' . &float_types (1, 1, 36, [24,8], [53,11], [53, 11])); + } elsif ($spec eq 'arm+hf') { + return &add_specs ('arm') . ' -mfloat-abi=hard'; } elsif ($spec eq 'aarch64') { return (' -m64' . &float_types (1, 1, 36, [24,8], [53,11], [113,15])); @@ -362,6 +357,10 @@ sub add_specs { } elsif ($arch =~ /^(sparc64)$/i) { return &add_specs ('sparc64'); } elsif ($arch =~ /^arm(?:v[78]l)?$/i) { + chomp (my $gccmachine = `$ccom -dumpmachine`); + if ($gccmachine eq 'arm-linux-gnueabihf') { + return &add_specs ('arm+hf'); + } return &add_specs ('arm'); } elsif ($arch =~ /^(aarch64)$/i) { return &add_specs ('aarch64'); -- 2.20.0