diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 19:23:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-16 19:23:18 +0000 |
commit | 43a123c1ae6613b3efeed291fa552ecd909d3acf (patch) | |
tree | fd92518b7024bc74031f78a1cf9e454b65e73665 /src/runtime/internal/startlinetest | |
parent | Initial commit. (diff) | |
download | golang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.tar.xz golang-1.20-43a123c1ae6613b3efeed291fa552ecd909d3acf.zip |
Adding upstream version 1.20.14.upstream/1.20.14upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/runtime/internal/startlinetest')
-rw-r--r-- | src/runtime/internal/startlinetest/func_amd64.go | 13 | ||||
-rw-r--r-- | src/runtime/internal/startlinetest/func_amd64.s | 28 |
2 files changed, 41 insertions, 0 deletions
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<ABIInternal>(SB),NOSPLIT,$8-0 + NO_LOCAL_POINTERS + MOVQ $0, AX // wantInlined + MOVQ ·CallerStartLine(SB), DX + CALL (DX) + RET |