aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/testdata/deadcode
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-09-24 16:54:31 -0400
committerCherry Zhang <cherryyz@google.com>2020-09-29 15:20:13 +0000
commit0ab72ed020d0c320b5007987abdf40677db34cfc (patch)
treeadfacfc78e174b0aa3e477a191b7b956a5b6f26f /src/cmd/link/internal/ld/testdata/deadcode
parent0163bdae685c1b060f8108ac5af13ea6374555b1 (diff)
downloadgo-0ab72ed020d0c320b5007987abdf40677db34cfc.tar.xz
cmd/link, runtime: use a sentinel value for unreachable method
In the method table, the method's code pointer is stored as an offset from the start of the text section. Currently, for an unreachable method, the offset is left as 0, which resolves to the start of the text section at run time. It is possible that there is valid code there. If an unreachable method is ever reached (due to a compiler or linker bug), the execution will jump to a wrong location but may continue to run for a while, until it fails with a seemingly unrelated error. This CL changes it to use -1 for unreachable method instead. At run time this will resolve to an invalid address, which makes it fail immediately if it is ever reached. Change-Id: Ied6ed7f1833c4f3b991fdf55d8810d70d307b2e6 Reviewed-on: https://go-review.googlesource.com/c/go/+/257203 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/cmd/link/internal/ld/testdata/deadcode')
0 files changed, 0 insertions, 0 deletions