busybox: fix build on SPARC and SPARC64
PATCH 1/1 busybox: fix build on SPARC and SPARC64
Since we introduced the support for building Busybox as individual binaries, Busybox started failing to build on SPARC/SPARC64 with this feature enabled:
appletlib.c:(.text.find_applet_by_name+0x14): relocation truncated to fit: R_SPARC_GOT13 against symbol applet_nameofs' defined in .rodata.applet_nameofs section in libbb/lib.a(appletlib.o) appletlib.c:(.text.find_applet_by_name+0x18): relocation truncated to fit: R_SPARC_GOT13 against symbol applet_names' defined in .rodata.applet_names section in libbb/lib.a(appletlib.o) [...]
This commit adds two patches to Busybox to fix this issue, by adding -fPIC to CFLAGS when building on SPARC/SPARC64. The patches have been submitted upstream.
Fixes:
http://autobuild.buildroot.net/results/90144369ccea8c41ec7643a79a7ebfaa9b7db95c/
--- ...clude-per-arch-Makefile-before-Makefile.f.patch | 46 +++++++++++++ ...h-sparc-sparc64-Makefile-define-ARCH_FPIC.patch | 79 ++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 package/busybox/0003-Makefile-include-per-arch-Makefile-before-Makefile.f.patch create mode 100644 package/busybox/0004-arch-sparc-sparc64-Makefile-define-ARCH_FPIC.patch
package/busybox/0003-Makefile-include-per-arch-Makefile-before-Makefile.f.patch new file +46 -0
@@ -0,0 +1,46 @@ +From 2c240f131ae5cc981702b45397be3b311c67a9ee Mon Sep 17 00:00:00 2001 +From: Thomas Petazzoni <[email protected]> +Date: Fri, 14 Jul 2017 22:23:46 +0200 +Subject: [PATCH] Makefile: include per-arch Makefile before Makefile.flags + +Makefile.flags contains: + +ARCH_FPIC ?= -fpic +ARCH_FPIE ?= -fpie + +However, arch/$(ARCH)/Makefile gets included *after* Makefile.flags, +and therefore doesn't get the chance to provide its own value. + +Fix this by including arch/$(ARCH)/Makefile *before* Makefile.flags. + +[Submitted upstream: http://lists.busybox.net/pipermail/busybox/2017-July/085632.html] +Signed-off-by: Thomas Petazzoni <[email protected]> +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 971e68e..fe85070 100644 +--- a/Makefile ++++ b/Makefile +@@ -508,6 +508,8 @@ ifeq ($(dot-config),1) + # To avoid any implicit rule to kick in, define an empty command + .config .kconfig.d: ; + ++-include $(srctree)/arch/$(ARCH)/Makefile ++ + # Now we can define CFLAGS etc according to .config + include $(srctree)/Makefile.flags + +@@ -531,8 +533,6 @@ endif + # Defaults busybox but it is usually overridden in the arch makefile + all: busybox doc + +--include $(srctree)/arch/$(ARCH)/Makefile +- + # arch Makefile may override CC so keep this after arch Makefile is included + #bbox# NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) + CHECKFLAGS += $(NOSTDINC_FLAGS) +-- +2.9.4 +
package/busybox/0004-arch-sparc-sparc64-Makefile-define-ARCH_FPIC.patch new file +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.9.4
Thomas Petazzoni
AppliedPATCH 1/1 busybox: fix build on SPARC and SPARC64
Hello,
Quoted 16 lines · Thomas Petazzoni
Since we introduced the support for building Busybox as individual binaries, Busybox started failing to build on SPARC/SPARC64 with this feature enabled:
appletlib.c:(.text.find_applet_by_name+0x14): relocation truncated to fit:
R_SPARC_GOT13against symbolapplet_nameofs' defined in .rodata.applet_nameofs section in libbb/lib.a(appletlib.o) appletlib.c:(.text.find_applet_by_name+0x18): relocation truncated to fit: R_SPARC_GOT13 against symbolapplet_names' defined in .rodata.applet_names section in libbb/lib.a(appletlib.o) [...]This commit adds two patches to Busybox to fix this issue, by adding -fPIC to CFLAGS when building on SPARC/SPARC64. The patches have been submitted upstream.
Fixes:
http://autobuild.buildroot.net/results/90144369ccea8c41ec7643a79a7ebfaa9b7db95c/
Quoted 7 lines
Signed-off-by Thomas Petazzoni <[email protected]>--- ...clude-per-arch-Makefile-before-Makefile.f.patch | 46 +++++++++++++ ...h-sparc-sparc64-Makefile-define-ARCH_FPIC.patch | 79 ++++++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 package/busybox/0003-Makefile-include-per-arch-Makefile-before-Makefile.f.patch create mode 100644 package/busybox/0004-arch-sparc-sparc64-Makefile-define-ARCH_FPIC.patch
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com