[Bug target/104894] [11/12 Regression] ICE with -fno-plt -mcpu=power10 on PowerPC64 LE Linux
amodra at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Mar 24 23:55:29 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104894
--- Comment #6 from Alan Modra <amodra at gmail dot com> ---
I'm sorry, I forgot exactly what was happening when I talked about this on the
call. What I should have said is that -mlongcall code is correct but is
missing a sibcall optimisation. -fno-plt code (after removing the assert or
using your patch) is incorrect. A direct call is wrong, because it may require
a plt call stub. gcc ought to be producing an inline plt call. Change the
testcase to
void foo();
void bar() {
foo();
foo();
}
to see what I mean. The asm output is
mflr 0
std 0,16(1)
stdu 1,-96(1)
.cfi_def_cfa_offset 96
.cfi_offset 65, 16
pld 12,0(0),1
.reloc .-8,R_PPC64_PLT_PCREL34_NOTOC,foo
mtctr 12
.reloc .-4,R_PPC64_PLTSEQ,foo
.reloc .,R_PPC64_PLTCALL_NOTOC,foo
bctrl
addi 1,1,96
.cfi_def_cfa_offset 0
ld 0,16(1)
mtlr 0
.cfi_restore 65
b foo@notoc
That "b foo@notoc" ought to be
pld 12,0(0),1
.reloc .-8,R_PPC64_PLT_PCREL34_NOTOC,foo
mtctr 12
.reloc .-4,R_PPC64_PLTSEQ,foo
.reloc .,R_PPC64_PLTCALL_NOTOC,foo
bctr
More information about the Gcc-bugs
mailing list