All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] goarch.bbclass: fixups for Go mips32 support
@ 2017-09-23  0:58 Khem Raj
  2017-09-23  0:58 ` [PATCH 2/4] go: disable PIE flags for cgo Khem Raj
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Khem Raj @ 2017-09-23  0:58 UTC (permalink / raw)
  To: openembedded-core

From: Matt Madison <matt@madison.systems>

* Fix the regular expression in the mips test

* Flag as incompatible any mips32 tunes for n32 ABI
  or soft-float, as go does not support them.

* Replace mips32r2 tune with mips32r1. Go only supports
  mips32r1, which is a strict subset of r2.  Adjusting
  this tune is not ideal, but is hopefully a temporary
  measure until more complete mips32 ISA coverage
  arrives upstream.

[YOCTO #12108]

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/goarch.bbclass | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/meta/classes/goarch.bbclass b/meta/classes/goarch.bbclass
index 8b95c5fe94..9ed562d5ab 100644
--- a/meta/classes/goarch.bbclass
+++ b/meta/classes/goarch.bbclass
@@ -43,10 +43,14 @@ def go_map_arch(a, d):
         return 'mips64le'
     elif re.match('mips64*', a):
         return 'mips64'
-    elif re.match('mipsel*', a):
-        return 'mipsle'
-    elif re.match('mips*', a):
-        return 'mips'
+    elif re.match('mips.*', a):
+        tf = d.getVar('TUNE_FEATURES').split()
+        if 'fpu-hard' in tf and 'n32' not in tf:
+            if 'mips32r2' in tf:
+                newtf = [t for t in tf if t != 'mips32r2']
+                newtf.append('mips32')
+                d.setVar('TUNE_FEATURES', ' '.join(newtf))
+            return 'mips' if 'bigendian' in tf else 'mipsle'
     elif re.match('p(pc|owerpc)(64)', a):
         return 'ppc64'
     elif re.match('p(pc|owerpc)(64el)', a):
-- 
2.14.1



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

* [PATCH 2/4] go: disable PIE flags for cgo
  2017-09-23  0:58 [PATCH 1/4] goarch.bbclass: fixups for Go mips32 support Khem Raj
@ 2017-09-23  0:58 ` Khem Raj
  2017-09-23  0:58 ` [PATCH 3/4] go_1.9: remove obsolete overrides Khem Raj
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2017-09-23  0:58 UTC (permalink / raw)
  To: openembedded-core

From: Matt Madison <matt@madison.systems>

If the security_flags.inc file is included, gcc
will do PIE builds by default.  These flags need
to be disabled for go packages that use cgo.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/classes/go.bbclass                | 3 +++
 meta/recipes-devtools/go/go-target.inc | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index e167c949ec..09b01a84c3 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -50,6 +50,9 @@ GOTOOLDIR = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go/pkg/tool/${BUILD_GOTUPLE}
 GOTOOLDIR_class-native = "${STAGING_LIBDIR_NATIVE}/go/pkg/tool/${BUILD_GOTUPLE}"
 export GOTOOLDIR
 
+SECURITY_CFLAGS = "${SECURITY_NOPIE_CFLAGS}"
+SECURITY_LDFLAGS = ""
+
 export CGO_ENABLED ?= "1"
 export CGO_CFLAGS ?= "${CFLAGS}"
 export CGO_CPPFLAGS ?= "${CPPFLAGS}"
diff --git a/meta/recipes-devtools/go/go-target.inc b/meta/recipes-devtools/go/go-target.inc
index b88d0166e5..6065c3c80d 100644
--- a/meta/recipes-devtools/go/go-target.inc
+++ b/meta/recipes-devtools/go/go-target.inc
@@ -18,6 +18,9 @@ GO_LDFLAGS = ""
 GO_LDFLAGS_class-nativesdk = "-linkmode external"
 export GO_LDFLAGS
 
+SECURITY_CFLAGS = "${SECURITY_NOPIE_CFLAGS}"
+SECURITY_LDFLAGS = ""
+
 do_configure[noexec] = "1"
 
 do_compile() {
-- 
2.14.1



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

* [PATCH 3/4] go_1.9: remove obsolete overrides
  2017-09-23  0:58 [PATCH 1/4] goarch.bbclass: fixups for Go mips32 support Khem Raj
  2017-09-23  0:58 ` [PATCH 2/4] go: disable PIE flags for cgo Khem Raj
@ 2017-09-23  0:58 ` Khem Raj
  2017-09-23  0:58 ` [PATCH 4/4] go: Fix build with -buildmode=pie Khem Raj
  2017-09-23  1:00 ` ✗ patchtest: failure for "goarch.bbclass: fixups for Go ..." and 3 more Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2017-09-23  0:58 UTC (permalink / raw)
  To: openembedded-core

From: Matt Madison <matt@madison.systems>

Now that mips and security flags fixes are in place
in the bbclasses, remove the local settings in this
recipe.

Signed-off-by: Matt Madison <matt@madison.systems>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/go/go_1.9.bb | 2 --
 1 file changed, 2 deletions(-)

diff --git a/meta/recipes-devtools/go/go_1.9.bb b/meta/recipes-devtools/go/go_1.9.bb
index 08ab793f86..c67e2cb050 100644
--- a/meta/recipes-devtools/go/go_1.9.bb
+++ b/meta/recipes-devtools/go/go_1.9.bb
@@ -1,4 +1,2 @@
 require go-${PV}.inc
 require go-target.inc
-TUNE_CCARGS_remove = "-march=mips32r2"
-SECURITY_PIE_CFLAGS_remove = "-fPIE -pie"
-- 
2.14.1



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

* [PATCH 4/4] go: Fix build with -buildmode=pie
  2017-09-23  0:58 [PATCH 1/4] goarch.bbclass: fixups for Go mips32 support Khem Raj
  2017-09-23  0:58 ` [PATCH 2/4] go: disable PIE flags for cgo Khem Raj
  2017-09-23  0:58 ` [PATCH 3/4] go_1.9: remove obsolete overrides Khem Raj
@ 2017-09-23  0:58 ` Khem Raj
  2017-09-23  1:00 ` ✗ patchtest: failure for "goarch.bbclass: fixups for Go ..." and 3 more Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Khem Raj @ 2017-09-23  0:58 UTC (permalink / raw)
  To: openembedded-core

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/go/go-1.9.inc                |  1 +
 ...dmode-pie-forces-external-linking-mode-on.patch | 46 ++++++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100644 meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch

diff --git a/meta/recipes-devtools/go/go-1.9.inc b/meta/recipes-devtools/go/go-1.9.inc
index 0b0aca3fbe..65adaa8d72 100644
--- a/meta/recipes-devtools/go/go-1.9.inc
+++ b/meta/recipes-devtools/go/go-1.9.inc
@@ -14,6 +14,7 @@ SRC_URI += "\
         file://0006-make.bash-add-GOTOOLDIR_BOOTSTRAP-environment-variab.patch \
         file://0007-ld-add-soname-to-shareable-objects.patch \
         file://0008-make.bash-add-GOHOSTxx-indirection-for-cross-canadia.patch \
+        file://0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch \
 "
 SRC_URI[main.md5sum] = "da2d44ea384076efec43ee1f8b7d45d2"
 SRC_URI[main.sha256sum] = "a4ab229028ed167ba1986825751463605264e44868362ca8e7accc8be057e993"
diff --git a/meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch b/meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch
new file mode 100644
index 0000000000..7475d9338a
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch
@@ -0,0 +1,46 @@
+From aae44527c8065d54f6acaf87c82cba1ac96fae59 Mon Sep 17 00:00:00 2001
+From: Ian Lance Taylor <iant@golang.org>
+Date: Fri, 18 Aug 2017 17:46:03 -0700
+Subject: [PATCH] cmd/go: -buildmode=pie forces external linking mode on all
+ systems
+
+The go tool assumed that -buildmode=pie implied internal linking on
+linux-amd64. However, that was changed by CL 36417 for issue #18968.
+
+Fixes #21452
+
+Change-Id: I8ed13aea52959cc5c53223f4c41ba35329445545
+Reviewed-on: https://go-review.googlesource.com/57231
+Run-TryBot: Ian Lance Taylor <iant@golang.org>
+TryBot-Result: Gobot Gobot <gobot@golang.org>
+Reviewed-by: Avelino <t@avelino.xxx>
+Reviewed-by: Rob Pike <r@golang.org>
+---
+Upstream-Status: Backport
+
+ src/cmd/go/internal/load/pkg.go | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
+index 2660d3f..d40773b 100644
+--- a/src/cmd/go/internal/load/pkg.go
++++ b/src/cmd/go/internal/load/pkg.go
+@@ -954,11 +954,12 @@ func (p *Package) load(stk *ImportStack, bp *build.Package, err error) *Package
+ 
+ 	if cfg.BuildContext.CgoEnabled && p.Name == "main" && !p.Goroot {
+ 		// Currently build modes c-shared, pie (on systems that do not
+-		// support PIE with internal linking mode), plugin, and
+-		// -linkshared force external linking mode, as of course does
++		// support PIE with internal linking mode (currently all
++		// systems: issue #18968)), plugin, and -linkshared force
++		// external linking mode, as of course does
+ 		// -ldflags=-linkmode=external. External linking mode forces
+ 		// an import of runtime/cgo.
+-		pieCgo := cfg.BuildBuildmode == "pie" && (cfg.BuildContext.GOOS != "linux" || cfg.BuildContext.GOARCH != "amd64")
++		pieCgo := cfg.BuildBuildmode == "pie"
+ 		linkmodeExternal := false
+ 		for i, a := range cfg.BuildLdflags {
+ 			if a == "-linkmode=external" {
+-- 
+2.14.1
+
-- 
2.14.1



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

* ✗ patchtest: failure for "goarch.bbclass: fixups for Go ..." and 3 more
  2017-09-23  0:58 [PATCH 1/4] goarch.bbclass: fixups for Go mips32 support Khem Raj
                   ` (2 preceding siblings ...)
  2017-09-23  0:58 ` [PATCH 4/4] go: Fix build with -buildmode=pie Khem Raj
@ 2017-09-23  1:00 ` Patchwork
  3 siblings, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-09-23  1:00 UTC (permalink / raw)
  To: Khem Raj; +Cc: openembedded-core

== Series Details ==

Series: "goarch.bbclass: fixups for Go ..." and 3 more
Revision: 1
URL   : https://patchwork.openembedded.org/series/9082/
State : failure

== Summary ==


Thank you for submitting this patch series to OpenEmbedded Core. This is
an automated response. Several tests have been executed on the proposed
series by patchtest resulting in the following failures:



* Issue             A patch file has been added, but does not have a Signed-off-by tag [test_signed_off_by_presence] 
  Suggested fix    Sign off the added patch file (meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch)



If you believe any of these test results are incorrect, please reply to the
mailing list (openembedded-core@lists.openembedded.org) raising your concerns.
Otherwise we would appreciate you correcting the issues and submitting a new
version of the patchset if applicable. Please ensure you add/increment the
version number when sending the new version (i.e. [PATCH] -> [PATCH v2] ->
[PATCH v3] -> ...).

---
Test framework: http://git.yoctoproject.org/cgit/cgit.cgi/patchtest
Test suite:     http://git.yoctoproject.org/cgit/cgit.cgi/patchtest-oe



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

end of thread, other threads:[~2017-09-23  1:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-23  0:58 [PATCH 1/4] goarch.bbclass: fixups for Go mips32 support Khem Raj
2017-09-23  0:58 ` [PATCH 2/4] go: disable PIE flags for cgo Khem Raj
2017-09-23  0:58 ` [PATCH 3/4] go_1.9: remove obsolete overrides Khem Raj
2017-09-23  0:58 ` [PATCH 4/4] go: Fix build with -buildmode=pie Khem Raj
2017-09-23  1:00 ` ✗ patchtest: failure for "goarch.bbclass: fixups for Go ..." and 3 more Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.