Skip to content

Commit

Permalink
Support assembly correctly for Go 1.22 (#227)
Browse files Browse the repository at this point in the history
* Specify package path for gensymabis

* Support Go 1.22 in go_module

* Version
  • Loading branch information
peterebden authored Feb 9, 2024
1 parent c8ecc21 commit ede3a17
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 1.16.4
--------------
* Support Go 1.22 for third-party packages containing assembly

Version 1.16.3
--------------
* Use version 1.10.2 of please_go tool
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16.3
1.16.4
2 changes: 1 addition & 1 deletion build_defs/go.build_defs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def go_library(name:str, srcs:list, resources:list=[], asm_srcs:list=None, hdrs:
},
outs = [name + '.abi'],
building_description = 'Creating ABI...',
cmd = f'eval `"$TOOL" env` && mkdir include && touch include/go_asm.h && "$TOOL" tool asm -trimpath "$TMP_DIR" -I include -I $GOROOT/pkg/include -D GOOS_{CONFIG.OS} -D GOARCH_{CONFIG.ARCH} -gensymabis -o "$OUT" $SRCS_ASM',
cmd = f'eval `"$TOOL" env` && mkdir include && touch include/go_asm.h && "$TOOL" tool asm -trimpath "$TMP_DIR" -I include -I $GOROOT/pkg/include -D GOOS_{CONFIG.OS} -D GOARCH_{CONFIG.ARCH} -gensymabis -p {package_path} -o "$OUT" $SRCS_ASM',
env= {
"GOOS": CONFIG.OS,
"GOARCH": CONFIG.ARCH,
Expand Down
2 changes: 1 addition & 1 deletion tools/please_go/install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ func (install *PleaseGoInstall) compilePackage(target string, pkg *build.Package

asmFiles := prefixPaths(pkg.SFiles, pkg.Dir)
if len(asmFiles) > 0 {
asmH, symabis, err := install.tc.Symabis(pkg.Dir, workDir, asmFiles)
asmH, symabis, err := install.tc.Symabis(importPath, pkg.Dir, workDir, asmFiles)
if err != nil {
return err
}
Expand Down
5 changes: 4 additions & 1 deletion tools/please_go/install/toolchain/toolchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ func (tc *Toolchain) Link(archive, out, importcfg string, ldFlags []string) erro
}

// Symabis will generate the asm header as well as the abi symbol file for the provided asm files.
func (tc *Toolchain) Symabis(sourceDir, objectDir string, asmFiles []string) (string, string, error) {
func (tc *Toolchain) Symabis(importpath, sourceDir, objectDir string, asmFiles []string) (string, string, error) {
asmH := fmt.Sprintf("%s/go_asm.h", objectDir)
symabis := fmt.Sprintf("%s/symabis", objectDir)

if importpath != "" {
importpath = fmt.Sprintf("-p %s", importpath)
}
// the gc Toolchain does this
if err := tc.Exec.Run("touch %s", asmH); err != nil {
return "", "", err
Expand Down

0 comments on commit ede3a17

Please sign in to comment.