diff --git a/gcc/config/arm/bpabi.h b/gcc/config/arm/bpabi.h
index ac5a0905cc5f74ec9c55f827af4f987c6d365650..4c730885ec0e7b38b16e31ce96829182f10fc8f5 100644
--- a/gcc/config/arm/bpabi.h
+++ b/gcc/config/arm/bpabi.h
@@ -46,7 +46,7 @@
 
 /* Tell the assembler to build BPABI binaries.  */
 #undef SUBTARGET_EXTRA_ASM_SPEC
-#define SUBTARGET_EXTRA_ASM_SPEC "-meabi=4"
+#define SUBTARGET_EXTRA_ASM_SPEC "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=4}"
 
 /* The generic link spec in elf.h does not support shared libraries.  */
 #undef LINK_SPEC