This is the mail archive of the binutils@sourceware.org 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]

[patch] cris: PLT disassembly support


Hello,

This patch implements the helper needed to get support for disassembly of the plt section for CRIS.

- Johan

bfd:
	* elf32-cris.c (cris_elf_plt_sym_val): New function.
	(elf_backend_plt_sym_val): Define.

ld/testsuite:
	* ld-cris/dso12-pltdis.d: New test.


Index: bfd/elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.105
diff -u -p -r1.105 elf32-cris.c
--- bfd/elf32-cris.c	19 Oct 2009 16:33:49 -0000	1.105
+++ bfd/elf32-cris.c	28 Oct 2009 09:17:29 -0000
@@ -2704,6 +2704,21 @@ cris_elf_gc_sweep_hook (bfd *abfd,
   return TRUE;
 }
 
+/* The elf_backend_plt_sym_val hook function.  */
+
+static bfd_vma
+cris_elf_plt_sym_val (bfd_vma i, const asection *plt,
+		      const arelent *rel ATTRIBUTE_UNUSED)
+{
+  bfd_size_type plt_entry_size;
+
+  plt_entry_size
+    = (bfd_get_mach (plt->owner) == bfd_mach_cris_v32
+       ? PLT_ENTRY_SIZE_V32 : PLT_ENTRY_SIZE);
+
+  return plt->vma + (i + 1) * plt_entry_size;
+}
+
 /* Make sure we emit a GOT entry if the symbol was supposed to have a PLT
    entry but we found we will not create any.  Called when we find we will
    not have any PLT for this symbol, by for example
@@ -4312,6 +4327,7 @@ elf_cris_got_elt_size (bfd *abfd ATTRIBU
 #define elf_backend_relocate_section		cris_elf_relocate_section
 #define elf_backend_gc_mark_hook		cris_elf_gc_mark_hook
 #define elf_backend_gc_sweep_hook		cris_elf_gc_sweep_hook
+#define elf_backend_plt_sym_val			cris_elf_plt_sym_val
 #define elf_backend_check_relocs                cris_elf_check_relocs
 #define elf_backend_grok_prstatus		cris_elf_grok_prstatus
 #define elf_backend_grok_psinfo			cris_elf_grok_psinfo

#source: expdyn1.s
#source: dsov32-1.s
#source: dsov32-2.s
#as: --pic --no-underscore --march=v32 --em=criself
#ld: --shared -m crislinux -z nocombreloc
#objdump: -d 

# Check dissassembly of .plt section.

.*:     file format elf32-cris


Disassembly of section \.plt:

0+1e4 <dsofn4@plt-0x1a>:

 1e4:	84e2                	subq 4,\$sp
 1e6:	0401                	addoq 4,\$r0,\$acr
 1e8:	7e7a                	move \$mof,\[\$sp\]
 1ea:	3f7a                	move \[\$acr\],\$mof
 1ec:	04f2                	addq 4,\$acr
 1ee:	6ffa                	move\.d \[\$acr\],\$acr
 1f0:	bf09                	jump \$acr
 1f2:	b005                	nop 
	\.\.\.

0+1fe <dsofn4@plt>:
 1fe:	6f0d 0c00 0000      	addo\.d c <dsofn4@plt-0x1f2>,\$r0,\$acr
 204:	6ffa                	move\.d \[\$acr\],\$acr
 206:	bf09                	jump \$acr
 208:	b005                	nop 
 20a:	3f7e 0000 0000      	move 0 <dsofn4@plt-0x1fe>,\$mof
 210:	bf0e d4ff ffff      	ba 1e4 <dsofn4@plt-0x1a>
 216:	b005                	nop 

0+218 <dsofn@plt>:
 218:	6f0d 1000 0000      	addo\.d 10 <dsofn4@plt-0x1ee>,\$r0,\$acr
 21e:	6ffa                	move\.d \[\$acr\],\$acr
 220:	bf09                	jump \$acr
 222:	b005                	nop 
 224:	3f7e 0c00 0000      	move c <dsofn4@plt-0x1f2>,\$mof
 22a:	bf0e baff ffff      	ba 1e4 <dsofn4@plt-0x1a>
 230:	b005                	nop 

Disassembly of section \.text:
#...
0+236 <dsofn3>:
 236:	bfbe e2ff ffff      	bsr 218 <dsofn@plt>
 23c:	b005                	nop 

0+23e <dsofn4>:
 23e:	7f0d a620 0000      	lapc 22e4 <_GLOBAL_OFFSET_TABLE_>,\$r0
 244:	5f0d 1400           	addo\.w 0x14,\$r0,\$acr
 248:	bfbe b6ff ffff      	bsr 1fe <dsofn4@plt>
#pass


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