From c1d9303d82de0bae1b861b17ec4f9812392ea3cb Mon Sep 17 00:00:00 2001 From: limeidan Date: Thu, 21 Mar 2024 11:20:58 +0800 Subject: [PATCH] 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 LUCI-TryBot-Result: Go LUCI Reviewed-by: Cherry Mui Reviewed-by: abner chenc --- src/cmd/link/link_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go index 21986b96e1..5fb73c4554 100644 --- a/src/cmd/link/link_test.go +++ b/src/cmd/link/link_test.go @@ -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") + } } } -- 2.48.1