From patchwork Wed Sep 14 18:15:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Pello X-Patchwork-Id: 57649 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 D747D384D19E for ; Wed, 14 Sep 2022 18:16:38 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by sourceware.org (Postfix) with ESMTPS id D593F38582AF for ; Wed, 14 Sep 2022 18:16:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D593F38582AF Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=otheo.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=otheo.eu Received: (Authenticated sender: #01#@otheo.eu) by mail.gandi.net (Postfix) with ESMTPSA id 7142FE0004 for ; Wed, 14 Sep 2022 18:16:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=otheo.eu; s=gm1; t=1663179385; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gdna0x4w3Z/JnzXHoMdTX4NhsTYKIwyuNZYwgH9cr9U=; b=JS/Eb+UeMtxjL5QOx/rAiU1i4fSkpSbh6fxu783640ODGfjdATLomzNFZovxNjt29u/MzB qD484kou8ZQavHfAOjXqcp465txVrxAUMvygCPSK6Ydczp9mYearOZOSCNuxQziYo1vDdw Tj4+sCe04gODb+S5FL9QlLwBlN7eJwr8UpLNjRjWPC+GGnauZIEcQXaCHxOpi62Rw/wXg2 MQJQc20h+zmCYkVNUstCHsrSW32pwec0PC+tkAVnr1IoMR6H/C1Nef2/lNC3LfsgfGiIm2 WHHX5Uwd0QxFxBaqofTEpla8dLnOuNjsYfLo5spAkw+7XDUg+y7wlVtjT8IXJA== Date: Wed, 14 Sep 2022 20:15:09 +0200 From: Javier Pello To: libc-alpha@sourceware.org Subject: [PATCH 6/6] elf: Simplify output of hwcap subdirectories in ld.so help Message-Id: <20220914201509.1c642836df76f95d3c2a8f28@otheo.eu> In-Reply-To: <20220914200724.8e685fbbaf441c96d19011c6@otheo.eu> References: <20220905200652.d69204581d15c64647da5cd2@otheo.eu> <87h71l9crb.fsf@oldenburg.str.redhat.com> <20220906201207.e7b3d08272af5649754e76b1@otheo.eu> <87h71i6rfa.fsf@oldenburg.str.redhat.com> <20220914200724.8e685fbbaf441c96d19011c6@otheo.eu> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; i686-pc-linux-gnu) Mime-Version: 1.0 X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: , Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The print_hwcap_1 machinery was useful for the legacy hwcaps subdirectories, but it is not worth the trouble now that they are gone. Signed-off-by: Javier Pello --- elf/dl-usage.c | 43 +++++++------------------------------------ 1 file changed, 7 insertions(+), 36 deletions(-) diff --git a/elf/dl-usage.c b/elf/dl-usage.c index efd6c77c..754a6391 100644 --- a/elf/dl-usage.c +++ b/elf/dl-usage.c @@ -104,34 +104,6 @@ print_search_path_for_help (struct dl_main_state *state) print_search_path_for_help_1 (__rtld_search_dirs.dirs); } -/* Helper function for printing flags associated with a HWCAP name. */ -static void -print_hwcap_1 (bool *first, bool active, const char *label) -{ - if (active) - { - if (*first) - { - _dl_printf (" ("); - *first = false; - } - else - _dl_printf (", "); - _dl_printf ("%s", label); - } -} - -/* Called after a series of print_hwcap_1 calls to emit the line - terminator. */ -static void -print_hwcap_1_finish (bool *first) -{ - if (*first) - _dl_printf ("\n"); - else - _dl_printf (")\n"); -} - /* Print the header for print_hwcaps_subdirectories. */ static void print_hwcaps_subdirectories_header (bool *nothing_printed) @@ -165,9 +137,7 @@ print_hwcaps_subdirectories (const struct dl_main_state *state) { print_hwcaps_subdirectories_header (¬hing_printed); print_hwcaps_subdirectories_name (&split); - bool first = true; - print_hwcap_1 (&first, true, "searched"); - print_hwcap_1_finish (&first); + _dl_printf (" (searched)\n"); } /* The built-in glibc-hwcaps subdirectories. Do the filtering @@ -178,13 +148,14 @@ print_hwcaps_subdirectories (const struct dl_main_state *state) { print_hwcaps_subdirectories_header (¬hing_printed); print_hwcaps_subdirectories_name (&split); - bool first = true; - print_hwcap_1 (&first, mask & 1, "supported"); bool listed = _dl_hwcaps_contains (state->glibc_hwcaps_mask, split.segment, split.length); - print_hwcap_1 (&first, !listed, "masked"); - print_hwcap_1 (&first, (mask & 1) && listed, "searched"); - print_hwcap_1_finish (&first); + if (mask & 1) + _dl_printf (" (supported, %s)\n", listed ? "searched" : "masked"); + else if (!listed) + _dl_printf (" (masked)\n"); + else + _dl_printf ("\n"); mask >>= 1; }