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]

Re: [PATCH] MIPS/LD/testsuite: Provide for correct PLT disassembly


On Mon, 18 Feb 2013, Richard Sandiford wrote:

> Hmm, the order looks a bit odd:
> 
> > Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/jalx-2.ld
> > ===================================================================
> > --- binutils-fsf-trunk-quilt.orig/ld/testsuite/ld-mips-elf/jalx-2.ld	2011-10-24 22:15:55.145952461 +0100
> > +++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/jalx-2.ld	2011-10-24 23:03:24.945915225 +0100
> > @@ -5,4 +5,16 @@ _start_text = _start_text_phys;
> >  SECTIONS
> >  {
> >    .text _start_text : AT (ADDR (.text)) { *(.text) }
> > +  .plt : { *(.plt) }
> > +  .interp : { *(.interp) }
> > +  .got : { *(.got) }
> > +  .got.plt : { *(.got.plt) }
> > +  .rld_map : { *(.rld_map) }
> > +  .dynsym : { *(.dynsym) }
> > +  .dynstr : { *(.dynstr) }
> > +  .dynamic : { *(.dynamic) }
> > +  .hash : { *(.hash) }
> > +  .reginfo : { *(.reginfo) }
> > +  .rodata : { *(.rodata) }
> > +  .rel.plt : { *(.rel.plt) }
> >  }
> 
> Things like .rodata and .rel.plt would normally be in the text segment,
> but things like .got.plt would normally be in the data segment.  Here
> .got.plt comes before the other two.  Obviously we don't care for this test,
> and the linker might not do anything better with orphaned sections.
> The list still seems more confusing than helpful though.

 To be honest I have no slightest idea where I got this order from, it's 
been a long time since I made this change.  And actually I was wondering 
about that just as I was preparing the patch to submit as this order is 
different to one I chose for the upcoming PLT tests, but I decided it 
didn't really matter that much for the test case, so I just left the 
sections as I originally arranged them.  Sorry about the confusion.

 On the other hand .rel.plt and.plt normally come before .text, but then I 
didn't want to mess with addresses.

> I think it'd be clearer to list only the sections you need for the
> test to work (.plt and .rel.plt?).  OK with that change, thanks.

 Either way is fine with me, however to be absolutely sure there are no 
surprises I've pushed the new version through regular regression testing 
(i.e. the 25 MIPS targets I currently use for this purpose).  Below is the 
final version I applied.

 Thanks for your review, I have applied all the other changes you have 
approved today as well (having removed an extraneous newline from 
gas-umips-picop-label that I inadvertently introduced).  More to come 
soon.

  Maciej

2013-02-18  Maciej W. Rozycki  <macro@codesourcery.com>

	* ld-mips-elf/jalx-2.ld: Include .rel.plt in output, give .plt a
	mapping.
	* ld-mips-elf/jalx-2.dd: Adjust disassembly accordingly.

Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/jalx-2.dd
===================================================================
--- binutils-fsf-trunk-quilt.orig/ld/testsuite/ld-mips-elf/jalx-2.dd	2013-02-18 21:23:54.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/jalx-2.dd	2013-02-18 21:24:10.264037629 +0000
@@ -29,7 +29,7 @@
  4400038:	f8be 0024 	sw	a1,36\(s8\)
  440003c:	41a2 0440 	lui	v0,0x440
  4400040:	3082 02a0 	addiu	a0,v0,672
- 4400044:	f110 0028 	jalx	44000a0 <_PROCEDURE_LINKAGE_TABLE_\+0x20>
+ 4400044:	f110 0028 	jalx	44000a0 <printf@plt>
  4400048:	0000 0000 	nop
  440004c:	f620 0010 	jal	4400020 <internal_function>
  4400050:	0000 0000 	nop
@@ -52,6 +52,8 @@
  4400094:	0018c082 	srl	t8,t8,0x2
  4400098:	0320f809 	jalr	t9
  440009c:	2718fffe 	addiu	t8,t8,-2
+
+044000a0 <printf@plt>:
  44000a0:	3c0f0440 	lui	t7,0x440
  44000a4:	8df900e0 	lw	t9,224\(t7\)
  44000a8:	03200008 	jr	t9
Index: binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/jalx-2.ld
===================================================================
--- binutils-fsf-trunk-quilt.orig/ld/testsuite/ld-mips-elf/jalx-2.ld	2013-02-18 21:23:54.000000000 +0000
+++ binutils-fsf-trunk-quilt/ld/testsuite/ld-mips-elf/jalx-2.ld	2013-02-18 21:27:05.774239623 +0000
@@ -5,4 +5,6 @@ _start_text = _start_text_phys;
 SECTIONS
 {
   .text _start_text : AT (ADDR (.text)) { *(.text) }
+  .plt : { *(.plt) }
+  .rel.plt : { *(.rel.plt) }
 }


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