From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1791) id 5A80C384B124; Mon, 30 May 2022 20:49:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A80C384B124 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Adhemerval Zanella To: glibc-cvs@sourceware.org Subject: [glibc] ia64: Remove _dl_skip_args usage X-Act-Checkin: glibc X-Git-Author: Adhemerval Zanella X-Git-Refname: refs/heads/master X-Git-Oldrev: 1b7f05d11e75594c06f0a8d193c80c7f74857d5f X-Git-Newrev: 57bb1e5b9fce7f3797bdb3005065187ba9d66c59 Message-Id: <20220530204936.5A80C384B124@sourceware.org> Date: Mon, 30 May 2022 20:49:36 +0000 (GMT) X-BeenThere: glibc-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Glibc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 May 2022 20:49:36 -0000 https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=57bb1e5b9fce7f3797bdb3005065187ba9d66c59 commit 57bb1e5b9fce7f3797bdb3005065187ba9d66c59 Author: Adhemerval Zanella Date: Thu May 26 13:08:01 2022 -0300 ia64: Remove _dl_skip_args usage 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. The startup code is changed to read the _dl_argc and _dl_argv values, and envp is calculated from argc and argv. Checked on ia64-linux-gnu. Reviewed-by: Carlos O'Donell Diff: --- sysdeps/ia64/dl-machine.h | 70 ++++++++++------------------------------------- 1 file changed, 14 insertions(+), 56 deletions(-) diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index 20e586aa35..704dbd1f8c 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -201,81 +201,39 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], " .save ar.pfs, r32\n" \ " .body\n" \ " { .mii\n" \ -" addl r3 = @gprel(_dl_skip_args), gp\n" \ -" adds r11 = 24, sp /* Load the address of argv. */\n" \ " /* Save the pointer to the user entry point fptr in loc2. */\n" \ " mov loc2 = ret0\n" \ +" addl r2 = @ltoff(_dl_argc), gp\n" \ " ;;\n" \ " }\n" \ " { .mii\n" \ -" ld4 r3 = [r3]\n" \ -" adds r10 = 16, sp /* Load the address of argc. */\n" \ -" mov out2 = r11\n" \ -" ;;\n" \ -" /* See if we were run as a command with the executable file\n" \ -" name as an extra leading argument. If so, adjust the argv\n" \ -" pointer to skip _dl_skip_args words.\n" \ -" Note that _dl_skip_args is an integer, not a long - Jes\n" \ -"\n" \ -" The stack pointer has to be 16 byte aligned. We cannot simply\n" \ -" addjust the stack pointer. We have to move the whole argv and\n" \ -" envp and adjust _dl_argv by _dl_skip_args. H.J. */\n" \ -" }\n" \ -" { .mib\n" \ -" ld8 out1 = [r10] /* is argc actually stored as a long\n" \ -" or as an int? */\n" \ -" addl r2 = @ltoff(_dl_argv), gp\n" \ +" ld8 out1 = [r2] /* Get the _dl_argc address. */\n" \ +" addl r3 = @ltoff(_dl_argv), gp\n" \ " ;;\n" \ " }\n" \ " { .mmi\n" \ -" ld8 r2 = [r2] /* Get the address of _dl_argv. */\n" \ -" sub out1 = out1, r3 /* Get the new argc. */\n" \ -" shladd r3 = r3, 3, r0\n" \ -" ;;\n" \ -" }\n" \ -" {\n" \ -" .mib\n" \ -" ld8 r17 = [r2] /* Get _dl_argv. */\n" \ -" add r15 = r11, r3 /* The address of the argv we move */\n" \ -" ;;\n" \ -" }\n" \ -" /* ??? Could probably merge these two loops into 3 bundles.\n" \ -" using predication to control which set of copies we're on. */\n" \ -"1: /* Copy argv. */\n" \ -" { .mfi\n" \ -" ld8 r16 = [r15], 8 /* Load the value in the old argv. */\n" \ +" ld8 out2 = [r3] /* Get the _dl_argv address. */\n" \ +" ld8 out1 = [out1] /* Get the adjusted _dl_argc. */\n" \ +" addl r2 = @gprel(_rtld_local), gp\n" \ " ;;\n" \ " }\n" \ -" { .mib\n" \ -" st8 [r11] = r16, 8 /* Store it in the new argv. */\n" \ -" cmp.ne p6, p7 = 0, r16\n" \ -"(p6) br.cond.dptk.few 1b\n" \ +" { .mmi\n" \ +" sxt4 out3 = out1 /* envp = argv + argc + 1 */\n" \ " ;;\n" \ " }\n" \ " { .mmi\n" \ -" mov out3 = r11\n" \ -" sub r17 = r17, r3 /* Substract _dl_skip_args. */\n" \ -" addl out0 = @gprel(_rtld_local), gp\n" \ -" }\n" \ -"1: /* Copy env. */\n" \ -" { .mfi\n" \ -" ld8 r16 = [r15], 8 /* Load the value in the old env. */\n" \ +" adds out3 = 1, out3\n" \ " ;;\n" \ " }\n" \ -" { .mib\n" \ -" st8 [r11] = r16, 8 /* Store it in the new env. */\n" \ -" cmp.ne p6, p7 = 0, r16\n" \ -"(p6) br.cond.dptk.few 1b\n" \ +" { .mmi\n" \ +" ld8 out2 = [out2] /* Get the adjusted _dl_argv. */\n" \ +" shladd out3 = out3, 3, r0\n" \ " ;;\n" \ " }\n" \ " { .mmb\n" \ -" st8 [r10] = out1 /* Record the new argc. */\n" \ -" ld8 out0 = [out0] /* get the linkmap */\n" \ -" }\n" \ -" { .mmb\n" \ -" st8 [r2] = r17 /* Load the new _dl_argv. */\n" \ +" add out3 = out3, out2\n" \ +" ld8 out0 = [r2] /* Get the linkmap. */\n" \ " br.call.sptk.many b0 = _dl_init#\n" \ -" ;;\n" \ " }\n" \ " /* Pass our finalizer function to the user,\n" \ " and jump to the user's entry point. */\n" \