This is the mail archive of the 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: [RFC PATCH] Synthetize some symbols for objdump -d

Jakub Jelinek <> wrote:
> Most of the arches should be able to use the generic code,
> if they use .got.plt they just need to define elf_backend_plt_entry_size
> and elf_backend_reserved_plt_size macros, otherwise they don't need
> anything in most cases.  IA-64 will need to define elf_backend_relplt_name,
> sparc64 provide its own implementation (as part of PLT is normal PLT like,
> the second is .got.plt like).
> What do you think?

Great!  This is very very useful and friendly feature, I believe.

SH needs a tiny change of opcodes/dis-sh.c because it uses constant
pools always and the address value tends to be disassembled as a part
of the comment by an SH specific routine.  With it, I've got

004004e0 <main>:
  4004e0:	e6 2f		mov.l	r14,@-r15
  4004e2:	22 4f		sts.l	pr,@-r15
  4004e4:	f3 6e		mov	r15,r14
  4004e6:	05 d1		mov.l	4004fc <main+0x1c>,r1	! 0x4005bc
  4004e8:	13 64		mov	r1,r4
  4004ea:	05 d1		mov.l	400500 <main+0x20>,r1	! 0x400378 <printf@plt>
  4004ec:	0b 41		jsr	@r1

as expected.  The attatched is a full SH portion.

I've also prepared a patch for SH gas/ld testsuite so to match this
change.  With this change, there are no regressions on sh-elf, sh-coff,
sh-unknown-linux-gnu and sh64-elf.  I'll resubmit them once the patch
is committed.

	* elf32-sh.c (elf_backend_plt_entry_size,
	elf_backend_reserved_plt_size): Define.
	* sh-dis.c (print_insn_sh): Print the value in constant pool
	as a symbol if it looks like a symbol.

diff -u3prN ORIG/src/bfd/elf32-sh.c TMP/src/bfd/elf32-sh.c
--- ORIG/src/bfd/elf32-sh.c	Tue Mar 30 09:10:23 2004
+++ TMP/src/bfd/elf32-sh.c	Wed Apr 21 08:52:26 2004
@@ -7534,6 +7534,8 @@ elf32_shlin_grok_psinfo (bfd *abfd, Elf_
 #define elf_backend_plt_readonly	1
 #define elf_backend_want_plt_sym	0
 #define elf_backend_got_header_size	12
+#define elf_backend_plt_entry_size	PLT_ENTRY_SIZE
+#define elf_backend_reserved_plt_size	PLT_ENTRY_SIZE
diff -u3prN ORIG/src/opcodes/sh-dis.c TMP/src/opcodes/sh-dis.c
--- ORIG/src/opcodes/sh-dis.c	Thu Mar  4 08:17:59 2004
+++ TMP/src/opcodes/sh-dis.c	Wed Apr 21 09:34:44 2004
@@ -855,7 +855,13 @@ print_insn_sh (memaddr, info)
 		    val = bfd_getb32 (bytes);
-	      fprintf_fn (stream, "\t! 0x%x", val);
+	      if ((*info->symbol_at_address_func) (val, info))
+		{
+		  fprintf_fn (stream, "\t! 0x");
+		  (*info->print_address_func) (val, info);
+		}
+	      else
+		fprintf_fn (stream, "\t! 0x%x", val);

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