diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index de7cc410a99..3db99097800 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -47,10 +47,9 @@ extern "C" {
 
 /* If size isn't specified as 64 or 32, NAME macro should fail.  */
 #ifndef NAME
-#if ARCH_SIZE == 64
+#if defined(ARCH_SIZE) && ARCH_SIZE == 64
 #define NAME(x, y) x ## 64 ## _ ## y
-#endif
-#if ARCH_SIZE == 32
+#elif defined(ARCH_SIZE) && ARCH_SIZE == 32
 #define NAME(x, y) x ## 32 ## _ ## y
 #endif
 #endif
