From patchwork Mon Oct 27 07:59:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Pinski X-Patchwork-Id: 39591 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B71332118A for ; Mon, 27 Oct 2014 08:05:18 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id h11sf946561wiw.3 for ; Mon, 27 Oct 2014 01:05:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:mailing-list :precedence:list-id:list-unsubscribe:list-subscribe:list-archive :list-post:list-help:sender:delivered-to:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results; bh=uQekTkTdcOENp+KIlVy9SJyfs4ZTql/ljuhMryFu+2M=; b=aAXRp72MIWJFPwVrxWPa9BY2NTrai8Bo/C9VbIVOjVo9MGynXhwTG7/M025Ds7C6Jd z7wajzeW2gbe5Y/7DqTzhIZoh5CQMMPJgWipzcQGqEkE4vaZmTS0asT2sGUQH8R2jAOK QaxYPlHhQeTa6H8D/ldCg9ii+hpiwVMThiD1quFCAuv+jRODqd9pw4VRiq23KXqTVeRM w48cXDFqDkIaaoCQM/7UMKE55HTdkrC5NYOg5nVLbUljDvC3JHQl4TbwsP3mqaTnozAk 6ismrZIpURi8UZTCwrnRZOyI0TQPx4Cxu/gvBmtDaQInROv23mnZm0zaDONxtrWvUqYg 6UtQ== X-Gm-Message-State: ALoCoQk28XgmZbeDSxZ7yXKBV2kk58Ic/oBOhjVFTEwH6iAUe9lY9hLduCZmdB24BRsuMwuEUBsT X-Received: by 10.112.142.36 with SMTP id rt4mr1660839lbb.3.1414397117882; Mon, 27 Oct 2014 01:05:17 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.200 with SMTP id x8ls522680lae.76.gmail; Mon, 27 Oct 2014 01:05:16 -0700 (PDT) X-Received: by 10.152.7.7 with SMTP id f7mr21361510laa.57.1414397116734; Mon, 27 Oct 2014 01:05:16 -0700 (PDT) Received: from mail-lb0-x236.google.com (mail-lb0-x236.google.com. [2a00:1450:4010:c04::236]) by mx.google.com with ESMTPS id w5si18662783lae.80.2014.10.27.01.05.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Oct 2014 01:05:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::236 as permitted sender) client-ip=2a00:1450:4010:c04::236; Received: by mail-lb0-f182.google.com with SMTP id f15so4273039lbj.27 for ; Mon, 27 Oct 2014 01:05:16 -0700 (PDT) X-Received: by 10.153.8.164 with SMTP id dl4mr21703255lad.29.1414397116373; Mon, 27 Oct 2014 01:05:16 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp247779lbz; Mon, 27 Oct 2014 01:05:15 -0700 (PDT) X-Received: by 10.66.97.39 with SMTP id dx7mr22685781pab.65.1414397114630; Mon, 27 Oct 2014 01:05:14 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id je3si9904788pbd.84.2014.10.27.01.05.13 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Oct 2014 01:05:14 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-53823-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 31344 invoked by alias); 27 Oct 2014 08:03:24 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list List-Id: List-Unsubscribe: , List-Subscribe: List-Archive: List-Post: , List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 31288 invoked by uid 89); 27 Oct 2014 08:03:23 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-ig0-f173.google.com X-Received: by 10.107.134.89 with SMTP id i86mr1268913iod.53.1414396999185; Mon, 27 Oct 2014 01:03:19 -0700 (PDT) From: Andrew Pinski To: libc-alpha@sourceware.org Cc: Andrew Pinski Subject: [PATCH 22/29] [AARCH64] Add support to ldconfig for ILP32 and libilp32 Date: Mon, 27 Oct 2014 00:59:46 -0700 Message-Id: <1414396793-9005-23-git-send-email-apinski@cavium.com> In-Reply-To: <1414396793-9005-1-git-send-email-apinski@cavium.com> References: <1414396793-9005-1-git-send-email-apinski@cavium.com> X-Original-Sender: apinski@cavium.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c04::236 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@sourceware.org X-Google-Group-Id: 836684582541 This patch adds support to ldconfig for libilp32 which is used by ILP32. * sysdeps/generic/ldconfig.h (FLAG_AARCH64_LIB32): New define. * elf/cache.c (print_entry): Handle FLAG_AARCH64_LIB32. * sysdeps/unix/sysv/linux/aarch64/dl-cache.h (_DL_CACHE_DEFAULT_ID): Define it to be the FLAG_AARCH64_LIB32 if compiling for ILP32. (add_system_dir): Add libilp32 to the list of system directories. * sysdeps/unix/sysv/linux/arm/readelflib.c (process_elf_file): Handle ILP32 elf binaries. --- elf/cache.c | 2 ++ sysdeps/generic/ldconfig.h | 1 + sysdeps/unix/sysv/linux/aarch64/dl-cache.h | 13 ++++++++++++- sysdeps/unix/sysv/linux/arm/readelflib.c | 4 +++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/elf/cache.c b/elf/cache.c index 4cbf8d9..267214f 100644 --- a/elf/cache.c +++ b/elf/cache.c @@ -101,6 +101,8 @@ print_entry (const char *lib, int flag, unsigned int osversion, case FLAG_AARCH64_LIB64: fputs (",AArch64", stdout); break; + case FLAG_AARCH64_LIB32: + fputs (",ILP32", stdout); /* Uses the ARM soft-float ABI. */ case FLAG_ARM_LIBSF: fputs (",soft-float", stdout); diff --git a/sysdeps/generic/ldconfig.h b/sysdeps/generic/ldconfig.h index ba1d953..1dd8b4e 100644 --- a/sysdeps/generic/ldconfig.h +++ b/sysdeps/generic/ldconfig.h @@ -42,6 +42,7 @@ #define FLAG_MIPS_LIB32_NAN2008 0x0c00 #define FLAG_MIPS64_LIBN32_NAN2008 0x0d00 #define FLAG_MIPS64_LIBN64_NAN2008 0x0e00 +#define FLAG_AARCH64_LIB32 0x0f00 /* Name of auxiliary cache. */ #define _PATH_LDCONFIG_AUX_CACHE "/var/cache/ldconfig/aux-cache" diff --git a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h index 32851d0..930aa20 100644 --- a/sysdeps/unix/sysv/linux/aarch64/dl-cache.h +++ b/sysdeps/unix/sysv/linux/aarch64/dl-cache.h @@ -18,7 +18,11 @@ #include +#ifdef __LP64__ #define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB64 | FLAG_ELF_LIBC6) +#else +#define _DL_CACHE_DEFAULT_ID (FLAG_AARCH64_LIB32 | FLAG_ELF_LIBC6) +#endif #define _dl_cache_check_flags(flags) \ ((flags) == _DL_CACHE_DEFAULT_ID) @@ -27,18 +31,25 @@ do \ { \ size_t len = strlen (dir); \ - char path[len + 3]; \ + char path[len + 6]; \ memcpy (path, dir, len + 1); \ if (len >= 6 && ! memcmp (path + len - 6, "/lib64", 6)) \ { \ len -= 2; \ path[len] = '\0'; \ } \ + if (len >= 9 && ! memcmp (path + len - 9, "/libilp32", 9))\ + { \ + len -= 5; \ + path[len] = '\0'; \ + } \ add_dir (path); \ if (len >= 4 && ! memcmp (path + len - 4, "/lib", 4)) \ { \ memcpy (path + len, "64", 3); \ add_dir (path); \ + memcpy (path + len, "ilp32", 6); \ + add_dir (path); \ } \ } while (0) diff --git a/sysdeps/unix/sysv/linux/arm/readelflib.c b/sysdeps/unix/sysv/linux/arm/readelflib.c index a15ebe4..e255fb0 100644 --- a/sysdeps/unix/sysv/linux/arm/readelflib.c +++ b/sysdeps/unix/sysv/linux/arm/readelflib.c @@ -41,7 +41,9 @@ process_elf_file (const char *file_name, const char *lib, int *flag, ret = process_elf32_file (file_name, lib, flag, osversion, soname, file_contents, file_length); - if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5) + if (!ret && elf_header->e_machine == EM_AARCH64) + *flag = FLAG_AARCH64_LIB32|FLAG_ELF_LIBC6; + else if (!ret && EF_ARM_EABI_VERSION (elf32_header->e_flags) == EF_ARM_EABI_VER5) { if (elf32_header->e_flags & EF_ARM_ABI_FLOAT_HARD) *flag = FLAG_ARM_LIBHF|FLAG_ELF_LIBC6;