PR28827 testcase

Alan Modra amodra@gmail.com
Sat Feb 5 10:00:23 GMT 2022


On Fri, Feb 04, 2022 at 11:43:13PM -0800, Fangrui Song wrote:
> On 2022-02-05, Alan Modra via Binutils wrote:
> > This testcase triggers a stub sizing error with the patches applied
> > for PR28743 (commit 2f83249c13d8 and c804c6f98d34).
> > 
> > 	PR 28827
> > 	* testsuite/ld-powerpc/pr28827-1.s,
> > 	* testsuite/ld-powerpc/pr28827-1.d: New test.
> > 	* testsuite/ld-powerpc/powerpc.exp: Run it.
> > 
> > diff --git a/ld/testsuite/ld-powerpc/powerpc.exp b/ld/testsuite/ld-powerpc/powerpc.exp
> > index 318bf92c85f..9eff14fc89f 100644
> > --- a/ld/testsuite/ld-powerpc/powerpc.exp
> > +++ b/ld/testsuite/ld-powerpc/powerpc.exp
> > @@ -465,6 +465,7 @@ if [ supports_ppc64 ] then {
> >     run_dump_test "tlsie"
> >     run_dump_test "non-contiguous-powerpc64"
> >     run_dump_test "tprel"
> > +    run_dump_test "pr28827-1"
> >     run_dump_test "pr28827-2"
> > }
> > 
> > diff --git a/ld/testsuite/ld-powerpc/pr28827-1.d b/ld/testsuite/ld-powerpc/pr28827-1.d
> > new file mode 100644
> > index 00000000000..8df9bcffddc
> > --- /dev/null
> > +++ b/ld/testsuite/ld-powerpc/pr28827-1.d
> > @@ -0,0 +1,4 @@
> > +# ld: -melf64ppc -gc-sections -shared -z relro --plt-align=0
> > +# size: -A
> > +
> > +#pass
> > diff --git a/ld/testsuite/ld-powerpc/pr28827-1.s b/ld/testsuite/ld-powerpc/pr28827-1.s
> > new file mode 100644
> > index 00000000000..bf647a69072
> > --- /dev/null
> > +++ b/ld/testsuite/ld-powerpc/pr28827-1.s
> > @@ -0,0 +1,6828 @@
> > +	.globl	_start
> > +	.type	_start,@function
> > +	.text
> > +_start:
> > +	.cfi_startproc
> > +0:
> > + addis 2,12,(.TOC.-0b)@ha
> > + addi 2,2,(.TOC.-0b)@l
> > +	.localentry _start,.-0b
> > + mflr 0
> > + std 0,16(1)
> > + stdu 1,-32(1)
> > +	.cfi_def_cfa_offset 32
> > +	.cfi_offset 65, 16
> > + bl f0
> > + nop
> > + bl f1
> > + nop
> > + bl f2
> > + nop
> > + bl f3
> > + nop
> > + bl f4
> > + nop
> > + bl f5
> > + nop
> > + bl f6
> > [...]
> 
> Can the long list of instructions be replaced with two output sections
> with only few instructions?

No, the idea was to create a reasonably big .plt and call stub
section.  (I should have used nested gas .irpt macros..)

> SECTIONS {
>   .text_low 0x2000: { *(.text_low) }
>   .text_high 0x2002000 : { *(.text_high) }
> }

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list