From patchwork Thu May 26 16:50:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 54425 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 BD7F03836E7E for ; Thu, 26 May 2022 17:02:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BD7F03836E7E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1653584521; bh=OlWeK9dJVctlDMqbj1ou3QrAVIo3Pm4OgPKQGTZYiV0=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=nH7P97t+m2j3nPamU4VLa27TkFlrVnrJgKWH5K/Hby59CqLSXQt+/JJ4UuqNr4h2/ mZOyf/DRquHBDcWda3/izTEag+SaQzsqAyvPBFxvQH83bxMFm0urPgxvOOLk608NEF 0Xq/9Hxh55nGGssdv1A0ZGxk//wk87qArgcpwCvU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 62DC63836670 for ; Thu, 26 May 2022 16:50:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 62DC63836670 Received: by mail-ot1-x335.google.com with SMTP id h9-20020a056830400900b0060b03bfe792so1311418ots.12 for ; Thu, 26 May 2022 09:50:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OlWeK9dJVctlDMqbj1ou3QrAVIo3Pm4OgPKQGTZYiV0=; b=cFhS5Ev4qkjB66AN9WRiIz2VY271roYYHsarmuS1Fi3gxjv7GM7utZK64J92epfbi3 LcNpYekNdlJnVLIkZpHqaXpvT5C0cFpK/Xm332R13wLDtYkvIKaKus6t3oMJoQDENHg9 iyFlyXiXS3nEI5edWyy+YiU8u1dsVYu56zbLnoWnMqHn6oB9UKzVTZru1mIi9D1Dx6zZ TyxDpgzC6PiiwpSJwTzLftuzFEVSC4SP1ENvd+3h7Asu/A1Kn43UQce9ZRQf40pKxzsH jwj++2puMP4+5pxr94+8v1IgRgPsw6dRkdk/Y8BW4R6/sEfGFiPEysgiV14ZQ5WPrEJG FzUA== X-Gm-Message-State: AOAM5304NSnS21lslghHCG46U93824581y7Cg4kBggWDgpzjjMXy4dyZ jG2D3+lb/i6h/VPG54ihS2rrFL6QsHK1UQ== X-Google-Smtp-Source: ABdhPJznzXD2FhLdkgufMnDq3kJm13nj/NZ8Dl0KehCKE5GHY7pQPisL5g1nQPNtAh0ssuHtRnBmgw== X-Received: by 2002:a9d:6545:0:b0:60b:1ccc:c6c7 with SMTP id q5-20020a9d6545000000b0060b1cccc6c7mr7397983otl.326.1653583831605; Thu, 26 May 2022 09:50:31 -0700 (PDT) Received: from birita.. ([2804:431:c7cb:9f85:b1e1:5370:63bd:a2ac]) by smtp.gmail.com with ESMTPSA id y26-20020a9d461a000000b0060603221255sm802521ote.37.2022.05.26.09.50.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 May 2022 09:50:31 -0700 (PDT) To: libc-alpha@sourceware.org, Szabolcs Nagy Subject: [PATCH 16/17] x86_64: Remove _dl_skip_args usage Date: Thu, 26 May 2022 13:50:02 -0300 Message-Id: <20220526165003.705355-17-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220526165003.705355-1-adhemerval.zanella@linaro.org> References: <20220526165003.705355-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, 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: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Since ad43cac44a the generic code already shuffles the argv/envp/auxv on the stack to remove the ld.so own arguments and thus _dl_skip_args is always 0. So there is no need to adjust the argc or argv. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: H.J. Lu --- sysdeps/x86_64/dl-machine.h | 13 ++----------- sysdeps/x86_64/x32/dl-machine.h | 12 +----------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index c70af7ab1e..e33ca2cc1a 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -140,17 +140,8 @@ _start:\n\ _dl_start_user:\n\ # Save the user entry point address in %r12.\n\ movq %rax, %r12\n\ - # See if we were run as a command with the executable file\n\ - # name as an extra leading argument.\n\ - movl _dl_skip_args(%rip), %eax\n\ - # Pop the original argument count.\n\ - popq %rdx\n\ - # Adjust the stack pointer to skip _dl_skip_args words.\n\ - leaq (%rsp,%rax,8), %rsp\n\ - # Subtract _dl_skip_args from argc.\n\ - subl %eax, %edx\n\ - # Push argc back on the stack.\n\ - pushq %rdx\n\ + # Read the original argument count.\n\ + movq (%rsp), %rdx\n\ # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\ # argc -> rsi\n\ movq %rdx, %rsi\n\ diff --git a/sysdeps/x86_64/x32/dl-machine.h b/sysdeps/x86_64/x32/dl-machine.h index 331374069e..681016c8d8 100644 --- a/sysdeps/x86_64/x32/dl-machine.h +++ b/sysdeps/x86_64/x32/dl-machine.h @@ -45,18 +45,8 @@ _start:\n\ _dl_start_user:\n\ # Save the user entry point address in %r12.\n\ movl %eax, %r12d\n\ - # See if we were run as a command with the executable file\n\ - # name as an extra leading argument.\n\ - movl _dl_skip_args(%rip), %eax\n\ - # Pop the original argument count.\n\ + # Read the original argument count.\n\ movl (%rsp), %edx\n\ - # Adjust the stack pointer to skip _dl_skip_args words.\n\ - lea 4(%rsp,%rax,4), %esp\n\ - # Subtract _dl_skip_args from argc.\n\ - subl %eax, %edx\n\ - # Push argc back on the stack.\n\ - subl $4, %esp\n\ - movl %edx, (%rsp)\n\ # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\ # argc -> rsi\n\ movl %edx, %esi\n\