From 350e4e14d811d6fcfff067989061309355ea8881 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Sun, 4 Jan 2009 21:19:43 +0000 Subject: ldso/ldso/dl-startup.c: make _dl_elf_main static; remove one dead variable. ldso/ldso/avr32/dl-startup.h: remove superfluous definition of START() macro. ldso/ldso/*/dl-startup.h: fix a typo in comment text data bss dec hex filename - 16752 244 92 17088 42c0 lib/ld-uClibc.so + 16709 240 92 17041 4291 lib/ld-uClibc.so --- ldso/ldso/arm/dl-startup.h | 2 +- ldso/ldso/avr32/dl-startup.h | 11 +---------- ldso/ldso/bfin/dl-startup.h | 2 +- ldso/ldso/cris/dl-startup.h | 2 +- ldso/ldso/dl-startup.c | 31 ++++++++++--------------------- ldso/ldso/frv/dl-startup.h | 2 +- ldso/ldso/i386/dl-startup.h | 2 +- ldso/ldso/m68k/dl-startup.h | 2 +- ldso/ldso/mips/dl-startup.h | 2 +- ldso/ldso/powerpc/dl-startup.h | 2 +- ldso/ldso/sh/dl-startup.h | 2 +- ldso/ldso/sh64/dl-startup.h | 2 +- ldso/ldso/sparc/dl-startup.h | 2 +- ldso/ldso/x86_64/dl-startup.h | 2 +- 14 files changed, 23 insertions(+), 43 deletions(-) (limited to 'ldso') diff --git a/ldso/ldso/arm/dl-startup.h b/ldso/ldso/arm/dl-startup.h index 73edbffa7..a95389d98 100644 --- a/ldso/ldso/arm/dl-startup.h +++ b/ldso/ldso/arm/dl-startup.h @@ -131,7 +131,7 @@ __asm__( /* Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*)ARGS)+1) diff --git a/ldso/ldso/avr32/dl-startup.h b/ldso/ldso/avr32/dl-startup.h index 3b8bf4ce2..066f65fc2 100644 --- a/ldso/ldso/avr32/dl-startup.h +++ b/ldso/ldso/avr32/dl-startup.h @@ -41,7 +41,7 @@ __asm__(" .text\n" " .previous\n"); /* Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long *)ARGS + 1) @@ -101,12 +101,3 @@ void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr, _dl_exit(1); } } - -/* Transfer control to the user's application, once the dynamic loader - * is done. This routine has to exit the current function, then call - * the _dl_elf_main function. - * - * Since our _dl_boot will simply call whatever is returned by - * _dl_boot2, we can just return the address we're supposed to - * call. */ -#define START() return _dl_elf_main; diff --git a/ldso/ldso/bfin/dl-startup.h b/ldso/ldso/bfin/dl-startup.h index a1e150e27..ea62dada2 100644 --- a/ldso/ldso/bfin/dl-startup.h +++ b/ldso/ldso/bfin/dl-startup.h @@ -100,7 +100,7 @@ struct elf32_fdpic_loadmap; /* * Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS) + 1) diff --git a/ldso/ldso/cris/dl-startup.h b/ldso/ldso/cris/dl-startup.h index dc9cd8fe2..0bc48f878 100644 --- a/ldso/ldso/cris/dl-startup.h +++ b/ldso/ldso/cris/dl-startup.h @@ -43,7 +43,7 @@ __asm__("" \ #endif /* __arch_v32 */ /* Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long *) ARGS)+1) diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c index 42fb44e9c..efd02da46 100644 --- a/ldso/ldso/dl-startup.c +++ b/ldso/ldso/dl-startup.c @@ -95,7 +95,7 @@ #include "dl-startup.h" /* Static declarations */ -int (*_dl_elf_main) (int, char **, char **); +static int (*_dl_elf_main) (int, char **, char **); static void* __rtld_stack_end; /* Points to argc on stack, e.g *((long *)__rtld_stackend) == argc */ strong_alias(__rtld_stack_end, __libc_stack_end) /* Exported version of __rtld_stack_end */ @@ -103,8 +103,7 @@ strong_alias(__rtld_stack_end, __libc_stack_end) /* Exported version of __rtld_s /* When we enter this piece of code, the program stack looks like this: argc argument counter (integer) argv[0] program name (pointer) - argv[1...N] program args (pointers) - argv[argc-1] end of args (integer) + argv[1..argc-1] program args (pointers) NULL env[0...N] environment variables (pointers) NULL @@ -123,7 +122,7 @@ DL_START(unsigned long args) ElfW(auxv_t) auxvt[AT_EGID + 1]; ElfW(Dyn) *dpnt; - /* WARNING! -- we cannot make _any_ funtion calls until we have + /* WARNING! -- we cannot make _any_ function calls until we have * taken care of fixing up our own relocations. Making static * inline calls is ok, but _no_ function calls. Not yet * anyways. */ @@ -131,12 +130,12 @@ DL_START(unsigned long args) /* First obtain the information on the stack that tells us more about what binary is loaded, where it is loaded, etc, etc */ GET_ARGV(aux_dat, args); - argc = *(aux_dat - 1); + argc = aux_dat[-1]; argv = (char **) aux_dat; aux_dat += argc; /* Skip over the argv pointers */ aux_dat++; /* Skip over NULL at end of argv */ envp = (char **) aux_dat; -#ifndef NO_EARLY_SEND_STDERR +#if !defined(NO_EARLY_SEND_STDERR) SEND_EARLY_STDERR_DEBUG("argc="); SEND_NUMBER_STDERR_DEBUG(argc, 0); SEND_EARLY_STDERR_DEBUG(" argv="); @@ -195,7 +194,7 @@ DL_START(unsigned long args) DL_BOOT_COMPUTE_GOT(got); /* Now, finally, fix up the location of the dynamic stuff */ - DL_BOOT_COMPUTE_DYN (dpnt, got, load_addr); + DL_BOOT_COMPUTE_DYN(dpnt, got, load_addr); SEND_EARLY_STDERR_DEBUG("First Dynamic section entry="); SEND_ADDRESS_STDERR_DEBUG(dpnt, 1); @@ -215,11 +214,9 @@ DL_START(unsigned long args) SEND_EARLY_STDERR_DEBUG("Done scanning DYNAMIC section\n"); #if defined(PERFORM_BOOTSTRAP_GOT) - SEND_EARLY_STDERR_DEBUG("About to do specific GOT bootstrap\n"); /* some arches (like MIPS) we have to tweak the GOT before relocations */ PERFORM_BOOTSTRAP_GOT(tpnt); - #endif #if !defined(PERFORM_BOOTSTRAP_GOT) || defined(__avr32__) @@ -229,13 +226,12 @@ DL_START(unsigned long args) SEND_EARLY_STDERR_DEBUG("About to do library loader relocations\n"); { - int goof, indx; -#ifdef ELF_MACHINE_PLTREL_OVERLAP + int indx; +#if defined(ELF_MACHINE_PLTREL_OVERLAP) # define INDX_MAX 1 #else # define INDX_MAX 2 #endif - goof = 0; for (indx = 0; indx < INDX_MAX; indx++) { unsigned int i; unsigned long *reloc_addr; @@ -278,8 +274,7 @@ DL_START(unsigned long args) strtab = (char *) tpnt->dynamic_info[DT_STRTAB]; sym = &symtab[symtab_index]; symbol_addr = (unsigned long) DL_RELOC_ADDR(load_addr, sym->st_value); - -#ifndef EARLY_STDERR_SPECIAL +#if !defined(EARLY_STDERR_SPECIAL) SEND_STDERR_DEBUG("relocating symbol: "); SEND_STDERR_DEBUG(strtab + sym->st_name); SEND_STDERR_DEBUG("\n"); @@ -291,14 +286,9 @@ DL_START(unsigned long args) PERFORM_BOOTSTRAP_RELOC(rpnt, reloc_addr, symbol_addr, load_addr, sym); } } - - if (goof) { - _dl_exit(14); - } } #endif - /* Wahoo!!! */ SEND_STDERR_DEBUG("Done relocating ldso; we can now use globals and make function calls!\n"); /* Now we have done the mandatory linking of some things. We are now @@ -311,13 +301,12 @@ DL_START(unsigned long args) _dl_get_ready_to_run(tpnt, load_addr, auxvt, envp, argv DL_GET_READY_TO_RUN_EXTRA_ARGS); - /* Transfer control to the application. */ SEND_STDERR_DEBUG("transfering control to application @ "); _dl_elf_main = (int (*)(int, char **, char **)) auxvt[AT_ENTRY].a_un.a_val; SEND_ADDRESS_STDERR_DEBUG(_dl_elf_main, 1); -#ifndef START +#if !defined(START) return _dl_elf_main; #else START(); diff --git a/ldso/ldso/frv/dl-startup.h b/ldso/ldso/frv/dl-startup.h index 674f81c15..72bea6807 100644 --- a/ldso/ldso/frv/dl-startup.h +++ b/ldso/ldso/frv/dl-startup.h @@ -76,7 +76,7 @@ struct elf32_fdpic_loadmap; /* * Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long*) ARGS) diff --git a/ldso/ldso/i386/dl-startup.h b/ldso/ldso/i386/dl-startup.h index 45f69b85d..0c3451488 100644 --- a/ldso/ldso/i386/dl-startup.h +++ b/ldso/ldso/i386/dl-startup.h @@ -35,7 +35,7 @@ __asm__ ( ); /* Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) & ARGS)+1) diff --git a/ldso/ldso/m68k/dl-startup.h b/ldso/ldso/m68k/dl-startup.h index 2ed9ead50..2c38102a3 100644 --- a/ldso/ldso/m68k/dl-startup.h +++ b/ldso/ldso/m68k/dl-startup.h @@ -40,7 +40,7 @@ _dl_start_user:\n\ .previous"); /* Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long *) ARGS) + 1) diff --git a/ldso/ldso/mips/dl-startup.h b/ldso/ldso/mips/dl-startup.h index 606b162a3..31730d4ad 100644 --- a/ldso/ldso/mips/dl-startup.h +++ b/ldso/ldso/mips/dl-startup.h @@ -111,7 +111,7 @@ __asm__("" /* * Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long *) ARGS)+1) diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h index 50e72c3ee..e471aa033 100644 --- a/ldso/ldso/powerpc/dl-startup.h +++ b/ldso/ldso/powerpc/dl-startup.h @@ -60,7 +60,7 @@ __asm__( /* * Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS)+1) diff --git a/ldso/ldso/sh/dl-startup.h b/ldso/ldso/sh/dl-startup.h index 7a3fdf235..ae7e2248d 100644 --- a/ldso/ldso/sh/dl-startup.h +++ b/ldso/ldso/sh/dl-startup.h @@ -32,7 +32,7 @@ __asm__( /* * Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long*) ARGS) diff --git a/ldso/ldso/sh64/dl-startup.h b/ldso/ldso/sh64/dl-startup.h index 33512a9bc..753134114 100644 --- a/ldso/ldso/sh64/dl-startup.h +++ b/ldso/ldso/sh64/dl-startup.h @@ -32,7 +32,7 @@ __asm__("" \ /* * Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long *)ARGS)+1) diff --git a/ldso/ldso/sparc/dl-startup.h b/ldso/ldso/sparc/dl-startup.h index cc11ec103..1abad1121 100644 --- a/ldso/ldso/sparc/dl-startup.h +++ b/ldso/ldso/sparc/dl-startup.h @@ -47,7 +47,7 @@ _dl_start_user:\n\ /* * Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. We assume that argc is stored * at the word just below the argvp that we return here. */ diff --git a/ldso/ldso/x86_64/dl-startup.h b/ldso/ldso/x86_64/dl-startup.h index 6da888068..7e05846dd 100644 --- a/ldso/ldso/x86_64/dl-startup.h +++ b/ldso/ldso/x86_64/dl-startup.h @@ -35,7 +35,7 @@ __asm__ ( ); /* Get a pointer to the argv array. On many platforms this can be just - * the address if the first argument, on other platforms we need to + * the address of the first argument, on other platforms we need to * do something a little more subtle here. */ #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS)+1) -- cgit v1.2.3