|
@@ -0,0 +1,79 @@
|
|
|
|
+From 43593d65827f4e7f848fc410321b0b2deed986fc Mon Sep 17 00:00:00 2001
|
|
|
|
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
|
|
+Date: Fri, 14 Jul 2017 21:54:37 +0200
|
|
|
|
+Subject: [PATCH] arch/{sparc,sparc64}/Makefile: define ARCH_FPIC
|
|
|
|
+
|
|
|
|
+Building Busybox on SPARC or SPARC64 with CONFIG_BUILD_LIBBUSYBOX=y
|
|
|
|
+currently fails with:
|
|
|
|
+
|
|
|
|
+miscutils/lib.a(i2c_tools.o): In function `i2c_dev_open':
|
|
|
|
+i2c_tools.c:(.text.i2c_dev_open+0x14): relocation truncated to fit: R_SPARC_GOT13 against `.LC0'
|
|
|
|
+i2c_tools.c:(.text.i2c_dev_open+0x38): relocation truncated to fit: R_SPARC_GOT13 against symbol `bb_errno' defined in COMMON section in libbb/lib.a(ptr_to_globals.o)
|
|
|
|
+i2c_tools.c:(.text.i2c_dev_open+0x6c): relocation truncated to fit: R_SPARC_GOT13 against `.LC1'
|
|
|
|
+miscutils/lib.a(i2c_tools.o): In function `check_funcs_test_end':
|
|
|
|
+i2c_tools.c:(.text.check_funcs_test_end+0x24): relocation truncated to fit: R_SPARC_GOT13 against `.LC2'
|
|
|
|
+i2c_tools.c:(.text.check_funcs_test_end+0x2c): relocation truncated to fit: R_SPARC_GOT13 against `.LC3'
|
|
|
|
+miscutils/lib.a(i2c_tools.o): In function `check_read_funcs':
|
|
|
|
+i2c_tools.c:(.text.check_read_funcs+0x30): relocation truncated to fit: R_SPARC_GOT13 against `.LC10'
|
|
|
|
+i2c_tools.c:(.text.check_read_funcs+0x80): relocation truncated to fit: R_SPARC_GOT13 against `.LC4'
|
|
|
|
+i2c_tools.c:(.text.check_read_funcs+0x98): relocation truncated to fit: R_SPARC_GOT13 against `.LC5'
|
|
|
|
+i2c_tools.c:(.text.check_read_funcs+0xc0): relocation truncated to fit: R_SPARC_GOT13 against `.LC6'
|
|
|
|
+i2c_tools.c:(.text.check_read_funcs+0xe0): relocation truncated to fit: R_SPARC_GOT13 against `.LC7'
|
|
|
|
+i2c_tools.c:(.text.check_read_funcs+0xf8): additional relocation overflows omitted from the output
|
|
|
|
+
|
|
|
|
+As stated by the gcc documentation, the SPARC architecture has a
|
|
|
|
+limited GOT size, which prevents moderately large binaries to be built
|
|
|
|
+with -fpic, and -fPIC is necessary. From gcc's documentation:
|
|
|
|
+
|
|
|
|
+'-fpic'
|
|
|
|
+ Generate position-independent code (PIC) suitable for use in a
|
|
|
|
+ shared library, if supported for the target machine. Such code
|
|
|
|
+ accesses all constant addresses through a global offset table
|
|
|
|
+ (GOT). The dynamic loader resolves the GOT entries when the
|
|
|
|
+ program starts (the dynamic loader is not part of GCC; it is part
|
|
|
|
+ of the operating system). If the GOT size for the linked
|
|
|
|
+ executable exceeds a machine-specific maximum size, you get an
|
|
|
|
+ error message from the linker indicating that '-fpic' does not
|
|
|
|
+ work; in that case, recompile with '-fPIC' instead. (These
|
|
|
|
+ maximums are 8k on the SPARC, 28k on AArch64 and 32k on the m68k
|
|
|
|
+ and RS/6000. The x86 has no such limit.)
|
|
|
|
+
|
|
|
|
+'-fPIC'
|
|
|
|
+ If supported for the target machine, emit position-independent
|
|
|
|
+ code, suitable for dynamic linking and avoiding any limit on the
|
|
|
|
+ size of the global offset table. This option makes a difference on
|
|
|
|
+ AArch64, m68k, PowerPC and SPARC.
|
|
|
|
+
|
|
|
|
+With a limit of 8KB on SPARC, we quickly reach this limit, and we hit
|
|
|
|
+it when building Busybox on SPARC/SPARC64 with the
|
|
|
|
+CONFIG_BUILD_LIBBUSYBOX=y option enabled.
|
|
|
|
+
|
|
|
|
+Therefore, this commit redefines ARCH_FPIC as -fPIC on sparc and
|
|
|
|
+sparc64 to solve this issue.
|
|
|
|
+
|
|
|
|
+[Submitted upstream: http://lists.busybox.net/pipermail/busybox/2017-July/085633.html]
|
|
|
|
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
|
|
+---
|
|
|
|
+ arch/sparc/Makefile | 1 +
|
|
|
|
+ arch/sparc64/Makefile | 1 +
|
|
|
|
+ 2 files changed, 2 insertions(+)
|
|
|
|
+ create mode 100644 arch/sparc/Makefile
|
|
|
|
+ create mode 100644 arch/sparc64/Makefile
|
|
|
|
+
|
|
|
|
+diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
|
|
|
|
+new file mode 100644
|
|
|
|
+index 0000000..4d6c5fb
|
|
|
|
+--- /dev/null
|
|
|
|
++++ b/arch/sparc/Makefile
|
|
|
|
+@@ -0,0 +1 @@
|
|
|
|
++ARCH_FPIC = -fPIC
|
|
|
|
+diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
|
|
|
|
+new file mode 100644
|
|
|
|
+index 0000000..4d6c5fb
|
|
|
|
+--- /dev/null
|
|
|
|
++++ b/arch/sparc64/Makefile
|
|
|
|
+@@ -0,0 +1 @@
|
|
|
|
++ARCH_FPIC = -fPIC
|
|
|
|
+--
|
|
|
|
+2.9.4
|
|
|
|
+
|