Make strong references for __psp_libc_init in the crt0 files

This commit is contained in:
Francisco Javier Trujillo Mata
2021-11-13 16:29:43 +01:00
parent 3adc56a88e
commit 1fdb7fd770
3 changed files with 5 additions and 19 deletions

View File

@@ -10,21 +10,13 @@ CCASFLAGS = $(CFLAGS)
# Borrowed this trick from newlib: create a dummy library to generate build rules.
noinst_LIBRARIES = lib.a
lib_a_SOURCES = dummy.c
# FIXME: This workaround is actually needed to get the stage1 installation
# working. Once a better way to do crt0 installation for newlib is figured out,
# this can be rewritten.
lib_a_SOURCES = crt0.c crt0_prx.c prxexports.c
all: crt0.o crt0_prx.o prxexports.o
startupdir = @PSPDEV_LIBDIR@
pspsdkdir = @PSPSDK_LIBDIR@
# Overwrite build rule to disable dependency magic
.c.o:
$(AM_V_CC)$(COMPILE) $< -c -o $@
# Install the prx specific stuff in the pspsdk libdir
install-exec-hook:
$(mkinstalldirs) $(DESTDIR)$(startupdir)

View File

@@ -38,11 +38,9 @@ extern const char* sce_newlib_main_thread_name __attribute__((weak));
extern SceModuleInfo module_info __attribute__((weak));
/* Allow newlib/psplibc to provide an init hook to be called before main */
extern void __psp_libc_init(int argc, char *argv[]) __attribute__((weak));
extern void __psp_libc_init(int argc, char *argv[]);
extern void _init(void);
extern void _fini(void);
extern int main(int argc, char *argv[]);
/**
@@ -75,8 +73,7 @@ void _main(SceSize args, void *argp)
argv[argc] = NULL;
/* Call libc initialization hook */
if(__psp_libc_init != NULL)
__psp_libc_init(argc, argv);
__psp_libc_init(argc, argv);
/* Make sure _fini() is called when the program ends. */
atexit((void *) _fini);

View File

@@ -41,11 +41,9 @@ extern const char* sce_newlib_main_thread_name __attribute__((weak));
extern SceModuleInfo module_info __attribute__((weak));
/* Allow newlib/psplibc to provide an init hook to be called before main */
extern void __psp_libc_init(int argc, char *argv[]) __attribute__((weak));
extern void __psp_libc_init(int argc, char *argv[]);
extern void _init(void);
extern void _fini(void);
extern int main(int argc, char *argv[]);
/**
@@ -80,8 +78,7 @@ void _main(SceSize args, void *argp)
argv[argc] = NULL;
/* Call libc initialization hook */
if(__psp_libc_init != NULL)
__psp_libc_init(argc, argv);
__psp_libc_init(argc, argv);
/* Make sure _fini() is called when the program ends. */
atexit((void *) _fini);