From patchwork Thu Oct 1 16:33:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 40608 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BA5CF398B88E; Thu, 1 Oct 2020 16:33:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BA5CF398B88E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601569997; bh=7Glj02Wr2qkaWoT8h7fJOT1NZxeoTvRzzPkJ2aoWAfM=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=bTRyP2OglQulkaYLy91Fnx1lldGc8IJ9lzJRr2n1jOzRPF6C+1sOyD3+gMlCJMLxw cLJC8IBq9RlXJv/DMt0vDeW8Sv6z2+nHguNbGgNBQzagF0mVURAzEeoTSQpanYlsKF ptMLRK024pm6SHXg0umU7LpS36zsOop2Vr0xwQDk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by sourceware.org (Postfix) with ESMTP id 1D91A398B837 for ; Thu, 1 Oct 2020 16:33:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1D91A398B837 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-442-37BrMFkGOQOLMF-sWRbu-A-1; Thu, 01 Oct 2020 12:33:13 -0400 X-MC-Unique: 37BrMFkGOQOLMF-sWRbu-A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 285EA10BBED8 for ; Thu, 1 Oct 2020 16:33:12 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-114-84.ams2.redhat.com [10.36.114.84]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 979585D9E8 for ; Thu, 1 Oct 2020 16:33:11 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 15/28] elf: Do not pass GLRO(dl_platform), GLRO(dl_platformlen) to _dl_important_hwcaps In-Reply-To: References: Message-Id: Date: Thu, 01 Oct 2020 18:33:09 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" In the current code, the function can easily obtain the information on its own. Reviewed-by: Adhemerval Zanella --- elf/dl-hwcaps.c | 11 +++++------ elf/dl-load.c | 3 +-- sysdeps/generic/ldsodefs.h | 12 ++++++------ 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/elf/dl-hwcaps.c b/elf/dl-hwcaps.c index 6df9efb255..44dbac099f 100644 --- a/elf/dl-hwcaps.c +++ b/elf/dl-hwcaps.c @@ -28,13 +28,12 @@ /* Return an array of useful/necessary hardware capability names. */ const struct r_strlenpair * -_dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, - size_t *max_capstrlen) +_dl_important_hwcaps (size_t *sz, size_t *max_capstrlen) { uint64_t hwcap_mask = GET_HWCAP_MASK(); /* Determine how many important bits are set. */ uint64_t masked = GLRO(dl_hwcap) & hwcap_mask; - size_t cnt = platform != NULL; + size_t cnt = GLRO (dl_platform) != NULL; size_t n, m; size_t total; struct r_strlenpair *result; @@ -60,10 +59,10 @@ _dl_important_hwcaps (const char *platform, size_t platform_len, size_t *sz, masked ^= 1ULL << n; ++m; } - if (platform != NULL) + if (GLRO (dl_platform) != NULL) { - temp[m].str = platform; - temp[m].len = platform_len; + temp[m].str = GLRO (dl_platform); + temp[m].len = GLRO (dl_platformlen); ++m; } diff --git a/elf/dl-load.c b/elf/dl-load.c index 0c8fa72c4d..f3201e7c14 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -697,8 +697,7 @@ _dl_init_paths (const char *llp, const char *source) #ifdef SHARED /* Get the capabilities. */ - capstr = _dl_important_hwcaps (GLRO(dl_platform), GLRO(dl_platformlen), - &ncapstr, &max_capstrlen); + capstr = _dl_important_hwcaps (&ncapstr, &max_capstrlen); #endif /* First set up the rest of the default search directory entries. */ diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 510a2f6841..382eeb9be0 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -1071,12 +1071,12 @@ extern void _dl_show_auxv (void) attribute_hidden; other. */ extern char *_dl_next_ld_env_entry (char ***position) attribute_hidden; -/* Return an array with the names of the important hardware capabilities. */ -extern const struct r_strlenpair *_dl_important_hwcaps (const char *platform, - size_t paltform_len, - size_t *sz, - size_t *max_capstrlen) - attribute_hidden; +/* Return an array with the names of the important hardware + capabilities. The length of the array is written to *SZ, and the + maximum of all strings length is written to *MAX_CAPSTRLEN. */ +const struct r_strlenpair *_dl_important_hwcaps (size_t *sz, + size_t *max_capstrlen) + attribute_hidden; /* Look up NAME in ld.so.cache and return the file name stored there, or null if none is found. Caller must free returned string. */