From patchwork Mon Jun 22 15:14:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 39748 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 938A93946C36; Mon, 22 Jun 2020 15:14:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 938A93946C36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1592838874; bh=54F4I94vB20MkwahhPb2wJzC2bu/NaDZCnU6Is26r74=; 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=Ig+j9XqajBjk7WE4UOfNVPQoHqBWpQrr0EnShr7BN4/goE3Plus0CQ2bocsSAq9mm ghyhmfYa95EFce+hF69ufb4o9nYO5vIDUeHoqpO9TQRwvD9PgFHI9CVa1tVrMYKb4Q sSTIbKGIN5lwkQE/49g8L198kS/IzmCVP5+y7iEM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 9E7623898537 for ; Mon, 22 Jun 2020 15:14:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9E7623898537 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-459-4MmkKCVVOdqSafgjWihaXg-1; Mon, 22 Jun 2020 11:14:30 -0400 X-MC-Unique: 4MmkKCVVOdqSafgjWihaXg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C515F464 for ; Mon, 22 Jun 2020 15:14:29 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-112-185.ams2.redhat.com [10.36.112.185]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 45E5C5C1BD for ; Mon, 22 Jun 2020 15:14:29 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 17/30] elf: Do not pass GLRO(dl_platform), GLRO(dl_platformlen) to _dl_important_hwcaps In-Reply-To: References: Message-Id: <0345646d6c2777fe33cb113dadeb876c3d4b1de6.1592836143.git.fweimer@redhat.com> Date: Mon, 22 Jun 2020 17:14:27 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.9 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_H3, 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. --- 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 675d5bd48b..6e5fa2af13 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 0f23352302..2de060848b 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -1059,12 +1059,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. */