Re: Help generating LELTP0 with SPE
Anirudh Mathukumilli via Gcc-help <[email protected]>
| Newsgroups | gmane.comp.gcc.help |
|---|---|
| Message-ID | <CAF5hExGFTRsUgSD_eQAdDHfVwZgsK7XUJMVSnoQUgF51rPoFAg@mail.gmail.com> |
On Sat, Nov 15, 2025 at 8:05 AM Segher Boessenkool < [email protected]> wrote: > 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? > The generated code does not output a difference between two label addresses here. I pasted this code in to demonstrate that the thunks themselves are placed in different sections in GCC 8, which is the same as what GCC does today. You mentioned in your original response "the two labels are (wrongly) not in the same section," which to me implied that I should try modifying the backend to put the destructors in the same section, but previous versions did not, and I was curious how they were generating debug info given that this was the case. > > > 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? > That was my question at the top of this thread: "Where precisely is this table generated? I know it has something to do with debug information, as removing the `-g` from compilation fixes my issue, but I can't quite figure out where this table is actually generated. " Apologies if this is a very obvious question; I haven't worked with GCC before and am still trying to understand how it all fits together. > > > Segher >