aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-05-26 13:08:01 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-05-30 16:33:08 -0300
commit57bb1e5b9fce7f3797bdb3005065187ba9d66c59 (patch)
treef6b75ab54886dee467c286f6a4fd178cbc0b9ca9 /sysdeps
parent1b7f05d11e75594c06f0a8d193c80c7f74857d5f (diff)
downloadglibc-57bb1e5b9fce7f3797bdb3005065187ba9d66c59.zip
glibc-57bb1e5b9fce7f3797bdb3005065187ba9d66c59.tar.gz
glibc-57bb1e5b9fce7f3797bdb3005065187ba9d66c59.tar.bz2
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>
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/ia64/dl-machine.h70
1 files changed, 14 insertions, 56 deletions
diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h
index 20e586a..704dbd1 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" \