From 0bcb06d2f206b920aed12619c82f6e311ecacce2 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Mon, 10 Jan 2005 09:54:50 +0000 Subject: [PATCH] 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) : Set skip_zeroes to 16. : Set skip_zeroes to 32. --- binutils/ChangeLog | 12 +++++++ binutils/configure | 74 ++++++++++++++++++++----------------------- binutils/configure.in | 6 ---- binutils/objdump.c | 18 +++++------ include/ChangeLog | 5 +++ include/dis-asm.h | 12 +++++++ opcodes/ChangeLog | 6 ++++ opcodes/disassemble.c | 11 ++++++- 8 files changed, 88 insertions(+), 56 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 02ddaea2796..44624e5767c 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,15 @@ +2005-01-10 Andreas Schwab + + * 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. + 2005-01-05 H.J. Lu * readelf.c (display_debug_loc): Display base address diff --git a/binutils/configure b/binutils/configure index 59a1b591354..dec5d8250f6 100755 --- a/binutils/configure +++ b/binutils/configure @@ -5037,19 +5037,19 @@ EOF fi echo $ac_n "checking for stat64""... $ac_c" 1>&6 -echo "configure:5054: checking for stat64" >&5 +echo "configure:5041: checking for stat64" >&5 if eval "test \"`echo '$''{'bu_cv_have_stat64'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { struct stat64 st; stat64 ("/tmp/foo", &st); ; return 0; } EOF -if { (eval echo configure:5066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bu_cv_have_stat64=yes else @@ -5059,14 +5059,14 @@ else saved_CPPFLAGS=$CPPFLAGS CPPFLAGS="$CPPFLAGS -D_LARGEFILE64_SOURCE" cat > conftest.$ac_ext < int main() { struct stat64 st; stat64 ("/tmp/foo", &st); ; return 0; } EOF -if { (eval echo configure:5083: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* bu_cv_have_stat64="need -D_LARGEFILE64_SOURCE" else @@ -5100,14 +5100,14 @@ fi # Some systems have frexp only in -lm, not in -lc. echo $ac_n "checking for library containing frexp""... $ac_c" 1>&6 -echo "configure:5050: checking for library containing frexp" >&5 +echo "configure:5104: checking for library containing frexp" >&5 if eval "test \"`echo '$''{'ac_cv_search_frexp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_func_search_save_LIBS="$LIBS" ac_cv_search_frexp="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5122: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_frexp="none required" else @@ -5129,7 +5129,7 @@ rm -f conftest* test "$ac_cv_search_frexp" = "no" && for i in m; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_frexp="-l$i" break @@ -5162,19 +5162,19 @@ else : fi echo $ac_n "checking for time_t in time.h""... $ac_c" 1>&6 -echo "configure:5112: checking for time_t in time.h" >&5 +echo "configure:5166: checking for time_t in time.h" >&5 if eval "test \"`echo '$''{'bu_cv_decl_time_t_time_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { time_t i; ; return 0; } EOF -if { (eval echo configure:5124: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5178: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_decl_time_t_time_h=yes else @@ -5195,19 +5195,19 @@ EOF fi echo $ac_n "checking for time_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:5145: checking for time_t in sys/types.h" >&5 +echo "configure:5199: checking for time_t in sys/types.h" >&5 if eval "test \"`echo '$''{'bu_cv_decl_time_t_types_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { time_t i; ; return 0; } EOF -if { (eval echo configure:5157: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5211: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_decl_time_t_types_h=yes else @@ -5230,12 +5230,12 @@ fi # Under Next 3.2 apparently does not define struct utimbuf # by default. echo $ac_n "checking for utime.h""... $ac_c" 1>&6 -echo "configure:5180: checking for utime.h" >&5 +echo "configure:5234: checking for utime.h" >&5 if eval "test \"`echo '$''{'bu_cv_header_utime_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #ifdef HAVE_TIME_H @@ -5246,7 +5246,7 @@ int main() { struct utimbuf s; ; return 0; } EOF -if { (eval echo configure:5196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5250: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bu_cv_header_utime_h=yes else @@ -5267,12 +5267,12 @@ EOF fi echo $ac_n "checking whether fprintf must be declared""... $ac_c" 1>&6 -echo "configure:5217: checking whether fprintf must be declared" >&5 +echo "configure:5271: checking whether fprintf must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_fprintf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5293,7 +5293,7 @@ int main() { char *(*pfn) = (char *(*)) fprintf ; return 0; } EOF -if { (eval echo configure:5243: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5297: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_fprintf=no else @@ -5314,12 +5314,12 @@ EOF fi echo $ac_n "checking whether strstr must be declared""... $ac_c" 1>&6 -echo "configure:5264: checking whether strstr must be declared" >&5 +echo "configure:5318: checking whether strstr must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_strstr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5340,7 +5340,7 @@ int main() { char *(*pfn) = (char *(*)) strstr ; return 0; } EOF -if { (eval echo configure:5290: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5344: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_strstr=no else @@ -5361,12 +5361,12 @@ EOF fi echo $ac_n "checking whether sbrk must be declared""... $ac_c" 1>&6 -echo "configure:5311: checking whether sbrk must be declared" >&5 +echo "configure:5365: checking whether sbrk must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_sbrk'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5387,7 +5387,7 @@ int main() { char *(*pfn) = (char *(*)) sbrk ; return 0; } EOF -if { (eval echo configure:5337: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5391: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_sbrk=no else @@ -5408,12 +5408,12 @@ EOF fi echo $ac_n "checking whether getenv must be declared""... $ac_c" 1>&6 -echo "configure:5358: checking whether getenv must be declared" >&5 +echo "configure:5412: checking whether getenv must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_getenv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5434,7 +5434,7 @@ int main() { char *(*pfn) = (char *(*)) getenv ; return 0; } EOF -if { (eval echo configure:5384: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5438: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_getenv=no else @@ -5455,12 +5455,12 @@ EOF fi echo $ac_n "checking whether environ must be declared""... $ac_c" 1>&6 -echo "configure:5405: checking whether environ must be declared" >&5 +echo "configure:5459: checking whether environ must be declared" >&5 if eval "test \"`echo '$''{'bfd_cv_decl_needed_environ'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5481,7 +5481,7 @@ int main() { char *(*pfn) = (char *(*)) environ ; return 0; } EOF -if { (eval echo configure:5431: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:5485: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* bfd_cv_decl_needed_environ=no else @@ -5625,12 +5625,6 @@ do 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 diff --git a/binutils/configure.in b/binutils/configure.in index 3eaa8251649..53e2db0bf38 100644 --- a/binutils/configure.in +++ b/binutils/configure.in @@ -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 diff --git a/binutils/objdump.c b/binutils/objdump.c index fa421ad7d5d..7249054214a 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -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_info * info, 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_info * info, 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; diff --git a/include/ChangeLog b/include/ChangeLog index 198570979d1..c4fab4bbf49 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2005-01-10 Andreas Schwab + + * dis-asm.h (struct disassemble_info): Add skip_zeroes and + skip_zeroes_at_end. + 2004-12-11 Ben Elliston * fibheap.h (struct fibnode): Only use unsigned long bitfields diff --git a/include/dis-asm.h b/include/dis-asm.h index aa8e2b50845..be54263a756 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -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. diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index 23821df87fc..2effaf30654 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,9 @@ +2005-01-10 Andreas Schwab + + * disassemble.c (disassemble_init_for_target) : Set skip_zeroes to 16. + : Set skip_zeroes to 32. + 2004-12-23 Tomer Levi * crx-opc.c: Mark 'bcop' instruction as RELAXABLE. diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c index 19de8f6f841..7fda7d39b84 100644 --- a/opcodes/disassemble.c +++ b/opcodes/disassemble.c @@ -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 @@ -423,6 +423,15 @@ disassemble_init_for_target (struct disassemble_info * info) case bfd_arch_arm: 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; -- 2.30.2