Re: Help generating LELTP0 with SPE

Segher Boessenkool <[email protected]>
Newsgroups gmane.comp.gcc.help
Message-ID <aRikys6l7xicQh4g@gate>
Hi!

On Thu, Nov 13, 2025 at 10:34:01AM -0800, Anirudh Mathukumilli wrote:
> Very concretely, I compiled libstdc++ with GCC version 8 (which still had
> support for powerpcpse) and found that the destructor thunks were in different
> sections:
> ```
> .LLSDACSE1350:
>         .section        .text._ZNSt9strstreamD1Ev
>         .size   _ZNSt9strstreamD1Ev, .-_ZNSt9strstreamD1Ev
>         .set    .LTHUNK4,_ZNSt9strstreamD1Ev
>         .section        .text._ZTv0_n12_NSt9strstreamD1Ev,"ax",@progbits
>         .align 2
>         .globl _ZTv0_n12_NSt9strstreamD1Ev
>         .type   _ZTv0_n12_NSt9strstreamD1Ev, @function
> _ZTv0_n12_NSt9strstreamD1Ev:
> .LFB1430:
> .LM389:
>         .cfi_startproc
>         lwz 12,0(3)
>         lwz 12,-12(12)
>         add 3,3,12
>         b .LTHUNK4@local
>         .cfi_endproc
> .LFE1430:
>         .size   _ZTv0_n12_NSt9strstreamD1Ev, .-_ZTv0_n12_NSt9strstreamD1Ev
>         .set    .LTHUNK5,_ZNSt9strstreamD1Ev
>         .section        .text._ZThn8_NSt9strstreamD1Ev,"ax",@progbits
>         .align 2
>         .globl _ZThn8_NSt9strstreamD1Ev
>         .type   _ZThn8_NSt9strstreamD1Ev, @function
> _ZThn8_NSt9strstreamD1Ev:
> .LFB1431:
> .LM390:
>         .cfi_startproc
>         addi 3,3,-8
>         b .LTHUNK5@local
>         .cfi_endproc
> ```
> Now, here's what my port generates:
> ```
> .LLSDACSE1355:
>         .section        .text._ZNSt9strstreamD1Ev
>         .size   _ZNSt9strstreamD1Ev, .-_ZNSt9strstreamD1Ev
>         .set    .LTHUNK4,_ZNSt9strstreamD1Ev
>         .section        .text._ZTv0_n12_NSt9strstreamD1Ev,"ax",@progbits
> .LFB1428:
> .LM674:
>         .cfi_startproc
>         lwz 12,0(3)
>         lwz 12,-12(12)
>         add 3,3,12
>         b .LTHUNK4@local
>         .cfi_endproc
> .LFE1428:
>         .set    .LTHUNK5,_ZNSt9strstreamD1Ev
>         .section        .text._ZThn8_NSt9strstreamD1Ev,"ax",@progbits
> .LFB1429:
> .LM675:
>         .cfi_startproc
>         addi 3,3,-8
>         b .LTHUNK5@local
>         .cfi_endproc
> .LFE1429:
>         .section        .text._ZNSt9strstreamD0Ev,"ax",@progbits
>         .align 2
>         .globl _ZNSt9strstreamD0Ev
>         .type   _ZNSt9strstreamD0Ev, @function
> ```
> I might be missing something, but both seem to put the destructor thunks in
> different sections - so why was GCC 8 able to short circuit and generate static
> numbers while the latest release cannot?

Where do you see the difference between two label addresses here?

>         powerpcspe-* was deprecated in GCC 8, and was removed from GCC 9.  That
>         was in 2018.
> 
>     I’m aware of this - I actually started my work by reverting your patch to
>     delete it! 

You did not get any of the improvements since then (the ones that are
implemented in target code).  That was the big reason to delete this
port btw: it is a significant cost to maintain it, for people unrelated
to the port!

>         > Looking at strstream.s, I noticed that the .LELTP0 label looks like
>         this:
>         > ```
>         > .LELTP0:
>         > ...
>         >         .uleb128 .LM46-.LM45

If those two labels are in different sections, the assembler will give
an error already.  So what emits this piece of assembler code?


Segher
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.