Skip to content

Commit ad55b87

Browse files
committed
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 <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Cherry Mui <[email protected]>
1 parent 3a7a528 commit ad55b87

11 files changed

+22
-0
lines changed

src/runtime/cgo/gcc_386.S

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
.file "gcc_386.S"
6+
57
/*
68
* Apple still insists on underscore prefixes for C function names.
79
*/

src/runtime/cgo/gcc_aix_ppc64.S

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// +build ppc64
66
// +build aix
77

8+
.file "gcc_aix_ppc64.S"
9+
810
/*
911
* void crosscall_ppc64(void (*fn)(void), void *g)
1012
*

src/runtime/cgo/gcc_amd64.S

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
.file "gcc_amd64.S"
6+
57
/*
68
* Apple still insists on underscore prefixes for C function names.
79
*/

src/runtime/cgo/gcc_arm.S

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
.file "gcc_arm.S"
6+
57
/*
68
* Apple still insists on underscore prefixes for C function names.
79
*/

src/runtime/cgo/gcc_arm64.S

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
.file "gcc_arm64.S"
6+
57
/*
68
* Apple still insists on underscore prefixes for C function names.
79
*/

src/runtime/cgo/gcc_linux_ppc64x.S

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// +build ppc64 ppc64le
66
// +build linux
77

8+
.file "gcc_linux_ppc64x.S"
9+
810
/*
911
* Apple still insists on underscore prefixes for C function names.
1012
*/

src/runtime/cgo/gcc_loong64.S

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
.file "gcc_loong4.S"
6+
57
/*
68
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
79
*

src/runtime/cgo/gcc_mips64x.S

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// +build mips64 mips64le
66

7+
.file "gcc_mips64x.S"
8+
79
/*
810
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
911
*

src/runtime/cgo/gcc_mipsx.S

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
// +build mips mipsle
66

7+
.file "gcc_mipsx.S"
8+
79
/*
810
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
911
*

src/runtime/cgo/gcc_riscv64.S

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
.file "gcc_riscv64.S"
6+
57
/*
68
* void crosscall1(void (*fn)(void), void (*setg_gcc)(void *g), void *g)
79
*

src/runtime/cgo/gcc_s390x.S

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
.file "gcc_s390x.S"
6+
57
/*
68
* void crosscall_s390x(void (*fn)(void), void *g)
79
*

0 commit comments

Comments
 (0)