go/src/cmd/link/internal/ld
Austin Clements 0f099a4bc5 runtime, cmd: rationalize StackLimit and StackGuard
The current definitions of StackLimit and StackGuard only indirectly
specify the NOSPLIT stack limit and duplicate a literal constant
(928). Currently, they define the stack guard delta, and from there
compute the NOSPLIT limit.

Rationalize these by defining a new constant, abi.StackNosplitBase,
which consolidates and directly specifies the NOSPLIT stack limit (in
the default case). From this we then compute the stack guard delta,
inverting the relationship between these two constants. While we're
here, we rename StackLimit to StackNosplit to make it clearer what's
being limited.

This change does not affect the values of these constants in the
default configuration. It does slightly change how
StackGuardMultiplier values other than 1 affect the constants, but
this multiplier is a pretty rough heuristic anyway.

                    before after
stackNosplit           800   800
_StackGuard            928   928
stackNosplit -race    1728  1600
_StackGuard -race     1856  1728

For #59670.

Change-Id: Ia94094c5e47897e7c088d24b4a5e33f5c2768db5
Reviewed-on: https://go-review.googlesource.com/c/go/+/486976
Auto-Submit: Austin Clements <austin@google.com>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-21 19:28:56 +00:00
..
testdata all: replace leading spaces with tabs in assembly 2023-03-23 20:52:57 +00:00
ar.go cmd/link: revise DLL import symbol handling 2022-11-19 23:11:11 +00:00
asmb.go
config.go cmd/go,cmd/link: prefer external linking when strange cgo flags seen 2023-03-14 13:17:46 +00:00
data.go all: fix misuses of "a" vs "an" 2023-04-04 14:20:53 +00:00
data_test.go
deadcode.go cmd/link: establish dependable package initialization order 2023-04-14 16:55:22 +00:00
deadcode_test.go cmd/link: linker portion of dead map removal 2023-02-06 20:56:47 +00:00
decodesym.go cmd/compile,runtime,reflect: move embedded bit from offset to name 2022-06-14 23:22:11 +00:00
dwarf.go all: add wasip1 asm and link logic 2023-04-05 19:28:25 +00:00
dwarf_test.go internal/platform: pass race mode to DefaultPIE 2023-03-20 23:32:34 +00:00
elf.go cmd/internal/obj/loong64, cmd/link/internal: switch to LoongArch ELF psABI v2 relocs 2023-04-10 15:50:11 +00:00
elf_test.go cmd/link: use testenv.Command instead of exec.Command in tests 2022-11-15 20:22:14 +00:00
errors.go cmd/link: remove unnecessary use of sync.Once alongside sync.Mutex 2022-11-02 14:38:08 +00:00
execarchive.go all: use os/exec instead of internal/execabs 2022-05-02 17:49:12 +00:00
execarchive_noexec.go
fallocate_test.go internal/syscall/unix: fix PosixFallocate error check on freebsd 2023-04-05 14:17:36 +00:00
go.go cmd/link: remove importcycles function 2023-01-24 17:00:10 +00:00
go_test.go cmd/link: use testenv.Command instead of exec.Command in tests 2022-11-15 20:22:14 +00:00
heap.go cmd/link: establish dependable package initialization order 2023-04-14 16:55:22 +00:00
heap_test.go
inittask.go cmd/link: establish dependable package initialization order 2023-04-14 16:55:22 +00:00
issue33808_test.go
ld.go all: replace package ioutil with os and io in src 2022-09-20 02:13:02 +00:00
ld_test.go all: skip tests that fail on android/arm64 2023-03-10 20:38:29 +00:00
lib.go cmd/link/internal/ld: disable execute-only for external linking on openbsd/arm64 2023-04-14 19:17:15 +00:00
link.go cmd/compile,cmd/internal/obj: replace Ctxt.FixedFrameSize method with Arch field 2022-04-19 15:59:22 +00:00
macho.go cmd/link, runtime: Apple libc atfork workaround take 3 2023-01-10 20:34:22 +00:00
macho_combine_dwarf.go
main.go cmd/link: establish dependable package initialization order 2023-04-14 16:55:22 +00:00
msync_darwin_libc.go cmd/link/internal/ld, syscall: use libc based msync on darwin for Go ≥ 1.20 2022-09-13 15:50:02 +00:00
msync_darwin_syscall.go cmd/link/internal/ld, syscall: use libc based msync on darwin for Go ≥ 1.20 2022-09-13 15:50:02 +00:00
nooptcgolink_test.go cmd/link: use testenv.Command instead of exec.Command in tests 2022-11-15 20:22:14 +00:00
outbuf.go all: fix spelling 2022-05-17 19:51:29 +00:00
outbuf_darwin.go cmd/link/internal/ld, syscall: use libc based msync on darwin for Go ≥ 1.20 2022-09-13 15:50:02 +00:00
outbuf_freebsd.go internal/syscall/unix: fix PosixFallocate error check on freebsd 2023-04-05 14:17:36 +00:00
outbuf_linux.go
outbuf_mmap.go cmd/cgo, cmd/compile, cmd/link: remove old style build tags 2022-10-04 19:36:17 +00:00
outbuf_nofallocate.go cmd/link/internal/ld, internal/syscall/unix: use posix_fallocate on freebsd 2023-03-27 19:14:57 +00:00
outbuf_nommap.go cmd/cgo, cmd/compile, cmd/link: remove old style build tags 2022-10-04 19:36:17 +00:00
outbuf_notdarwin.go cmd/link/internal/ld, internal/syscall/unix: use posix_fallocate on freebsd 2023-03-27 19:14:57 +00:00
outbuf_test.go
outbuf_windows.go all: transfer reflect.{SliceHeader, StringHeader} to unsafeheader.{Slice, String} 2022-09-09 01:59:25 +00:00
pcln.go internal/abi, runtime, cmd: merge PCDATA_* and FUNCDATA_* consts into internal/abi 2023-04-21 19:28:49 +00:00
pe.go cmd/link/internal/ld: don't set IMAGE_FILE_DEBUG_STRIPPED on PE binaries 2023-04-07 11:34:41 +00:00
stackcheck.go runtime, cmd: rationalize StackLimit and StackGuard 2023-04-21 19:28:56 +00:00
stackcheck_test.go cmd/link: use testenv.Command instead of exec.Command in tests 2022-11-15 20:22:14 +00:00
sym.go all: add wasip1 asm and link logic 2023-04-05 19:28:25 +00:00
symtab.go cmd/link: establish dependable package initialization order 2023-04-14 16:55:22 +00:00
target.go cmd/link: define ELF .note section on FreeBSD 2022-10-13 21:14:48 +00:00
typelink.go
util.go cmd/link: make Exitf panic under -h 2023-02-22 20:39:11 +00:00
xcoff.go all: fix misuses of "a" vs "an" 2023-04-04 14:20:53 +00:00