public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] ia64: Remove _dl_skip_args usage Date: Mon, 30 May 2022 20:49:36 +0000 (GMT) [thread overview] Message-ID: <20220530204936.5A80C384B124@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=57bb1e5b9fce7f3797bdb3005065187ba9d66c59 commit 57bb1e5b9fce7f3797bdb3005065187ba9d66c59 Author: Adhemerval Zanella <adhemerval.zanella@linaro.org> 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 <carlos@redhat.com> 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" \
reply other threads:[~2022-05-30 20:49 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220530204936.5A80C384B124@sourceware.org \ --to=azanella@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).