Package: fpc / 3.0.0+dfsg-11+deb9u1

fix_ppc64s_prt0.as_as_shown_by_cge.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Description: the build of castle-game-engine with fpc 3.0.0 on ppc64 FTBFS
Bug: http://bugs.freepascal.org/view.php?id=29587
Source: http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/linux/powerpc64/prt0.as?r1=32528&r2=32527&pathrev=32528&view=patch
Source: http://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/fixes_3_0/rtl/linux/powerpc64/prt0.as?r1=33046&r2=33045&pathrev=33046&view=patch
Index: fpc/fpcsrc/rtl/linux/powerpc64/prt0.as
===================================================================
--- fpc.orig/fpcsrc/rtl/linux/powerpc64/prt0.as
+++ fpc/fpcsrc/rtl/linux/powerpc64/prt0.as
@@ -324,17 +324,34 @@ _restvr_31: addi r12,r0,-16
  * Main program entry point for dynamic executables.
  *
  * r7 contains the function pointer that needs to be registered for calling at exit.
+ * r3/r4/r5 contain argc/argv/envp
  */
 FUNCTION_PROLOG _dynamic_start
   LOAD_64BIT_VAL 11, __dl_fini
   std      7,0(11)
-  LOAD_64BIT_VAL 11, _start
-  /* do not bother loading the actual function address of _start. We can directly jump to it */
-  /* set up GOT pointer from original start function */
+  LOAD_64BIT_VAL 11, PASCALMAIN
+  /* set up GOT pointer from PASCALMAIN */
   ld       2,8(11)
   /* and environment pointer */
   ld      11,16(11)
-  b       _start
+  /* store argument count */
+  LOAD_64BIT_VAL 10,operatingsystem_parameter_argc
+  stw     3,0(10)
+  /* store argument address */
+  LOAD_64BIT_VAL 10,operatingsystem_parameter_argv
+  std     4,0(10)
+  /* store environment pointer */
+  LOAD_64BIT_VAL 10,operatingsystem_parameter_envp
+  std     5,0(10)
+
+  LOAD_64BIT_VAL 8,__stkptr
+  std     1,0(8)
+
+  bl      PASCALMAIN
+  nop
+
+  /* we should not reach here. Crash horribly */
+  trap
 .long 0
 .byte 0, 12, 64, 0, 0, 0, 0, 0