From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 DDCD13857C46 for ; Fri, 18 Sep 2020 08:13:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DDCD13857C46 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-6-buUMti2UPJqN8CObhklxwQ-1; Fri, 18 Sep 2020 04:13:08 -0400 X-MC-Unique: buUMti2UPJqN8CObhklxwQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 059D9912C10; Fri, 18 Sep 2020 08:13:08 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-113-177.ams2.redhat.com [10.36.113.177]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5513919D7C; Fri, 18 Sep 2020 08:13:07 +0000 (UTC) From: Florian Weimer To: "H.J. Lu via Libc-alpha" Subject: Re: [PATCH 3/3] ld.so: Add --list-tunables to print tunable values References: <20200912134441.2407884-1-hjl.tools@gmail.com> <20200912134441.2407884-4-hjl.tools@gmail.com> Date: Fri, 18 Sep 2020 10:13:05 +0200 In-Reply-To: <20200912134441.2407884-4-hjl.tools@gmail.com> (H. J. Lu via Libc-alpha's message of "Sat, 12 Sep 2020 06:44:41 -0700") Message-ID: <87tuvv8pv2.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-13.0 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-List-Received-Date: Fri, 18 Sep 2020 08:13:14 -0000 * H. J. Lu via Libc-alpha: > diff --git a/elf/Makefile b/elf/Makefile > index 0b78721848..7943a684ab 100644 > --- a/elf/Makefile > +++ b/elf/Makefile > @@ -414,7 +414,7 @@ endif > ifeq (yes,$(build-shared)) > ifeq ($(run-built-tests),yes) > tests-special += $(objpfx)tst-pathopt.out $(objpfx)tst-rtld-load-self.out \ > - $(objpfx)tst-rtld-preload.out > + $(objpfx)tst-rtld-preload.out $(objpfx)list-tunables.out > endif I think the new test needs to be conditional on $(have-tunables) as well. > /* If we have no further argument the program was called incorrectly. > Grant the user some education. */ > if (_dl_argc < 2) > - _dl_fatal_printf ("\ > + { > +#if HAVE_TUNABLES > + _dl_printf > +#else > + _dl_fatal_printf > +#endif > + ("\ > Usage: ld.so [OPTION]... EXECUTABLE-FILE [ARGS-FOR-PROGRAM...]\n\ > You have invoked `ld.so', the helper program for shared library executables.\n\ > This program usually lives in the file `/lib/ld.so', and special directives\n\ > @@ -1293,6 +1321,11 @@ of this helper program; chances are you did not intend to run this program.\n\ > in LIST\n\ > --audit LIST use objects named in LIST as auditors\n\ > --preload LIST preload objects named in LIST\n"); > +#if HAVE_TUNABLES > + _dl_fatal_printf ("\ > + --list-tunables list all tunables with minimum and maximum values\n"); > +#endif > + } I think you should preprocessor string splicing, so something like this: --preload LIST preload objects named in LIST\n" #if HAVE_TUNABLES "\ --list-tunables list all tunables with minimum and maximum values\n" #endif ); It should minimize the required changes. Rest looks okay to me. Thanks, Florian -- Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243, Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill