https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97107
Bug ID: 97107 Summary: libgo fails to build for power10 Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: amodra at gmail dot com Target Milestone: --- ld.gold: error: runtime/.libs/go-cdiv.o: failed to match split-stack sequence at section 1 offset 0 ld.gold: error: runtime/.libs/go-cdiv.o: failed to match split-stack sequence at section 1 offset 70 ld.gold: error: runtime/.libs/runtime_c.o: failed to match split-stack sequence at section 1 offset 310 ld.gold: error: reflect/.libs/makefunc_ffi_c.o: failed to match split-stack sequence at section 1 offset 1a0 Recently added rs6000 backend code allows sibcalls when pcrel. In the go-cdiv.o cases we have tail calls to __divsc3 and __divdc3 both of which are non-split-stack functions. The functions making those calls don't have a stack frame, and therefore don't have the magic split-stack instruction sequence that gold patches to allocate a larger stack. Now those __div libgcc functions don't have large stack frames that might blow the very limited stack provided, but in general you can't tail call non-split-stack functions from split-stack code. It isn't actually the sibcall that is the problem, but that rs6000_expand_split_stack_prologue didn't emit the magic code gold patches and a __morestack call. ie. a sibcall to non-split-stack code from split-stack is fine if there is sufficient stack memory mapped. __morestack is quite a surprising function on powerpc in that it calls back to its caller - and a tail call will continue running in the context of extra stack mapped until it returns.