1
0
mirror of https://github.com/golang/go synced 2024-11-18 02:04:45 -07:00

runtime/cgo: add .file directive to GNU assembly files

Without it, at least on ARM64 with older BFD linker, it will
include the file of the object file (which is of a temporary path)
as a debug symbol into the binary, causing the build to be
nondeterministic. Adding a .file directive makes it to create a
STT_FILE symbol with deterministic input, and prevent the linker
creating one using the temporary object file path.

Fixes #57035.

Change-Id: I3ab716b240f60f7a891af2f7e10b467df67d1f31
Reviewed-on: https://go-review.googlesource.com/c/go/+/454838
Reviewed-by: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Cherry Mui 2022-12-02 13:34:03 -05:00
parent 3a7a528c2d
commit ad55b878e7
11 changed files with 22 additions and 0 deletions

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
.file "gcc_386.S"
/*
* Apple still insists on underscore prefixes for C function names.
*/

View File

@ -5,6 +5,8 @@
// +build ppc64
// +build aix
.file "gcc_aix_ppc64.S"
/*
* void crosscall_ppc64(void (*fn)(void), void *g)
*

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
.file "gcc_amd64.S"
/*
* Apple still insists on underscore prefixes for C function names.
*/

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
.file "gcc_arm.S"
/*
* Apple still insists on underscore prefixes for C function names.
*/

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
.file "gcc_arm64.S"
/*
* Apple still insists on underscore prefixes for C function names.
*/

View File

@ -5,6 +5,8 @@
// +build ppc64 ppc64le
// +build linux
.file "gcc_linux_ppc64x.S"
/*
* Apple still insists on underscore prefixes for C function names.
*/

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
.file "gcc_loong4.S"
/*
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
*

View File

@ -4,6 +4,8 @@
// +build mips64 mips64le
.file "gcc_mips64x.S"
/*
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
*

View File

@ -4,6 +4,8 @@
// +build mips mipsle
.file "gcc_mipsx.S"
/*
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
*

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
.file "gcc_riscv64.S"
/*
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
*

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
.file "gcc_s390x.S"
/*
* void crosscall_s390x(void (*fn)(void), void *g)
*