-
Notifications
You must be signed in to change notification settings - Fork 17.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/link: load symbols from .syso in external link mode
Fix linking with a package having a .syso file in external link mode, that would otherwise cause an error before executing the external linker because it can't find symbols that are exported in the said .syso file. Fixes #33139
- Loading branch information
Showing
4 changed files
with
61 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Test that we can link a syso file that is embedded in a package, that is | ||
# referenced by an assembly stub. See issue 33139. | ||
[!gc] stop | ||
[darwin] cc -c -o syso/test.syso syso/asm/test_darwin.s | ||
[!darwin] cc -c -o syso/test.syso syso/asm/test.s | ||
go build -ldflags='-linkmode=external' ./cmd/main.go | ||
|
||
-- syso/test.s -- | ||
#include "textflag.h" | ||
|
||
TEXT ·Test(SB), NOSPLIT, $0 | ||
JMP asmTest(SB) | ||
|
||
-- syso/test.go -- | ||
package syso | ||
|
||
func Test() | ||
|
||
-- syso/asm/test.s -- | ||
.globl asmTest | ||
asmTest: | ||
ret | ||
|
||
-- syso/asm/test_darwin.s -- | ||
.globl _asmTest | ||
_asmTest: | ||
ret | ||
|
||
-- cmd/main.go -- | ||
package main | ||
|
||
import "syso" | ||
|
||
func main() { | ||
syso.Test() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters