Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Add pie build mode to all binary builds" not work as it described #3190

Open
dyhkwong opened this issue Oct 15, 2024 · 0 comments
Open

"Add pie build mode to all binary builds" not work as it described #3190

dyhkwong opened this issue Oct 15, 2024 · 0 comments

Comments

@dyhkwong
Copy link
Contributor

dyhkwong commented Oct 15, 2024

related commit: 8191faa

- name: Build V2Ray
run: |
mkdir -p build_assets
EXTRA_ARG=""
case "$GOOS-$GOARCH" in
"linux-386")
;&
"linux-amd64")
;&
"linux-arm64")
EXTRA_ARG=EXTRA_ARG+"-buildmode=pie"
;;
esac
go build -v -o build_assets/v2ray -trimpath -ldflags "-s -w -buildid=" ./main

EXTRA_ARG does not get passed to go build. So it does not build with -buildmode=pie.

GOARCH='amd64' GOOS='linux' GOVERSION='go1.23.2', build v5.21.0 without -buildmode=pie:

$ CGO_ENABLED=0 go build -v -o v2ray -trimpath -ldflags "-s -w -buildid=" ./main
$ sha256sum v2ray 
fb5354aa11d3361280af9ffc0aa5acfe316337e82bfe01707bc483e3a123fef2  v2ray

Without -buildmode=pie, the hash of the binary matches the one of v5.21.0 release.

GOARCH='amd64' GOOS='linux' GOVERSION='go1.23.2', build v5.21.0 with -buildmode=pie:

$ CGO_ENABLED=0 go build -v -o v2ray -trimpath -ldflags "-s -w -buildid=" -buildmode=pie ./main
$ sha256sum v2ray 
94b193f4375d64bb636ed1e78ff874820dd1818effb7f010082474bc408aed66  v2ray
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant