Bladeren bron

* fixed sigill problem when running in gdb

florian 21 jaren geleden
bovenliggende
commit
c244b8b527
1 gewijzigde bestanden met toevoegingen van 35 en 22 verwijderingen
  1. 35 22
      rtl/linux/arm/prt0.as

+ 35 - 22
rtl/linux/arm/prt0.as

@@ -45,38 +45,30 @@
 	.globl _start
 	.type _start,#function
 _start:
-	/* Fetch address of fini */
-	ldr ip, =__libc_csu_fini
-
 	/* Clear the frame pointer since this is the outermost frame.  */
 	mov fp, #0
+	ldmia   sp!, {a2}
 
 	/* Pop argc off the stack and save a pointer to argv */
-	ldr a2, [sp], #4
-	mov a3, sp
-
-	/* Push stack limit */
-	str a3, [sp, #-4]!
-
-	/* Push rtld_fini */
-	str a1, [sp, #-4]!
+	ldr ip,=U_SYSTEM_ARGC
+	ldr a3,=U_SYSTEM_ARGV 
+	str a2,[ip]
 
-	/* Set up the other arguments in registers */
-	ldr a1, =main
-	ldr a4, =__libc_csu_init
+	/* calc envp */
+	add a2,a2,#1
+	add a2,sp,a2,LSL #2
+	ldr ip,=U_SYSTEM_ENVP
 
-	/* Push fini */
-	str ip, [sp, #-4]!
-
-	/* __libc_start_main (main, argc, argv, init, fini, rtld_fini, stack_end) */
+	str sp,[a3]
+        str a2,[ip]
 
 	/* Let the libc call main and exit with its return code.  */
 	bl PASCALMAIN
 
 	/* should never get here....*/
-	bl abort
-
-/* Define a symbol for the first piece of initialized data.  */
+	/* bl abort */
+	
+	/* Define a symbol for the first piece of initialized data.  */
 	.data
 	.globl __data_start
 __data_start:
@@ -84,8 +76,29 @@ __data_start:
 	.weak data_start
 	data_start = __data_start
 
+	.section ".comment"
+	.byte 0
+	.ascii "generated by FPC http://www.freepascal.org\0"
+
+/* We need this stuff to make gdb behave itself, otherwise
+   gdb will chokes with SIGILL when trying to debug apps.
+*/
+        .section ".note.ABI-tag", "a"
+        .align 4
+        .long 1f - 0f
+        .long 3f - 2f
+        .long  1
+0:      .asciz "GNU"
+1:      .align 4
+2:      .long 0
+        .long 2,0,0
+3:      .align 4
+
 /*
   $Log$
-  Revision 1.1  2003-08-27 13:07:07  florian
+  Revision 1.2  2004-01-20 18:32:46  florian
+    * fixed sigill problem when running in gdb
+
+  Revision 1.1  2003/08/27 13:07:07  florian
     * initial revision of arm startup code
 */