From: ericonr <ericonr@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: [PR PATCH] go: enable PIE builds for Go executables
Date: Fri, 10 Apr 2020 22:57:18 +0200 [thread overview]
Message-ID: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-20854@inbox.vuxu.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 1164 bytes --]
There is a new 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.
It's referenced in this issue, but without any solution.
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: 1422 bytes --]
From 4fac0444912f240ec510aab00819f04799f4913e 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
---
srcpkgs/go/patches/default-buildmode-pie.patch | 12 ++++++++++++
srcpkgs/go/template | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 srcpkgs/go/patches/default-buildmode-pie.patch
diff --git a/srcpkgs/go/patches/default-buildmode-pie.patch b/srcpkgs/go/patches/default-buildmode-pie.patch
new file mode 100644
index 00000000000..3861c8b3293
--- /dev/null
+++ b/srcpkgs/go/patches/default-buildmode-pie.patch
@@ -0,0 +1,12 @@
+diff go/src/cmd/go/internal/work/init.go go/src/cmd/go/internal/work/init.go
+--- go/src/cmd/go/internal/work/init.go
++++ go/src/cmd/go/internal/work/init.go
+@@ -131,7 +131,7 @@ func buildModeInit() {
+ ldBuildmode = "c-shared"
+ case "default":
+ switch cfg.Goos {
+- case "android":
++ case "android", "linux":
+ codegenArg = "-shared"
+ ldBuildmode = "pie"
+ case "darwin":
diff --git a/srcpkgs/go/template b/srcpkgs/go/template
index fdab001f28c..d4af971de19 100644
--- a/srcpkgs/go/template
+++ b/srcpkgs/go/template
@@ -1,7 +1,7 @@
# Template file for 'go'
pkgname=go
version=1.14.2
-revision=1
+revision=2
create_wrksrc=yes
build_wrksrc=go
hostmakedepends="go1.12-bootstrap"
next reply other threads:[~2020-04-10 20:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-10 20:57 ericonr [this message]
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 ` [PR PATCH] [Updated] " ericonr
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=gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-20854@inbox.vuxu.org \
--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).