]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: check if the trampoline is actually added
authorlimeidan <limeidan@loongson.cn>
Thu, 21 Mar 2024 03:20:58 +0000 (11:20 +0800)
committerabner chenc <chenguoqi@loongson.cn>
Mon, 21 Oct 2024 01:55:03 +0000 (01:55 +0000)
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>
src/cmd/link/link_test.go

index 21986b96e1c7b5a3c670071dae3e1d50d2215471..5fb73c4554234e83512e0450f0782dd7f25247d1 100644 (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")
+               }
        }
 }