]> Cypherpunks repositories - gostls13.git/commit
cmd/link/internal/loong64: use BREAK 0 as the code pad sequence
authorWANG Xuerui <git@xen0n.name>
Sat, 11 Mar 2023 14:38:01 +0000 (22:38 +0800)
committerM Zhuo <mzh@golangcn.org>
Wed, 15 Mar 2023 07:19:39 +0000 (07:19 +0000)
commit71f82df19a7595b422d9dbc7d05530bd824a9114
tree547f5e26cf6dd957458020624fe4d40496c66f04
parent7789966286a97c2e60140c7108c6df8238436dbe
cmd/link/internal/loong64: use BREAK 0 as the code pad sequence

As the comment on CodePad goes, we "might want to pad with a trap
instruction to catch wayward programs". The current behavior of
zero-padding is equivalent to padding with an instruction of 0x00000000,
which is invalid according to the LoongArch manuals nevertheless, but
rumor has it that some early and/or engineering samples of Loongson
3A5000 recognized it (maybe behaving like NOP). It is better to avoid
undocumented behavior and ensure execution flow would not overflow the
pads.

Change-Id: I531b1eabeb355e9ad4a2d5340e61f2fe71349297
Reviewed-on: https://go-review.googlesource.com/c/go/+/475616
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/link/internal/loong64/obj.go