diff options
author | midipix <writeonce@midipix.org> | 2017-10-18 01:17:32 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-10-19 18:27:25 -0400 |
commit | 8b88c69b142375c9c7f75c8b2339441ff5401821 (patch) | |
tree | a5b6b222367ea7050b119bf8a138005af5cf52ee /crt | |
parent | c6e963c421c2e22f06a83b93cb4d0f76c68fb3e9 (diff) | |
download | mmglue-8b88c69b142375c9c7f75c8b2339441ff5401821.tar.bz2 mmglue-8b88c69b142375c9c7f75c8b2339441ff5401821.tar.xz |
_start(): moved flavor-specific logic (idata|ldso|vrfs) to __libc_loader_init().
Diffstat (limited to 'crt')
-rw-r--r-- | crt/nt32/Scrt1.c | 13 | ||||
-rw-r--r-- | crt/nt32/crt1.c | 20 | ||||
-rw-r--r-- | crt/nt32/crtidata.c | 10 | ||||
-rw-r--r-- | crt/nt64/Scrt1.c | 13 | ||||
-rw-r--r-- | crt/nt64/crt1.c | 20 | ||||
-rw-r--r-- | crt/nt64/crtidata.c | 10 |
6 files changed, 32 insertions, 54 deletions
diff --git a/crt/nt32/Scrt1.c b/crt/nt32/Scrt1.c index c635211..bb534d3 100644 --- a/crt/nt32/Scrt1.c +++ b/crt/nt32/Scrt1.c @@ -1,11 +1,14 @@ -#include "psxglue.h" +/****************************************/ +/* dynamically linked applications only */ +/* see also: crtidata.c */ +/****************************************/ -__psx_init_routine __psx_init; +int __attribute__((__visibility__("hidden"))) __psx_init(int *,char ***,char ***,void *); +void __attribute__((__visibility__("hidden"))) __libc_entry_routine(void *,void *,int); -__psx_init_routine * __psx_init_fn(void) +void __libc_loader_init(void * __main, int flags) { - return __psx_init; + __libc_entry_routine(__main,__psx_init,flags); } -#define LIBC_STATIC #include "crt1.c" diff --git a/crt/nt32/crt1.c b/crt/nt32/crt1.c index 75a5053..b74a2bf 100644 --- a/crt/nt32/crt1.c +++ b/crt/nt32/crt1.c @@ -1,11 +1,3 @@ -#ifdef LIBC_STATIC -#define __external_routine -#else -#define __external_routine __attribute__((dllimport)) -#endif - -#include "psxglue.h" - /** * options: posix session, fallback terminal emulator * x86_64-nt64-midipix-gcc --target-help | grep -A2 posix @@ -17,17 +9,13 @@ extern const int __crtopt_dinga __attribute((weak,alias("__disabled"))); extern const int __crtopt_ldso __attribute((weak,alias("__disabled"))); extern const int __crtopt_vrfs __attribute((weak,alias("__disabled"))); -int main(); - -__psx_init_routine * __psx_init_fn(void); - -__external_routine -void __libc_entry_routine(void *,void *,int); +int main(); +void __libc_loader_init(void * __main, int flags); void _start(void) { - __libc_entry_routine( - main,__psx_init_fn(), + __libc_loader_init( + main, __crtopt_posix | __crtopt_dinga | __crtopt_ldso diff --git a/crt/nt32/crtidata.c b/crt/nt32/crtidata.c index 6037c25..19e146a 100644 --- a/crt/nt32/crtidata.c +++ b/crt/nt32/crtidata.c @@ -3,14 +3,12 @@ /* see also: Scrt1.c */ /****************************************/ -#include "psxglue.h" - #define __external_routine __attribute__((dllimport)) -__external_routine -__psx_init_routine __psx_init; +__external_routine int __psx_init(int *,char ***,char ***,void *); +__external_routine void __libc_entry_routine(void *,void *,int); -__psx_init_routine * __psx_init_fn(void) +void __libc_loader_init(void * __main, int flags) { - return __psx_init; + __libc_entry_routine(__main,__psx_init,flags); } diff --git a/crt/nt64/Scrt1.c b/crt/nt64/Scrt1.c index c635211..bb534d3 100644 --- a/crt/nt64/Scrt1.c +++ b/crt/nt64/Scrt1.c @@ -1,11 +1,14 @@ -#include "psxglue.h" +/****************************************/ +/* dynamically linked applications only */ +/* see also: crtidata.c */ +/****************************************/ -__psx_init_routine __psx_init; +int __attribute__((__visibility__("hidden"))) __psx_init(int *,char ***,char ***,void *); +void __attribute__((__visibility__("hidden"))) __libc_entry_routine(void *,void *,int); -__psx_init_routine * __psx_init_fn(void) +void __libc_loader_init(void * __main, int flags) { - return __psx_init; + __libc_entry_routine(__main,__psx_init,flags); } -#define LIBC_STATIC #include "crt1.c" diff --git a/crt/nt64/crt1.c b/crt/nt64/crt1.c index 75a5053..b74a2bf 100644 --- a/crt/nt64/crt1.c +++ b/crt/nt64/crt1.c @@ -1,11 +1,3 @@ -#ifdef LIBC_STATIC -#define __external_routine -#else -#define __external_routine __attribute__((dllimport)) -#endif - -#include "psxglue.h" - /** * options: posix session, fallback terminal emulator * x86_64-nt64-midipix-gcc --target-help | grep -A2 posix @@ -17,17 +9,13 @@ extern const int __crtopt_dinga __attribute((weak,alias("__disabled"))); extern const int __crtopt_ldso __attribute((weak,alias("__disabled"))); extern const int __crtopt_vrfs __attribute((weak,alias("__disabled"))); -int main(); - -__psx_init_routine * __psx_init_fn(void); - -__external_routine -void __libc_entry_routine(void *,void *,int); +int main(); +void __libc_loader_init(void * __main, int flags); void _start(void) { - __libc_entry_routine( - main,__psx_init_fn(), + __libc_loader_init( + main, __crtopt_posix | __crtopt_dinga | __crtopt_ldso diff --git a/crt/nt64/crtidata.c b/crt/nt64/crtidata.c index 6037c25..19e146a 100644 --- a/crt/nt64/crtidata.c +++ b/crt/nt64/crtidata.c @@ -3,14 +3,12 @@ /* see also: Scrt1.c */ /****************************************/ -#include "psxglue.h" - #define __external_routine __attribute__((dllimport)) -__external_routine -__psx_init_routine __psx_init; +__external_routine int __psx_init(int *,char ***,char ***,void *); +__external_routine void __libc_entry_routine(void *,void *,int); -__psx_init_routine * __psx_init_fn(void) +void __libc_loader_init(void * __main, int flags) { - return __psx_init; + __libc_entry_routine(__main,__psx_init,flags); } |