cmd/link: check if the trampoline is actually added

Change-Id: I2ddffe9118fd9954d9bae60c92fd8fc5b311b93a
Reviewed-on: https://go-review.googlesource.com/c/go/+/603736
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
This commit is contained in:
limeidan 2024-03-21 11:20:58 +08:00 committed by abner chenc
parent f2d118fd5f
commit c1d9303d82
1 changed files with 8 additions and 0 deletions

View File

@ -706,6 +706,14 @@ func TestTrampoline(t *testing.T) {
if string(out) != "hello\n" {
t.Errorf("unexpected output (%s):\n%s", mode, out)
}
out, err = testenv.Command(t, testenv.GoToolPath(t), "tool", "nm", exe).CombinedOutput()
if err != nil {
t.Errorf("nm failure: %s\n%s\n", err, string(out))
}
if !bytes.Contains(out, []byte("T runtime.deferreturn+0-tramp0")) {
t.Errorf("Trampoline T runtime.deferreturn+0-tramp0 is missing")
}
}
}