[2/4] go: disable PIE flags for cgo

Message ID 20170923005823.10278-2-raj.khem@gmail.com
State New
Headers show
Series
  • [1/4] goarch.bbclass: fixups for Go mips32 support
Related show

Commit Message

Khem Raj Sept. 23, 2017, 12:58 a.m.
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(+)

-- 
2.14.1

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

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() {