summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2017-10-22 13:48:54 (GMT)
committerWaldemar Brodkorb <wbx@openadk.org>2017-10-22 13:49:01 (GMT)
commit30254eae11889ca53ec6207c81ced6854fa2e44a (patch)
tree0b7d60040f5749e416ff15914efd0ef0847f622a
parente8b758c782fe224a6439d9f169131fda7d6d9cb8 (diff)
musl: get the linker name by compiling a test app
-rw-r--r--package/musl/Makefile71
1 files changed, 7 insertions, 64 deletions
diff --git a/package/musl/Makefile b/package/musl/Makefile
index 52ecabd..3c3da3f 100644
--- a/package/musl/Makefile
+++ b/package/musl/Makefile
@@ -26,68 +26,11 @@ CONFIG_STYLE:= manual
BUILD_STYLE:= manual
INSTALL_STYLE:= manual
-MARCH:= $(ADK_TARGET_CPU_ARCH)
-ifeq ($(ADK_TARGET_CPU_ARCH),i686)
-MARCH:= i386
-endif
-ifeq ($(ADK_TARGET_CPU_ARCH),i586)
-MARCH:= i386
-endif
-ifeq ($(ADK_TARGET_CPU_ARCH),i486)
-MARCH:= i386
-endif
-ifeq ($(ADK_TARGET_CPU_ARCH),ppc)
-ifeq ($(ADK_TARGET_SOFT_FLOAT),y)
-MARCH:= powerpc-sf
-else
-MARCH:= powerpc
-endif
-endif
-ifeq ($(ADK_TARGET_CPU_ARCH),ppc64)
-MARCH:= powerpc64
-endif
-ifeq ($(ADK_TARGET_CPU_ARCH),ppc64le)
-MARCH:= powerpc64le
-endif
-ifeq ($(ADK_TARGET_CPU_ARCH),sh2eb)
-ifeq ($(ADK_TARGET_BINFMT_FDPIC),y)
-MARCH:= sheb-nofpu-fdpic
-else
-MARCH:= sheb-nofpu
-endif
-endif
-ifeq ($(ADK_TARGET_CPU_ARCH),sh4)
-MARCH:= sh
-endif
-ifeq ($(ADK_TARGET_CPU_ARCH),sh4eb)
-MARCH:= sheb
-endif
-ifeq ($(ADK_TARGET_ARCH_MIPS),y)
-ifeq ($(ADK_TARGET_SOFT_FLOAT),y)
-ifeq ($(ADK_TARGET_LITTLE_ENDIAN),y)
-MARCH:= mipsel-sf
-else
-MARCH:= mips-sf
-endif
-endif
-endif
-ifeq ($(ADK_TARGET_ARCH_MIPS64),y)
-ifeq ($(ADK_TARGET_ABI_N32),y)
-ifeq ($(ADK_TARGET_LITTLE_ENDIAN),y)
-MARCH:= mipsn32el
-else
-MARCH:= mipsn32
-endif
-endif
-endif
-ifeq ($(ADK_TARGET_ARCH_ARM),y)
-ifeq ($(ADK_TARGET_ABI),eabihf)
-MARCH:= armhf
-endif
-endif
-ifeq ($(ADK_TARGET_ABI_X32),y)
-MARCH:= x32
-endif
+MUSL_LD_SO:= "`echo 'void main(void) {}' |${TARGET_CC} -x c -o \
+ $(BUILD_DIR)/.musl.tmp - >/dev/null 2>&1 ;\
+ ${TARGET_COMPILER_PREFIX}readelf -l $(BUILD_DIR)/.musl.tmp 2>/dev/null \
+ | grep 'program interpreter: /lib/ld-musl' | sed -e 's|.*lib/||'|sed -e 's|]||' ;\
+ rm $(BUILD_DIR)/.musl.tmp`"
# do nothing, musl is already build in toolchain directory
do-install:
@@ -96,9 +39,9 @@ ifneq ($(ADK_TARGET_USE_STATIC_LIBS_ONLY),y)
${INSTALL_DIR} $(IDIR_MUSL)/$(ADK_TARGET_LIBC_PATH)
$(CP) $(STAGING_TARGET_DIR)/usr/lib/libc.so $(IDIR_MUSL)/$(ADK_TARGET_LIBC_PATH)
(cd $(IDIR_MUSL)/$(ADK_TARGET_LIBC_PATH) && \
- ln -sf libc.so ld-musl-$(MARCH).so.1)
+ ln -sf libc.so $(MUSL_LD_SO))
(cd $(IDIR_MUSL)/bin && \
- ln -sf ../lib/ld-musl-$(MARCH).so.1 ldd)
+ ln -sf ../lib/$(MUSL_LD_SO) ldd)
endif