From patchwork Thu Aug 13 01:16:42 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bamvor Jian Zhang X-Patchwork-Id: 506803 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id DE19414056B for ; Thu, 13 Aug 2015 11:27:09 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 230DA91508; Thu, 13 Aug 2015 01:27:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HzGQEvkRzqyd; Thu, 13 Aug 2015 01:27:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 22597914F5; Thu, 13 Aug 2015 01:27:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 71F701C1481 for ; Thu, 13 Aug 2015 01:27:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6B7A7914F3 for ; Thu, 13 Aug 2015 01:27:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xrLpprHj7TW3 for ; Thu, 13 Aug 2015 01:27:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pa0-f45.google.com (mail-pa0-f45.google.com [209.85.220.45]) by whitealder.osuosl.org (Postfix) with ESMTPS id AED94914EA for ; Thu, 13 Aug 2015 01:27:01 +0000 (UTC) Received: by pacrr5 with SMTP id rr5so25892161pac.3 for ; Wed, 12 Aug 2015 18:27:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VEKa3nvU0Sefr+dLoMoy4r+PujfZgKDopPyi+TbKKrw=; b=TX/m078wAhscdSh9PphO8j7blwd/WQeUOxgiqV3iH0bxuajx+jbumTLbECJccpr2Kk rcTDUs5Qlo0k7NUyfNvBo1HMgR8Ohg6EeUvJvh7d8p4wSt5OTnidL4uspjDp/sCvP6je CxdFiMXQCIyGrdz+Rx0apvPZ7au8Zoc6wxyPowxvpB4wexNLdm2BwSlr3fl+WkynzZke jOUz/299wHlvxuj/2yadMyTllGmlivaFmdIFAKQbPhE1CHHtX+X9HWDi/VqPUNjRkILx B/EmyVQ3HUSfThQ/zPuNjpvY5XVzFq5xmFc9QiUcoZwOTFAIeK9O129KCYtdILG5o4ma FL/w== X-Gm-Message-State: ALoCoQnY/MJ+gfIocFs7YZmS+8xyujVI50CfiYj5RmbGbIwP0bw2cAua4VtY302RWzmHyAdYH7oz X-Received: by 10.68.218.65 with SMTP id pe1mr71713372pbc.2.1439428742234; Wed, 12 Aug 2015 18:19:02 -0700 (PDT) Received: from linux-j170.site ([104.156.239.73]) by smtp.gmail.com with ESMTPSA id tz1sm402197pbc.50.2015.08.12.18.18.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 12 Aug 2015 18:19:01 -0700 (PDT) From: Bamvor Jian Zhang To: buildroot@busybox.net Date: Thu, 13 Aug 2015 09:16:42 +0800 Message-Id: <1439428605-17453-3-git-send-email-bamvor.zhangjian@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1439428605-17453-1-git-send-email-bamvor.zhangjian@linaro.org> References: <1439428605-17453-1-git-send-email-bamvor.zhangjian@linaro.org> Cc: thomas.petazzoni@free-electrons.com, gustavo.zacarias@free-electrons.com Subject: [Buildroot] [PATCH V3 RESEND 2/5] aarch64: ilp32: handle special file name X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Bamvor Jian Zhang In aarch64 ilp32, the directory of library is libilp32. And the linker is ld-linux-aarch64_ilp32.so.1 or ld-linux-aarch64_be_ilp32.so.1 which is linked to libilp32/ld-VERSION.so(ld-2.20.so in my system). Signed-off-by: Bamvor Jian Zhang --- Makefile | 6 +++ toolchain/helpers.mk | 5 ++- toolchain/toolchain-external/toolchain-external.mk | 44 +++++++++++++++++++++- 3 files changed, 51 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index b4cef3f..df9a289 100644 --- a/Makefile +++ b/Makefile @@ -452,6 +452,12 @@ LIB_SYMLINK = lib64 else LIB_SYMLINK = lib32 endif +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32") +# On X86_64, ilp32 library will be located in libx32 directory. +ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y) +LIB_SYMLINK = libilp32 +endif +endif $(STAGING_DIR): @mkdir -p $(STAGING_DIR)/bin diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk index 7c70d35..32f1587 100644 --- a/toolchain/helpers.mk +++ b/toolchain/helpers.mk @@ -38,7 +38,7 @@ # # $1: arch specific sysroot directory # $2: support libraries directory (can be empty) -# $3: library directory ('lib' or 'lib64') from which libraries must be copied +# $3: library directory ('lib', 'lib64' or 'libilp32') from which libraries must be copied # $4: library name # $5: destination directory of the libary, relative to $(TARGET_DIR) # @@ -141,7 +141,8 @@ copy_toolchain_sysroot = \ if [ -d $${ARCH_SYSROOT_DIR}/$$i ] ; then \ rsync -au --chmod=u=rwX,go=rX --exclude 'usr/lib/locale' \ --exclude lib --exclude lib32 --exclude lib64 \ - $${ARCH_SYSROOT_DIR}/$$i/ $(STAGING_DIR)/$$i/ ; \ + --exclude libilp32 $${ARCH_SYSROOT_DIR}/$$i/ \ + $(STAGING_DIR)/$$i/ ; \ fi ; \ done ; \ if [ `readlink -f $${SYSROOT_DIR}` != `readlink -f $${ARCH_SYSROOT_DIR}` ] ; then \ diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk index 3cb59c6..344dd5a 100644 --- a/toolchain/toolchain-external/toolchain-external.mk +++ b/toolchain/toolchain-external/toolchain-external.mk @@ -86,6 +86,10 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL),y) LIB_EXTERNAL_LIBS += libc.so libgcc_s.so.* endif +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32") +LIB_EXTERNAL_LIBS += ld*.so +endif + ifeq ($(BR2_INSTALL_LIBSTDCPP),y) USR_LIB_EXTERNAL_LIBS += libstdc++.so.* endif @@ -253,6 +257,19 @@ define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK ln -snf . $(TARGET_DIR)/usr/lib/aarch64-linux-gnu endef +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32") +ifeq ($(BR2_ENDIAN), "LITTLE") +define TOOLCHAIN_EXTERNAL_ILP32_SYMLINK + ln -sf ld*.so $(TARGET_DIR)/lib/ld-linux-aarch64_ilp32.so.1 +endef +endif +ifeq ($(BR2_ENDIAN), "BIG") +define TOOLCHAIN_EXTERNAL_ILP32_SYMLINK + ln -sf ld*.so $(TARGET_DIR)/lib/ld-linux-aarch64_be_ilp32.so.1 +endef +endif +endif + ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201305),y) TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi TOOLCHAIN_EXTERNAL_SOURCE = arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2 @@ -394,6 +411,7 @@ TOOLCHAIN_EXTERNAL_SITE = $(dir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL))) TOOLCHAIN_EXTERNAL_SOURCE = $(notdir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL))) # We can't check hashes for custom downloaded toolchains BR_NO_CHECK_HASH_FOR += $(TOOLCHAIN_EXTERNAL_SOURCE) +TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS += TOOLCHAIN_EXTERNAL_ILP32_SYMLINK endif # In fact, we don't need to download the toolchain, since it is already @@ -445,17 +463,18 @@ endef # - lib64/ # - lib32-fp/ (Cavium toolchain) # - lib64-fp/ (Cavium toolchain) +# - libilp32/ (Aarch64/aarch64_be ilp32 library) # - usr/lib// (Linaro toolchain) # # And variations on these. define toolchain_find_sysroot -$$(echo -n $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:(usr/)?lib(32|64)?([^/]*)?/([^/]*/)?libc\.a::') +$$(echo -n $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:(usr/)?lib(32|64|ilp32)?([^/]*)?/([^/]*/)?libc\.a::') endef # Returns the lib subdirectory for the given compiler + flags (i.e # typically lib32 or lib64 for some toolchains) define toolchain_find_libdir -$$(echo -n $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:.*/(usr/)?(lib(32|64)?([^/]*)?)/([^/]*/)?libc.a:\2:') +$$(echo -n $(call toolchain_find_libc_a,$(1)) | sed -r -e 's:.*/(usr/)?(lib(32|64|ilp32)?([^/]*)?)/([^/]*/)?libc.a:\2:') endef # Checks for an already installed toolchain: check the toolchain @@ -737,10 +756,30 @@ define TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO fi endef +ifeq ($(BR2_GCC_TARGET_ABI), "ilp32") +ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y) +ifeq ($(BR2_ENDIAN), "LITTLE") +ILP32_SYM = ld-linux-aarch64_ilp32.so.1 +else +ILP32_SYM = ld-linux-aarch64_be_ilp32.so.1 +endif +define TOOLCHAIN_EXTERNAL_INSTALL_ILP32_LINK + LD_ILP32=`basename $(STAGING_DIR)/lib/ld*.so`; \ + ln -sf $${LD_ILP32} $(STAGING_DIR)/lib/${ILP32_SYM} +endef + +define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_ILP32_LINK + LD_ILP32=`basename $(TARGET_DIR)/lib/ld*.so`; \ + ln -sf $${LD_ILP32} $(TARGET_DIR)/lib/${ILP32_SYM} +endef +endif +endif + define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS $(TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS) $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER) $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT) + $(TOOLCHAIN_EXTERNAL_INSTALL_ILP32_LINK) endef # Even though we're installing things in both the staging, the host @@ -751,6 +790,7 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_CMDS $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC) $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT) $(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO) + $(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_ILP32_LINK) endef $(eval $(generic-package))