]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.18] runtime: make static/dynamic startup detection work with...
authorPaul E. Murphy <murp@ibm.com>
Tue, 22 Mar 2022 16:52:02 +0000 (11:52 -0500)
committerCherry Mui <cherryyz@google.com>
Mon, 4 Apr 2022 20:27:32 +0000 (20:27 +0000)
commit0bf8319883298dbeea81444cb704d8c0e9935bae
treece7c3b2939b8d924cad5f4188dbeba5155397b28
parent78b8b4a1760ce212c05edd14f52711936ee60930
[release-branch.go1.18] runtime: make static/dynamic startup detection work with musl on ppc64le

The glibc loader explicitly sets the first doubleword on the stack (R1)
to $0 to indicate it was dynamically loaded.

An ELFv2 ABI compliant loader will set R3/R4 to argc/argv when starting
the process, and R13 to TLS. musl is not compliant. Instead it passes
argc/argv like the kernel, but R3/R4 are in an undefined state and R13
is valid.

With the knowledge above, the startup code can be modified to
dynamically handle all three cases when linked internally.

Fixes #51874

Change-Id: I5de33862c161900d9161817388bbc13a65fdc69c
Reviewed-on: https://go-review.googlesource.com/c/go/+/394654
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Paul Murphy <murp@ibm.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Paul Murphy <murp@ibm.com>
Trust: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/394794
Trust: Emmanuel Odeke <emmanuel@orijtech.com>
src/runtime/rt0_linux_ppc64le.s