This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
New configure variable: OBJDUMP_DEFS, new objdump define: DISASSEMBLER_NEEDS_RELOCS
- To: binutils at sources dot redhat dot com
- Subject: New configure variable: OBJDUMP_DEFS, new objdump define: DISASSEMBLER_NEEDS_RELOCS
- From: Nick Clifton <nickc at redhat dot com>
- Date: Tue, 9 Jan 2001 12:25:40 -0800
Hi Guys,
I am applying the patch below to create a new configure variable
'OBJDUMP_DEFS' and a new define for objdump
'DISASSEMBLER_NEEDS_RELOCS'.
The new configure variable is so that command line switches can be
passed to the compiler used to compile objdump.o.
The new objdump define is so that relocs will be read in, even if
--reloc has not been specified on the command line. This allows the
INSN_HAS_RELOC flag to be set and passed to the disassembler even
when --reloc was not specified. In turn this means that
disassemblers that use the INSN_HAS_RELOC flag will now have
consistent behavior with or without the --reloc flag.
Cheers
Nick
2001-01-09 Nick Clifton <nickc@redhat.com>
* Makefile.am: Add rule to build objdump.o from objdump.c and
using OBJDUMP_DEFS.
* Makefile.in: Regenerate.
* configure.in: Define OBJDUMP_DEFS. Default to empty.
(arm, xscale, d10v): For these targets define OBJDUMP_DEFS to
-DDISASSEMBLER_NEEDS_RELOCS.
* confgiure: Regenerate.
* objdump.c (disassemble_bytes): If DISASSEMBLER_NEEDS_RELOCS
is defined read in the relocs even if dump_reloc_info is
false.
Index: Makefile.am
===================================================================
RCS file: /cvs/src//src/binutils/Makefile.am,v
retrieving revision 1.17
diff -p -r1.17 Makefile.am
*** Makefile.am 2000/07/20 17:28:56 1.17
--- Makefile.am 2001/01/09 20:15:06
*************** nm_new_SOURCES = nm.c $(BULIBS)
*** 171,176 ****
--- 171,179 ----
objdump_SOURCES = objdump.c prdbg.c $(DEBUG_SRCS) $(BULIBS)
objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS)
+ objdump.o:objdump.c
+ $(COMPILE) -c $(OBJDUMP_DEFS) $(srcdir)/objdump.c
+
underscore.c: stamp-under ; @true
stamp-under: Makefile
Index: configure.in
===================================================================
RCS file: /cvs/src//src/binutils/configure.in,v
retrieving revision 1.18
diff -p -r1.18 configure.in
*** configure.in 2000/12/19 22:22:02 1.18
--- configure.in 2001/01/09 20:15:06
*************** DLLTOOL_DEFS=
*** 171,176 ****
--- 171,177 ----
BUILD_WINDRES=
BUILD_DLLWRAP=
BUILD_MISC=
+ OBJDUMP_DEFS=
for targ in $target $canon_targets
do
*************** changequote([,])dnl
*** 219,224 ****
--- 220,228 ----
DLLTOOL_DEFS="$DLLTOOL_DEFS -DDLLTOOL_ARM"
BUILD_WINDRES='$(WINDRES_PROG)$(EXEEXT)'
;;
+ arm-* | xscale-* | strongarm-* | d10v-*)
+ OBJDUMP_DEFS="-DDISASSEMBLER_NEEDS_RELOCS"
+ ;;
changequote(,)dnl
i[3-6]86-*pe* | i[3-6]86-*-cygwin* | i[3-6]86-*-mingw32*)
changequote([,])dnl
*************** AC_SUBST(DLLTOOL_DEFS)
*** 267,272 ****
--- 271,277 ----
AC_SUBST(BUILD_WINDRES)
AC_SUBST(BUILD_DLLWRAP)
AC_SUBST(BUILD_MISC)
+ AC_SUBST(OBJDUMP_DEFS)
AC_DEFINE_UNQUOTED(TARGET, "${target}", [Configured target name.])
Index: objdump.c
===================================================================
RCS file: /cvs/src//src/binutils/objdump.c,v
retrieving revision 1.31
diff -p -r1.31 objdump.c
*** objdump.c 2000/08/18 01:58:12 1.31
--- objdump.c 2001/01/09 20:15:06
*************** disassemble_bytes (info, disassemble_fn,
*** 1358,1370 ****
info->bytes_per_line = 0;
info->bytes_per_chunk = 0;
/* FIXME: This is wrong. It tests the number of octets
in the last instruction, not the current one. */
if (*relppp < relppend
&& (**relppp)->address >= addr_offset
! && (**relppp)->address < addr_offset + octets / opb)
info->flags = INSN_HAS_RELOC;
else
info->flags = 0;
octets = (*disassemble_fn) (section->vma + addr_offset, info);
--- 1358,1372 ----
info->bytes_per_line = 0;
info->bytes_per_chunk = 0;
+ #ifdef DISASSEMBLER_NEEDS_RELOCS
/* FIXME: This is wrong. It tests the number of octets
in the last instruction, not the current one. */
if (*relppp < relppend
&& (**relppp)->address >= addr_offset
! && (**relppp)->address <= addr_offset + octets / opb)
info->flags = INSN_HAS_RELOC;
else
+ #endif
info->flags = 0;
octets = (*disassemble_fn) (section->vma + addr_offset, info);
*************** disassemble_bytes (info, disassemble_fn,
*** 1504,1515 ****
need_nl = true;
}
! if (dump_reloc_info
! && (section->flags & SEC_RELOC) != 0)
{
while ((*relppp) < relppend
&& ((**relppp)->address >= (bfd_vma) addr_offset
&& (**relppp)->address < (bfd_vma) addr_offset + octets / opb))
{
arelent *q;
--- 1506,1525 ----
need_nl = true;
}
! if ((section->flags & SEC_RELOC) != 0
! #ifndef DISASSEMBLER_NEEDS_RELOCS
! && dump_reloc_info
! #endif
! )
{
while ((*relppp) < relppend
&& ((**relppp)->address >= (bfd_vma) addr_offset
&& (**relppp)->address < (bfd_vma) addr_offset + octets / opb))
+ #ifdef DISASSEMBLER_NEEDS_RELOCS
+ if (! dump_reloc_info)
+ ++(*relppp);
+ else
+ #endif
{
arelent *q;
*************** disassemble_data (abfd)
*** 1665,1672 ****
if (only != (char *) NULL && strcmp (only, section->name) != 0)
continue;
! if (dump_reloc_info
! && (section->flags & SEC_RELOC) != 0)
{
long relsize;
--- 1675,1685 ----
if (only != (char *) NULL && strcmp (only, section->name) != 0)
continue;
! if ((section->flags & SEC_RELOC) != 0
! #ifndef DISASSEMBLER_NEEDS_RELOCS
! && dump_reloc_info
! #endif
! )
{
long relsize;