Skip to contentSkip to conversation

package/go: needs PIE support

PATCH New Romain Naour 3 participants 3 messages Jul 24, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/go: needs PIE support

When build statically, runc try to link against Scrt1.o which is not provided by uClibc ARM toolchain for static build only.

[...]arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find Scrt1.o: No such file or directory
collect2: error: ld returned 1 exit status

On ARM, Go forces the use of -pie, for some reason:

pie := (goarch == "arm" && goos == "linux") || goos == "android" if pie { // we need to use -pie for Linux/ARM to get accurate imported sym
cgoLDFLAGS = append(cgoLDFLAGS, "-pie")
}

For this reason, add a dependency on BR2_TOOLCHAIN_SUPPORTS_PIE for ARM CPUs to disable Go for such toolchains.

While at it, rewrap Go dependencies.

[1] http://lists.busybox.net/pipermail/buildroot/2016-July/167206.html

Cc Thomas Petazzoni <[email protected]>
Cc Christian Stewart <[email protected]>

---
Require https://patchwork.ozlabs.org/patch/646956/

---
 package/go/Config.in.host | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
package/go/Config.in.host +3 -1
index d6d35dc..d79c669 100644
@@ -1,7 +1,9 @@
 config BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
 	bool
 	default y
-	depends on BR2_arm || BR2_aarch64 || BR2_i386 || BR2_x86_64 || BR2_powerpc64 || BR2_powerpc64le || BR2_mips64 || BR2_mips64el
+	depends on (BR2_arm && BR2_TOOLCHAIN_SUPPORTS_PIE) || BR2_aarch64 \
+		|| BR2_i386 || BR2_x86_64 || BR2_powerpc64 || BR2_powerpc64le \
+		|| BR2_mips64 || BR2_mips64el
 	depends on !BR2_ARM_CPU_ARMV4
 	# MIPS R6 support in Go has not yet been developed.
 	depends on !BR2_mips_64r6
Signature · 1 line
2.5.5
#1 lore raw

PATCH 1/1 package/go: needs PIE support

Romain,

Quoted 2 lines · Romain Naour

When build statically, runc try to link against Scrt1.o which is not provided by uClibc ARM toolchain for static build only.

Works fine, tested on aarch64, arm, and x86-64.

Best,
Christian

#2 lore raw

PATCH 1/1 package/go: needs PIE support

In reply to Romain Naour

Hello,

Quoted 20 lines · Romain Naour

When build statically, runc try to link against Scrt1.o which is not provided by uClibc ARM toolchain for static build only.

[...]arm-buildroot-linux-uclibcgnueabi/bin/ld: cannot find Scrt1.o: No such file or directory
collect2: error: ld returned 1 exit status

On ARM, Go forces the use of -pie, for some reason:

pie := (goarch == "arm" && goos == "linux") || goos == "android" if pie { // we need to use -pie for Linux/ARM to get accurate imported sym
cgoLDFLAGS = append(cgoLDFLAGS, "-pie")
}

For this reason, add a dependency on BR2_TOOLCHAIN_SUPPORTS_PIE for ARM CPUs to disable Go for such toolchains.

While at it, rewrap Go dependencies.

[1] http://lists.busybox.net/pipermail/buildroot/2016-July/167206.html

Quoted 8 lines
Cc Thomas Petazzoni <[email protected]>
Cc Christian Stewart <[email protected]>

---
Require https://patchwork.ozlabs.org/patch/646956/

---
 package/go/Config.in.host | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com