diff mbox series

[2/7] go: Fix build with PIE on musl

Message ID 20171014154858.35123-2-raj.khem@gmail.com
State Superseded
Headers show
Series [1/7] go-dep: Upgrade to 0.3.1 | expand

Commit Message

Khem Raj Oct. 14, 2017, 3:48 p.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 meta/recipes-devtools/go/go-1.9.inc                |   3 +
 .../go/go-1.9/default-buildmode-pie.patch          |  13 +++
 .../go/go-1.9/set-external-linker.patch            | 104 +++++++++++++++++++++
 3 files changed, 120 insertions(+)
 create mode 100644 meta/recipes-devtools/go/go-1.9/default-buildmode-pie.patch
 create mode 100644 meta/recipes-devtools/go/go-1.9/set-external-linker.patch

-- 
2.14.2

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

Comments

Ross Burton Oct. 17, 2017, 12:31 p.m. UTC | #1
The patches have no header, upstream-status, or signed-off-by.

Ross

On 14 October 2017 at 16:48, Khem Raj <raj.khem@gmail.com> wrote:

> Signed-off-by: Khem Raj <raj.khem@gmail.com>

> ---

>  meta/recipes-devtools/go/go-1.9.inc                |   3 +

>  .../go/go-1.9/default-buildmode-pie.patch          |  13 +++

>  .../go/go-1.9/set-external-linker.patch            | 104

> +++++++++++++++++++++

>  3 files changed, 120 insertions(+)

>  create mode 100644 meta/recipes-devtools/go/go-1.

> 9/default-buildmode-pie.patch

>  create mode 100644 meta/recipes-devtools/go/go-1.

> 9/set-external-linker.patch

>

> diff --git a/meta/recipes-devtools/go/go-1.9.inc

> b/meta/recipes-devtools/go/go-1.9.inc

> index 65adaa8d72..f52abb5735 100644

> --- a/meta/recipes-devtools/go/go-1.9.inc

> +++ b/meta/recipes-devtools/go/go-1.9.inc

> @@ -15,6 +15,9 @@ SRC_URI += "\

>          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

> \

> +        file://default-buildmode-pie.patch \

>  "

> +SRC_URI_append_libc-musl = " file://set-external-linker.patch"

> +

>  SRC_URI[main.md5sum] = "da2d44ea384076efec43ee1f8b7d45d2"

>  SRC_URI[main.sha256sum] = "a4ab229028ed167ba1986825751463

> 605264e44868362ca8e7accc8be057e993"

> diff --git a/meta/recipes-devtools/go/go-1.9/default-buildmode-pie.patch

> b/meta/recipes-devtools/go/go-1.9/default-buildmode-pie.patch

> new file mode 100644

> index 0000000000..cc8aef0ad0

> --- /dev/null

> +++ b/meta/recipes-devtools/go/go-1.9/default-buildmode-pie.patch

> @@ -0,0 +1,13 @@

> +diff -upr src/go.orig/src/cmd/go/internal/work/build.go

> src/go/src/cmd/go/internal/work/build.go

> +--- go.orig/src/cmd/go/internal/work/build.go  2017-08-27

> 17:38:26.354750979 +0200

> ++++ go/src/cmd/go/internal/work/build.go       2017-08-27

> 17:40:27.555130105 +0200

> +@@ -304,7 +304,8 @@ func BuildModeInit() {

> +               ldBuildmode = "c-shared"

> +       case "default":

> +               switch platform {

> +-              case "android/arm", "android/arm64", "android/amd64",

> "android/386":

> ++              case "linux/386", "linux/amd64", "linux/arm",

> "linux/arm64", "linux/ppc64le", "linux/s390x",

> ++                      "android/arm", "android/arm64", "android/amd64",

> "android/386":

> +                       codegenArg = "-shared"

> +                       ldBuildmode = "pie"

> +               case "darwin/arm", "darwin/arm64":

> diff --git a/meta/recipes-devtools/go/go-1.9/set-external-linker.patch

> b/meta/recipes-devtools/go/go-1.9/set-external-linker.patch

> new file mode 100644

> index 0000000000..79eaff7205

> --- /dev/null

> +++ b/meta/recipes-devtools/go/go-1.9/set-external-linker.patch

> @@ -0,0 +1,104 @@

> +Index: go/src/cmd/link/internal/amd64/obj.go

> +===================================================================

> +--- go.orig/src/cmd/link/internal/amd64/obj.go

> ++++ go/src/cmd/link/internal/amd64/obj.go

> +@@ -67,7 +67,7 @@ func Init() {

> +       ld.Thearch.Append64 = ld.Append64l

> +       ld.Thearch.TLSIEtoLE = tlsIEtoLE

> +

> +-      ld.Thearch.Linuxdynld = "/lib64/ld-linux-x86-64.so.2"

> ++      ld.Thearch.Linuxdynld = "/lib/ld-musl-x86_64.so.1"

> +       ld.Thearch.Freebsddynld = "/libexec/ld-elf.so.1"

> +       ld.Thearch.Openbsddynld = "/usr/libexec/ld.so"

> +       ld.Thearch.Netbsddynld = "/libexec/ld.elf_so"

> +Index: go/src/cmd/link/internal/arm/obj.go

> +===================================================================

> +--- go.orig/src/cmd/link/internal/arm/obj.go

> ++++ go/src/cmd/link/internal/arm/obj.go

> +@@ -63,7 +63,7 @@ func Init() {

> +       ld.Thearch.Append32 = ld.Append32l

> +       ld.Thearch.Append64 = ld.Append64l

> +

> +-      ld.Thearch.Linuxdynld = "/lib/ld-linux.so.3" // 2 for OABI, 3 for

> EABI

> ++      ld.Thearch.Linuxdynld = "/lib/ld-musl-armhf.so.1"

> +       ld.Thearch.Freebsddynld = "/usr/libexec/ld-elf.so.1"

> +       ld.Thearch.Openbsddynld = "/usr/libexec/ld.so"

> +       ld.Thearch.Netbsddynld = "/libexec/ld.elf_so"

> +Index: go/src/cmd/link/internal/arm64/obj.go

> +===================================================================

> +--- go.orig/src/cmd/link/internal/arm64/obj.go

> ++++ go/src/cmd/link/internal/arm64/obj.go

> +@@ -62,7 +62,7 @@ func Init() {

> +       ld.Thearch.Append32 = ld.Append32l

> +       ld.Thearch.Append64 = ld.Append64l

> +

> +-      ld.Thearch.Linuxdynld = "/lib/ld-linux-aarch64.so.1"

> ++      ld.Thearch.Linuxdynld = "/lib/ld-musl-aarch64.so.1"

> +

> +       ld.Thearch.Freebsddynld = "XXX"

> +       ld.Thearch.Openbsddynld = "XXX"

> +Index: go/src/cmd/link/internal/mips/obj.go

> +===================================================================

> +--- go.orig/src/cmd/link/internal/mips/obj.go

> ++++ go/src/cmd/link/internal/mips/obj.go

> +@@ -77,7 +77,7 @@ func Init() {

> +               ld.Thearch.Append64 = ld.Append64b

> +       }

> +

> +-      ld.Thearch.Linuxdynld = "/lib/ld.so.1"

> ++      ld.Thearch.Linuxdynld = "/lib/ld-musl-mipsle.so.1"

> +

> +       ld.Thearch.Freebsddynld = "XXX"

> +       ld.Thearch.Openbsddynld = "XXX"

> +Index: go/src/cmd/link/internal/mips64/obj.go

> +===================================================================

> +--- go.orig/src/cmd/link/internal/mips64/obj.go

> ++++ go/src/cmd/link/internal/mips64/obj.go

> +@@ -75,7 +75,7 @@ func Init() {

> +               ld.Thearch.Append64 = ld.Append64b

> +       }

> +

> +-      ld.Thearch.Linuxdynld = "/lib64/ld64.so.1"

> ++      ld.Thearch.Linuxdynld = "/lib64/ld-musl-mips64le.so.1"

> +

> +       ld.Thearch.Freebsddynld = "XXX"

> +       ld.Thearch.Openbsddynld = "XXX"

> +Index: go/src/cmd/link/internal/ppc64/obj.go

> +===================================================================

> +--- go.orig/src/cmd/link/internal/ppc64/obj.go

> ++++ go/src/cmd/link/internal/ppc64/obj.go

> +@@ -77,7 +77,7 @@ func Init() {

> +       }

> +

> +       // TODO(austin): ABI v1 uses /usr/lib/ld.so.1

> +-      ld.Thearch.Linuxdynld = "/lib64/ld64.so.1"

> ++      ld.Thearch.Linuxdynld = "/lib/ld-musl-powerpc64le.so.1"

> +

> +       ld.Thearch.Freebsddynld = "XXX"

> +       ld.Thearch.Openbsddynld = "XXX"

> +Index: go/src/cmd/link/internal/s390x/obj.go

> +===================================================================

> +--- go.orig/src/cmd/link/internal/s390x/obj.go

> ++++ go/src/cmd/link/internal/s390x/obj.go

> +@@ -62,7 +62,7 @@ func Init() {

> +       ld.Thearch.Append32 = ld.Append32b

> +       ld.Thearch.Append64 = ld.Append64b

> +

> +-      ld.Thearch.Linuxdynld = "/lib64/ld64.so.1"

> ++      ld.Thearch.Linuxdynld = "/lib/ld-musl-s390x.so.1"

> +

> +       // not relevant for s390x

> +       ld.Thearch.Freebsddynld = "XXX"

> +Index: go/src/cmd/link/internal/x86/obj.go

> +===================================================================

> +--- go.orig/src/cmd/link/internal/x86/obj.go

> ++++ go/src/cmd/link/internal/x86/obj.go

> +@@ -63,7 +63,7 @@ func Init() {

> +       ld.Thearch.Append32 = ld.Append32l

> +       ld.Thearch.Append64 = ld.Append64l

> +

> +-      ld.Thearch.Linuxdynld = "/lib/ld-linux.so.2"

> ++      ld.Thearch.Linuxdynld = "/lib/ld-musl-i386.so.1"

> +       ld.Thearch.Freebsddynld = "/usr/libexec/ld-elf.so.1"

> +       ld.Thearch.Openbsddynld = "/usr/libexec/ld.so"

> +       ld.Thearch.Netbsddynld = "/usr/libexec/ld.elf_so"

> --

> 2.14.2

>

> --

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.openembedded.org/mailman/listinfo/openembedded-core

>
<div dir="ltr">The patches have no header, upstream-status, or signed-off-by.<div><br></div><div>Ross</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 14 October 2017 at 16:48, Khem Raj <span dir="ltr">&lt;<a href="mailto:raj.khem@gmail.com" target="_blank">raj.khem@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Signed-off-by: Khem Raj &lt;<a href="mailto:raj.khem@gmail.com">raj.khem@gmail.com</a>&gt;<br>
---<br>
 meta/recipes-devtools/go/go-1.<wbr>9.inc                |   3 +<br>
 .../go/go-1.9/default-<wbr>buildmode-pie.patch          |  13 +++<br>
 .../go/go-1.9/set-external-<wbr>linker.patch            | 104 +++++++++++++++++++++<br>
 3 files changed, 120 insertions(+)<br>
 create mode 100644 meta/recipes-devtools/go/go-1.<wbr>9/default-buildmode-pie.patch<br>
 create mode 100644 meta/recipes-devtools/go/go-1.<wbr>9/set-external-linker.patch<br>
<br>
diff --git a/meta/recipes-devtools/go/go-<wbr>1.9.inc b/meta/recipes-devtools/go/go-<wbr>1.9.inc<br>
index 65adaa8d72..f52abb5735 100644<br>
--- a/meta/recipes-devtools/go/go-<wbr>1.9.inc<br>
+++ b/meta/recipes-devtools/go/go-<wbr>1.9.inc<br>
@@ -15,6 +15,9 @@ SRC_URI += &quot;\<br>
         file://0007-ld-add-soname-to-<wbr>shareable-objects.patch \<br>
         file://0008-make.bash-add-<wbr>GOHOSTxx-indirection-for-<wbr>cross-canadia.patch \<br>
         file://0009-cmd-go-buildmode-<wbr>pie-forces-external-linking-<wbr>mode-on.patch \<br>
+        file://default-buildmode-pie.<wbr>patch \<br>
 &quot;<br>
+SRC_URI_append_libc-musl = &quot; file://set-external-linker.<wbr>patch&quot;<br>
+<br>
 SRC_URI[main.md5sum] = &quot;<wbr>da2d44ea384076efec43ee1f8b7d45<wbr>d2&quot;<br>
 SRC_URI[main.sha256sum] = &quot;<wbr>a4ab229028ed167ba1986825751463<wbr>605264e44868362ca8e7accc8be057<wbr>e993&quot;<br>
diff --git a/meta/recipes-devtools/go/go-<wbr>1.9/default-buildmode-pie.<wbr>patch b/meta/recipes-devtools/go/go-<wbr>1.9/default-buildmode-pie.<wbr>patch<br>
new file mode 100644<br>
index 0000000000..cc8aef0ad0<br>
--- /dev/null<br>
+++ b/meta/recipes-devtools/go/go-<wbr>1.9/default-buildmode-pie.<wbr>patch<br>
@@ -0,0 +1,13 @@<br>
+diff -upr src/go.orig/src/cmd/go/<wbr>internal/work/build.go src/go/src/cmd/go/internal/<wbr>work/build.go<br>
+--- go.orig/src/cmd/go/internal/<wbr>work/build.go  2017-08-27 17:38:26.354750979 +0200<br>
++++ go/src/cmd/go/internal/work/<wbr>build.go       2017-08-27 17:40:27.555130105 +0200<br>
+@@ -304,7 +304,8 @@ func BuildModeInit() {<br>
+               ldBuildmode = &quot;c-shared&quot;<br>
+       case &quot;default&quot;:<br>
+               switch platform {<br>
+-              case &quot;android/arm&quot;, &quot;android/arm64&quot;, &quot;android/amd64&quot;, &quot;android/386&quot;:<br>
++              case &quot;linux/386&quot;, &quot;linux/amd64&quot;, &quot;linux/arm&quot;, &quot;linux/arm64&quot;, &quot;linux/ppc64le&quot;, &quot;linux/s390x&quot;,<br>
++                      &quot;android/arm&quot;, &quot;android/arm64&quot;, &quot;android/amd64&quot;, &quot;android/386&quot;:<br>
+                       codegenArg = &quot;-shared&quot;<br>
+                       ldBuildmode = &quot;pie&quot;<br>
+               case &quot;darwin/arm&quot;, &quot;darwin/arm64&quot;:<br>
diff --git a/meta/recipes-devtools/go/go-<wbr>1.9/set-external-linker.patch b/meta/recipes-devtools/go/go-<wbr>1.9/set-external-linker.patch<br>
new file mode 100644<br>
index 0000000000..79eaff7205<br>
--- /dev/null<br>
+++ b/meta/recipes-devtools/go/go-<wbr>1.9/set-external-linker.patch<br>
@@ -0,0 +1,104 @@<br>
+Index: go/src/cmd/link/internal/<wbr>amd64/obj.go<br>
+=============================<wbr>==============================<wbr>========<br>
+--- go.orig/src/cmd/link/internal/<wbr>amd64/obj.go<br>
++++ go/src/cmd/link/internal/<wbr>amd64/obj.go<br>
+@@ -67,7 +67,7 @@ func Init() {<br>
+       ld.Thearch.Append64 = ld.Append64l<br>
+       ld.Thearch.TLSIEtoLE = tlsIEtoLE<br>
+<br>
+-      ld.Thearch.Linuxdynld = &quot;/lib64/ld-linux-x86-64.so.2&quot;<br>
++      ld.Thearch.Linuxdynld = &quot;/lib/ld-musl-x86_64.so.1&quot;<br>
+       ld.Thearch.Freebsddynld = &quot;/libexec/ld-elf.so.1&quot;<br>
+       ld.Thearch.Openbsddynld = &quot;/usr/libexec/ld.so&quot;<br>
+       ld.Thearch.Netbsddynld = &quot;/libexec/ld.elf_so&quot;<br>
+Index: go/src/cmd/link/internal/arm/<wbr>obj.go<br>
+=============================<wbr>==============================<wbr>========<br>
+--- go.orig/src/cmd/link/internal/<wbr>arm/obj.go<br>
++++ go/src/cmd/link/internal/arm/<wbr>obj.go<br>
+@@ -63,7 +63,7 @@ func Init() {<br>
+       ld.Thearch.Append32 = ld.Append32l<br>
+       ld.Thearch.Append64 = ld.Append64l<br>
+<br>
+-      ld.Thearch.Linuxdynld = &quot;/lib/ld-linux.so.3&quot; // 2 for OABI, 3 for EABI<br>
++      ld.Thearch.Linuxdynld = &quot;/lib/ld-musl-armhf.so.1&quot;<br>
+       ld.Thearch.Freebsddynld = &quot;/usr/libexec/ld-elf.so.1&quot;<br>
+       ld.Thearch.Openbsddynld = &quot;/usr/libexec/ld.so&quot;<br>
+       ld.Thearch.Netbsddynld = &quot;/libexec/ld.elf_so&quot;<br>
+Index: go/src/cmd/link/internal/<wbr>arm64/obj.go<br>
+=============================<wbr>==============================<wbr>========<br>
+--- go.orig/src/cmd/link/internal/<wbr>arm64/obj.go<br>
++++ go/src/cmd/link/internal/<wbr>arm64/obj.go<br>
+@@ -62,7 +62,7 @@ func Init() {<br>
+       ld.Thearch.Append32 = ld.Append32l<br>
+       ld.Thearch.Append64 = ld.Append64l<br>
+<br>
+-      ld.Thearch.Linuxdynld = &quot;/lib/ld-linux-aarch64.so.1&quot;<br>
++      ld.Thearch.Linuxdynld = &quot;/lib/ld-musl-aarch64.so.1&quot;<br>
+<br>
+       ld.Thearch.Freebsddynld = &quot;XXX&quot;<br>
+       ld.Thearch.Openbsddynld = &quot;XXX&quot;<br>
+Index: go/src/cmd/link/internal/mips/<wbr>obj.go<br>
+=============================<wbr>==============================<wbr>========<br>
+--- go.orig/src/cmd/link/internal/<wbr>mips/obj.go<br>
++++ go/src/cmd/link/internal/mips/<wbr>obj.go<br>
+@@ -77,7 +77,7 @@ func Init() {<br>
+               ld.Thearch.Append64 = ld.Append64b<br>
+       }<br>
+<br>
+-      ld.Thearch.Linuxdynld = &quot;/lib/ld.so.1&quot;<br>
++      ld.Thearch.Linuxdynld = &quot;/lib/ld-musl-mipsle.so.1&quot;<br>
+<br>
+       ld.Thearch.Freebsddynld = &quot;XXX&quot;<br>
+       ld.Thearch.Openbsddynld = &quot;XXX&quot;<br>
+Index: go/src/cmd/link/internal/<wbr>mips64/obj.go<br>
+=============================<wbr>==============================<wbr>========<br>
+--- go.orig/src/cmd/link/internal/<wbr>mips64/obj.go<br>
++++ go/src/cmd/link/internal/<wbr>mips64/obj.go<br>
+@@ -75,7 +75,7 @@ func Init() {<br>
+               ld.Thearch.Append64 = ld.Append64b<br>
+       }<br>
+<br>
+-      ld.Thearch.Linuxdynld = &quot;/lib64/ld64.so.1&quot;<br>
++      ld.Thearch.Linuxdynld = &quot;/lib64/ld-musl-mips64le.so.1&quot;<br>
+<br>
+       ld.Thearch.Freebsddynld = &quot;XXX&quot;<br>
+       ld.Thearch.Openbsddynld = &quot;XXX&quot;<br>
+Index: go/src/cmd/link/internal/<wbr>ppc64/obj.go<br>
+=============================<wbr>==============================<wbr>========<br>
+--- go.orig/src/cmd/link/internal/<wbr>ppc64/obj.go<br>
++++ go/src/cmd/link/internal/<wbr>ppc64/obj.go<br>
+@@ -77,7 +77,7 @@ func Init() {<br>
+       }<br>
+<br>
+       // TODO(austin): ABI v1 uses /usr/lib/ld.so.1<br>
+-      ld.Thearch.Linuxdynld = &quot;/lib64/ld64.so.1&quot;<br>
++      ld.Thearch.Linuxdynld = &quot;/lib/ld-musl-powerpc64le.so.<wbr>1&quot;<br>
+<br>
+       ld.Thearch.Freebsddynld = &quot;XXX&quot;<br>
+       ld.Thearch.Openbsddynld = &quot;XXX&quot;<br>
+Index: go/src/cmd/link/internal/<wbr>s390x/obj.go<br>
+=============================<wbr>==============================<wbr>========<br>
+--- go.orig/src/cmd/link/internal/<wbr>s390x/obj.go<br>
++++ go/src/cmd/link/internal/<wbr>s390x/obj.go<br>
+@@ -62,7 +62,7 @@ func Init() {<br>
+       ld.Thearch.Append32 = ld.Append32b<br>
+       ld.Thearch.Append64 = ld.Append64b<br>
+<br>
+-      ld.Thearch.Linuxdynld = &quot;/lib64/ld64.so.1&quot;<br>
++      ld.Thearch.Linuxdynld = &quot;/lib/ld-musl-s390x.so.1&quot;<br>
+<br>
+       // not relevant for s390x<br>
+       ld.Thearch.Freebsddynld = &quot;XXX&quot;<br>
+Index: go/src/cmd/link/internal/x86/<wbr>obj.go<br>
+=============================<wbr>==============================<wbr>========<br>
+--- go.orig/src/cmd/link/internal/<wbr>x86/obj.go<br>
++++ go/src/cmd/link/internal/x86/<wbr>obj.go<br>
+@@ -63,7 +63,7 @@ func Init() {<br>
+       ld.Thearch.Append32 = ld.Append32l<br>
+       ld.Thearch.Append64 = ld.Append64l<br>
+<br>
+-      ld.Thearch.Linuxdynld = &quot;/lib/ld-linux.so.2&quot;<br>
++      ld.Thearch.Linuxdynld = &quot;/lib/ld-musl-i386.so.1&quot;<br>
+       ld.Thearch.Freebsddynld = &quot;/usr/libexec/ld-elf.so.1&quot;<br>
+       ld.Thearch.Openbsddynld = &quot;/usr/libexec/ld.so&quot;<br>
+       ld.Thearch.Netbsddynld = &quot;/usr/libexec/ld.elf_so&quot;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.14.2<br>
<br>
--<br>
______________________________<wbr>_________________<br>
Openembedded-core mailing list<br>
<a href="mailto:Openembedded-core@lists.openembedded.org">Openembedded-core@lists.<wbr>openembedded.org</a><br>
<a href="http://lists.openembedded.org/mailman/listinfo/openembedded-core" rel="noreferrer" target="_blank">http://lists.openembedded.org/<wbr>mailman/listinfo/openembedded-<wbr>core</a><br>
</font></span></blockquote></div><br></div>
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/recipes-devtools/go/go-1.9.inc b/meta/recipes-devtools/go/go-1.9.inc
index 65adaa8d72..f52abb5735 100644
--- a/meta/recipes-devtools/go/go-1.9.inc
+++ b/meta/recipes-devtools/go/go-1.9.inc
@@ -15,6 +15,9 @@  SRC_URI += "\
         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 \
+        file://default-buildmode-pie.patch \
 "
+SRC_URI_append_libc-musl = " file://set-external-linker.patch"
+
 SRC_URI[main.md5sum] = "da2d44ea384076efec43ee1f8b7d45d2"
 SRC_URI[main.sha256sum] = "a4ab229028ed167ba1986825751463605264e44868362ca8e7accc8be057e993"
diff --git a/meta/recipes-devtools/go/go-1.9/default-buildmode-pie.patch b/meta/recipes-devtools/go/go-1.9/default-buildmode-pie.patch
new file mode 100644
index 0000000000..cc8aef0ad0
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/default-buildmode-pie.patch
@@ -0,0 +1,13 @@ 
+diff -upr src/go.orig/src/cmd/go/internal/work/build.go src/go/src/cmd/go/internal/work/build.go
+--- go.orig/src/cmd/go/internal/work/build.go	2017-08-27 17:38:26.354750979 +0200
++++ go/src/cmd/go/internal/work/build.go	2017-08-27 17:40:27.555130105 +0200
+@@ -304,7 +304,8 @@ func BuildModeInit() {
+ 		ldBuildmode = "c-shared"
+ 	case "default":
+ 		switch platform {
+-		case "android/arm", "android/arm64", "android/amd64", "android/386":
++		case "linux/386", "linux/amd64", "linux/arm", "linux/arm64", "linux/ppc64le", "linux/s390x",
++			"android/arm", "android/arm64", "android/amd64", "android/386":
+ 			codegenArg = "-shared"
+ 			ldBuildmode = "pie"
+ 		case "darwin/arm", "darwin/arm64":
diff --git a/meta/recipes-devtools/go/go-1.9/set-external-linker.patch b/meta/recipes-devtools/go/go-1.9/set-external-linker.patch
new file mode 100644
index 0000000000..79eaff7205
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/set-external-linker.patch
@@ -0,0 +1,104 @@ 
+Index: go/src/cmd/link/internal/amd64/obj.go
+===================================================================
+--- go.orig/src/cmd/link/internal/amd64/obj.go
++++ go/src/cmd/link/internal/amd64/obj.go
+@@ -67,7 +67,7 @@ func Init() {
+ 	ld.Thearch.Append64 = ld.Append64l
+ 	ld.Thearch.TLSIEtoLE = tlsIEtoLE
+ 
+-	ld.Thearch.Linuxdynld = "/lib64/ld-linux-x86-64.so.2"
++	ld.Thearch.Linuxdynld = "/lib/ld-musl-x86_64.so.1"
+ 	ld.Thearch.Freebsddynld = "/libexec/ld-elf.so.1"
+ 	ld.Thearch.Openbsddynld = "/usr/libexec/ld.so"
+ 	ld.Thearch.Netbsddynld = "/libexec/ld.elf_so"
+Index: go/src/cmd/link/internal/arm/obj.go
+===================================================================
+--- go.orig/src/cmd/link/internal/arm/obj.go
++++ go/src/cmd/link/internal/arm/obj.go
+@@ -63,7 +63,7 @@ func Init() {
+ 	ld.Thearch.Append32 = ld.Append32l
+ 	ld.Thearch.Append64 = ld.Append64l
+ 
+-	ld.Thearch.Linuxdynld = "/lib/ld-linux.so.3" // 2 for OABI, 3 for EABI
++	ld.Thearch.Linuxdynld = "/lib/ld-musl-armhf.so.1"
+ 	ld.Thearch.Freebsddynld = "/usr/libexec/ld-elf.so.1"
+ 	ld.Thearch.Openbsddynld = "/usr/libexec/ld.so"
+ 	ld.Thearch.Netbsddynld = "/libexec/ld.elf_so"
+Index: go/src/cmd/link/internal/arm64/obj.go
+===================================================================
+--- go.orig/src/cmd/link/internal/arm64/obj.go
++++ go/src/cmd/link/internal/arm64/obj.go
+@@ -62,7 +62,7 @@ func Init() {
+ 	ld.Thearch.Append32 = ld.Append32l
+ 	ld.Thearch.Append64 = ld.Append64l
+ 
+-	ld.Thearch.Linuxdynld = "/lib/ld-linux-aarch64.so.1"
++	ld.Thearch.Linuxdynld = "/lib/ld-musl-aarch64.so.1"
+ 
+ 	ld.Thearch.Freebsddynld = "XXX"
+ 	ld.Thearch.Openbsddynld = "XXX"
+Index: go/src/cmd/link/internal/mips/obj.go
+===================================================================
+--- go.orig/src/cmd/link/internal/mips/obj.go
++++ go/src/cmd/link/internal/mips/obj.go
+@@ -77,7 +77,7 @@ func Init() {
+ 		ld.Thearch.Append64 = ld.Append64b
+ 	}
+ 
+-	ld.Thearch.Linuxdynld = "/lib/ld.so.1"
++	ld.Thearch.Linuxdynld = "/lib/ld-musl-mipsle.so.1"
+ 
+ 	ld.Thearch.Freebsddynld = "XXX"
+ 	ld.Thearch.Openbsddynld = "XXX"
+Index: go/src/cmd/link/internal/mips64/obj.go
+===================================================================
+--- go.orig/src/cmd/link/internal/mips64/obj.go
++++ go/src/cmd/link/internal/mips64/obj.go
+@@ -75,7 +75,7 @@ func Init() {
+ 		ld.Thearch.Append64 = ld.Append64b
+ 	}
+ 
+-	ld.Thearch.Linuxdynld = "/lib64/ld64.so.1"
++	ld.Thearch.Linuxdynld = "/lib64/ld-musl-mips64le.so.1"
+ 
+ 	ld.Thearch.Freebsddynld = "XXX"
+ 	ld.Thearch.Openbsddynld = "XXX"
+Index: go/src/cmd/link/internal/ppc64/obj.go
+===================================================================
+--- go.orig/src/cmd/link/internal/ppc64/obj.go
++++ go/src/cmd/link/internal/ppc64/obj.go
+@@ -77,7 +77,7 @@ func Init() {
+ 	}
+ 
+ 	// TODO(austin): ABI v1 uses /usr/lib/ld.so.1
+-	ld.Thearch.Linuxdynld = "/lib64/ld64.so.1"
++	ld.Thearch.Linuxdynld = "/lib/ld-musl-powerpc64le.so.1"
+ 
+ 	ld.Thearch.Freebsddynld = "XXX"
+ 	ld.Thearch.Openbsddynld = "XXX"
+Index: go/src/cmd/link/internal/s390x/obj.go
+===================================================================
+--- go.orig/src/cmd/link/internal/s390x/obj.go
++++ go/src/cmd/link/internal/s390x/obj.go
+@@ -62,7 +62,7 @@ func Init() {
+ 	ld.Thearch.Append32 = ld.Append32b
+ 	ld.Thearch.Append64 = ld.Append64b
+ 
+-	ld.Thearch.Linuxdynld = "/lib64/ld64.so.1"
++	ld.Thearch.Linuxdynld = "/lib/ld-musl-s390x.so.1"
+ 
+ 	// not relevant for s390x
+ 	ld.Thearch.Freebsddynld = "XXX"
+Index: go/src/cmd/link/internal/x86/obj.go
+===================================================================
+--- go.orig/src/cmd/link/internal/x86/obj.go
++++ go/src/cmd/link/internal/x86/obj.go
+@@ -63,7 +63,7 @@ func Init() {
+ 	ld.Thearch.Append32 = ld.Append32l
+ 	ld.Thearch.Append64 = ld.Append64l
+ 
+-	ld.Thearch.Linuxdynld = "/lib/ld-linux.so.2"
++	ld.Thearch.Linuxdynld = "/lib/ld-musl-i386.so.1"
+ 	ld.Thearch.Freebsddynld = "/usr/libexec/ld-elf.so.1"
+ 	ld.Thearch.Openbsddynld = "/usr/libexec/ld.so"
+ 	ld.Thearch.Netbsddynld = "/usr/libexec/ld.elf_so"