[PATCH] Don't define ARCH_cris for BFD64

Alan Modra amodra@gmail.com
Wed May 4 22:37:07 GMT 2022


On Wed, May 04, 2022 at 04:37:03PM +0200, Hans-Peter Nilsson wrote:
> > From: Alan Modra <amodra@gmail.com>
> > Date: Wed, 4 May 2022 10:39:58 +0200
> 
> > On Wed, May 04, 2022 at 09:15:43AM +0100, Luis Machado wrote:
> > > On 5/4/22 09:08, Alan Modra wrote:
> > > > On Wed, May 04, 2022 at 08:56:28AM +0100, Luis Machado via Binutils wrote:
> > > > > I believe it is a mistake to define ARCH_cris when BFD64 is defined. It is
> > > > > a 32-bit architecture, so should be placed outside of the BFD64 block.
> > > > 
> > > > No.  cris may be 32-bit but the bfd support requires a 64-bit bfd.
> > > > See config.bfd.
> > > > 
> > > 
> > > Interesting, I missed that. So I suppose GDB will need to move these cris
> > > files from ALL_TARGET_OBS to ALL_64_TARGET_OBS.
> > > 
> > > I see opcodes/Makefile.am also puts the cris files into
> > > TARGET32_LIBOPCODES_CFILES. Is that a mistake?
> > 
> > Hmm, maybe config.bfd is wrong.  I see cris files in bfd/Makefile.am
> > BFD32_BACKENDS.  Hans-Peter, do you know what is going on here?
> 
> I didn't remember that I had changed anything 32/64-related
> in that area, so I had to consult git blame.  The most
> recent change I did was in 2017, so whatever 32/64-changes
> is probably related to 56fbd041853a "Fix gas/22304 by
> forcing a 64-bit bfd for cris*-*" (TL;DR: expressions
> overflow).  That commit *could* be slightly wrong; perhaps
> it shouldn't be wrapped in #ifdef BFD64?
> 
> Adding CRIS files to BFD32_BACKENDS happened when the port
> was added, back in 2000.  If it's wrong for a 32-bit target
> to be there, then I don't want to be right! :)

OK, so this means we have two slightly different versions of cris
support.  Configured to support cris directly with --target or
--enable-targets mentioning one of the cris tuples will always give
you a 64-bit bfd.  On a 32-bit host configured with
--enable-targets=all you'll get a 32-bit bfd, and miss some support
for explicitly choosing and displaying targets.  (The #ifdef comments
in config.bfd are used to generate targmatch.h, which gets included
into targets.c.)

I'm going to apply the following, and Luis, please apply your
disassemble.c change.

	* config.bfd (cris): Remove #idef BFD64.

diff --git a/bfd/config.bfd b/bfd/config.bfd
index 5a690742eb3..2a6aec28036 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -460,7 +460,6 @@ case "${targ}" in
     targ_underscore=yes
     ;;
 
-#ifdef BFD64
   cris-*-* | crisv32-*-*)
     targ_defvec=cris_aout_vec
     targ_selvecs="cris_elf32_us_vec cris_elf32_vec"
@@ -470,7 +469,6 @@ case "${targ}" in
     esac
     want64=true
     ;;
-#endif
 
   crx-*-elf*)
     targ_defvec=crx_elf32_vec


-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list