From 1ef3ce91c70cb6a536438132d3202ccb3eddadbc Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 19 Jul 2017 17:56:56 +0200 Subject: sparc: needs -fPIC Pinted out by Thomas Petazzoni. Signed-off-by: Denys Vlasenko --- Makefile | 2 +- arch/sparc/Makefile | 11 +++++++++++ arch/sparc64/Makefile | 11 +++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 arch/sparc/Makefile create mode 100644 arch/sparc64/Makefile diff --git a/Makefile b/Makefile index 0a5f86929..c756dfeaf 100644 --- a/Makefile +++ b/Makefile @@ -178,7 +178,7 @@ endif # SUBARCH is subsequently ignored. ifneq ($(CROSS_COMPILE),) -SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1) +SUBARCH := $(shell echo $(CROSS_COMPILE) | cut -d- -f1 | sed 's:^.*/::g') else SUBARCH := $(shell uname -m) endif diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile new file mode 100644 index 000000000..0b1c56cb5 --- /dev/null +++ b/arch/sparc/Makefile @@ -0,0 +1,11 @@ +# When building a library, even intra-library references, +# such as from find_applet_by_name() to applet_names[], +# don't work with -fpic on sparc, needs -fPIC. +# Don't know why it fails in this case but works when +# a binary is being built. +# +# (if is superfluous, ARCH_FPIC is only used by library build, but it +# demonstrates the point: non-pic binary does not need it) +ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y) +ARCH_FPIC = -fPIC +endif diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile new file mode 100644 index 000000000..0b1c56cb5 --- /dev/null +++ b/arch/sparc64/Makefile @@ -0,0 +1,11 @@ +# When building a library, even intra-library references, +# such as from find_applet_by_name() to applet_names[], +# don't work with -fpic on sparc, needs -fPIC. +# Don't know why it fails in this case but works when +# a binary is being built. +# +# (if is superfluous, ARCH_FPIC is only used by library build, but it +# demonstrates the point: non-pic binary does not need it) +ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y) +ARCH_FPIC = -fPIC +endif -- cgit v1.2.3