Don't compile some opcodes files when bfd is 32-bit only

Alan Modra amodra@gmail.com
Fri Nov 12 08:37:54 GMT 2021


	* Makefile.am (TARGET_LIBOPCODES_CFILES): Split into..
	(TARGET64_LIBOPCODES_CFILES): ..this and..
	(TARGET32_LIBOPCODES_CFILES): ..this.
	(ALL_MACHINES): Likewise split to
	(ALL64_MACHINES, ALL32_MACHINES): ..this.
	* disassemble.c: Define some ARCH_* when ARCH_all only if BFD64.
	* configure.ac (BFD_MACHINES): Defined depending on BFD_ARCH_SIZE.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index e07e360d842..ab7072c0249 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -88,7 +88,7 @@ HFILES = \
 
 # C source files that correspond to .o's ending up in libopcodes
 # for all machines.
-TARGET_LIBOPCODES_CFILES = \
+TARGET64_LIBOPCODES_CFILES = \
 	aarch64-asm.c \
 	aarch64-asm-2.c \
 	aarch64-dis.c \
@@ -97,6 +97,27 @@ TARGET_LIBOPCODES_CFILES = \
 	aarch64-opc-2.c \
 	alpha-dis.c \
 	alpha-opc.c \
+	bpf-asm.c \
+	bpf-desc.c \
+	bpf-dis.c \
+	bpf-ibld.c \
+	bpf-opc.c \
+	ia64-dis.c \
+	ia64-opc.c \
+	loongarch-opc.c \
+	loongarch-dis.c \
+	loongarch-coder.c \
+	mips-dis.c \
+	mips-opc.c \
+	mips16-opc.c \
+	micromips-opc.c \
+	mmix-dis.c \
+	mmix-opc.c \
+	nfp-dis.c \
+	riscv-dis.c \
+	riscv-opc.c
+
+TARGET32_LIBOPCODES_CFILES = \
 	arc-dis.c \
 	arc-ext.c \
 	arc-opc.c \
@@ -120,11 +141,6 @@ TARGET_LIBOPCODES_CFILES = \
 	d30v-dis.c \
 	d30v-opc.c \
 	dlx-dis.c \
-	bpf-asm.c \
-	bpf-desc.c \
-	bpf-dis.c \
-	bpf-ibld.c \
-	bpf-opc.c \
 	epiphany-asm.c \
 	epiphany-desc.c \
 	epiphany-dis.c \
@@ -146,8 +162,6 @@ TARGET_LIBOPCODES_CFILES = \
 	hppa-dis.c \
 	i386-dis.c \
 	i386-opc.c \
-	ia64-dis.c \
-	ia64-opc.c \
 	ip2k-asm.c \
 	ip2k-desc.c \
 	ip2k-dis.c \
@@ -164,9 +178,6 @@ TARGET_LIBOPCODES_CFILES = \
 	lm32-ibld.c \
 	lm32-opc.c \
 	lm32-opinst.c \
-	loongarch-opc.c \
-	loongarch-dis.c \
-	loongarch-coder.c \
 	m10200-dis.c \
 	m10200-opc.c \
 	m10300-dis.c \
@@ -196,12 +207,6 @@ TARGET_LIBOPCODES_CFILES = \
 	mep-opc.c \
 	metag-dis.c \
 	microblaze-dis.c \
-	micromips-opc.c \
-	mips-dis.c \
-	mips-opc.c \
-	mips16-opc.c \
-	mmix-dis.c \
-	mmix-opc.c \
 	moxie-dis.c \
 	moxie-opc.c \
 	msp430-decode.c \
@@ -213,7 +218,6 @@ TARGET_LIBOPCODES_CFILES = \
 	mt-opc.c \
 	nds32-asm.c \
 	nds32-dis.c \
-	nfp-dis.c \
 	nios2-dis.c \
 	nios2-opc.c \
 	ns32k-dis.c \
@@ -230,8 +234,6 @@ TARGET_LIBOPCODES_CFILES = \
 	ppc-opc.c \
 	pru-dis.c \
 	pru-opc.c \
-	riscv-dis.c \
-	riscv-opc.c \
 	rl78-decode.c \
 	rl78-dis.c \
 	rx-decode.c \
@@ -278,7 +280,8 @@ TARGET_LIBOPCODES_CFILES = \
 
 # C source files that correspond to .o's ending up in libopcodes.
 LIBOPCODES_CFILES = \
-	$(TARGET_LIBOPCODES_CFILES) \
+	$(TARGET32_LIBOPCODES_CFILES) \
+	$(TARGET64_LIBOPCODES_CFILES) \
 	dis-buf.c \
 	dis-init.c \
 	disassemble.c
@@ -299,7 +302,8 @@ CFILES = \
 	s390-mkopc.c \
 	z8kgen.c
 
-ALL_MACHINES = $(TARGET_LIBOPCODES_CFILES:.c=.lo)
+ALL32_MACHINES = $(TARGET32_LIBOPCODES_CFILES:.c=.lo)
+ALL64_MACHINES = $(TARGET64_LIBOPCODES_CFILES:.c=.lo)
 
 OFILES = @BFD_MACHINES@
 
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index 942737106ab..59ed0d2c81f 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -479,7 +479,7 @@ HFILES = \
 
 # C source files that correspond to .o's ending up in libopcodes
 # for all machines.
-TARGET_LIBOPCODES_CFILES = \
+TARGET64_LIBOPCODES_CFILES = \
 	aarch64-asm.c \
 	aarch64-asm-2.c \
 	aarch64-dis.c \
@@ -488,6 +488,27 @@ TARGET_LIBOPCODES_CFILES = \
 	aarch64-opc-2.c \
 	alpha-dis.c \
 	alpha-opc.c \
+	bpf-asm.c \
+	bpf-desc.c \
+	bpf-dis.c \
+	bpf-ibld.c \
+	bpf-opc.c \
+	ia64-dis.c \
+	ia64-opc.c \
+	loongarch-opc.c \
+	loongarch-dis.c \
+	loongarch-coder.c \
+	mips-dis.c \
+	mips-opc.c \
+	mips16-opc.c \
+	micromips-opc.c \
+	mmix-dis.c \
+	mmix-opc.c \
+	nfp-dis.c \
+	riscv-dis.c \
+	riscv-opc.c
+
+TARGET32_LIBOPCODES_CFILES = \
 	arc-dis.c \
 	arc-ext.c \
 	arc-opc.c \
@@ -511,11 +532,6 @@ TARGET_LIBOPCODES_CFILES = \
 	d30v-dis.c \
 	d30v-opc.c \
 	dlx-dis.c \
-	bpf-asm.c \
-	bpf-desc.c \
-	bpf-dis.c \
-	bpf-ibld.c \
-	bpf-opc.c \
 	epiphany-asm.c \
 	epiphany-desc.c \
 	epiphany-dis.c \
@@ -537,8 +553,6 @@ TARGET_LIBOPCODES_CFILES = \
 	hppa-dis.c \
 	i386-dis.c \
 	i386-opc.c \
-	ia64-dis.c \
-	ia64-opc.c \
 	ip2k-asm.c \
 	ip2k-desc.c \
 	ip2k-dis.c \
@@ -555,9 +569,6 @@ TARGET_LIBOPCODES_CFILES = \
 	lm32-ibld.c \
 	lm32-opc.c \
 	lm32-opinst.c \
-	loongarch-opc.c \
-	loongarch-dis.c \
-	loongarch-coder.c \
 	m10200-dis.c \
 	m10200-opc.c \
 	m10300-dis.c \
@@ -587,12 +598,6 @@ TARGET_LIBOPCODES_CFILES = \
 	mep-opc.c \
 	metag-dis.c \
 	microblaze-dis.c \
-	micromips-opc.c \
-	mips-dis.c \
-	mips-opc.c \
-	mips16-opc.c \
-	mmix-dis.c \
-	mmix-opc.c \
 	moxie-dis.c \
 	moxie-opc.c \
 	msp430-decode.c \
@@ -604,7 +609,6 @@ TARGET_LIBOPCODES_CFILES = \
 	mt-opc.c \
 	nds32-asm.c \
 	nds32-dis.c \
-	nfp-dis.c \
 	nios2-dis.c \
 	nios2-opc.c \
 	ns32k-dis.c \
@@ -621,8 +625,6 @@ TARGET_LIBOPCODES_CFILES = \
 	ppc-opc.c \
 	pru-dis.c \
 	pru-opc.c \
-	riscv-dis.c \
-	riscv-opc.c \
 	rl78-decode.c \
 	rl78-dis.c \
 	rx-decode.c \
@@ -670,7 +672,8 @@ TARGET_LIBOPCODES_CFILES = \
 
 # C source files that correspond to .o's ending up in libopcodes.
 LIBOPCODES_CFILES = \
-	$(TARGET_LIBOPCODES_CFILES) \
+	$(TARGET32_LIBOPCODES_CFILES) \
+	$(TARGET64_LIBOPCODES_CFILES) \
 	dis-buf.c \
 	dis-init.c \
 	disassemble.c
@@ -692,7 +695,8 @@ CFILES = \
 	s390-mkopc.c \
 	z8kgen.c
 
-ALL_MACHINES = $(TARGET_LIBOPCODES_CFILES:.c=.lo)
+ALL32_MACHINES = $(TARGET32_LIBOPCODES_CFILES:.c=.lo)
+ALL64_MACHINES = $(TARGET64_LIBOPCODES_CFILES:.c=.lo)
 OFILES = @BFD_MACHINES@
 
 # development.sh is used to determine -Werror default.
diff --git a/opcodes/configure b/opcodes/configure
index acfbdd6ec6f..6672c368082 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -12319,7 +12319,11 @@ if test x${all_targets} = xfalse ; then
 
 else	# all_targets is true
     archdefs=-DARCH_all
-    BFD_MACHINES='$(ALL_MACHINES)'
+    if grep '#define BFD_ARCH_SIZE 64' ../bfd/bfd-in3.h > /dev/null; then
+	BFD_MACHINES='$(ALL32_MACHINES) $(ALL64_MACHINES)'
+    else
+	BFD_MACHINES='$(ALL32_MACHINES)'
+    fi
 fi
 
 
diff --git a/opcodes/configure.ac b/opcodes/configure.ac
index 757ce10fbe2..03433157c08 100644
--- a/opcodes/configure.ac
+++ b/opcodes/configure.ac
@@ -379,7 +379,11 @@ if test x${all_targets} = xfalse ; then
 
 else	# all_targets is true
     archdefs=-DARCH_all
-    BFD_MACHINES='$(ALL_MACHINES)'
+    if grep '#define BFD_ARCH_SIZE 64' ../bfd/bfd-in3.h > /dev/null; then
+	BFD_MACHINES='$(ALL32_MACHINES) $(ALL64_MACHINES)'
+    else
+	BFD_MACHINES='$(ALL32_MACHINES)'
+    fi
 fi
 
 AC_SUBST(archdefs)
diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
index 61e666c1822..21d894f57d4 100644
--- a/opcodes/disassemble.c
+++ b/opcodes/disassemble.c
@@ -24,20 +24,30 @@
 #include "opintl.h"
 
 #ifdef ARCH_all
+#ifdef BFD64
 #define ARCH_aarch64
 #define ARCH_alpha
+#define ARCH_bpf
+#define ARCH_cris
+#define ARCH_ia64
+#define ARCH_loongarch
+#define ARCH_mips
+#define ARCH_mmix
+#define ARCH_nfp
+#define ARCH_riscv
+#define ARCH_score
+#define ARCH_tilegx
+#endif
 #define ARCH_arc
 #define ARCH_arm
 #define ARCH_avr
 #define ARCH_bfin
 #define ARCH_cr16
-#define ARCH_cris
 #define ARCH_crx
 #define ARCH_csky
 #define ARCH_d10v
 #define ARCH_d30v
 #define ARCH_dlx
-#define ARCH_bpf
 #define ARCH_epiphany
 #define ARCH_fr30
 #define ARCH_frv
@@ -45,11 +55,9 @@
 #define ARCH_h8300
 #define ARCH_hppa
 #define ARCH_i386
-#define ARCH_ia64
 #define ARCH_ip2k
 #define ARCH_iq2000
 #define ARCH_lm32
-#define ARCH_loongarch
 #define ARCH_m32c
 #define ARCH_m32r
 #define ARCH_m68hc11
@@ -59,15 +67,12 @@
 #define ARCH_mep
 #define ARCH_metag
 #define ARCH_microblaze
-#define ARCH_mips
-#define ARCH_mmix
 #define ARCH_mn10200
 #define ARCH_mn10300
 #define ARCH_moxie
 #define ARCH_mt
 #define ARCH_msp430
 #define ARCH_nds32
-#define ARCH_nfp
 #define ARCH_nios2
 #define ARCH_ns32k
 #define ARCH_or1k
@@ -75,13 +80,11 @@
 #define ARCH_pj
 #define ARCH_powerpc
 #define ARCH_pru
-#define ARCH_riscv
 #define ARCH_rs6000
 #define ARCH_rl78
 #define ARCH_rx
 #define ARCH_s12z
 #define ARCH_s390
-#define ARCH_score
 #define ARCH_sh
 #define ARCH_sparc
 #define ARCH_spu
@@ -89,7 +92,6 @@
 #define ARCH_tic4x
 #define ARCH_tic54x
 #define ARCH_tic6x
-#define ARCH_tilegx
 #define ARCH_tilepro
 #define ARCH_v850
 #define ARCH_vax

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list