Skip to contentSkip to conversation

goarch.bbclass: fixups for Go mips32 support

PATCH In review Khem Raj 2 participants 5 messages Sep 23, 2017

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/4 goarch.bbclass: fixups for Go mips32 support

From: Matt Madison <[email protected]>

* 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]

---
 meta/classes/goarch.bbclass | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
meta/classes/goarch.bbclass +8 -4
index 8b95c5fe94..9ed562d5ab 100644
@@ -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):
Signature · 1 line
2.14.1
author
#1 lore raw

PATCH 2/4 go: disable PIE flags for cgo

From: Matt Madison <[email protected]>

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.

---
 meta/classes/go.bbclass                | 3 +++
 meta/recipes-devtools/go/go-target.inc | 3 +++
 2 files changed, 6 insertions(+)
meta/classes/go.bbclass +3 -0
index e167c949ec..09b01a84c3 100644
@@ -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}"
meta/recipes-devtools/go/go-target.inc +3 -0
index b88d0166e5..6065c3c80d 100644
@@ -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() {
Signature · 1 line
2.14.1
author
#2 lore raw

PATCH 3/4 go_1.9: remove obsolete overrides

In reply to Khem Raj

From: Matt Madison <[email protected]>

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

---
 meta/recipes-devtools/go/go_1.9.bb | 2 --
 1 file changed, 2 deletions(-)
meta/recipes-devtools/go/go_1.9.bb +0 -2
index 08ab793f86..c67e2cb050 100644
@@ -1,4 +1,2 @@
 require go-${PV}.inc
 require go-target.inc
-TUNE_CCARGS_remove = "-march=mips32r2"
-SECURITY_PIE_CFLAGS_remove = "-fPIE -pie"
Signature · 1 line
2.14.1
author
#3 lore raw

PATCH 4/4 go: Fix build with -buildmode=pie

In reply to Khem Raj
---
 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
meta/recipes-devtools/go/go-1.9.inc +1 -0
index 0b0aca3fbe..65adaa8d72 100644
@@ -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"
meta/recipes-devtools/go/go-1.9/0009-cmd-go-buildmode-pie-forces-external-linking-mode-on.patch new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.14.1
#4 lore raw

✗ patchtest: failure for "goarch.bbclass: fixups for Go ..." and 3 more

In reply to Khem Raj

== 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 ([email protected]) 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