From ccd992355df7192993c666236047820244914598 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 16 Apr 2024 21:19:13 +0200 Subject: Adding upstream version 1.21.8. Signed-off-by: Daniel Baumann --- src/runtime/internal/startlinetest/func_amd64.go | 13 +++++++++++ src/runtime/internal/startlinetest/func_amd64.s | 28 ++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 src/runtime/internal/startlinetest/func_amd64.go create mode 100644 src/runtime/internal/startlinetest/func_amd64.s (limited to 'src/runtime/internal/startlinetest') diff --git a/src/runtime/internal/startlinetest/func_amd64.go b/src/runtime/internal/startlinetest/func_amd64.go new file mode 100644 index 0000000..ab7063d --- /dev/null +++ b/src/runtime/internal/startlinetest/func_amd64.go @@ -0,0 +1,13 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package startlinetest contains helpers for runtime_test.TestStartLineAsm. +package startlinetest + +// Defined in func_amd64.s, this is a trivial assembly function that calls +// runtime_test.callerStartLine. +func AsmFunc() int + +// Provided by runtime_test. +var CallerStartLine func(bool) int diff --git a/src/runtime/internal/startlinetest/func_amd64.s b/src/runtime/internal/startlinetest/func_amd64.s new file mode 100644 index 0000000..96982be --- /dev/null +++ b/src/runtime/internal/startlinetest/func_amd64.s @@ -0,0 +1,28 @@ +// Copyright 2022 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "funcdata.h" +#include "textflag.h" + +// Assembly function for runtime_test.TestStartLineAsm. +// +// Note that this file can't be built directly as part of runtime_test, as assembly +// files can't declare an alternative package. Building it into runtime is +// possible, but linkshared complicates things: +// +// 1. linkshared mode leaves the function around in the final output of +// non-test builds. +// 2. Due of (1), the linker can't resolve the callerStartLine relocation +// (as runtime_test isn't built for non-test builds). +// +// Thus it is simpler to just put this in its own package, imported only by +// runtime_test. We use ABIInternal as no ABI wrapper is generated for +// callerStartLine since it is in a different package. + +TEXT ·AsmFunc(SB),NOSPLIT,$8-0 + NO_LOCAL_POINTERS + MOVQ $0, AX // wantInlined + MOVQ ·CallerStartLine(SB), DX + CALL (DX) + RET -- cgit v1.2.3