Guest User

Untitled

a guest
Feb 16th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.59 KB | None | 0 0
  1. diff -u -r ocaml-3.11.1/asmcomp/mips/arch.ml my_ocaml/asmcomp/mips/arch.ml
  2. --- ocaml-3.11.1/asmcomp/mips/arch.ml 2002-11-29 16:03:36.000000000 +0100
  3. +++ my_ocaml/asmcomp/mips/arch.ml 2009-08-09 23:18:31.000000000 +0200
  4. @@ -35,7 +35,7 @@
  5.  
  6. let big_endian =
  7. match Config.system with
  8. - "ultrix" -> false
  9. + "ultrix" | "gnu" -> false
  10. | "irix" -> true
  11. | _ -> fatal_error "Arch_mips.big_endian"
  12.  
  13. diff -u -r ocaml-3.11.1/asmcomp/mips/emit.mlp my_ocaml/asmcomp/mips/emit.mlp
  14. --- ocaml-3.11.1/asmcomp/mips/emit.mlp 2004-01-05 21:25:56.000000000 +0100
  15. +++ my_ocaml/asmcomp/mips/emit.mlp 2009-08-23 12:11:58.000000000 +0200
  16. @@ -252,7 +252,7 @@
  17. | Lop(Icall_ind) ->
  18. ` move $25, {emit_reg i.arg.(0)}\n`;
  19. liveregs i live_25;
  20. - ` jal {emit_reg i.arg.(0)}\n`;
  21. + ` jal $25\n`; (* {emit_reg i.arg.(0)}\n; Equivalent but avoids "Warning: MIPS PIC call to register other than $25" on GNU as *)
  22. `{record_frame i.live}\n`
  23. | Lop(Icall_imm s) ->
  24. liveregs i 0;
  25. @@ -269,7 +269,7 @@
  26. liveregs i 0;
  27. ` move $25, {emit_reg i.arg.(0)}\n`;
  28. liveregs i live_25;
  29. - ` j {emit_reg i.arg.(0)}\n`
  30. + ` j $25\n`
  31. | Lop(Itailcall_imm s) ->
  32. if s = !function_name then begin
  33. ` b {emit_label !tailrec_entry_point}\n`
  34. @@ -277,11 +277,11 @@
  35. let n = frame_size() in
  36. if !contains_calls then
  37. ` lw $31, {emit_int(n - 4)}($sp)\n`;
  38. + ` la $25, {emit_symbol s}\n`;
  39. if !uses_gp then
  40. ` lw $gp, {emit_int(n - 8)}($sp)\n`;
  41. if n > 0 then
  42. ` addu $sp, $sp, {emit_int n}\n`;
  43. - ` la $25, {emit_symbol s}\n`;
  44. liveregs i live_25;
  45. ` j $25\n`
  46. end
  47. @@ -305,8 +305,13 @@
  48. begin match chunk with
  49. Double_u ->
  50. (* Destination is not 8-aligned, hence cannot use l.d *)
  51. - ` ldl $24, {emit_addressing addr i.arg 0}\n`;
  52. - ` ldr $24, {emit_addressing (offset_addressing addr 7) i.arg 0}\n`;
  53. + if big_endian then begin
  54. + ` ldl $24, {emit_addressing addr i.arg 0}\n`;
  55. + ` ldr $24, {emit_addressing (offset_addressing addr 7) i.arg 0}\n`
  56. + end else begin
  57. + ` ldl $24, {emit_addressing (offset_addressing addr 7) i.arg 0}\n`;
  58. + ` ldr $24, {emit_addressing addr i.arg 0}\n`
  59. + end;
  60. ` dmtc1 $24, {emit_reg dest}\n`
  61. | Single ->
  62. ` l.s {emit_reg dest}, {emit_addressing addr i.arg 0}\n`;
  63. @@ -328,8 +333,13 @@
  64. Double_u ->
  65. (* Destination is not 8-aligned, hence cannot use l.d *)
  66. ` dmfc1 $24, {emit_reg src}\n`;
  67. - ` sdl $24, {emit_addressing addr i.arg 1}\n`;
  68. - ` sdr $24, {emit_addressing (offset_addressing addr 7) i.arg 1}\n`
  69. + if big_endian then begin
  70. + ` sdl $24, {emit_addressing addr i.arg 1}\n`;
  71. + ` sdr $24, {emit_addressing (offset_addressing addr 7) i.arg 1}\n`
  72. + end else begin
  73. + ` sdl $24, {emit_addressing (offset_addressing addr 7) i.arg 1}\n`;
  74. + ` sdr $24, {emit_addressing addr i.arg 1}\n`
  75. + end
  76. | Single ->
  77. ` cvt.s.d $f31, {emit_reg src}\n`;
  78. ` s.s $f31, {emit_addressing addr i.arg 1}\n`
  79. @@ -552,16 +562,18 @@
  80. (* There are really two groups of registers:
  81. $sp and $30 always point to stack locations
  82. $2 - $21 never point to stack locations. *)
  83. - ` .noalias $2,$sp; .noalias $2,$30; .noalias $3,$sp; .noalias $3,$30\n`;
  84. - ` .noalias $4,$sp; .noalias $4,$30; .noalias $5,$sp; .noalias $5,$30\n`;
  85. - ` .noalias $6,$sp; .noalias $6,$30; .noalias $7,$sp; .noalias $7,$30\n`;
  86. - ` .noalias $8,$sp; .noalias $8,$30; .noalias $9,$sp; .noalias $9,$30\n`;
  87. - ` .noalias $10,$sp; .noalias $10,$30; .noalias $11,$sp; .noalias $11,$30\n`;
  88. - ` .noalias $12,$sp; .noalias $12,$30; .noalias $13,$sp; .noalias $13,$30\n`;
  89. - ` .noalias $14,$sp; .noalias $14,$30; .noalias $15,$sp; .noalias $15,$30\n`;
  90. - ` .noalias $16,$sp; .noalias $16,$30; .noalias $17,$sp; .noalias $17,$30\n`;
  91. - ` .noalias $18,$sp; .noalias $18,$30; .noalias $19,$sp; .noalias $19,$30\n`;
  92. - ` .noalias $20,$sp; .noalias $20,$30; .noalias $21,$sp; .noalias $21,$30\n\n`;
  93. + if Config.system = "irix" then begin
  94. + ` .noalias $2,$sp; .noalias $2,$30; .noalias $3,$sp; .noalias $3,$30\n`;
  95. + ` .noalias $4,$sp; .noalias $4,$30; .noalias $5,$sp; .noalias $5,$30\n`;
  96. + ` .noalias $6,$sp; .noalias $6,$30; .noalias $7,$sp; .noalias $7,$30\n`;
  97. + ` .noalias $8,$sp; .noalias $8,$30; .noalias $9,$sp; .noalias $9,$30\n`;
  98. + ` .noalias $10,$sp; .noalias $10,$30; .noalias $11,$sp; .noalias $11,$30\n`;
  99. + ` .noalias $12,$sp; .noalias $12,$30; .noalias $13,$sp; .noalias $13,$30\n`;
  100. + ` .noalias $14,$sp; .noalias $14,$30; .noalias $15,$sp; .noalias $15,$30\n`;
  101. + ` .noalias $16,$sp; .noalias $16,$30; .noalias $17,$sp; .noalias $17,$30\n`;
  102. + ` .noalias $18,$sp; .noalias $18,$30; .noalias $19,$sp; .noalias $19,$30\n`;
  103. + ` .noalias $20,$sp; .noalias $20,$30; .noalias $21,$sp; .noalias $21,$30\n\n`
  104. + end;
  105. let lbl_begin = Compilenv.make_symbol (Some "data_begin") in
  106. ` .data\n`;
  107. ` .globl {emit_symbol lbl_begin}\n`;
  108. diff -u -r ocaml-3.11.1/asmrun/mips.s my_ocaml/asmrun/mips.s
  109. --- ocaml-3.11.1/asmrun/mips.s 2004-07-13 14:18:53.000000000 +0200
  110. +++ my_ocaml/asmrun/mips.s 2009-08-20 09:34:36.000000000 +0200
  111. @@ -187,7 +187,7 @@
  112. sw $30, caml_exception_pointer
  113. /* Call C function */
  114. move $25, $24
  115. - jal $24
  116. + jal $25
  117. /* Reload return address, alloc ptr, alloc limit */
  118. lw $31, 0($16) /* caml_last_return_address */
  119. lw $22, 0($17) /* caml_young_ptr */
  120. @@ -254,7 +254,7 @@
  121. sw $0, caml_last_return_address
  122. /* Call the Caml code */
  123. move $25, $24
  124. - jal $24
  125. + jal $25
  126. $104:
  127. /* Pop the trap frame, restoring caml_exception_pointer */
  128. lw $24, 0($sp)
  129. diff -u -r ocaml-3.11.1/configure my_ocaml/configure
  130. --- ocaml-3.11.1/configure 2009-05-20 17:33:09.000000000 +0200
  131. +++ my_ocaml/configure 2009-08-23 10:55:44.000000000 +0200
  132. @@ -40,7 +40,7 @@
  133. verbose=no
  134. withcurses=yes
  135. withsharedlibs=yes
  136. -gcc_warnings="-Wall"
  137. +gcc_warnings="-W -Wall"
  138. partialld="ld -r"
  139.  
  140. # Try to turn internationalization off, can cause config.guess to malfunction!
  141. @@ -292,6 +292,9 @@
  142. # (For those who want to force "cc -64")
  143. # Turn off warning "unused library"
  144. bytecclinkopts="-Wl,-woff,84";;
  145. + gcc*,mips64el-*)
  146. + bytecccompopts=""
  147. + bytecclinkopts="-fno-defer-pop $gcc_warnings -Wl,-O1 -Wl,--as-needed";;
  148. *,alpha*-*-unicos*)
  149. # For the Cray T3E
  150. bytecccompopts="-DUMK";;
  151. @@ -468,6 +471,8 @@
  152. echo "64-bit integers must be doubleword-aligned."
  153. echo "#define ARCH_ALIGN_INT64" >> m.h
  154. fi;;
  155. + mips64el-*)
  156. + echo "#define ARCH_ALIGN_INT64" >> m.h;;
  157. *)
  158. sh ./runtest int64align.c
  159. case $? in
  160. @@ -636,6 +641,7 @@
  161. fi;;
  162. i[3456]86-*-gnu*) arch=i386; system=gnu;;
  163. mips-*-irix6*) arch=mips; system=irix;;
  164. + mips*-gnu*) arch=mips; system=gnu;;
  165. hppa1.1-*-hpux*) arch=hppa; system=hpux;;
  166. hppa2.0*-*-hpux*) arch=hppa; system=hpux;;
  167. hppa*-*-linux*) arch=hppa; system=linux;;
  168. @@ -672,7 +678,7 @@
  169. if test -z "$ccoption"; then
  170. case "$arch,$system,$cc" in
  171. alpha,digital,gcc*) nativecc=cc;;
  172. - mips,*,gcc*) nativecc=cc;;
  173. + mips,irix,gcc*) nativecc=cc;;
  174. *) nativecc="$bytecc";;
  175. esac
  176. else
  177. @@ -687,6 +693,9 @@
  178. alpha,cc*,digital,*) nativecccompopts=-std1;;
  179. mips,cc*,irix,*) nativecccompopts=-n32
  180. nativecclinkopts="-n32 -Wl,-woff,84";;
  181. + mips,gcc*,gnu,mips64el-*)
  182. + nativecccompopts="$gcc_warnings -fPIC"
  183. + nativecclinkopts="--as-needed";;
  184. *,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix"
  185. nativecclinkopts="-posix";;
  186. *,*,rhapsody,*darwin[1-5].*)
  187. @@ -725,6 +734,8 @@
  188. aspp='gcc -c -Wa,-xexplicit';;
  189. mips,*,irix) as='as -n32 -O2 -nocpp -g0'
  190. aspp='as -n32 -O2';;
  191. + mips,*,gnu) as='as -KPIC'
  192. + aspp='gcc -c -fPIC';; # got bus error without fPIC ?
  193. power,*,elf) as='as -u -m ppc'
  194. aspp='gcc -c';;
  195. power,*,bsd) as='as'
  196. @@ -756,6 +767,7 @@
  197. case "$nativecc" in gcc*) ;; *) cc_profile='-xpg';; esac;;
  198. amd64,*,linux) profiling='prof';;
  199. amd64,*,gnu) profiling='prof';;
  200. + mips,*,gnu) profiling='prof';;
  201. *) profiling='noprof';;
  202. esac
Add Comment
Please, Sign In to add comment