File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -555,21 +555,14 @@ __asm void __rt_entry (void) {
555
555
556
556
#elif defined (__GNUC__ )
557
557
558
- __attribute__((naked )) void pre_main (void ) {
559
- __asm (
560
- ".syntax unified \n "
561
- ".thumb \n "
562
- /* Save link register (keep 8 byte alignment with dummy r4) */
563
- "push {r4, lr}\n"
564
- "ldr r0,= __libc_fini_array\n"
565
- "bl atexit\n"
566
- "bl __libc_init_array\n"
567
- /* Restore link register and branch so when main returns it
568
- * goes to the thread destroy function.
569
- */
570
- "pop {r4, lr}\n"
571
- "b main\n"
572
- );
558
+ extern void __libc_fini_array (void );
559
+ extern void __libc_init_array (void );
560
+ extern int main (int argc , char * * argv );
561
+
562
+ void pre_main (void ) {
563
+ atexit (__libc_fini_array );
564
+ __libc_init_array ();
565
+ main (0 , NULL );
573
566
}
574
567
575
568
__attribute__((naked )) void software_init_hook (void ) {
You can’t perform that action at this time.
0 commit comments