From patchwork Tue Jan 11 18:43:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 49886 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 E4CB0389AC25 for ; Tue, 11 Jan 2022 18:46:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E4CB0389AC25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1641926779; bh=j1lDS166elHFGfMmEqK+Pec5LewJCgfL1dNQNRqqGB4=; 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=IoPnBQ3CYbgpi/VKGVb0eZmwSso/O3k9qVfahLW+tDGowIv+PPcCpLOWQldK1G9Ki 7aYUIoVoKFhNrKvMPo6FcQMPaWZTMSMqXUT+d19q98RVBeMbEgGGHqoZxNngaXl4pq 1gkFcFVjA37/WDIjouyrdj2ngT2fynkdKgl38cpA= 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 [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 1824538A940B for ; Tue, 11 Jan 2022 18:44:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1824538A940B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-557-R9ZpBwpaOI-xhZBl46TdnQ-1; Tue, 11 Jan 2022 13:44:00 -0500 X-MC-Unique: R9ZpBwpaOI-xhZBl46TdnQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AAFBB190D353 for ; Tue, 11 Jan 2022 18:43:59 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D7087E67B for ; Tue, 11 Jan 2022 18:43:58 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH 3/5] Linux: Remove DL_FIND_ARG_COMPONENTS In-Reply-To: References: X-From-Line: d98840e19421dcaa582163b93d0dfe286e8ab5e5 Mon Sep 17 00:00:00 2001 Message-Id: Date: Tue, 11 Jan 2022 19:43:57 +0100 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.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_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" The generic definition is always used since the Native Client port has been removed. --- sysdeps/unix/sysv/linux/dl-sysdep.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index 72aa109f2f..a13e0ea7ad 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -59,19 +59,6 @@ void *__libc_stack_end attribute_relro = NULL; rtld_hidden_data_def(__libc_stack_end) void *_dl_random attribute_relro = NULL; -#ifndef DL_FIND_ARG_COMPONENTS -# define DL_FIND_ARG_COMPONENTS(cookie, argc, argv, envp, auxp) \ - do { \ - void **_tmp; \ - (argc) = *(long int *) cookie; \ - (argv) = (char **) ((long int *) cookie + 1); \ - (envp) = (argv) + (argc) + 1; \ - for (_tmp = (void **) (envp); *_tmp; ++_tmp) \ - continue; \ - (auxp) = (void *) ++_tmp; \ - } while (0) -#endif - #ifndef DL_STACK_END # define DL_STACK_END(cookie) ((void *) (cookie)) #endif @@ -90,8 +77,16 @@ _dl_sysdep_start (void **start_argptr, #endif __libc_stack_end = DL_STACK_END (start_argptr); - DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, _dl_argv, _environ, - GLRO(dl_auxv)); + _dl_argc = (intptr_t) *start_argptr; + _dl_argv = (char **) (start_argptr + 1); /* Necessary aliasing violation. */ + _environ = _dl_argv + _dl_argc + 1; + for (char **tmp = _environ + 1; ; ++tmp) + if (*tmp == NULL) + { + /* Another necessary aliasing violation. */ + GLRO(dl_auxv) = (ElfW(auxv_t) *) (tmp + 1); + break; + } user_entry = (ElfW(Addr)) ENTRY_POINT; GLRO(dl_platform) = NULL; /* Default to nothing known about the platform. */