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

Richard Sandiford rdsandiford@googlemail.com
Mon Feb 18 18:56:00 GMT 2013


"Maciej W. Rozycki" <macro@codesourcery.com> writes:
>  We have a test case in the LD test suite that disassembles PLT, but 
> discards .rel.plt upon link.  As a result the PLT cannot be correctly 
> interpreted, the synthetic symbols cannot be made.
>
>  I propose this change in preparation to switch to microMIPS PLT support 
> where the presence of _PROCEDURE_LINKAGE_TABLE_ and the synthetic symbols 
> will actually be a requirement for meaningful interpretation/disassembly 
> of the PLT.  The change adds all the dynamic and other usual sections to 
> the linker script as well, for clarity (they're output implicitly anyway).

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.

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.

Richard



More information about the Binutils mailing list