--- gcc/config/aarch64/aarch64-option-extensions.def +++ gcc/config/aarch64/aarch64-option-extensions.def @@ -44,7 +44,8 @@ the extension (for example, the 'crypto' extension depends on four entries: aes, pmull, sha1, sha2 being present). In that case this field should contain a space (" ") separated list of the strings in 'Features' - that are required. Their order is not important. */ + that are required. Their order is not important. An empty string means + do not detect this feature during auto detection. */ /* Enabling "fp" just enables "fp". Disabling "fp" also disables "simd", "crypto", "fp16", "aes", "sha2", --- gcc/config/aarch64/driver-aarch64.c +++ gcc/config/aarch64/driver-aarch64.c @@ -253,6 +253,12 @@ host_detect_local_cpu (int argc, const char **argv) char *p = NULL; char *feat_string = concat (aarch64_extensions[i].feat_string, NULL); + + /* If the feature contains no HWCAPS string then ignore it for the + auto detection. */ + if (strlen (feat_string) == 0) + continue; + bool enabled = true; /* This may be a multi-token feature string. We need --- gcc/testsuite/gcc.target/aarch64/options_set_10.c +++ gcc/testsuite/gcc.target/aarch64/options_set_10.c @@ -0,0 +1,11 @@ +/* { dg-do compile { target "aarch64*-*-linux*" } } */ +/* { dg-additional-options "-mcpu=native" } */ + +int main () +{ + return 0; +} + +/* { dg-final { scan-assembler-not {\.arch .+\+profile.*} } } */ + + /* Check that an empty feature string is not detected during mcpu=native. */