add register cgo symbols #339
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
name: goloader Testing | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
env: | |
GOPATH: ${{ github.workspace }} | |
GO111MODULE: auto | |
strategy: | |
fail-fast: false | |
matrix: | |
go-second-version: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
exclude: | |
- os: macos-latest | |
go-second-version: 8 | |
- os: macos-latest | |
go-second-version: 9 | |
- os: macos-latest | |
go-second-version: 10 | |
- os: macos-latest | |
go-second-version: 11 | |
- os: macos-latest | |
go-second-version: 12 | |
- os: macos-latest | |
go-second-version: 13 | |
- os: macos-latest | |
go-second-version: 14 | |
- os: macos-latest | |
go-second-version: 15 | |
include: | |
- os: macos-12 | |
go-second-version: 11 | |
- os: macos-12 | |
go-second-version: 12 | |
- os: macos-12 | |
go-second-version: 13 | |
- os: macos-12 | |
go-second-version: 14 | |
- os: macos-12 | |
go-second-version: 15 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.${{ matrix.go-second-version }}.x | |
- name: Rename cmd/internal | |
shell: sh | |
run: | |
cp -r `go env GOROOT`/src/cmd/internal `go env GOROOT`/src/cmd/objfile | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
path: ${{ env.GOPATH }}/src/github.com/${{ github.repository }} | |
- name: Build | |
run: | |
go build github.com/pkujhd/goloader/examples/loader | |
- name: Compile const.go | |
shell: sh | |
run: | | |
if [ ${{ matrix.go-second-version }} -ge 20 ]; then | |
go list -export -f '{{if .Export}}packagefile {{.ImportPath}}={{.Export}}{{end}}' std `go list -f {{.Imports}} $GOPATH/src/github.com/pkujhd/goloader/examples/const/const.go | awk '{sub(/^\[/, ""); print }' | awk '{sub(/\]$/, ""); print }'` > importcfg | |
go tool compile -importcfg importcfg $GOPATH/src/github.com/pkujhd/goloader/examples/const/const.go | |
else | |
go tool compile $GOPATH/src/github.com/pkujhd/goloader/examples/const/const.go | |
fi | |
- name: Compile base.go | |
shell: sh | |
run: | | |
if [ ${{ matrix.go-second-version }} -ge 20 ]; then | |
go list -export -f '{{if .Export}}packagefile {{.ImportPath}}={{.Export}}{{end}}' std `go list -f {{.Imports}} $GOPATH/src/github.com/pkujhd/goloader/examples/base/base.go | awk '{sub(/^\[/, ""); print }' | awk '{sub(/\]$/, ""); print }'` > importcfg | |
go tool compile -importcfg importcfg $GOPATH/src/github.com/pkujhd/goloader/examples/base/base.go | |
else | |
go tool compile $GOPATH/src/github.com/pkujhd/goloader/examples/base/base.go | |
fi | |
- name: Test base.o | |
run: | |
./loader -o base.o -run main.main | |
- name: Test const.o | |
run: | |
./loader -o const.o -run main.main |