diff options
author | Alexander Monakov <amonakov@ispras.ru> | 2018-10-21 00:27:44 +0300 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-11-02 12:13:53 -0400 |
commit | 00bd3b7d3006c5d350959c994fa65358bf65e6a2 (patch) | |
tree | f01170de878bd15c28a29c6258ff063f71c8f128 /src/env | |
parent | 0239cd0681e889a269fb7691f60e81ef8d081e6b (diff) | |
download | musl-00bd3b7d3006c5d350959c994fa65358bf65e6a2.tar.gz musl-00bd3b7d3006c5d350959c994fa65358bf65e6a2.tar.bz2 musl-00bd3b7d3006c5d350959c994fa65358bf65e6a2.tar.xz musl-00bd3b7d3006c5d350959c994fa65358bf65e6a2.zip |
__libc_start_main: slightly simplify stage2 pointer setup
Use "+r" in the asm instead of implementing a non-transparent copy by
applying "0" constraint to the source value. Introduce a typedef for
the function type to avoid spelling it out twice.
Diffstat (limited to 'src/env')
-rw-r--r-- | src/env/__libc_start_main.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/env/__libc_start_main.c b/src/env/__libc_start_main.c index b4965d7f..7c95f822 100644 --- a/src/env/__libc_start_main.c +++ b/src/env/__libc_start_main.c @@ -66,7 +66,8 @@ static void libc_start_init(void) weak_alias(libc_start_init, __libc_start_init); -static int libc_start_main_stage2(int (*)(int,char **,char **), int, char **); +typedef int lsm2_fn(int (*)(int,char **,char **), int, char **); +static lsm2_fn libc_start_main_stage2; int __libc_start_main(int (*main)(int,char **,char **), int argc, char **argv) { @@ -79,8 +80,8 @@ int __libc_start_main(int (*main)(int,char **,char **), int argc, char **argv) /* Barrier against hoisting application code or anything using ssp * or thread pointer prior to its initialization above. */ - int (*stage2)(int (*)(int,char **,char **), int, char **); - __asm__ ( "" : "=r"(stage2) : "0"(libc_start_main_stage2) : "memory" ); + lsm2_fn *stage2 = libc_start_main_stage2; + __asm__ ( "" : "+r"(stage2) : : "memory" ); return stage2(main, argc, argv); } |