Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] go: enable PIE builds for Go executables
@ 2020-04-10 20:57 ericonr
  2020-04-12 11:02 ` travankor
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: ericonr @ 2020-04-10 20:57 UTC (permalink / raw)
  To: ml

[-- 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"

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-09-29  1:50 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 20:57 [PR PATCH] go: enable PIE builds for Go executables 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 ` [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

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).