This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Testsuite fixes for GAS


Alan Modra <amodra@bigpond.net.au> writes:

> On Sat, Jan 08, 2005 at 09:41:47PM +0100, Andreas Schwab wrote:
>> Depending on the definition of SKIP_ZEROES in objdump, which depends on
>> the enabled targets, trailing zeroes in a section may or may not be
>> disassembled.
>
> Eww.  Should really be fixed by having objdump interrogate bfd about the
> target.

Yes.  Tested on
{i386,ia64,powerpc,powerpc64,s390,s390x,x86_64}-suse-linux, each with
--enable-targets={alpha,arm,hppa,i686,ia64,m68k,powerpc,powerpc64,s390,s390x,sparc,sparc64,x86_64}-suse-linux.

2005-01-09  Andreas Schwab  <schwab@suse.de>

binutils/:
	* configure.in: Don't define SKIP_ZEROES.
	* configure: Regenerate.
	* objdump.c (disassemble_data): Set skip_zeroes and
	skip_zeroes_at_end in disasm_info to defaults.
	(DEFAULT_SKIP_ZEROES): Rename from SKIP_ZEROES and always define.
	(DEFAULT_SKIP_ZEROES_AT_END): Rename from SKIP_ZEROES_AT_END and
	always define.
	(disassemble_bytes): Use skip_zeroes and skip_zeroes_at_end from
	objdump_disasm_info.

include/:
	* dis-asm.h (struct disassemble_info): Add skip_zeroes and
	skip_zeroes_at_end.

opcodes/:
	* disassemble.c (disassemble_init_for_target) <case
	bfd_arch_ia64>: Set skip_zeroes to 16.
	<case bfd_arch_tic4x>: Set skip_zeroes to 32.

Index: binutils/configure.in
===================================================================
RCS file: /cvs/src/src/binutils/configure.in,v
retrieving revision 1.44
diff -u -a -p -r1.44 configure.in
--- binutils/configure.in	13 Oct 2004 14:33:51 -0000	1.44
+++ binutils/configure.in	9 Jan 2005 13:39:56 -0000
@@ -310,12 +310,6 @@ changequote([,])dnl
   	  BUILD_DLLTOOL='$(DLLTOOL_PROG)$(EXEEXT)'
 	  DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_MCORE_ELF"
 	  ;;
-        c4x-*-* | tic4x-*-*)
-          OBJDUMP_DEFS="$OBJDUMP_DEFS -DSKIP_ZEROES=32"
-          ;;
-	ia64-*-*)
-	  OBJDUMP_DEFS="$OBJDUMP_DEFS -DSKIP_ZEROES=16"
-	  ;;
 	esac
     fi
 done
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.97
diff -u -a -p -r1.97 objdump.c
--- binutils/objdump.c	30 Dec 2004 22:33:20 -0000	1.97
+++ binutils/objdump.c	9 Jan 2005 13:40:03 -0000
@@ -1202,9 +1202,7 @@ process_section_p (asection * section)
 /* The number of zeroes we want to see before we start skipping them.
    The number is arbitrarily chosen.  */
 
-#ifndef SKIP_ZEROES
-#define SKIP_ZEROES (8)
-#endif
+#define DEFAULT_SKIP_ZEROES 8
 
 /* The number of zeroes to skip at the end of a section.  If the
    number of zeroes at the end is between SKIP_ZEROES_AT_END and
@@ -1213,9 +1211,7 @@ process_section_p (asection * section)
    attempt to avoid disassembling zeroes inserted by section
    alignment.  */
 
-#ifndef SKIP_ZEROES_AT_END
-#define SKIP_ZEROES_AT_END (3)
-#endif
+#define DEFAULT_SKIP_ZEROES_AT_END 3
 
 /* Disassemble some data in memory between given values.  */
 
@@ -1236,7 +1232,9 @@ disassemble_bytes (struct disassemble_in
   bfd_boolean done_dot;
   int skip_addr_chars;
   bfd_vma addr_offset;
-  int opb = info->octets_per_byte;
+  unsigned int opb = info->octets_per_byte;
+  unsigned int skip_zeroes = info->skip_zeroes;
+  unsigned int skip_zeroes_at_end = info->skip_zeroes_at_end;
   SFILE sfile;
 
   aux = (struct objdump_disasm_info *) info->application_data;
@@ -1292,9 +1290,9 @@ disassemble_bytes (struct disassemble_in
       if (! disassemble_zeroes
 	  && (info->insn_info_valid == 0
 	      || info->branch_delay_insns == 0)
-	  && (z - addr_offset * opb >= SKIP_ZEROES
+	  && (z - addr_offset * opb >= skip_zeroes
 	      || (z == stop_offset * opb &&
-		  z - addr_offset * opb < SKIP_ZEROES_AT_END)))
+		  z - addr_offset * opb < skip_zeroes_at_end)))
 	{
 	  printf ("\t...\n");
 
@@ -1855,6 +1853,8 @@ disassemble_data (bfd *abfd)
   disasm_info.mach = bfd_get_mach (abfd);
   disasm_info.disassembler_options = disassembler_options;
   disasm_info.octets_per_byte = bfd_octets_per_byte (abfd);
+  disasm_info.skip_zeroes = DEFAULT_SKIP_ZEROES;
+  disasm_info.skip_zeroes_at_end = DEFAULT_SKIP_ZEROES_AT_END;
 
   if (bfd_big_endian (abfd))
     disasm_info.display_endian = disasm_info.endian = BFD_ENDIAN_BIG;
Index: include/dis-asm.h
===================================================================
RCS file: /cvs/src/src/include/dis-asm.h,v
retrieving revision 1.48
diff -u -a -p -r1.48 dis-asm.h
--- include/dis-asm.h	8 Nov 2004 13:17:38 -0000	1.48
+++ include/dis-asm.h	9 Jan 2005 13:40:24 -0000
@@ -159,6 +159,18 @@ typedef struct disassemble_info {
      Normally one, but some DSPs have byte sizes of 16 or 32 bits.  */
   unsigned int octets_per_byte;
 
+  /* The number of zeroes we want to see at the end of a section before we
+     start skipping them.  */
+  unsigned int skip_zeroes;
+
+  /* The number of zeroes to skip at the end of a section.  If the number
+     of zeroes at the end is between SKIP_ZEROES_AT_END and SKIP_ZEROES,
+     they will be disassembled.  If there are fewer than
+     SKIP_ZEROES_AT_END, they will be skipped.  This is a heuristic
+     attempt to avoid disassembling zeroes inserted by section
+     alignment.  */
+  unsigned int skip_zeroes_at_end;
+
   /* Results from instruction decoders.  Not all decoders yet support
      this information.  This info is set each time an instruction is
      decoded, and is only valid for the last such instruction.
Index: opcodes/disassemble.c
===================================================================
RCS file: /cvs/src/src/opcodes/disassemble.c,v
retrieving revision 1.48
diff -u -a -p -r1.48 disassemble.c
--- opcodes/disassemble.c	8 Nov 2004 13:17:37 -0000	1.48
+++ opcodes/disassemble.c	9 Jan 2005 13:41:00 -0000
@@ -1,5 +1,5 @@
 /* Select disassembly routine for specified architecture.
-   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004
+   Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005
    Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -424,6 +424,15 @@ disassemble_init_for_target (struct disa
       info->symbol_is_valid = arm_symbol_is_valid;
       break;
 #endif
+#ifdef ARCH_ia64
+    case bfd_arch_ia64:
+      info->skip_zeroes = 16;
+      break;
+#endif
+#ifdef ARCH_tic4x
+    case bfd_arch_tic4x:
+      info->skip_zeroes = 32;
+#endif
     default:
       break;
     }

>
>> 	* gas/i386/intel16.d: Ignore trailing text with #pass. 
>> 	* gas/i386/intelok.d: Likewise.
>> 	* gas/i386/prefix.d: Likewise.
>> 	* gas/i386/sub.d: Likewise.
>> 	* gas/i386/padlock.d: Likewise.
>> 	* gas/i386/x86_64.d: Likewise.
>
> OK.

I've checked that in anyway, although it's not really necessary any more
with the above patch.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]