From: ericonr <ericonr@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] go: enable PIE builds for Go executables
Date: Sun, 19 Apr 2020 08:09:32 +0200 [thread overview]
Message-ID: <20200419060932.hfb1B6lDdH0B6-rH1_GWBBMnZ1MBTMWTq0GvfyYW1JA@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-20854@inbox.vuxu.org>
[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]
There is an updated pull request by ericonr against master on the void-packages repository
https://github.com/ericonr/void-packages go-default-pie
https://github.com/void-linux/void-packages/pull/20854
go: enable PIE builds for Go executables
Fixed up version of #20450
Both Arch Linux and Alpine already implement this feature. Arch has a package called go-pie that's used for most of their PKGBUILDs, while the only version of Go on Alpine is one capable of producing PIE binaries.
On Arch: https://www.archlinux.org/packages/community/x86_64/go-pie/
On Alpine: https://pkgs.alpinelinux.org/package/edge/community/x86_64/go
The patch used here is actually adapted from the one used by Arch, and if adopted can allow us to remove the nostrip flag from the go build_style.
I'm getting some weird build output, where it says
loadinternal: cannot find runtime/cgo
so I'm not completely certain that it's 100% complete. Building a program that uses cgo does work cleanly, so I'm not sure what it means.
A patch file from https://github.com/void-linux/void-packages/pull/20854.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-go-default-pie-20854.patch --]
[-- Type: text/x-diff, Size: 1198 bytes --]
From 19b05766856fd8c1d5f334651051218ec0e7315e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Fri, 10 Apr 2020 17:54:35 -0300
Subject: [PATCH] go: enable PIE builds for Go executables
Enabling PIE builds for Go executables created by gc enables us to
remove the nostrip and nopie variables from those builds. nostrip was
moved to the gccgo cases only.
---
common/environment/build-style/go.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/environment/build-style/go.sh b/common/environment/build-style/go.sh
index 3f83013d4f7..fd23421fa6e 100644
--- a/common/environment/build-style/go.sh
+++ b/common/environment/build-style/go.sh
@@ -4,15 +4,15 @@ if [ -z "$hostmakedepends" -o "${hostmakedepends##*gcc-go-tools*}" ]; then
archs="aarch64* armv[567]* i686* x86_64* ppc64le*"
fi
hostmakedepends+=" go"
- nopie=yes
+ export GOFLAGS="-buildmode=pie"
else
# gccgo compiler
if [ "$CROSS_BUILD" ]; then
# target compiler to use; otherwise it'll just call gccgo
export GCCGO="${XBPS_CROSS_TRIPLET}-gccgo"
fi
+ nostrip=yes
fi
-nostrip=yes
case "$XBPS_TARGET_MACHINE" in
aarch64*) export GOARCH=arm64;;
next prev parent reply other threads:[~2020-04-19 6:09 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-10 20:57 [PR PATCH] " ericonr
2020-04-12 11:02 ` travankor
2020-04-12 19:03 ` ericonr
2020-04-12 19:04 ` ericonr
2020-04-12 19:32 ` q66
2020-04-12 20:49 ` travankor
2020-04-12 21:09 ` ericonr
2020-04-18 5:39 ` ericonr
2020-04-19 6:09 ` ericonr [this message]
2020-04-19 6:16 ` ericonr
2020-04-19 6:22 ` ericonr
2020-04-20 3:37 ` the-maldridge
2020-04-21 4:49 ` ericonr
2020-04-21 4:49 ` [PR PATCH] [Closed]: " ericonr
2020-04-21 4:51 ` ericonr
2020-09-29 1:50 ` [TRACKING-upstream] " ericonr
2020-09-29 1:50 ` [PR PATCH] [Closed]: " ericonr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200419060932.hfb1B6lDdH0B6-rH1_GWBBMnZ1MBTMWTq0GvfyYW1JA@z \
--to=ericonr@users.noreply.github.com \
--cc=ml@inbox.vuxu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).