Преглед изворни кода

* rebase to trunk@17295

git-svn-id: branches/avr@17296 -
florian пре 14 година
родитељ
комит
fb84cb865b
100 измењених фајлова са 7433 додато и 1590 уклоњено
  1. 79 1
      .gitattributes
  2. 3 1
      compiler/aasmbase.pas
  3. 9 3
      compiler/aggas.pas
  4. 8 0
      compiler/aoptobj.pas
  5. 2 0
      compiler/arm/cgcpu.pas
  6. 16 1
      compiler/arm/cpuinfo.pas
  7. 3 0
      compiler/cclasses.pas
  8. 54 0
      compiler/cgobj.pas
  9. 3 3
      compiler/comprsrc.pas
  10. 28 8
      compiler/cstreams.pas
  11. 123 0
      compiler/cwindirs.pp
  12. 3 1
      compiler/defcmp.pas
  13. 22 23
      compiler/finput.pas
  14. 2 14
      compiler/fmodule.pas
  15. 30 2
      compiler/globals.pas
  16. 5 2
      compiler/globtype.pas
  17. 1 1
      compiler/i386/ag386nsm.pas
  18. 10 28
      compiler/i386/cgcpu.pas
  19. 78 1
      compiler/i386/i386att.inc
  20. 78 1
      compiler/i386/i386atts.inc
  21. 78 1
      compiler/i386/i386int.inc
  22. 1 1
      compiler/i386/i386nop.inc
  23. 78 1
      compiler/i386/i386op.inc
  24. 77 0
      compiler/i386/i386prop.inc
  25. 1270 10
      compiler/i386/i386tab.inc
  26. 4 1
      compiler/link.pas
  27. 1 1
      compiler/msg/errorct.msg
  28. 153 153
      compiler/msg/errord.msg
  29. 1 1
      compiler/msg/errorda.msg
  30. 1 1
      compiler/msg/errordu.msg
  31. 5 1
      compiler/msg/errore.msg
  32. 1 1
      compiler/msg/errores.msg
  33. 1 1
      compiler/msg/errorf.msg
  34. 1 1
      compiler/msg/errorfi.msg
  35. 1 1
      compiler/msg/errorhe.msg
  36. 1 1
      compiler/msg/errorheu.msg
  37. 1 1
      compiler/msg/errorid.msg
  38. 1 1
      compiler/msg/errorn.msg
  39. 1 1
      compiler/msg/errorpl.msg
  40. 1 1
      compiler/msg/errorpli.msg
  41. 1 1
      compiler/msg/errorpt.msg
  42. 1 1
      compiler/msg/errorptu.msg
  43. 1 1
      compiler/msg/errorr.msg
  44. 1 1
      compiler/msg/errorru.msg
  45. 1 1
      compiler/msg/errorues.msg
  46. 4 2
      compiler/msgidx.inc
  47. 376 371
      compiler/msgtxt.inc
  48. 21 1
      compiler/ncal.pas
  49. 10 1
      compiler/ncgcal.pas
  50. 56 141
      compiler/ncgmem.pas
  51. 2 1
      compiler/ncgrtti.pas
  52. 140 4
      compiler/ncgutil.pas
  53. 0 11
      compiler/nset.pas
  54. 9 2
      compiler/ogbase.pas
  55. 22 16
      compiler/ogcoff.pas
  56. 29 23
      compiler/ogelf.pas
  57. 1 0
      compiler/ogmacho.pas
  58. 1516 0
      compiler/ognlm.pas
  59. 2 2
      compiler/owar.pas
  60. 4 4
      compiler/owbase.pas
  61. 4 2
      compiler/paramgr.pas
  62. 4 3
      compiler/pdecl.pas
  63. 2 1
      compiler/pdecobj.pas
  64. 15 2
      compiler/pdecsub.pas
  65. 30 0
      compiler/pdecvar.pas
  66. 6 6
      compiler/pexpr.pas
  67. 2 4
      compiler/pinline.pas
  68. 8 15
      compiler/pmodules.pas
  69. 1 0
      compiler/powerpc/agppcmpw.pas
  70. 70 41
      compiler/ppu.pas
  71. 65 0
      compiler/procinfo.pas
  72. 6 19
      compiler/psub.pas
  73. 97 48
      compiler/ptype.pas
  74. 1 1
      compiler/regvars.pas
  75. 2 1
      compiler/symconst.pas
  76. 25 9
      compiler/symdef.pas
  77. 5 0
      compiler/symsym.pas
  78. 1 0
      compiler/symtable.pas
  79. 7 4
      compiler/symtype.pas
  80. 3 0
      compiler/systems.pas
  81. 5 5
      compiler/systems/i_nwm.pas
  82. 1 1
      compiler/systems/i_wii.pas
  83. 1 1
      compiler/systems/t_embed.pas
  84. 432 5
      compiler/systems/t_nwm.pas
  85. 1 2
      compiler/systems/t_wii.pas
  86. 2 0
      compiler/tokens.pas
  87. 27 521
      compiler/utils/samplecfg
  88. 3 3
      compiler/x86/agx86int.pas
  89. 431 4
      compiler/x86/x86ins.dat
  90. 7 2
      compiler/x86_64/cgcpu.pas
  91. 78 1
      compiler/x86_64/x8664ats.inc
  92. 78 1
      compiler/x86_64/x8664att.inc
  93. 78 1
      compiler/x86_64/x8664int.inc
  94. 1 1
      compiler/x86_64/x8664nop.inc
  95. 78 1
      compiler/x86_64/x8664op.inc
  96. 77 0
      compiler/x86_64/x8664pro.inc
  97. 1291 10
      compiler/x86_64/x8664tab.inc
  98. 6 6
      packages/Makefile
  99. 5 5
      packages/Makefile.fpc
  100. 45 10
      packages/cdrom/src/cdromlin.inc

+ 79 - 1
.gitattributes

@@ -132,6 +132,7 @@ compiler/crefs.pas svneol=native#text/plain
 compiler/cresstr.pas svneol=native#text/plain
 compiler/cresstr.pas svneol=native#text/plain
 compiler/cstreams.pas svneol=native#text/plain
 compiler/cstreams.pas svneol=native#text/plain
 compiler/cutils.pas svneol=native#text/plain
 compiler/cutils.pas svneol=native#text/plain
+compiler/cwindirs.pp svneol=native#text/plain
 compiler/dbgbase.pas svneol=native#text/plain
 compiler/dbgbase.pas svneol=native#text/plain
 compiler/dbgdwarf.pas svneol=native#text/plain
 compiler/dbgdwarf.pas svneol=native#text/plain
 compiler/dbgstabs.pas svneol=native#text/plain
 compiler/dbgstabs.pas svneol=native#text/plain
@@ -335,6 +336,7 @@ compiler/ogelf.pas svneol=native#text/plain
 compiler/oglx.pas svneol=native#text/plain
 compiler/oglx.pas svneol=native#text/plain
 compiler/ogmacho.pas svneol=native#text/plain
 compiler/ogmacho.pas svneol=native#text/plain
 compiler/ogmap.pas svneol=native#text/plain
 compiler/ogmap.pas svneol=native#text/plain
+compiler/ognlm.pas svneol=native#text/plain
 compiler/optbase.pas svneol=native#text/plain
 compiler/optbase.pas svneol=native#text/plain
 compiler/optcse.pas svneol=native#text/plain
 compiler/optcse.pas svneol=native#text/plain
 compiler/optdead.pas svneol=native#text/plain
 compiler/optdead.pas svneol=native#text/plain
@@ -2173,6 +2175,7 @@ packages/fcl-net/src/win/resolve.inc svneol=native#text/plain
 packages/fcl-passrc/Makefile svneol=native#text/plain
 packages/fcl-passrc/Makefile svneol=native#text/plain
 packages/fcl-passrc/Makefile.fpc svneol=native#text/plain
 packages/fcl-passrc/Makefile.fpc svneol=native#text/plain
 packages/fcl-passrc/examples/test_parser.pp svneol=native#text/plain
 packages/fcl-passrc/examples/test_parser.pp svneol=native#text/plain
+packages/fcl-passrc/examples/testunit1.pp svneol=native#text/plain
 packages/fcl-passrc/fpmake.pp svneol=native#text/plain
 packages/fcl-passrc/fpmake.pp svneol=native#text/plain
 packages/fcl-passrc/src/pastree.pp svneol=native#text/plain
 packages/fcl-passrc/src/pastree.pp svneol=native#text/plain
 packages/fcl-passrc/src/paswrite.pp svneol=native#text/plain
 packages/fcl-passrc/src/paswrite.pp svneol=native#text/plain
@@ -2292,9 +2295,71 @@ packages/fcl-res/xml/versionconsts.xml svneol=native#text/plain
 packages/fcl-res/xml/versionresource.xml svneol=native#text/plain
 packages/fcl-res/xml/versionresource.xml svneol=native#text/plain
 packages/fcl-res/xml/versiontypes.xml svneol=native#text/plain
 packages/fcl-res/xml/versiontypes.xml svneol=native#text/plain
 packages/fcl-res/xml/winpeimagereader.xml svneol=native#text/plain
 packages/fcl-res/xml/winpeimagereader.xml svneol=native#text/plain
+packages/fcl-stl/Makefile svneol=native#text/plain
+packages/fcl-stl/Makefile.fpc svneol=native#text/plain
+packages/fcl-stl/doc/arrayutils.tex svneol=native#text/plain
+packages/fcl-stl/doc/deque.tex svneol=native#text/plain
+packages/fcl-stl/doc/dequeexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/main.tex svneol=native#text/plain
+packages/fcl-stl/doc/makra.tex svneol=native#text/plain
+packages/fcl-stl/doc/map.tex svneol=native#text/plain
+packages/fcl-stl/doc/mapexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/priorityqueue.tex svneol=native#text/plain
+packages/fcl-stl/doc/priorityqueueexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/queue.tex svneol=native#text/plain
+packages/fcl-stl/doc/queueexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/set.tex svneol=native#text/plain
+packages/fcl-stl/doc/setexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/sortingexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/stack.tex svneol=native#text/plain
+packages/fcl-stl/doc/stackexample.pp svneol=native#text/plain
+packages/fcl-stl/doc/util.tex svneol=native#text/plain
+packages/fcl-stl/doc/vector.tex svneol=native#text/plain
+packages/fcl-stl/doc/vectorexample.pp svneol=native#text/plain
+packages/fcl-stl/src/garrayutils.pp svneol=native#text/plain
+packages/fcl-stl/src/gdeque.pp svneol=native#text/plain
+packages/fcl-stl/src/gmap.pp svneol=native#text/plain
+packages/fcl-stl/src/gpriorityqueue.pp svneol=native#text/plain
+packages/fcl-stl/src/gqueue.pp svneol=native#text/plain
+packages/fcl-stl/src/gset.pp svneol=native#text/plain
+packages/fcl-stl/src/gstack.pp svneol=native#text/plain
+packages/fcl-stl/src/gutil.pp svneol=native#text/plain
+packages/fcl-stl/src/gvector.pp svneol=native#text/plain
+packages/fcl-stl/tests/clean svneol=native#text/plain
+packages/fcl-stl/tests/garrayutilstest.pp svneol=native#text/plain
+packages/fcl-stl/tests/gdequetest.pp svneol=native#text/plain
+packages/fcl-stl/tests/gmaptest.pp svneol=native#text/plain
+packages/fcl-stl/tests/gmaptestzal.pp svneol=native#text/plain
+packages/fcl-stl/tests/gpriorityqueuetest.pp svneol=native#text/plain
+packages/fcl-stl/tests/gqueuetest.pp svneol=native#text/plain
+packages/fcl-stl/tests/gsetrefcounttest.pp svneol=native#text/plain
+packages/fcl-stl/tests/gsettest.pp svneol=native#text/plain
+packages/fcl-stl/tests/gstacktest.pp svneol=native#text/plain
+packages/fcl-stl/tests/gvectortest.pp svneol=native#text/plain
+packages/fcl-stl/tests/run-all-tests svneol=native#text/plain
+packages/fcl-stl/tests/suiteconfig.pp svneol=native#text/plain
+packages/fcl-stl/tests/testrunner.pp svneol=native#text/plain
 packages/fcl-web/Makefile svneol=native#text/plain
 packages/fcl-web/Makefile svneol=native#text/plain
 packages/fcl-web/Makefile.fpc svneol=native#text/plain
 packages/fcl-web/Makefile.fpc svneol=native#text/plain
+packages/fcl-web/Makefile.org svneol=native#text/plain
 packages/fcl-web/Makefile_fpmake.fpc svneol=native#text/plain
 packages/fcl-web/Makefile_fpmake.fpc svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.html svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.ico -text
+packages/fcl-web/examples/combined/combined.ini svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.lpi svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.lpr svneol=native#text/plain
+packages/fcl-web/examples/combined/combined.res -text
+packages/fcl-web/examples/combined/combined.sql svneol=native#text/plain
+packages/fcl-web/examples/combined/login.js svneol=native#text/plain
+packages/fcl-web/examples/combined/login.png -text svneol=unset#image/png
+packages/fcl-web/examples/combined/users.html svneol=native#text/plain
+packages/fcl-web/examples/combined/users.js svneol=native#text/plain
+packages/fcl-web/examples/combined/users.sql svneol=native#text/plain
+packages/fcl-web/examples/combined/wmlogin.lfm svneol=native#text/plain
+packages/fcl-web/examples/combined/wmlogin.pp svneol=native#text/plain
+packages/fcl-web/examples/combined/wmusers.lfm svneol=native#text/plain
+packages/fcl-web/examples/combined/wmusers.lrs svneol=native#text/plain
+packages/fcl-web/examples/combined/wmusers.pp svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/README.txt svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/README.txt svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/demo.lpi svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/demo.lpi svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/demo.lpr svneol=native#text/plain
 packages/fcl-web/examples/jsonrpc/demo1/demo.lpr svneol=native#text/plain
@@ -7381,6 +7446,7 @@ rtl/netware/npackon.inc svneol=native#text/plain
 rtl/netware/nwcalls.pp svneol=native#text/plain
 rtl/netware/nwcalls.pp svneol=native#text/plain
 rtl/netware/nwnit.pp svneol=native#text/plain
 rtl/netware/nwnit.pp svneol=native#text/plain
 rtl/netware/nwpre.as svneol=native#text/plain
 rtl/netware/nwpre.as svneol=native#text/plain
+rtl/netware/nwpre.imp svneol=native#text/plain
 rtl/netware/nwpre.pp svneol=native#text/plain
 rtl/netware/nwpre.pp svneol=native#text/plain
 rtl/netware/nwprot.pp svneol=native#text/plain
 rtl/netware/nwprot.pp svneol=native#text/plain
 rtl/netware/nwpsrv.imp -text
 rtl/netware/nwpsrv.imp -text
@@ -7886,6 +7952,7 @@ rtl/win/syswin.inc svneol=native#text/plain
 rtl/win/tthread.inc svneol=native#text/plain
 rtl/win/tthread.inc svneol=native#text/plain
 rtl/win/varutils.pp svneol=native#text/plain
 rtl/win/varutils.pp svneol=native#text/plain
 rtl/win/video.pp svneol=native#text/plain
 rtl/win/video.pp svneol=native#text/plain
+rtl/win/windirs.pp svneol=native#text/plain
 rtl/win/winevent.pp svneol=native#text/plain
 rtl/win/winevent.pp svneol=native#text/plain
 rtl/win/wininc/Makefile svneol=native#text/plain
 rtl/win/wininc/Makefile svneol=native#text/plain
 rtl/win/wininc/ascdef.inc svneol=native#text/plain
 rtl/win/wininc/ascdef.inc svneol=native#text/plain
@@ -8285,6 +8352,7 @@ tests/tbf/tb0216.pp svneol=native#text/plain
 tests/tbf/tb0217.pp svneol=native#text/plain
 tests/tbf/tb0217.pp svneol=native#text/plain
 tests/tbf/tb0218.pp svneol=native#text/plain
 tests/tbf/tb0218.pp svneol=native#text/plain
 tests/tbf/tb0219.pp svneol=native#text/pascal
 tests/tbf/tb0219.pp svneol=native#text/pascal
+tests/tbf/tb0220.pp svneol=native#text/plain
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0115.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain
 tests/tbf/ub0149.pp svneol=native#text/plain
 tests/tbf/ub0158a.pp svneol=native#text/plain
 tests/tbf/ub0158a.pp svneol=native#text/plain
@@ -9046,10 +9114,12 @@ tests/test/cg/obj/tcext4.c -text
 tests/test/cg/obj/tcext5.c -text
 tests/test/cg/obj/tcext5.c -text
 tests/test/cg/obj/tcext6.c svneol=native#text/plain
 tests/test/cg/obj/tcext6.c svneol=native#text/plain
 tests/test/cg/obj/win32/i386/cpptcl1.o -text
 tests/test/cg/obj/win32/i386/cpptcl1.o -text
+tests/test/cg/obj/win32/i386/cpptcl2.o -text
 tests/test/cg/obj/win32/i386/ctest.o -text
 tests/test/cg/obj/win32/i386/ctest.o -text
 tests/test/cg/obj/win32/i386/tcext3.o -text
 tests/test/cg/obj/win32/i386/tcext3.o -text
 tests/test/cg/obj/win32/i386/tcext4.o -text
 tests/test/cg/obj/win32/i386/tcext4.o -text
 tests/test/cg/obj/win32/i386/tcext5.o -text
 tests/test/cg/obj/win32/i386/tcext5.o -text
+tests/test/cg/obj/win32/i386/tcext6.o -text
 tests/test/cg/obj/win64/x86_64/ctest.o -text svneol=unset#unset
 tests/test/cg/obj/win64/x86_64/ctest.o -text svneol=unset#unset
 tests/test/cg/obj/win64/x86_64/tcext3.o -text svneol=unset#unset
 tests/test/cg/obj/win64/x86_64/tcext3.o -text svneol=unset#unset
 tests/test/cg/obj/win64/x86_64/tcext4.o -text svneol=unset#unset
 tests/test/cg/obj/win64/x86_64/tcext4.o -text svneol=unset#unset
@@ -9441,6 +9511,7 @@ tests/test/tabsvr3.pp svneol=native#text/plain
 tests/test/tabsvr4.pp svneol=native#text/plain
 tests/test/tabsvr4.pp svneol=native#text/plain
 tests/test/tabsvr5.pp svneol=native#text/plain
 tests/test/tabsvr5.pp svneol=native#text/plain
 tests/test/taddstr1.pp svneol=native#text/plain
 tests/test/taddstr1.pp svneol=native#text/plain
+tests/test/taes1.pp svneol=native#text/plain
 tests/test/talign.pp svneol=native#text/plain
 tests/test/talign.pp svneol=native#text/plain
 tests/test/talign1.pp svneol=native#text/plain
 tests/test/talign1.pp svneol=native#text/plain
 tests/test/talign2.pp svneol=native#text/plain
 tests/test/talign2.pp svneol=native#text/plain
@@ -9453,6 +9524,8 @@ tests/test/tarray4.pp svneol=native#text/plain
 tests/test/tarray5.pp svneol=native#text/plain
 tests/test/tarray5.pp svneol=native#text/plain
 tests/test/tarray6.pp svneol=native#text/plain
 tests/test/tarray6.pp svneol=native#text/plain
 tests/test/tarray7.pp svneol=native#text/plain
 tests/test/tarray7.pp svneol=native#text/plain
+tests/test/tarray8.pp svneol=native#text/plain
+tests/test/tarray9.pp svneol=native#text/plain
 tests/test/tasmread.pp svneol=native#text/plain
 tests/test/tasmread.pp svneol=native#text/plain
 tests/test/tasout.pp svneol=native#text/plain
 tests/test/tasout.pp svneol=native#text/plain
 tests/test/tassignmentoperator1.pp svneol=native#text/pascal
 tests/test/tassignmentoperator1.pp svneol=native#text/pascal
@@ -9527,6 +9600,8 @@ tests/test/tclass12b.pp svneol=native#text/pascal
 tests/test/tclass12c.pp svneol=native#text/pascal
 tests/test/tclass12c.pp svneol=native#text/pascal
 tests/test/tclass12d.pp svneol=native#text/plain
 tests/test/tclass12d.pp svneol=native#text/plain
 tests/test/tclass13.pp svneol=native#text/pascal
 tests/test/tclass13.pp svneol=native#text/pascal
+tests/test/tclass13a.pp svneol=native#text/plain
+tests/test/tclass13b.pp svneol=native#text/plain
 tests/test/tclass14a.pp svneol=native#text/pascal
 tests/test/tclass14a.pp svneol=native#text/pascal
 tests/test/tclass14b.pp svneol=native#text/pascal
 tests/test/tclass14b.pp svneol=native#text/pascal
 tests/test/tclass2.pp svneol=native#text/plain
 tests/test/tclass2.pp svneol=native#text/plain
@@ -9964,6 +10039,7 @@ tests/test/tsealed3.pp svneol=native#text/pascal
 tests/test/tsealed4.pp svneol=native#text/pascal
 tests/test/tsealed4.pp svneol=native#text/pascal
 tests/test/tsealed5.pp svneol=native#text/pascal
 tests/test/tsealed5.pp svneol=native#text/pascal
 tests/test/tsealed6.pp svneol=native#text/pascal
 tests/test/tsealed6.pp svneol=native#text/pascal
+tests/test/tsec1.pp svneol=native#text/plain
 tests/test/tsel1.pp svneol=native#text/plain
 tests/test/tsel1.pp svneol=native#text/plain
 tests/test/tsel2.pp svneol=native#text/plain
 tests/test/tsel2.pp svneol=native#text/plain
 tests/test/tset1.pp svneol=native#text/plain
 tests/test/tset1.pp svneol=native#text/plain
@@ -11191,15 +11267,17 @@ tests/webtbs/tw1850.pp svneol=native#text/plain
 tests/webtbs/tw1851.pp svneol=native#text/plain
 tests/webtbs/tw1851.pp svneol=native#text/plain
 tests/webtbs/tw18512.pp svneol=native#text/pascal
 tests/webtbs/tw18512.pp svneol=native#text/pascal
 tests/webtbs/tw1856.pp svneol=native#text/plain
 tests/webtbs/tw1856.pp svneol=native#text/plain
-tests/webtbs/tw18567 svneol=native#text/pascal
+tests/webtbs/tw18567.pp svneol=native#text/pascal
 tests/webtbs/tw18610.pp svneol=native#text/pascal
 tests/webtbs/tw18610.pp svneol=native#text/pascal
 tests/webtbs/tw1862.pp svneol=native#text/plain
 tests/webtbs/tw1862.pp svneol=native#text/plain
 tests/webtbs/tw18620.pp svneol=native#text/pascal
 tests/webtbs/tw18620.pp svneol=native#text/pascal
 tests/webtbs/tw1863.pp svneol=native#text/plain
 tests/webtbs/tw1863.pp svneol=native#text/plain
 tests/webtbs/tw1867.pp svneol=native#text/plain
 tests/webtbs/tw1867.pp svneol=native#text/plain
 tests/webtbs/tw18690.pp svneol=native#text/plain
 tests/webtbs/tw18690.pp svneol=native#text/plain
+tests/webtbs/tw18702.pp svneol=native#text/pascal
 tests/webtbs/tw1873.pp svneol=native#text/plain
 tests/webtbs/tw1873.pp svneol=native#text/plain
 tests/webtbs/tw1883.pp svneol=native#text/plain
 tests/webtbs/tw1883.pp svneol=native#text/plain
+tests/webtbs/tw18859.pp svneol=native#text/plain
 tests/webtbs/tw1888.pp svneol=native#text/plain
 tests/webtbs/tw1888.pp svneol=native#text/plain
 tests/webtbs/tw1889.pp svneol=native#text/plain
 tests/webtbs/tw1889.pp svneol=native#text/plain
 tests/webtbs/tw1896.pp svneol=native#text/plain
 tests/webtbs/tw1896.pp svneol=native#text/plain

+ 3 - 1
compiler/aasmbase.pas

@@ -40,7 +40,7 @@ interface
        TAsmsymbind=(
        TAsmsymbind=(
          AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL,AB_WEAK_EXTERNAL,
          AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL,AB_WEAK_EXTERNAL,
          { global in the current program/library, but not visible outside it }
          { global in the current program/library, but not visible outside it }
-         AB_PRIVATE_EXTERN,AB_LAZY);
+         AB_PRIVATE_EXTERN,AB_LAZY,AB_IMPORT);
 
 
        TAsmsymtype=(
        TAsmsymtype=(
          AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL,
          AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL,
@@ -61,6 +61,8 @@ interface
 
 
     type
     type
        TAsmSectiontype=(sec_none,
        TAsmSectiontype=(sec_none,
+         { this section type allows to define a user named section }
+         sec_user,
          sec_code,
          sec_code,
          sec_data,
          sec_data,
          { read-only, but may contain relocations }
          { read-only, but may contain relocations }

+ 9 - 3
compiler/aggas.pas

@@ -259,7 +259,7 @@ implementation
 
 
     function TGNUAssembler.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
     function TGNUAssembler.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
       const
       const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text',
           '.text',
           '.data',
           '.data',
 { why doesn't .rodata work? (FK) }
 { why doesn't .rodata work? (FK) }
@@ -277,7 +277,7 @@ implementation
 {$if defined(m68k)} { Amiga/m68k GNU AS doesn't seem to like .rodata (KB) }
 {$if defined(m68k)} { Amiga/m68k GNU AS doesn't seem to like .rodata (KB) }
           '.data',
           '.data',
 {$else}
 {$else}
-    '.rodata',
+          '.rodata',
 {$endif}
 {$endif}
           '.bss',
           '.bss',
           '.threadvar',
           '.threadvar',
@@ -331,7 +331,7 @@ implementation
           '.obcj_nlcatlist',
           '.obcj_nlcatlist',
           '.objc_protolist'
           '.objc_protolist'
         );
         );
-        secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text',
           '.text',
           '.data.rel',
           '.data.rel',
           '.data.rel',
           '.data.rel',
@@ -419,6 +419,10 @@ implementation
           (target_info.system=system_i386_go32v2) then
           (target_info.system=system_i386_go32v2) then
           secname:='.data';
           secname:='.data';
 
 
+        { section type user gives the user full controll on the section name }
+        if atype=sec_user then
+          secname:=aname;
+
         { For bss we need to set some flags that are target dependent,
         { For bss we need to set some flags that are target dependent,
           it is easier to disable it for smartlinking. It doesn't take up
           it is easier to disable it for smartlinking. It doesn't take up
           filespace }
           filespace }
@@ -426,6 +430,7 @@ implementation
            create_smartlink_sections and
            create_smartlink_sections and
            (aname<>'') and
            (aname<>'') and
            (atype<>sec_toc) and
            (atype<>sec_toc) and
+           (atype<>sec_user) and
            { on embedded systems every byte counts, so smartlink bss too }
            { on embedded systems every byte counts, so smartlink bss too }
            ((atype<>sec_bss) or (target_info.system in systems_embedded)) then
            ((atype<>sec_bss) or (target_info.system in systems_embedded)) then
           begin
           begin
@@ -1513,6 +1518,7 @@ implementation
     const
     const
 (* Translation table - replace unsupported section types with basic ones. *)
 (* Translation table - replace unsupported section types with basic ones. *)
         SecXTable: array[TAsmSectionType] of TAsmSectionType = (
         SecXTable: array[TAsmSectionType] of TAsmSectionType = (
+         sec_none,
          sec_none,
          sec_none,
          sec_code,
          sec_code,
          sec_data,
          sec_data,

+ 8 - 0
compiler/aoptobj.pas

@@ -991,6 +991,7 @@ Unit AoptObj;
                         strpnew('next label reused'))));
                         strpnew('next label reused'))));
       {$endif finaldestdebug}
       {$endif finaldestdebug}
                       l.increfs;
                       l.increfs;
+                      tasmlabel(hp.oper[0]^.ref^.symbol).decrefs;
                       hp.oper[0]^.ref^.symbol := l;
                       hp.oper[0]^.ref^.symbol := l;
                       if not GetFinalDestination(hp,succ(level)) then
                       if not GetFinalDestination(hp,succ(level)) then
                         exit;
                         exit;
@@ -1037,6 +1038,12 @@ Unit AoptObj;
                                 (hp1.typ <> ait_label) do
                                 (hp1.typ <> ait_label) do
                             if not(hp1.typ in ([ait_label,ait_align]+skipinstr)) then
                             if not(hp1.typ in ([ait_label,ait_align]+skipinstr)) then
                               begin
                               begin
+                                if (hp1.typ = ait_instruction) and
+                                   taicpu(hp1).is_jmp and
+                                   (taicpu(hp1).oper[0]^.typ = top_ref) and
+                                   assigned(taicpu(hp1).oper[0]^.ref^.symbol) and
+                                   (taicpu(hp1).oper[0]^.ref^.symbol is TAsmLabel) then
+                                   TAsmLabel(taicpu(hp1).oper[0]^.ref^.symbol).decrefs;
                                 asml.remove(hp1);
                                 asml.remove(hp1);
                                 hp1.free;
                                 hp1.free;
                               end
                               end
@@ -1051,6 +1058,7 @@ Unit AoptObj;
                             begin
                             begin
                               hp2:=tai(hp1.next);
                               hp2:=tai(hp1.next);
                               asml.remove(p);
                               asml.remove(p);
+                              tasmlabel(taicpu(p).oper[0]^.ref^.symbol).decrefs;
                               p.free;
                               p.free;
                               p:=hp2;
                               p:=hp2;
                               continue;
                               continue;

+ 2 - 0
compiler/arm/cgcpu.pas

@@ -3479,6 +3479,8 @@ unit cgcpu;
               begin
               begin
                 { restore int registers and return }
                 { restore int registers and return }
                 list.concat(taicpu.op_reg_reg(A_MOV, NR_STACK_POINTER_REG, NR_FRAME_POINTER_REG));
                 list.concat(taicpu.op_reg_reg(A_MOV, NR_STACK_POINTER_REG, NR_FRAME_POINTER_REG));
+                { Add 4 to SP to make it point to an "imaginary PC" which the paramanager assumes is there(for normal ARM) }
+                list.concat(taicpu.op_reg_const(A_ADD, NR_STACK_POINTER_REG, 4));
 
 
                 reference_reset(ref,4);
                 reference_reset(ref,4);
                 ref.index:=NR_STACK_POINTER_REG;
                 ref.index:=NR_STACK_POINTER_REG;

+ 16 - 1
compiler/arm/cpuinfo.pas

@@ -99,7 +99,9 @@ Const
      pocall_softfloat,
      pocall_softfloat,
      { same as stdcall (requires that all const records are passed by
      { same as stdcall (requires that all const records are passed by
        reference, but that's already done for stdcall) }
        reference, but that's already done for stdcall) }
-     pocall_mwpascal
+     pocall_mwpascal,
+     { used for interrupt handling }
+     pocall_interrupt
    ];
    ];
 
 
    cputypestr : array[tcputype] of string[8] = ('',
    cputypestr : array[tcputype] of string[8] = ('',
@@ -147,6 +149,19 @@ Const
       'STELLARIS'
       'STELLARIS'
      );
      );
 
 
+   interruptvectors : array[tcontrollertype] of longint =
+     (0,
+      8,
+      8,
+      8,
+      8,
+      8,
+      8,
+      8,
+      12+59, { XL-density }
+      12 { No model specified }
+     );
+
    vfp_scalar = [fpu_vfpv2,fpu_vfpv3];
    vfp_scalar = [fpu_vfpv2,fpu_vfpv3];
 
 
    { Supported optimizations, only used for information }
    { Supported optimizations, only used for information }

+ 3 - 0
compiler/cclasses.pas

@@ -2208,6 +2208,9 @@ end;
     function TCmdStrListItem.GetCopy:TLinkedListItem;
     function TCmdStrListItem.GetCopy:TLinkedListItem;
       begin
       begin
         Result:=(inherited GetCopy);
         Result:=(inherited GetCopy);
+        { TLinkedListItem.GetCopy performs a "move" to copy all data -> reinit
+          the ansistring, so the refcount is properly increased }
+        Initialize(TCmdStrListItem(Result).FPStr);
         TCmdStrListItem(Result).FPStr:=FPstr;
         TCmdStrListItem(Result).FPStr:=FPstr;
       end;
       end;
 
 

+ 54 - 0
compiler/cgobj.pas

@@ -451,6 +451,8 @@ unit cgobj;
 
 
           procedure g_incrrefcount(list : TAsmList;t: tdef; const ref: treference);
           procedure g_incrrefcount(list : TAsmList;t: tdef; const ref: treference);
           procedure g_decrrefcount(list : TAsmList;t: tdef; const ref: treference);
           procedure g_decrrefcount(list : TAsmList;t: tdef; const ref: treference);
+          procedure g_array_rtti_helper(list: TAsmList; t: tdef; const ref: treference; const highloc: tlocation;
+            const name: string);
           procedure g_initialize(list : TAsmList;t : tdef;const ref : treference);
           procedure g_initialize(list : TAsmList;t : tdef;const ref : treference);
           procedure g_finalize(list : TAsmList;t : tdef;const ref : treference);
           procedure g_finalize(list : TAsmList;t : tdef;const ref : treference);
 
 
@@ -3509,6 +3511,8 @@ implementation
           end
           end
          else
          else
           begin
           begin
+            if is_open_array(t) then
+              InternalError(201103054);
             reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
             reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
             a_loadaddr_ref_cgpara(list,href,cgpara2);
             a_loadaddr_ref_cgpara(list,href,cgpara2);
             a_loadaddr_ref_cgpara(list,ref,cgpara1);
             a_loadaddr_ref_cgpara(list,ref,cgpara1);
@@ -3574,6 +3578,8 @@ implementation
           end
           end
          else
          else
           begin
           begin
+            if is_open_array(t) then
+              InternalError(201103053);
             reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
             reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
             a_loadaddr_ref_cgpara(list,href,cgpara2);
             a_loadaddr_ref_cgpara(list,href,cgpara2);
             a_loadaddr_ref_cgpara(list,ref,cgpara1);
             a_loadaddr_ref_cgpara(list,ref,cgpara1);
@@ -3587,6 +3593,50 @@ implementation
         cgpara1.done;
         cgpara1.done;
       end;
       end;
 
 
+    procedure tcg.g_array_rtti_helper(list: TAsmList; t: tdef; const ref: treference; const highloc: tlocation; const name: string);
+      var
+        cgpara1,cgpara2,cgpara3: TCGPara;
+        href: TReference;
+        hreg, lenreg: TRegister;
+      begin
+        cgpara1.init;
+        cgpara2.init;
+        cgpara3.init;
+        paramanager.getintparaloc(pocall_default,1,cgpara1);
+        paramanager.getintparaloc(pocall_default,2,cgpara2);
+        paramanager.getintparaloc(pocall_default,3,cgpara3);
+
+        reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
+        if highloc.loc=LOC_CONSTANT then
+          a_load_const_cgpara(list,OS_INT,highloc.value+1,cgpara3)
+        else
+          begin
+            if highloc.loc in [LOC_REGISTER,LOC_CREGISTER] then
+              hreg:=highloc.register
+            else
+              begin
+                hreg:=getintregister(list,OS_INT);
+                a_load_loc_reg(list,OS_INT,highloc,hreg);
+              end;
+            { increment, converts high(x) to length(x) }
+            lenreg:=getintregister(list,OS_INT);
+            a_op_const_reg_reg(list,OP_ADD,OS_INT,1,hreg,lenreg);
+            a_load_reg_cgpara(list,OS_INT,lenreg,cgpara3);
+          end;
+
+        a_loadaddr_ref_cgpara(list,href,cgpara2);
+        a_loadaddr_ref_cgpara(list,ref,cgpara1);
+        paramanager.freecgpara(list,cgpara1);
+        paramanager.freecgpara(list,cgpara2);
+        paramanager.freecgpara(list,cgpara3);
+        allocallcpuregisters(list);
+        a_call_name(list,name,false);
+        deallocallcpuregisters(list);
+
+        cgpara3.done;
+        cgpara2.done;
+        cgpara1.done;
+      end;
 
 
     procedure tcg.g_initialize(list : TAsmList;t : tdef;const ref : treference);
     procedure tcg.g_initialize(list : TAsmList;t : tdef;const ref : treference);
       var
       var
@@ -3605,6 +3655,8 @@ implementation
            a_load_const_ref(list,OS_ADDR,0,ref)
            a_load_const_ref(list,OS_ADDR,0,ref)
          else
          else
            begin
            begin
+              if is_open_array(t) then
+                InternalError(201103052);
               reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
               reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
               a_loadaddr_ref_cgpara(list,href,cgpara2);
               a_loadaddr_ref_cgpara(list,href,cgpara2);
               a_loadaddr_ref_cgpara(list,ref,cgpara1);
               a_loadaddr_ref_cgpara(list,ref,cgpara1);
@@ -3638,6 +3690,8 @@ implementation
             end
             end
          else
          else
            begin
            begin
+              if is_open_array(t) then
+                InternalError(201103051);
               reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
               reference_reset_symbol(href,RTTIWriter.get_rtti_label(t,initrtti),0,sizeof(pint));
               a_loadaddr_ref_cgpara(list,href,cgpara2);
               a_loadaddr_ref_cgpara(list,href,cgpara2);
               a_loadaddr_ref_cgpara(list,ref,cgpara1);
               a_loadaddr_ref_cgpara(list,ref,cgpara1);

+ 3 - 3
compiler/comprsrc.pas

@@ -377,18 +377,18 @@ end;
 
 
 function CopyResFile(inf,outf : TCmdStr) : boolean;
 function CopyResFile(inf,outf : TCmdStr) : boolean;
 var
 var
-  src,dst : TCFileStream;
+  src,dst : TCCustomFileStream;
 begin
 begin
   { Copy .res file to units output dir. }
   { Copy .res file to units output dir. }
   Result:=false;
   Result:=false;
-  src:=TCFileStream.Create(inf,fmOpenRead or fmShareDenyNone);
+  src:=CFileStreamClass.Create(inf,fmOpenRead or fmShareDenyNone);
   if CStreamError<>0 then
   if CStreamError<>0 then
     begin
     begin
       Message1(exec_e_cant_open_resource_file, src.FileName);
       Message1(exec_e_cant_open_resource_file, src.FileName);
       Include(current_settings.globalswitches, cs_link_nolink);
       Include(current_settings.globalswitches, cs_link_nolink);
       exit;
       exit;
     end;
     end;
-  dst:=TCFileStream.Create(current_module.outputpath^+outf,fmCreate);
+  dst:=CFileStreamClass.Create(current_module.outputpath^+outf,fmCreate);
   if CStreamError<>0 then
   if CStreamError<>0 then
     begin
     begin
       Message1(exec_e_cant_write_resource_file, dst.FileName);
       Message1(exec_e_cant_write_resource_file, dst.FileName);

+ 28 - 8
compiler/cstreams.pas

@@ -100,23 +100,38 @@ type
     property Size: Longint read GetSize write SetSize;
     property Size: Longint read GetSize write SetSize;
   end;
   end;
 
 
+{ TCCustomFileStream class }
+
+  TCCustomFileStream = class(TCStream)
+  protected
+    FFileName : String;
+  public
+    constructor Create(const AFileName: string;{shortstring!} Mode: Word); virtual; abstract;
+    function EOF: boolean; virtual; abstract;
+    property FileName : String Read FFilename;
+  end;
+
 { TFileStream class }
 { TFileStream class }
 
 
-  TCFileStream = class(TCStream)
+  TCFileStream = class(TCCustomFileStream)
   Private
   Private
-    FFileName : String;
     FHandle: File;
     FHandle: File;
   protected
   protected
     procedure SetSize(NewSize: Longint); override;
     procedure SetSize(NewSize: Longint); override;
   public
   public
-    constructor Create(const AFileName: string; Mode: Word);
+    constructor Create(const AFileName: string; Mode: Word); override;
     destructor Destroy; override;
     destructor Destroy; override;
     function Read(var Buffer; Count: Longint): Longint; override;
     function Read(var Buffer; Count: Longint): Longint; override;
     function Write(const Buffer; Count: Longint): Longint; override;
     function Write(const Buffer; Count: Longint): Longint; override;
     function Seek(Offset: Longint; Origin: Word): Longint; override;
     function Seek(Offset: Longint; Origin: Word): Longint; override;
-    property FileName : String Read FFilename;
+    function EOF: boolean; override;
   end;
   end;
 
 
+  TCFileStreamClass = class of TCCustomFileStream;
+var
+  CFileStreamClass: TCFileStreamClass = TCFileStream;
+
+type
 { TCustomMemoryStream abstract class }
 { TCustomMemoryStream abstract class }
 
 
   TCCustomMemoryStream = class(TCStream)
   TCCustomMemoryStream = class(TCStream)
@@ -441,6 +456,11 @@ begin
   Result:=l;
   Result:=l;
 end;
 end;
 
 
+function TCFileStream.EOF: boolean;
+begin
+  EOF:=system.eof(FHandle);
+end;
+
 
 
 {****************************************************************************}
 {****************************************************************************}
 {*                             TCustomMemoryStream                          *}
 {*                             TCustomMemoryStream                          *}
@@ -489,11 +509,11 @@ end;
 
 
 procedure TCCustomMemoryStream.SaveToFile(const FileName: string);
 procedure TCCustomMemoryStream.SaveToFile(const FileName: string);
 
 
-Var S : TCFileStream;
+Var S : TCCustomFileStream;
 
 
 begin
 begin
   Try
   Try
-    S:=TCFileStream.Create (FileName,fmCreate);
+    S:=CFileStreamClass.Create (FileName,fmCreate);
     SaveToStream(S);
     SaveToStream(S);
   finally
   finally
     S.free;
     S.free;
@@ -574,11 +594,11 @@ end;
 
 
 procedure TCMemoryStream.LoadFromFile(const FileName: string);
 procedure TCMemoryStream.LoadFromFile(const FileName: string);
 
 
-Var S : TCFileStream;
+Var S : TCCustomFileStream;
 
 
 begin
 begin
   Try
   Try
-    S:=TCFileStream.Create (FileName,fmOpenRead);
+    S:=CFileStreamClass.Create (FileName,fmOpenRead);
     LoadFromStream(S);
     LoadFromStream(S);
   finally
   finally
     S.free;
     S.free;

+ 123 - 0
compiler/cwindirs.pp

@@ -0,0 +1,123 @@
+{ this unit is temporarily included in the compiler sources till stable releases with
+  windirs from the rtl are shipped
+}
+unit cwindirs;
+
+{$mode objfpc}
+{$H+}
+
+interface
+
+uses
+  windows,
+  strings;
+
+Const
+  CSIDL_PROGRAMS                = $0002; { %SYSTEMDRIVE%\Program Files                                      }
+  CSIDL_PERSONAL                = $0005; { %USERPROFILE%\My Documents                                       }
+  CSIDL_FAVORITES               = $0006; { %USERPROFILE%\Favorites                                          }
+  CSIDL_STARTUP                 = $0007; { %USERPROFILE%\Start menu\Programs\Startup                        }
+  CSIDL_RECENT                  = $0008; { %USERPROFILE%\Recent                                             }
+  CSIDL_SENDTO                  = $0009; { %USERPROFILE%\Sendto                                             }
+  CSIDL_STARTMENU               = $000B; { %USERPROFILE%\Start menu                                         }
+  CSIDL_MYMUSIC                 = $000D; { %USERPROFILE%\Documents\My Music                                 }
+  CSIDL_MYVIDEO                 = $000E; { %USERPROFILE%\Documents\My Videos                                }
+  CSIDL_DESKTOPDIRECTORY        = $0010; { %USERPROFILE%\Desktop                                            }
+  CSIDL_NETHOOD                 = $0013; { %USERPROFILE%\NetHood                                            }
+  CSIDL_TEMPLATES               = $0015; { %USERPROFILE%\Templates                                          }
+  CSIDL_COMMON_STARTMENU        = $0016; { %PROFILEPATH%\All users\Start menu                               }
+  CSIDL_COMMON_PROGRAMS         = $0017; { %PROFILEPATH%\All users\Start menu\Programs                      }
+  CSIDL_COMMON_STARTUP          = $0018; { %PROFILEPATH%\All users\Start menu\Programs\Startup              }
+  CSIDL_COMMON_DESKTOPDIRECTORY = $0019; { %PROFILEPATH%\All users\Desktop                                  }
+  CSIDL_APPDATA                 = $001A; { %USERPROFILE%\Application Data (roaming)                         }
+  CSIDL_PRINTHOOD               = $001B; { %USERPROFILE%\Printhood                                          }
+  CSIDL_LOCAL_APPDATA           = $001C; { %USERPROFILE%\Local Settings\Application Data (non roaming)      }
+  CSIDL_COMMON_FAVORITES        = $001F; { %PROFILEPATH%\All users\Favorites                                }
+  CSIDL_INTERNET_CACHE          = $0020; { %USERPROFILE%\Local Settings\Temporary Internet Files            }
+  CSIDL_COOKIES                 = $0021; { %USERPROFILE%\Cookies                                            }
+  CSIDL_HISTORY                 = $0022; { %USERPROFILE%\Local settings\History                             }
+  CSIDL_COMMON_APPDATA          = $0023; { %PROFILESPATH%\All Users\Application Data                        }
+  CSIDL_WINDOWS                 = $0024; { %SYSTEMROOT%                                                     }
+  CSIDL_SYSTEM                  = $0025; { %SYSTEMROOT%\SYSTEM32 (may be system on 95/98/ME)                }
+  CSIDL_PROGRAM_FILES           = $0026; { %SYSTEMDRIVE%\Program Files                                      }
+  CSIDL_MYPICTURES              = $0027; { %USERPROFILE%\My Documents\My Pictures                           }
+  CSIDL_PROFILE                 = $0028; { %USERPROFILE%                                                    }
+  CSIDL_PROGRAM_FILES_COMMON    = $002B; { %SYSTEMDRIVE%\Program Files\Common                               }
+  CSIDL_COMMON_TEMPLATES        = $002D; { %PROFILEPATH%\All Users\Templates                                }
+  CSIDL_COMMON_DOCUMENTS        = $002E; { %PROFILEPATH%\All Users\Documents                                }
+  CSIDL_COMMON_ADMINTOOLS       = $002F; { %PROFILEPATH%\All Users\Start Menu\Programs\Administrative Tools }
+  CSIDL_ADMINTOOLS              = $0030; { %USERPROFILE%\Start Menu\Programs\Administrative Tools           }
+  CSIDL_COMMON_MUSIC            = $0035; { %PROFILEPATH%\All Users\Documents\my music                       }
+  CSIDL_COMMON_PICTURES         = $0036; { %PROFILEPATH%\All Users\Documents\my pictures                    }
+  CSIDL_COMMON_VIDEO            = $0037; { %PROFILEPATH%\All Users\Documents\my videos                      }
+  CSIDL_CDBURN_AREA             = $003B; { %USERPROFILE%\Local Settings\Application Data\Microsoft\CD Burning }
+  CSIDL_PROFILES                = $003E; { %PROFILEPATH%                                                    }
+
+  CSIDL_FLAG_CREATE             = $8000; { (force creation of requested folder if it doesn't exist yet)     }
+
+Function GetWindowsSpecialDir(ID :  Integer) : String;
+
+implementation
+
+uses
+  sysutils;
+
+Type
+  PFNSHGetFolderPath = Function(Ahwnd: HWND; Csidl: Integer; Token: THandle; Flags: DWord; Path: PChar): HRESULT; stdcall;
+
+
+var
+  SHGetFolderPath : PFNSHGetFolderPath = Nil;
+  CFGDLLHandle : THandle = 0;
+
+Procedure InitDLL;
+
+Var
+  pathBuf: array[0..MAX_PATH-1] of char;
+  pathLength: Integer;
+begin
+  { Load shfolder.dll using a full path, in order to prevent spoofing (Mantis #18185)
+    Don't bother loading shell32.dll because shfolder.dll itself redirects SHGetFolderPath
+    to shell32.dll whenever possible. }
+  pathLength:=GetSystemDirectory(pathBuf, MAX_PATH);
+  if (pathLength>0) and (pathLength<MAX_PATH-14) then { 14=length('\shfolder.dll'#0) }
+  begin
+    StrLCopy(@pathBuf[pathLength],'\shfolder.dll',MAX_PATH-pathLength-1);
+    CFGDLLHandle:=LoadLibrary(pathBuf);
+
+    if (CFGDLLHandle<>0) then
+    begin
+      Pointer(ShGetFolderPath):=GetProcAddress(CFGDLLHandle,'SHGetFolderPathA');
+      If @ShGetFolderPath=nil then
+      begin
+        FreeLibrary(CFGDLLHandle);
+        CFGDllHandle:=0;
+      end;
+    end;
+  end;
+  If (@ShGetFolderPath=Nil) then
+    Raise Exception.Create('Could not determine SHGetFolderPath Function');
+end;
+
+Function GetWindowsSpecialDir(ID :  Integer) : String;
+
+Var
+  APath : Array[0..MAX_PATH] of char;
+
+begin
+  Result:='';
+  if (CFGDLLHandle=0) then
+    InitDLL;
+  If (SHGetFolderPath<>Nil) then
+    begin
+    if SHGetFolderPath(0,ID or CSIDL_FLAG_CREATE,0,0,@APATH[0])=S_OK then
+      Result:=IncludeTrailingPathDelimiter(StrPas(@APath[0]));
+    end;
+end;
+
+Initialization
+Finalization
+  if CFGDLLHandle<>0 then
+   FreeLibrary(CFGDllHandle);
+end.
+

+ 3 - 1
compiler/defcmp.pas

@@ -1260,7 +1260,9 @@ implementation
                    find_real_objcclass_definition(tobjectdef(def_to),false)) then
                    find_real_objcclass_definition(tobjectdef(def_to),false)) then
                  begin
                  begin
                    doconv:=tc_equal;
                    doconv:=tc_equal;
-                   eq:=te_equal;
+                   { exact, not equal, because can change between interface
+                     and implementation }
+                   eq:=te_exact;
                  end
                  end
                { object pascal objects }
                { object pascal objects }
                else if (def_from.typ=objectdef) and
                else if (def_from.typ=objectdef) and

+ 22 - 23
compiler/finput.pas

@@ -26,7 +26,7 @@ unit finput;
 interface
 interface
 
 
     uses
     uses
-      cutils,cclasses;
+      cutils,cclasses,cstreams;
 
 
     const
     const
        InputFileBufSize=32*1024+1;
        InputFileBufSize=32*1024+1;
@@ -91,7 +91,7 @@ interface
          function fileclose: boolean; override;
          function fileclose: boolean; override;
          procedure filegettime; override;
          procedure filegettime; override;
        private
        private
-         f            : file;       { current file handle }
+         f            : TCCustomFileStream;       { current file handle }
        end;
        end;
 
 
        tinputfilemanager = class
        tinputfilemanager = class
@@ -457,47 +457,46 @@ uses
             exit;
             exit;
           end;
           end;
         { Open file }
         { Open file }
-        ofm:=filemode;
-        filemode:=0;
-        Assign(f,filename);
-        {$I-}
-         reset(f,1);
-        {$I+}
-        filemode:=ofm;
-        fileopen:=(ioresult=0);
+        fileopen:=false;
+        try
+          f:=CFileStreamClass.Create(filename,fmOpenRead);
+          fileopen:=true;
+        except
+        end;
       end;
       end;
 
 
 
 
     function tdosinputfile.fileseek(pos: longint): boolean;
     function tdosinputfile.fileseek(pos: longint): boolean;
       begin
       begin
-        {$I-}
-         seek(f,Pos);
-        {$I+}
-        fileseek:=(ioresult=0);
+        fileseek:=false;
+        try
+          f.position:=Pos;
+          fileseek:=true;
+        except
+        end;
       end;
       end;
 
 
 
 
     function tdosinputfile.fileread(var databuf; maxsize: longint): longint;
     function tdosinputfile.fileread(var databuf; maxsize: longint): longint;
-      var
-        w : longint;
       begin
       begin
-        blockread(f,databuf,maxsize,w);
-        fileread:=w;
+        fileread:=f.Read(databuf,maxsize);
       end;
       end;
 
 
 
 
     function tdosinputfile.fileeof: boolean;
     function tdosinputfile.fileeof: boolean;
       begin
       begin
-        fileeof:=eof(f);
+        fileeof:=f.eof();
       end;
       end;
 
 
 
 
     function tdosinputfile.fileclose: boolean;
     function tdosinputfile.fileclose: boolean;
       begin
       begin
-        {$I-}
-         system.close(f);
-        {$I+}
-        fileclose:=(ioresult=0);
+        fileclose:=false;
+        try
+          f.Free;
+          fileclose:=true;
+        except
+        end;
       end;
       end;
 
 
 
 

+ 2 - 14
compiler/fmodule.pas

@@ -544,7 +544,6 @@ implementation
     destructor tmodule.Destroy;
     destructor tmodule.Destroy;
       var
       var
         i : longint;
         i : longint;
-        hpi : tprocinfo;
       begin
       begin
         if assigned(unitmap) then
         if assigned(unitmap) then
           freemem(unitmap);
           freemem(unitmap);
@@ -582,12 +581,7 @@ implementation
                 current_specializedef:=nil;
                 current_specializedef:=nil;
               end;
               end;
             { release procinfo tree }
             { release procinfo tree }
-            while assigned(procinfo) do
-             begin
-               hpi:=tprocinfo(procinfo).parent;
-               tprocinfo(procinfo).free;
-               procinfo:=hpi;
-             end;
+            tprocinfo(procinfo).destroy_tree;
           end;
           end;
         DoneDebugInfo(self);
         DoneDebugInfo(self);
         used_units.free;
         used_units.free;
@@ -642,7 +636,6 @@ implementation
 
 
     procedure tmodule.reset;
     procedure tmodule.reset;
       var
       var
-        hpi : tprocinfo;
         i   : longint;
         i   : longint;
       begin
       begin
         if assigned(scanner) then
         if assigned(scanner) then
@@ -664,12 +657,7 @@ implementation
                 current_specializedef:=nil;
                 current_specializedef:=nil;
               end;
               end;
             { release procinfo tree }
             { release procinfo tree }
-            while assigned(procinfo) do
-             begin
-               hpi:=tprocinfo(procinfo).parent;
-               tprocinfo(procinfo).free;
-               procinfo:=hpi;
-             end;
+            tprocinfo(procinfo).destroy_tree;
           end;
           end;
         if assigned(asmdata) then
         if assigned(asmdata) then
           begin
           begin

+ 30 - 2
compiler/globals.pas

@@ -26,7 +26,7 @@ unit globals;
 interface
 interface
 
 
     uses
     uses
-{$ifdef win32}
+{$ifdef windows}
       windows,
       windows,
 {$endif}
 {$endif}
 {$ifdef os2}
 {$ifdef os2}
@@ -476,6 +476,13 @@ implementation
     uses
     uses
 {$ifdef macos}
 {$ifdef macos}
       macutils,
       macutils,
+{$endif}
+{$ifdef mswindows}
+{$ifdef VER2_4}
+      cwindirs,
+{$else VER2_4}
+      windirs,
+{$endif VER2_4}
 {$endif}
 {$endif}
       comphook;
       comphook;
 
 
@@ -718,7 +725,18 @@ implementation
                           Default Macro Handling
                           Default Macro Handling
 ****************************************************************************}
 ****************************************************************************}
 
 
+
      procedure DefaultReplacements(var s:ansistring);
      procedure DefaultReplacements(var s:ansistring);
+{$ifdef mswindows}
+       procedure ReplaceSpecialFolder(const MacroName: string; const ID: integer);
+         begin
+           // Only try to receive the special folders (and thus dynamically
+           // load shfolder.dll) when that's needed.
+           if pos(MacroName,s)>0 then
+             Replace(s,MacroName,GetWindowsSpecialDir(ID));
+         end;
+
+{$endif mswindows}
        var
        var
          envstr: string;
          envstr: string;
          envvalue: pchar;
          envvalue: pchar;
@@ -734,6 +752,15 @@ implementation
            Replace(s,'$FPCTARGET',target_os_string)
            Replace(s,'$FPCTARGET',target_os_string)
          else
          else
            Replace(s,'$FPCTARGET',target_full_string);
            Replace(s,'$FPCTARGET',target_full_string);
+{$ifdef mswindows}
+         ReplaceSpecialFolder('$LOCAL_APPDATA',CSIDL_LOCAL_APPDATA);
+         ReplaceSpecialFolder('$APPDATA',CSIDL_APPDATA);
+         ReplaceSpecialFolder('$COMMON_APPDATA',CSIDL_COMMON_APPDATA);
+         ReplaceSpecialFolder('$PERSONAL',CSIDL_PERSONAL);
+         ReplaceSpecialFolder('$PROGRAM_FILES',CSIDL_PROGRAM_FILES);
+         ReplaceSpecialFolder('$PROGRAM_FILES_COMMON',CSIDL_PROGRAM_FILES_COMMON);
+         ReplaceSpecialFolder('$PROFILE',CSIDL_PROFILE);
+{$endif mswindows}
          { Replace environment variables between dollar signs }
          { Replace environment variables between dollar signs }
          i := pos('$',s);
          i := pos('$',s);
          while i>0 do
          while i>0 do
@@ -980,7 +1007,8 @@ implementation
          'SAFECALL',
          'SAFECALL',
          'STDCALL',
          'STDCALL',
          'SOFTFLOAT',
          'SOFTFLOAT',
-         'MWPASCAL'
+         'MWPASCAL',
+         'INTERRUPT'
         );
         );
       var
       var
         t  : tproccalloption;
         t  : tproccalloption;

+ 5 - 2
compiler/globtype.pas

@@ -360,7 +360,9 @@ interface
          pocall_softfloat,
          pocall_softfloat,
          { Metrowerks Pascal. Special case on Mac OS (X): passes all }
          { Metrowerks Pascal. Special case on Mac OS (X): passes all }
          { constant records by reference.                            }
          { constant records by reference.                            }
-         pocall_mwpascal
+         pocall_mwpascal,
+         { Special interrupt handler for embedded systems }
+         pocall_interrupt
        );
        );
        tproccalloptions = set of tproccalloption;
        tproccalloptions = set of tproccalloption;
 
 
@@ -377,7 +379,8 @@ interface
            'SafeCall',
            'SafeCall',
            'StdCall',
            'StdCall',
            'SoftFloat',
            'SoftFloat',
-           'MWPascal'
+           'MWPascal',
+           'Interrupt'
          );
          );
 
 
        { Default calling convention }
        { Default calling convention }

+ 1 - 1
compiler/i386/ag386nsm.pas

@@ -445,7 +445,7 @@ interface
 
 
     procedure T386NasmAssembler.WriteSection(atype:TAsmSectiontype;const aname:string);
     procedure T386NasmAssembler.WriteSection(atype:TAsmSectiontype;const aname:string);
       const
       const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text',
           '.text',
           '.data',
           '.data',
           '.data',
           '.data',

+ 10 - 28
compiler/i386/cgcpu.pas

@@ -371,6 +371,9 @@ unit cgcpu;
         getcpuregister(list,NR_EDI);
         getcpuregister(list,NR_EDI);
         a_load_loc_reg(list,OS_INT,lenloc,NR_EDI);
         a_load_loc_reg(list,OS_INT,lenloc,NR_EDI);
         list.concat(Taicpu.op_reg(A_INC,S_L,NR_EDI));
         list.concat(Taicpu.op_reg(A_INC,S_L,NR_EDI));
+        { Now EDI contains (high+1). Copy it to ECX for later use. }
+        getcpuregister(list,NR_ECX);
+        list.concat(Taicpu.op_reg_reg(A_MOV,S_L,NR_EDI,NR_ECX));
         if (elesize<>1) then
         if (elesize<>1) then
          begin
          begin
            if ispowerof2(elesize, power) then
            if ispowerof2(elesize, power) then
@@ -394,43 +397,22 @@ unit cgcpu;
              a_jmp_always(list,again);
              a_jmp_always(list,again);
 
 
              a_label(list,ok);
              a_label(list,ok);
-             list.concat(Taicpu.op_reg_reg(A_SUB,S_L,NR_EDI,NR_ESP));
-             ungetcpuregister(list,NR_EDI);
-             { now reload EDI }
-             getcpuregister(list,NR_EDI);
-             a_load_loc_reg(list,OS_INT,lenloc,NR_EDI);
-             list.concat(Taicpu.op_reg(A_INC,S_L,NR_EDI));
-
-             if (elesize<>1) then
-              begin
-                if ispowerof2(elesize, power) then
-                  list.concat(Taicpu.op_const_reg(A_SHL,S_L,power,NR_EDI))
-                else
-                  list.concat(Taicpu.op_const_reg(A_IMUL,S_L,elesize,NR_EDI));
-              end;
-          end
-        else
+          end;
 {$endif __NOWINPECOFF__}
 {$endif __NOWINPECOFF__}
-          list.concat(Taicpu.op_reg_reg(A_SUB,S_L,NR_EDI,NR_ESP));
+        { If we were probing pages, EDI=(size mod pagesize) and ESP is decremented
+          by (size div pagesize)*pagesize, otherwise EDI=size.
+          Either way, subtracting EDI from ESP will set ESP to desired final value. }
+        list.concat(Taicpu.op_reg_reg(A_SUB,S_L,NR_EDI,NR_ESP));
         { align stack on 4 bytes }
         { align stack on 4 bytes }
         list.concat(Taicpu.op_const_reg(A_AND,S_L,aint($fffffff4),NR_ESP));
         list.concat(Taicpu.op_const_reg(A_AND,S_L,aint($fffffff4),NR_ESP));
         { load destination, don't use a_load_reg_reg, that will add a move instruction
         { load destination, don't use a_load_reg_reg, that will add a move instruction
           that can confuse the reg allocator }
           that can confuse the reg allocator }
         list.concat(Taicpu.Op_reg_reg(A_MOV,S_L,NR_ESP,NR_EDI));
         list.concat(Taicpu.Op_reg_reg(A_MOV,S_L,NR_ESP,NR_EDI));
 
 
-        { Allocate other registers }
-        getcpuregister(list,NR_ECX);
+        { Allocate ESI and load it with source }
         getcpuregister(list,NR_ESI);
         getcpuregister(list,NR_ESI);
-
-        { load count }
-        a_load_loc_reg(list,OS_INT,lenloc,NR_ECX);
-
-        { load source }
         a_loadaddr_ref_reg(list,ref,NR_ESI);
         a_loadaddr_ref_reg(list,ref,NR_ESI);
 
 
-        { scheduled .... }
-        list.concat(Taicpu.op_reg(A_INC,S_L,NR_ECX));
-
         { calculate size }
         { calculate size }
         len:=elesize;
         len:=elesize;
         opsize:=S_B;
         opsize:=S_B;
@@ -446,7 +428,7 @@ unit cgcpu;
             len:=len shr 1;
             len:=len shr 1;
           end;
           end;
 
 
-        if len<>0 then
+        if len>1 then
           begin
           begin
             if ispowerof2(len, power) then
             if ispowerof2(len, power) then
               list.concat(Taicpu.op_const_reg(A_SHL,S_L,power,NR_ECX))
               list.concat(Taicpu.op_const_reg(A_SHL,S_L,power,NR_ECX))

+ 78 - 1
compiler/i386/i386att.inc

@@ -602,5 +602,82 @@
 'insertq',
 'insertq',
 'extrq',
 'extrq',
 'lzcnt',
 'lzcnt',
-'popcnt'
+'pabsb',
+'pabsw',
+'pabsd',
+'palignr',
+'phaddw',
+'phaddd',
+'phaddsw',
+'phsubw',
+'phsubd',
+'phsubsw',
+'pmaddubsw',
+'pmulhrsw',
+'pshufb',
+'psignb',
+'psignw',
+'psignd',
+'blendps',
+'blendpd',
+'blendvps',
+'blendvpd',
+'dpps',
+'dppd',
+'extractps',
+'insertps',
+'movntdqa',
+'mpsadbw',
+'packusdw',
+'pblendvb',
+'pblendw',
+'pcmpeqq',
+'pextrb',
+'pextrd',
+'pextrq',
+'phminposuw',
+'pinsrb',
+'pinsrd',
+'pinsrq',
+'pmaxsb',
+'pmaxsd',
+'pmaxud',
+'pmaxuw',
+'pminsb',
+'pminsd',
+'pminuw',
+'pminud',
+'pmovsxbw',
+'pmovsxbd',
+'pmovsxbq',
+'pmovsxwd',
+'pmovsxwq',
+'pmovsxdq',
+'pmovzxbw',
+'pmovzxbd',
+'pmovzxbq',
+'pmovzxwd',
+'pmovzxwq',
+'pmovzxdq',
+'pmuldq',
+'ptest',
+'roundps',
+'roundpd',
+'roundss',
+'roundsd',
+'pcmpestri',
+'pcmpestrm',
+'pcmpistri',
+'pcmpistrm',
+'pcmpgtq',
+'popcnt',
+'aesenc',
+'aesenclast',
+'aesdec',
+'aesdeclast',
+'aesimc',
+'aeskeygen',
+'stosq',
+'lodsq',
+'cmpsq'
 );
 );

+ 78 - 1
compiler/i386/i386atts.inc

@@ -602,5 +602,82 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufINT,
 attsufINT,
-attsufINT
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufINT,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE
 );
 );

+ 78 - 1
compiler/i386/i386int.inc

@@ -602,5 +602,82 @@
 'insertq',
 'insertq',
 'extrq',
 'extrq',
 'lzcnt',
 'lzcnt',
-'popcnt'
+'pabsb',
+'pabsw',
+'pabsd',
+'palignr',
+'phaddw',
+'phaddd',
+'phaddsw',
+'phsubw',
+'phsubd',
+'phsubsw',
+'pmaddubsw',
+'pmulhrsw',
+'pshufb',
+'psignb',
+'psignw',
+'psignd',
+'blendps',
+'blendpd',
+'blendvps',
+'blendvpd',
+'dpps',
+'dppd',
+'extractps',
+'insertps',
+'movntdqa',
+'mpsadbw',
+'packusdw',
+'pblendvb',
+'pblendw',
+'pcmpeqq',
+'pextrb',
+'pextrd',
+'pextrq',
+'phminposuw',
+'pinsrb',
+'pinsrd',
+'pinsrq',
+'pmaxsb',
+'pmaxsd',
+'pmaxud',
+'pmaxuw',
+'pminsb',
+'pminsd',
+'pminuw',
+'pminud',
+'pmovsxbw',
+'pmovsxbd',
+'pmovsxbq',
+'pmovsxwd',
+'pmovsxwq',
+'pmovsxdq',
+'pmovzxbw',
+'pmovzxbd',
+'pmovzxbq',
+'pmovzxwd',
+'pmovzxwq',
+'pmovzxdq',
+'pmuldq',
+'ptest',
+'roundps',
+'roundpd',
+'roundss',
+'roundsd',
+'pcmpestri',
+'pcmpestrm',
+'pcmpistri',
+'pcmpistrm',
+'pcmpgtq',
+'popcnt',
+'aesenc',
+'aesenclast',
+'aesdec',
+'aesdeclast',
+'aesimc',
+'aeskeygen',
+'stosq',
+'lodsq',
+'cmpsq'
 );
 );

+ 1 - 1
compiler/i386/i386nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
 { don't edit, this file is generated from x86ins.dat }
-1380;
+1560;

+ 78 - 1
compiler/i386/i386op.inc

@@ -602,5 +602,82 @@ A_MOVNTSD,
 A_INSERTQ,
 A_INSERTQ,
 A_EXTRQ,
 A_EXTRQ,
 A_LZCNT,
 A_LZCNT,
-A_POPCNT
+A_PABSB,
+A_PABSW,
+A_PABSD,
+A_PALIGNR,
+A_PHADDW,
+A_PHADDD,
+A_PHADDSW,
+A_PHSUBW,
+A_PHSUBD,
+A_PHSUBSW,
+A_PMADDUBSW,
+A_PMULHRSW,
+A_PSHUFB,
+A_PSIGNB,
+A_PSIGNW,
+A_PSIGND,
+A_BLENDPS,
+A_BLENDPD,
+A_BLENDVPS,
+A_BLENDVPD,
+A_DPPS,
+A_DPPD,
+A_EXTRACTPS,
+A_INSERTPS,
+A_MOVNTDQA,
+A_MPSADBW,
+A_PACKUSDW,
+A_PBLENDVB,
+A_PBLENDW,
+A_PCMPEQQ,
+A_PEXTRB,
+A_PEXTRD,
+A_PEXTRQ,
+A_PHMINPOSUW,
+A_PINSRB,
+A_PINSRD,
+A_PINSRQ,
+A_PMAXSB,
+A_PMAXSD,
+A_PMAXUD,
+A_PMAXUW,
+A_PMINSB,
+A_PMINSD,
+A_PMINUW,
+A_PMINUD,
+A_PMOVSXBW,
+A_PMOVSXBD,
+A_PMOVSXBQ,
+A_PMOVSXWD,
+A_PMOVSXWQ,
+A_PMOVSXDQ,
+A_PMOVZXBW,
+A_PMOVZXBD,
+A_PMOVZXBQ,
+A_PMOVZXWD,
+A_PMOVZXWQ,
+A_PMOVZXDQ,
+A_PMULDQ,
+A_PTEST,
+A_ROUNDPS,
+A_ROUNDPD,
+A_ROUNDSS,
+A_ROUNDSD,
+A_PCMPESTRI,
+A_PCMPESTRM,
+A_PCMPISTRI,
+A_PCMPISTRM,
+A_PCMPGTQ,
+A_POPCNT,
+A_AESENC,
+A_AESENCLAST,
+A_AESDEC,
+A_AESDECLAST,
+A_AESIMC,
+A_AESKEYGEN,
+A_STOSQ,
+A_LODSQ,
+A_CMPSQ
 );
 );

+ 77 - 0
compiler/i386/i386prop.inc

@@ -602,5 +602,82 @@
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_RRAX, Ch_WMemEDI, Ch_RWRDI)),
+(Ch: (Ch_WRAX, Ch_RWRSI, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None))
 (Ch: (Ch_All, Ch_None, Ch_None))
 );
 );

+ 1270 - 10
compiler/i386/i386tab.inc

@@ -7796,7 +7796,14 @@
     ops     : 3;
     ops     : 3;
     optypes : (ot_reg32,ot_xmmreg,ot_immediate);
     optypes : (ot_reg32,ot_xmmreg,ot_immediate);
     code    : #1#102#211#2#15#197#72#22;
     code    : #1#102#211#2#15#197#72#22;
-    flags   : if_willamette or if_sse2 or if_sb or if_ar2
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRW;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#21#65#22;
+    flags   : if_sse4
   ),
   ),
   (
   (
     opcode  : A_PINSRW;
     opcode  : A_PINSRW;
@@ -9608,7 +9615,7 @@
     opcode  : A_MOVNTSD;
     opcode  : A_MOVNTSD;
     ops     : 2;
     ops     : 2;
     optypes : (ot_memory,ot_xmmreg,ot_none);
     optypes : (ot_memory,ot_xmmreg,ot_none);
-    code    : #192#220#213#211#2#15#43#0#65;
+    code    : #192#220#213#211#2#15#43#65;
     flags   : if_sse4
     flags   : if_sse4
   ),
   ),
   (
   (
@@ -9647,17 +9654,1270 @@
     flags   : if_386 or if_sm or if_sse4
     flags   : if_386 or if_sm or if_sse4
   ),
   ),
   (
   (
-    opcode  : A_POPCNT;
+    opcode  : A_PABSB;
     ops     : 2;
     ops     : 2;
-    optypes : (ot_reg16,ot_regmem,ot_none);
-    code    : #208#219#193#211#2#15#184#72;
-    flags   : if_386 or if_sm or if_sse4
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#28#72;
+    flags   : if_sse4
   ),
   ),
   (
   (
-    opcode  : A_POPCNT;
+    opcode  : A_PABSB;
     ops     : 2;
     ops     : 2;
-    optypes : (ot_reg32 or ot_bits64,ot_regmem,ot_none);
-    code    : #209#219#193#211#2#15#184#72;
-    flags   : if_386 or if_sm or if_sse4
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_immediate);
+    code    : #217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_mmxreg,ot_memory,ot_immediate);
+    code    : #193#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg or ot_signed,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#12#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg or ot_signed,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#12#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#2#15#58#253#1#13#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#2#15#58#253#1#13#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#20#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#20#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#21#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#21#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#64#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#64#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#65#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#65#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_EXTRACTPS;
+    ops     : 3;
+    optypes : (ot_memory,ot_xmmreg,ot_immediate);
+    code    : #1#102#213#3#15#58#23#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_EXTRACTPS;
+    ops     : 3;
+    optypes : (ot_reg32 or ot_bits64,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#3#15#58#23#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_INSERTPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#33#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_INSERTPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#33#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MOVNTDQA;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#42#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MPSADBW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#66#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MPSADBW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#66#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PACKUSDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#43#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PACKUSDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#43#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDVB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#16#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDVB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#16#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate or ot_signed);
+    code    : #1#102#217#3#15#58#14#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate or ot_signed);
+    code    : #1#102#193#217#3#15#58#14#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPEQQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#41#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPEQQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#41#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRB;
+    ops     : 3;
+    optypes : (ot_reg32,ot_xmmreg,ot_immediate);
+    code    : #1#102#211#3#15#58#20#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRB;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits8,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#20#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRD;
+    ops     : 3;
+    optypes : (ot_reg32,ot_xmmreg,ot_immediate);
+    code    : #1#102#211#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRD;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRQ;
+    ops     : 3;
+    optypes : (ot_reg64,ot_xmmreg,ot_immediate);
+    code    : #1#102#214#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRQ;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits64,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#214#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHMINPOSUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#65#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHMINPOSUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#65#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRB;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg32,ot_immediate);
+    code    : #1#102#217#3#15#58#32#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRB;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits8,ot_immediate);
+    code    : #1#102#193#217#3#15#58#32#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg32,ot_immediate);
+    code    : #1#102#217#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits32,ot_immediate);
+    code    : #1#102#193#217#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRQ;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg64,ot_immediate);
+    code    : #1#102#214#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRQ;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits64,ot_immediate);
+    code    : #1#102#193#214#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#60#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#60#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#61#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#61#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#63#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#63#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#62#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#62#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#56#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#56#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#57#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#57#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#58#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#58#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#59#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#59#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#32#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#32#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#33#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#33#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#34#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#34#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#35#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#35#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#36#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#36#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#37#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#37#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#48#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#48#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#49#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#49#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#50#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#50#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#51#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#51#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#52#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#52#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#53#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#53#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#40#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#40#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PTEST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#23#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#8#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#8#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#9#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#9#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#10#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#10#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#11#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#11#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#97#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#97#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#96#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#96#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#99#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#99#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#98#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#98#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPGTQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#55#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPGTQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#55#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg16,ot_regmem or ot_bits16,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg32,ot_regmem or ot_bits32,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg64,ot_regmem or ot_bits64,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_AESENC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#220#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#220#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENCLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#221#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENCLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#221#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDEC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#222#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDEC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#222#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDECLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#223#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDECLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#223#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESIMC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#219#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESIMC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#219#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESKEYGEN;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#223#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESKEYGEN;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#223#72#22;
+    flags   : if_sse4
   )
   )
 );
 );

+ 4 - 1
compiler/link.pas

@@ -150,7 +150,7 @@ Implementation
       begin
       begin
         result:=0;
         result:=0;
         bufsize:=64*1024;
         bufsize:=64*1024;
-	      fs:=TCFileStream.Create(fn,fmOpenRead or fmShareDenyNone);
+	      fs:=CFileStreamClass.Create(fn,fmOpenRead or fmShareDenyNone);
 	      if CStreamError<>0 then
 	      if CStreamError<>0 then
 	        begin
 	        begin
 	          fs.Free;
 	          fs.Free;
@@ -1051,6 +1051,9 @@ Implementation
         if ErrorCount>0 then
         if ErrorCount>0 then
           goto myexit;
           goto myexit;
 
 
+        { parse linker options specific for output format }
+        exeoutput.ParseScript (linkscript);
+
         { Create .exe sections and add .o sections }
         { Create .exe sections and add .o sections }
         ParseScript_Order;
         ParseScript_Order;
         exeoutput.RemoveUnreferencedSections;
         exeoutput.RemoveUnreferencedSections;

+ 1 - 1
compiler/msg/errorct.msg

@@ -2100,7 +2100,7 @@ option_code_page_not_available=11039_E_La p
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler versió $FPCFULLVERSION [$FPCDATE] per $FPCCPU
 Free Pascal Compiler versió $FPCFULLVERSION [$FPCDATE] per $FPCCPU
-Copyright (c) 1993-2010 per Florian Klaempfl
+Copyright (c) 1993-2011 per Florian Klaempfl
 ]
 ]
 
 
 #
 #

Разлика између датотеке није приказан због своје велике величине
+ 153 - 153
compiler/msg/errord.msg


+ 1 - 1
compiler/msg/errorda.msg

@@ -2207,7 +2207,7 @@ option_config_is_dir=11040_F_Konfigurationsfilen $1 er et directory
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] til $FPCTARGET
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] til $FPCTARGET
-Copyright (c) 1993-2010 Florian Klaempfl
+Copyright (c) 1993-2011 Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errordu.msg

@@ -2991,7 +2991,7 @@ wpo_cant_create_feedback_file=12019_E_Die angegebene Feedback-Eingabe-Datei "$1"
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler Version $FPCFULLVERSION [$FPCDATE] für $FPCTARGET
 Free Pascal Compiler Version $FPCFULLVERSION [$FPCDATE] für $FPCTARGET
-Copyright (c) 1993-2010 Florian Klämpfl
+Copyright (c) 1993-2011 Florian Klämpfl und andere
 ]
 ]
 
 
 #
 #

+ 5 - 1
compiler/msg/errore.msg

@@ -1366,6 +1366,10 @@ parser_e_cant_use_type_parameters_here=03304_E_Type parameters may require initi
 % Type parameters may be specialized with types which (e.g. \var{ansistring}) need initialization/finalization
 % Type parameters may be specialized with types which (e.g. \var{ansistring}) need initialization/finalization
 % code which is implicitly generated by the compiler. 
 % code which is implicitly generated by the compiler. 
 % \end{description}
 % \end{description}
+parser_e_externals_no_section=03305_E_Variables being declared as external cannot be in a custom section
+% A section directive is not valid for variables being declared as external.
+parser_e_section_no_locals=03306_E_Non-static and non-global variables cannot have a section directive
+% A variable placed in a custom section is always statically allocated so it must be either a static or global variable.
 # Type Checking
 # Type Checking
 #
 #
 # 04095 is the last used one
 # 04095 is the last used one
@@ -2966,7 +2970,7 @@ wpo_cant_create_feedback_file=12019_E_Cannot create specified whole program opti
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl and others
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errores.msg

@@ -2111,7 +2111,7 @@ option_code_page_not_available=11039_E_C
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorf.msg

@@ -1712,7 +1712,7 @@ option_asm_forced=11022_W_"$1" assembler use forced
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Compilateur Free Pascal version $FPCFULLVERSION [$FPCDATE] pour $FPCTARGET
 Compilateur Free Pascal version $FPCFULLVERSION [$FPCDATE] pour $FPCTARGET
-Copyright (c) 1998-2009 by Florian Klaempfl
+Copyright (c) 1998-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorfi.msg

@@ -2258,7 +2258,7 @@ option_config_is_dir=11040_F_Le fichier de configuration $1 est un r
 # Logo (option -l)
 # Logo (option -l)
 #
 #
 option_logo=11023_[ Compilateur Free Pascal version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
 option_logo=11023_[ Compilateur Free Pascal version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2010, Florian Klaempfl ]
+Copyright (c) 1993-2011, Florian Klaempfl ]
 #
 #
 # Info (option -i)
 # Info (option -i)
 #
 #

+ 1 - 1
compiler/msg/errorhe.msg

@@ -2404,7 +2404,7 @@ option_confict_asm_debug=11041_W_
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorheu.msg

@@ -2404,7 +2404,7 @@ option_confict_asm_debug=11041_W_סוג הפלט של המאסף שנבחר "$1"
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorid.msg

@@ -2421,7 +2421,7 @@ option_confict_asm_debug=11041_W_Output assembler yang dipilih "$1" tidak bisa m
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler versi $FPCFULLVERSION [$FPCDATE] untuk $FPCCPU
 Free Pascal Compiler versi $FPCFULLVERSION [$FPCDATE] untuk $FPCCPU
-Hak Cipta (c) 1993-2010 oleh Florian Klaempfl
+Hak Cipta (c) 1993-2011 oleh Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorn.msg

@@ -2183,7 +2183,7 @@ option_config_is_dir=11040_F_Config bestand $1 is een directorie
 %\end{description}
 %\end{description}
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler versie $FPCFULLVERSION [$FPCDATE] voor $FPCTARGET
 Free Pascal Compiler versie $FPCFULLVERSION [$FPCDATE] voor $FPCTARGET
-Copyright (c) 1998-2009 door Florian Klaempfl en anderen
+Copyright (c) 1998-2011 door Florian Klaempfl en anderen
 ]
 ]
 #
 #
 # Info (option -i)
 # Info (option -i)

+ 1 - 1
compiler/msg/errorpl.msg

@@ -2116,7 +2116,7 @@ option_code_page_not_available=11039_E_Nieznana strona kodowa
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler wersja $FPCFULLVERSION [$FPCDATE] dla $FPCCPU
 Free Pascal Compiler wersja $FPCFULLVERSION [$FPCDATE] dla $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorpli.msg

@@ -2116,7 +2116,7 @@ option_code_page_not_available=11039_E_Nieznana strona kodowa
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler wersja $FPCFULLVERSION [$FPCDATE] dla $FPCCPU
 Free Pascal Compiler wersja $FPCFULLVERSION [$FPCDATE] dla $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorpt.msg

@@ -2905,7 +2905,7 @@ wpo_cant_create_feedback_file=12019_E_Imposs
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Compilador Free Pascal versÆo $FPCFULLVERSION [$FPCDATE] para $FPCCPU
 Compilador Free Pascal versÆo $FPCFULLVERSION [$FPCDATE] para $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorptu.msg

@@ -2905,7 +2905,7 @@ wpo_cant_create_feedback_file=12019_E_Impossível criar arquivo retorno otimiza
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Compilador Free Pascal versão $FPCFULLVERSION [$FPCDATE] para $FPCCPU
 Compilador Free Pascal versão $FPCFULLVERSION [$FPCDATE] para $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorr.msg

@@ -2503,7 +2503,7 @@ wpo_cant_create_feedback_file=12019_E_
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Š®¬¯¨«ïâ®à Free Pascal ¢¥àᨨ $FPCFULLVERSION [$FPCDATE] ¤«ï $FPCCPU
 Š®¬¯¨«ïâ®à Free Pascal ¢¥àᨨ $FPCFULLVERSION [$FPCDATE] ¤«ï $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorru.msg

@@ -2503,7 +2503,7 @@ wpo_cant_create_feedback_file=12019_E_Невозможно создать фай
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Компилятор Free Pascal версии $FPCFULLVERSION [$FPCDATE] для $FPCCPU
 Компилятор Free Pascal версии $FPCFULLVERSION [$FPCDATE] для $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 1 - 1
compiler/msg/errorues.msg

@@ -2105,7 +2105,7 @@ option_code_page_not_available=11039_E_Código de página desconocido
 #
 #
 option_logo=11023_[
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2010 by Florian Klaempfl
+Copyright (c) 1993-2011 by Florian Klaempfl
 ]
 ]
 
 
 #
 #

+ 4 - 2
compiler/msgidx.inc

@@ -393,6 +393,8 @@ const
   parser_e_no_constructor_in_records=03302;
   parser_e_no_constructor_in_records=03302;
   parser_e_at_least_one_argument_must_be_of_type=03303;
   parser_e_at_least_one_argument_must_be_of_type=03303;
   parser_e_cant_use_type_parameters_here=03304;
   parser_e_cant_use_type_parameters_here=03304;
+  parser_e_externals_no_section=03305;
+  parser_e_section_no_locals=03306;
   type_e_mismatch=04000;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
   type_e_not_equal_types=04002;
@@ -882,9 +884,9 @@ const
   option_info=11024;
   option_info=11024;
   option_help_pages=11025;
   option_help_pages=11025;
 
 
-  MsgTxtSize = 58686;
+  MsgTxtSize = 58848;
 
 
   MsgIdxMax : array[1..20] of longint=(
   MsgIdxMax : array[1..20] of longint=(
-    24,88,305,99,84,54,111,22,202,63,
+    24,88,307,99,84,54,111,22,202,63,
     49,20,1,1,1,1,1,1,1,1
     49,20,1,1,1,1,1,1,1,1
   );
   );

+ 376 - 371
compiler/msgtxt.inc

@@ -1,7 +1,7 @@
 {$ifdef Delphi}
 {$ifdef Delphi}
-const msgtxt : array[0..000244] of string[240]=(
+const msgtxt : array[0..000245] of string[240]=(
 {$else Delphi}
 {$else Delphi}
-const msgtxt : array[0..000244,1..240] of char=(
+const msgtxt : array[0..000245,1..240] of char=(
 {$endif Delphi}
 {$endif Delphi}
   '01000_T_Compiler: $1'#000+
   '01000_T_Compiler: $1'#000+
   '01001_D_Compiler OS: $1'#000+
   '01001_D_Compiler OS: $1'#000+
@@ -477,582 +477,587 @@ const msgtxt : array[0..000244,1..240] of char=(
   '1"'#000+
   '1"'#000+
   '03304_E_Type parameters may require initialization/finalization - can'#039+
   '03304_E_Type parameters may require initialization/finalization - can'#039+
   't be used in variant r','ecords'#000+
   't be used in variant r','ecords'#000+
+  '03305_E_Variables being declared as external cannot be in a custom sec'+
+  'tion'#000+
+  '03306_E_Non-static and non-global variables cannot have a section dire'+
+  'ctive'#000+
   '04000_E_Type mismatch'#000+
   '04000_E_Type mismatch'#000+
   '04001_E_Incompatible types: got "$1" expected "$2"'#000+
   '04001_E_Incompatible types: got "$1" expected "$2"'#000+
-  '04002_E_Type mismatch between "$1" and "$2"'#000+
+  '04002_E_T','ype mismatch between "$1" and "$2"'#000+
   '04003_E_Type identifier expected'#000+
   '04003_E_Type identifier expected'#000+
   '04004_E_Variable identifier expected'#000+
   '04004_E_Variable identifier expected'#000+
-  '04005_E_Integer expression expected, but got "','$1"'#000+
+  '04005_E_Integer expression expected, but got "$1"'#000+
   '04006_E_Boolean expression expected, but got "$1"'#000+
   '04006_E_Boolean expression expected, but got "$1"'#000+
-  '04007_E_Ordinal expression expected'#000+
+  '04007_E_Ordinal expression expected',#000+
   '04008_E_pointer type expected, but got "$1"'#000+
   '04008_E_pointer type expected, but got "$1"'#000+
   '04009_E_class type expected, but got "$1"'#000+
   '04009_E_class type expected, but got "$1"'#000+
   '04011_E_Can'#039't evaluate constant expression'#000+
   '04011_E_Can'#039't evaluate constant expression'#000+
-  '04012_E_Set elements ','are not compatible'#000+
+  '04012_E_Set elements are not compatible'#000+
   '04013_E_Operation not implemented for sets'#000+
   '04013_E_Operation not implemented for sets'#000+
-  '04014_W_Automatic type conversion from floating type to COMP which is '+
-  'an integer type'#000+
+  '04014_W_Automatic type conv','ersion from floating type to COMP which i'+
+  's an integer type'#000+
   '04015_H_use DIV instead to get an integer result'#000+
   '04015_H_use DIV instead to get an integer result'#000+
-  '04016_E_String types have to match exactly ','in $V+ mode'#000+
+  '04016_E_String types have to match exactly in $V+ mode'#000+
   '04017_E_succ or pred on enums with assignments not possible'#000+
   '04017_E_succ or pred on enums with assignments not possible'#000+
-  '04018_E_Can'#039't read or write variables of this type'#000+
+  '04018_E_Can'#039't rea','d or write variables of this type'#000+
   '04019_E_Can'#039't use readln or writeln on typed file'#000+
   '04019_E_Can'#039't use readln or writeln on typed file'#000+
   '04020_E_Can'#039't use read or write on untyped file.'#000+
   '04020_E_Can'#039't use read or write on untyped file.'#000+
-  '04021_E_Type confl','ict between set elements'#000+
+  '04021_E_Type conflict between set elements'#000+
   '04022_W_lo/hi(dword/qword) returns the upper/lower word/dword'#000+
   '04022_W_lo/hi(dword/qword) returns the upper/lower word/dword'#000+
-  '04023_E_Integer or real expression expected'#000+
+  '04','023_E_Integer or real expression expected'#000+
   '04024_E_Wrong type "$1" in array constructor'#000+
   '04024_E_Wrong type "$1" in array constructor'#000+
-  '04025_E_Incompatible type for arg no. $1: Got "$2", expected "$3','"'#000+
+  '04025_E_Incompatible type for arg no. $1: Got "$2", expected "$3"'#000+
   '04026_E_Method (variable) and Procedure (variable) are not compatible'#000+
   '04026_E_Method (variable) and Procedure (variable) are not compatible'#000+
-  '04027_E_Illegal constant passed to internal math function'#000+
+  '04027_E_Illegal c','onstant passed to internal math function'#000+
   '04028_E_Can'#039't take the address of constant expressions'#000+
   '04028_E_Can'#039't take the address of constant expressions'#000+
   '04029_E_Argument can'#039't be assigned to'#000+
   '04029_E_Argument can'#039't be assigned to'#000+
-  '04030_E_Can'#039't ass','ign local procedure/function to procedure varia'+
-  'ble'#000+
-  '04031_E_Can'#039't assign values to an address'#000+
+  '04030_E_Can'#039't assign local procedure/function to procedure variabl'+
+  'e'#000+
+  '04031_E_Can'#039't assign values to an addr','ess'#000+
   '04032_E_Can'#039't assign values to const variable'#000+
   '04032_E_Can'#039't assign values to const variable'#000+
   '04033_E_Array type required'#000+
   '04033_E_Array type required'#000+
   '04034_E_interface type expected, but got "$1"'#000+
   '04034_E_interface type expected, but got "$1"'#000+
-  '04035_H_Mixing signed expre','ssions and longwords gives a 64bit result'+
-  #000+
-  '04036_W_Mixing signed expressions and cardinals here may cause a range'+
-  ' check error'#000+
+  '04035_H_Mixing signed expressions and longwords gives a 64bit result'#000+
+  '04036_W_Mixing signed expressions and cardinals',' here may cause a ran'+
+  'ge check error'#000+
   '04037_E_Typecast has different size ($1 -> $2) in assignment'#000+
   '04037_E_Typecast has different size ($1 -> $2) in assignment'#000+
-  '04038_E_enums with assignments can'#039't be used as array ','index'#000+
+  '04038_E_enums with assignments can'#039't be used as array index'#000+
   '04039_E_Class or Object types "$1" and "$2" are not related'#000+
   '04039_E_Class or Object types "$1" and "$2" are not related'#000+
-  '04040_W_Class types "$1" and "$2" are not related'#000+
+  '04040_W_Class types "$1','" and "$2" are not related'#000+
   '04041_E_Class or interface type expected, but got "$1"'#000+
   '04041_E_Class or interface type expected, but got "$1"'#000+
   '04042_E_Type "$1" is not completely defined'#000+
   '04042_E_Type "$1" is not completely defined'#000+
-  '04043_W_String literal ha','s more characters than short string length'#000+
-  '04044_W_Comparison is always false due to range of values'#000+
+  '04043_W_String literal has more characters than short string length'#000+
+  '04044_W_Comparison is always false due to rang','e of values'#000+
   '04045_W_Comparison is always true due to range of values'#000+
   '04045_W_Comparison is always true due to range of values'#000+
   '04046_W_Constructing a class "$1" with abstract method "$2"'#000+
   '04046_W_Constructing a class "$1" with abstract method "$2"'#000+
-  '04047_H_The left opera','nd of the IN operator should be byte sized'#000+
-  '04048_W_Type size mismatch, possible loss of data / range check error'#000+
+  '04047_H_The left operand of the IN operator should be byte sized'#000+
+  '04048_W_Type size mismatch, possible loss of d','ata / range check erro'+
+  'r'#000+
   '04049_H_Type size mismatch, possible loss of data / range check error'#000+
   '04049_H_Type size mismatch, possible loss of data / range check error'#000+
-  '04050_E_The address of an abstract method can'#039't be taken'#000,
+  '04050_E_The address of an abstract method can'#039't be taken'#000+
   '04051_E_Assignments to formal parameters and open arrays are not possi'+
   '04051_E_Assignments to formal parameters and open arrays are not possi'+
   'ble'#000+
   'ble'#000+
-  '04052_E_Constant Expression expected'#000+
+  '04052_E_Constan','t Expression expected'#000+
   '04053_E_Operation "$1" not supported for types "$2" and "$3"'#000+
   '04053_E_Operation "$1" not supported for types "$2" and "$3"'#000+
   '04054_E_Illegal type conversion: "$1" to "$2"'#000+
   '04054_E_Illegal type conversion: "$1" to "$2"'#000+
-  '04055_H_Conversion bet','ween ordinals and pointers is not portable'#000+
-  '04056_W_Conversion between ordinals and pointers is not portable'#000+
+  '04055_H_Conversion between ordinals and pointers is not portable'#000+
+  '04056_W_Conversion between ordinals and pointe','rs is not portable'#000+
   '04057_E_Can'#039't determine which overloaded function to call'#000+
   '04057_E_Can'#039't determine which overloaded function to call'#000+
   '04058_E_Illegal counter variable'#000+
   '04058_E_Illegal counter variable'#000+
-  '04059_W_Converting constant real value to',' double for C variable argu'+
-  'ment, add explicit typecast to prevent this.'#000+
-  '04060_E_Class or COM interface type expected, but got "$1"'#000+
+  '04059_W_Converting constant real value to double for C variable argume'+
+  'nt, add explicit typecast to prevent this.'#000+
+  '04060_E_Class or ','COM interface type expected, but got "$1"'#000+
   '04061_E_Constant packed arrays are not yet supported'#000+
   '04061_E_Constant packed arrays are not yet supported'#000+
-  '04062_E_Incompatible type for arg no. $1: Got "$2" expec','ted "(Bit)Pa'+
-  'cked Array"'#000+
-  '04063_E_Incompatible type for arg no. $1: Got "$2" expected "(not pack'+
-  'ed) Array"'#000+
+  '04062_E_Incompatible type for arg no. $1: Got "$2" expected "(Bit)Pack'+
+  'ed Array"'#000+
+  '04063_E_Incompatible type for arg no. $1: Got "$2" expected "(not',' pa'+
+  'cked) Array"'#000+
   '04064_E_Elements of packed arrays cannot be of a type which need to be'+
   '04064_E_Elements of packed arrays cannot be of a type which need to be'+
   ' initialised'#000+
   ' initialised'#000+
-  '04065_E_Constant packed records and objects are not ','yet supported'#000+
+  '04065_E_Constant packed records and objects are not yet supported'#000+
   '04066_W_Arithmetic "$1" on untyped pointer is unportable to {$T+}, sug'+
   '04066_W_Arithmetic "$1" on untyped pointer is unportable to {$T+}, sug'+
-  'gest typecast'#000+
+  'gest ','typecast'#000+
   '04076_E_Can'#039't take address of a subroutine marked as local'#000+
   '04076_E_Can'#039't take address of a subroutine marked as local'#000+
   '04077_E_Can'#039't export subroutine marked as local from a unit'#000+
   '04077_E_Can'#039't export subroutine marked as local from a unit'#000+
-  '04078_E_Type is not aut','omatable: "$1"'#000+
+  '04078_E_Type is not automatable: "$1"'#000+
   '04079_H_Converting the operands to "$1" before doing the add could pre'+
   '04079_H_Converting the operands to "$1" before doing the add could pre'+
-  'vent overflow errors.'#000+
+  'vent',' overflow errors.'#000+
   '04080_H_Converting the operands to "$1" before doing the subtract coul'+
   '04080_H_Converting the operands to "$1" before doing the subtract coul'+
   'd prevent overflow errors.'#000+
   'd prevent overflow errors.'#000+
-  '04081_H_Converting the operands to "','$1" before doing the multiply co'+
-  'uld prevent overflow errors.'#000+
-  '04082_W_Converting pointers to signed integers may result in wrong com'+
-  'parison results and range errors, use an unsigned type instead.'#000+
+  '04081_H_Converting the operands to "$1" before doing the multiply coul'+
+  'd prevent overflow errors.'#000+
+  '04082_W_Converting pointers ','to signed integers may result in wrong c'+
+  'omparison results and range errors, use an unsigned type instead.'#000+
   '04083_E_Interface type $1 has no valid GUID'#000+
   '04083_E_Interface type $1 has no valid GUID'#000+
-  '0','4084_E_Invalid selector name "$1"'#000+
+  '04084_E_Invalid selector name "$1"'#000+
   '04085_E_Expected Objective-C method, but got $1'#000+
   '04085_E_Expected Objective-C method, but got $1'#000+
-  '04086_E_Expected Objective-C method or constant method name'#000+
+  '04086_E','_Expected Objective-C method or constant method name'#000+
   '04087_E_No type info available for this type'#000+
   '04087_E_No type info available for this type'#000+
   '04088_E_Ordinal or string expression expected'#000+
   '04088_E_Ordinal or string expression expected'#000+
-  '04089_E','_String expression expected'#000+
+  '04089_E_String expression expected'#000+
   '04090_W_Converting 0 to NIL'#000+
   '04090_W_Converting 0 to NIL'#000+
-  '04091_E_Objective-C protocol type expected, but got "$1"'#000+
+  '04091_E_Objective-C protocol type',' expected, but got "$1"'#000+
   '04092_E_The type "$1" is not supported for interaction with the Object'+
   '04092_E_The type "$1" is not supported for interaction with the Object'+
   'ive-C runtime.'#000+
   'ive-C runtime.'#000+
-  '04093_E_Class or objcclass type expected, ','but got "$1"'#000+
+  '04093_E_Class or objcclass type expected, but got "$1"'#000+
   '04094_E_Objcclass type expected'#000+
   '04094_E_Objcclass type expected'#000+
-  '04095_W_Coerced univ parameter type in procedural variable may cause c'+
-  'rash or memory corruption: $1 to $2'#000+
+  '04095_W_Coerced univ parameter type in proce','dural variable may cause'+
+  ' crash or memory corruption: $1 to $2'#000+
   '04096_E_Type parameters of specializations of generics cannot referenc'+
   '04096_E_Type parameters of specializations of generics cannot referenc'+
-  'e the currently spe','cialized type'#000+
+  'e the currently specialized type'#000+
   '04097_E_Type parameters are not allowed on non-generic class/record/ob'+
   '04097_E_Type parameters are not allowed on non-generic class/record/ob'+
-  'ject procedure or function'#000+
+  'ject ','procedure or function'#000+
   '04098_E_Generic declaration of "$1" differs from previous declaration'#000+
   '04098_E_Generic declaration of "$1" differs from previous declaration'#000+
   '05000_E_Identifier not found "$1"'#000+
   '05000_E_Identifier not found "$1"'#000+
-  '05001_F_Internal Error in',' SymTableStack()'#000+
+  '05001_F_Internal Error in SymTableStack()'#000+
   '05002_E_Duplicate identifier "$1"'#000+
   '05002_E_Duplicate identifier "$1"'#000+
-  '05003_H_Identifier already defined in $1 at line $2'#000+
+  '05003_H_Identifier already defined in ','$1 at line $2'#000+
   '05004_E_Unknown identifier "$1"'#000+
   '05004_E_Unknown identifier "$1"'#000+
   '05005_E_Forward declaration not solved "$1"'#000+
   '05005_E_Forward declaration not solved "$1"'#000+
   '05007_E_Error in type definition'#000+
   '05007_E_Error in type definition'#000+
-  '05009_E_Forward type not res','olved "$1"'#000+
+  '05009_E_Forward type not resolved "$1"'#000+
   '05010_E_Only static variables can be used in static methods or outside'+
   '05010_E_Only static variables can be used in static methods or outside'+
-  ' methods'#000+
+  ' methods',#000+
   '05012_F_record or class type expected'#000+
   '05012_F_record or class type expected'#000+
   '05013_E_Instances of classes or objects with an abstract method are no'+
   '05013_E_Instances of classes or objects with an abstract method are no'+
   't allowed'#000+
   't allowed'#000+
   '05014_W_Label not defined "$1"'#000+
   '05014_W_Label not defined "$1"'#000+
-  '0','5015_E_Label used but not defined "$1"'#000+
+  '05015_E_Label used but not defined "$1"'#000+
   '05016_E_Illegal label declaration'#000+
   '05016_E_Illegal label declaration'#000+
-  '05017_E_GOTO and LABEL are not supported (use switch -Sg)'#000+
+  '05017_E_GOTO and',' LABEL are not supported (use switch -Sg)'#000+
   '05018_E_Label not found'#000+
   '05018_E_Label not found'#000+
   '05019_E_identifier isn'#039't a label'#000+
   '05019_E_identifier isn'#039't a label'#000+
   '05020_E_label already defined'#000+
   '05020_E_label already defined'#000+
-  '05021_E_illegal type d','eclaration of set elements'#000+
+  '05021_E_illegal type declaration of set elements'#000+
   '05022_E_Forward class definition not resolved "$1"'#000+
   '05022_E_Forward class definition not resolved "$1"'#000+
-  '05023_H_Unit "$1" not used in $2'#000+
+  '05023_H_Uni','t "$1" not used in $2'#000+
   '05024_H_Parameter "$1" not used'#000+
   '05024_H_Parameter "$1" not used'#000+
   '05025_N_Local variable "$1" not used'#000+
   '05025_N_Local variable "$1" not used'#000+
   '05026_H_Value parameter "$1" is assigned but never used'#000+
   '05026_H_Value parameter "$1" is assigned but never used'#000+
-  '0502','7_N_Local variable "$1" is assigned but never used'#000+
+  '05027_N_Local variable "$1" is assigned but never used'#000+
   '05028_H_Local $1 "$2" is not used'#000+
   '05028_H_Local $1 "$2" is not used'#000+
-  '05029_N_Private field "$1.$2" is never used'#000+
+  '0502','9_N_Private field "$1.$2" is never used'#000+
   '05030_N_Private field "$1.$2" is assigned but never used'#000+
   '05030_N_Private field "$1.$2" is assigned but never used'#000+
   '05031_N_Private method "$1.$2" never used'#000+
   '05031_N_Private method "$1.$2" never used'#000+
-  '05032_E_Set ','type expected'#000+
+  '05032_E_Set type expected'#000+
   '05033_W_Function result does not seem to be set'#000+
   '05033_W_Function result does not seem to be set'#000+
-  '05034_W_Type "$1" is not aligned correctly in current record for C'#000+
+  '05034_W_Type "$1" is not al','igned correctly in current record for C'#000+
   '05035_E_Unknown record field identifier "$1"'#000+
   '05035_E_Unknown record field identifier "$1"'#000+
   '05036_W_Local variable "$1" does not seem to be initialized'#000+
   '05036_W_Local variable "$1" does not seem to be initialized'#000+
-  '05037_','W_Variable "$1" does not seem to be initialized'#000+
-  '05038_E_identifier idents no member "$1"'#000+
+  '05037_W_Variable "$1" does not seem to be initialized'#000+
+  '05038_E_identifier idents no member "$1"'#000,
   '05039_H_Found declaration: $1'#000+
   '05039_H_Found declaration: $1'#000+
   '05040_E_Data element too large'#000+
   '05040_E_Data element too large'#000+
   '05042_E_No matching implementation for interface method "$1" found'#000+
   '05042_E_No matching implementation for interface method "$1" found'#000+
-  '05043_W_Symbol "$1" is ','deprecated'#000+
+  '05043_W_Symbol "$1" is deprecated'#000+
   '05044_W_Symbol "$1" is not portable'#000+
   '05044_W_Symbol "$1" is not portable'#000+
   '05055_W_Symbol "$1" is not implemented'#000+
   '05055_W_Symbol "$1" is not implemented'#000+
-  '05056_E_Can'#039't create unique type from this type'#000+
+  '050','56_E_Can'#039't create unique type from this type'#000+
   '05057_H_Local variable "$1" does not seem to be initialized'#000+
   '05057_H_Local variable "$1" does not seem to be initialized'#000+
-  '05058_H_Variable "$1" does not seem to be init','ialized'#000+
+  '05058_H_Variable "$1" does not seem to be initialized'#000+
   '05059_W_Function result variable does not seem to initialized'#000+
   '05059_W_Function result variable does not seem to initialized'#000+
-  '05060_H_Function result variable does not seem to be initialized'#000+
+  '05060_H_Function re','sult variable does not seem to be initialized'#000+
   '05061_W_Variable "$1" read but nowhere assigned'#000+
   '05061_W_Variable "$1" read but nowhere assigned'#000+
   '05062_H_Found abstract method: $1'#000+
   '05062_H_Found abstract method: $1'#000+
-  '05063_W_Symbol "$1" is ','experimental'#000+
+  '05063_W_Symbol "$1" is experimental'#000+
   '05064_W_Forward declaration "$1" not resolved, assumed external'#000+
   '05064_W_Forward declaration "$1" not resolved, assumed external'#000+
-  '05065_W_Symbol "$1" is belongs to a library'#000+
+  '05065_W_Symb','ol "$1" is belongs to a library'#000+
   '05066_W_Symbol "$1" is deprecated: "$2"'#000+
   '05066_W_Symbol "$1" is deprecated: "$2"'#000+
   '05067_E_Cannot find an enumerator for the type "$1"'#000+
   '05067_E_Cannot find an enumerator for the type "$1"'#000+
-  '05068_E_Cannot find a "Move','Next" method in enumerator "$1"'#000+
-  '05069_E_Cannot find a "Current" property in enumerator "$1"'#000+
+  '05068_E_Cannot find a "MoveNext" method in enumerator "$1"'#000+
+  '05069_E_Cannot find a "Current" property in enumerator "$','1"'#000+
   '05070_E_Mismatch between number of declared parameters and number of c'+
   '05070_E_Mismatch between number of declared parameters and number of c'+
   'olons in message string.'#000+
   'olons in message string.'#000+
   '05071_N_Private type "$1.$2" never used'#000+
   '05071_N_Private type "$1.$2" never used'#000+
-  '05072_N_Priva','te const "$1.$2" never used'#000+
+  '05072_N_Private const "$1.$2" never used'#000+
   '05073_N_Private property "$1.$2" never used'#000+
   '05073_N_Private property "$1.$2" never used'#000+
-  '05074_W_Unit "$1" is deprecated'#000+
+  '05074_W_Unit "$1"',' is deprecated'#000+
   '05075_W_Unit "$1" is deprecated: "$2"'#000+
   '05075_W_Unit "$1" is deprecated: "$2"'#000+
   '05076_W_Unit "$1" is not portable'#000+
   '05076_W_Unit "$1" is not portable'#000+
   '05077_W_Unit "$1" is belongs to a library'#000+
   '05077_W_Unit "$1" is belongs to a library'#000+
-  '05078_W_Unit "$1" is n','ot implemented'#000+
+  '05078_W_Unit "$1" is not implemented'#000+
   '05079_W_Unit "$1" is experimental'#000+
   '05079_W_Unit "$1" is experimental'#000+
-  '05080_E_No complete definition of the formally declared objcclass "$1"'+
-  ' is in scope'#000+
+  '05080_E_No complete definition of the fo','rmally declared objcclass "$'+
+  '1" is in scope'#000+
   '05081_E_Gotos into initialization or finalization blocks of units are '+
   '05081_E_Gotos into initialization or finalization blocks of units are '+
   'not allowed'#000+
   'not allowed'#000+
-  '05082=E_Invalid external n','ame "$1" for formal class "$2"'#000+
-  '05083=E_Complete class definition with external name "$1" here'#000+
+  '05082=E_Invalid external name "$1" for formal class "$2"'#000+
+  '05083=E_Complete class definition with external name "$1" ','here'#000+
   '06009_E_Parameter list size exceeds 65535 bytes'#000+
   '06009_E_Parameter list size exceeds 65535 bytes'#000+
   '06012_E_File types must be var parameters'#000+
   '06012_E_File types must be var parameters'#000+
   '06013_E_The use of a far pointer isn'#039't allowed there'#000+
   '06013_E_The use of a far pointer isn'#039't allowed there'#000+
-  '060','15_E_EXPORT declared functions can'#039't be called'#000+
-  '06016_W_Possible illegal call of constructor or destructor'#000+
+  '06015_E_EXPORT declared functions can'#039't be called'#000+
+  '06016_W_Possible illegal call of construct','or or destructor'#000+
   '06017_N_Inefficient code'#000+
   '06017_N_Inefficient code'#000+
   '06018_W_unreachable code'#000+
   '06018_W_unreachable code'#000+
   '06020_E_Abstract methods can'#039't be called directly'#000+
   '06020_E_Abstract methods can'#039't be called directly'#000+
-  '06027_DL_Register $1 weight $2 $3'#000,
+  '06027_DL_Register $1 weight $2 $3'#000+
   '06029_DL_Stack frame is omitted'#000+
   '06029_DL_Stack frame is omitted'#000+
   '06031_E_Object or class methods can'#039't be inline.'#000+
   '06031_E_Object or class methods can'#039't be inline.'#000+
-  '06032_E_Procvar calls cannot be inline.'#000+
+  '06032_E_','Procvar calls cannot be inline.'#000+
   '06033_E_No code for inline procedure stored'#000+
   '06033_E_No code for inline procedure stored'#000+
   '06035_E_Element zero of an ansi/wide- or longstring can'#039't be acces'+
   '06035_E_Element zero of an ansi/wide- or longstring can'#039't be acces'+
-  'sed, use ','(set)length instead'#000+
+  'sed, use (set)length instead'#000+
   '06037_E_Constructors or destructors cannot be called inside a '#039'wit'+
   '06037_E_Constructors or destructors cannot be called inside a '#039'wit'+
-  'h'#039' clause'#000+
+  'h'#039' ','clause'#000+
   '06038_E_Cannot call message handler methods directly'#000+
   '06038_E_Cannot call message handler methods directly'#000+
   '06039_E_Jump in or outside of an exception block'#000+
   '06039_E_Jump in or outside of an exception block'#000+
-  '06040_E_Control flow statements aren'#039't all','owed in a finally bloc'+
-  'k'#000+
+  '06040_E_Control flow statements aren'#039't allowed in a finally block'#000+
   '06041_W_Parameters size exceeds limit for certain cpu'#039's'#000+
   '06041_W_Parameters size exceeds limit for certain cpu'#039's'#000+
-  '06042_W_Local variable size exceed limit for certain cpu'#039's'#000+
+  '06042_W_L','ocal variable size exceed limit for certain cpu'#039's'#000+
   '06043_E_Local variables size exceeds supported limit'#000+
   '06043_E_Local variables size exceeds supported limit'#000+
   '06044_E_BREAK not allowed'#000+
   '06044_E_BREAK not allowed'#000+
-  '06045_E_CONTINUE not a','llowed'#000+
+  '06045_E_CONTINUE not allowed'#000+
   '06046_F_Unknown compilerproc "$1". Check if you use the correct run ti'+
   '06046_F_Unknown compilerproc "$1". Check if you use the correct run ti'+
-  'me library.'#000+
+  'me library.'#000,
   '06047_F_Cannot find system type "$1". Check if you use the correct run'+
   '06047_F_Cannot find system type "$1". Check if you use the correct run'+
   ' time library.'#000+
   ' time library.'#000+
   '06048_H_Inherited call to abstract method ignored'#000+
   '06048_H_Inherited call to abstract method ignored'#000+
-  '06049_E_Goto lab','el "$1" not defined or optimized away'#000+
-  '06050_F_Cannot find type "$1" in unit "$2". Check if you use the corre'+
-  'ct run time library.'#000+
+  '06049_E_Goto label "$1" not defined or optimized away'#000+
+  '06050_F_Cannot find type "$1" in unit "$2". Check i','f you use the cor'+
+  'rect run time library.'#000+
   '06051_E_Interprocedural gotos are allowed only to outer subroutines'#000+
   '06051_E_Interprocedural gotos are allowed only to outer subroutines'#000+
-  '06052_E_Label must be defined in the same s','cope as it is declared'#000+
-  '06053_E_Leaving procedures containing explicit or implicit exceptions '+
-  'frames using goto is not allowed'#000+
+  '06052_E_Label must be defined in the same scope as it is declared'#000+
+  '06053_E_Leaving procedures containing explicit or implicit excepti','on'+
+  's frames using goto is not allowed'#000+
   '07000_DL_Starting $1 styled assembler parsing'#000+
   '07000_DL_Starting $1 styled assembler parsing'#000+
   '07001_DL_Finished $1 styled assembler parsing'#000+
   '07001_DL_Finished $1 styled assembler parsing'#000+
-  '07002_E_Non-label patt','ern contains @'#000+
+  '07002_E_Non-label pattern contains @'#000+
   '07004_E_Error building record offset'#000+
   '07004_E_Error building record offset'#000+
-  '07005_E_OFFSET used without identifier'#000+
+  '07005_E_OFFSET used without identifie','r'#000+
   '07006_E_TYPE used without identifier'#000+
   '07006_E_TYPE used without identifier'#000+
   '07007_E_Cannot use local variable or parameters here'#000+
   '07007_E_Cannot use local variable or parameters here'#000+
   '07008_E_need to use OFFSET here'#000+
   '07008_E_need to use OFFSET here'#000+
-  '07009_E_need to use $ here'#000,
+  '07009_E_need to use $ here'#000+
   '07010_E_Cannot use multiple relocatable symbols'#000+
   '07010_E_Cannot use multiple relocatable symbols'#000+
-  '07011_E_Relocatable symbol can only be added'#000+
+  '07011_E_Relocatable symbol can only be ad','ded'#000+
   '07012_E_Invalid constant expression'#000+
   '07012_E_Invalid constant expression'#000+
   '07013_E_Relocatable symbol is not allowed'#000+
   '07013_E_Relocatable symbol is not allowed'#000+
   '07014_E_Invalid reference syntax'#000+
   '07014_E_Invalid reference syntax'#000+
-  '07015_E_You cannot reach $1 from tha','t code'#000+
+  '07015_E_You cannot reach $1 from that code'#000+
   '07016_E_Local symbols/labels aren'#039't allowed as references'#000+
   '07016_E_Local symbols/labels aren'#039't allowed as references'#000+
-  '07017_E_Invalid base and index register usage'#000+
+  '07017_E_Invalid base and',' index register usage'#000+
   '07018_W_Possible error in object field handling'#000+
   '07018_W_Possible error in object field handling'#000+
   '07019_E_Wrong scale factor specified'#000+
   '07019_E_Wrong scale factor specified'#000+
   '07020_E_Multiple index register usage'#000+
   '07020_E_Multiple index register usage'#000+
-  '07021_','E_Invalid operand type'#000+
+  '07021_E_Invalid operand type'#000+
   '07022_E_Invalid string as opcode operand: $1'#000+
   '07022_E_Invalid string as opcode operand: $1'#000+
-  '07023_W_@CODE and @DATA not supported'#000+
+  '07023_W_@CODE and @DA','TA not supported'#000+
   '07024_E_Null label references are not allowed'#000+
   '07024_E_Null label references are not allowed'#000+
   '07025_E_Divide by zero in asm evaluator'#000+
   '07025_E_Divide by zero in asm evaluator'#000+
   '07026_E_Illegal expression'#000+
   '07026_E_Illegal expression'#000+
-  '07027_E_escape sequen','ce ignored: $1'#000+
+  '07027_E_escape sequence ignored: $1'#000+
   '07028_E_Invalid symbol reference'#000+
   '07028_E_Invalid symbol reference'#000+
-  '07029_W_Fwait can cause emulation problems with emu387'#000+
+  '07029_W_Fwait can cause emulation problem','s with emu387'#000+
   '07030_W_$1 without operand translated into $1P'#000+
   '07030_W_$1 without operand translated into $1P'#000+
   '07031_W_ENTER instruction is not supported by Linux kernel'#000+
   '07031_W_ENTER instruction is not supported by Linux kernel'#000+
-  '07032_W_Calling an overload fun','ction in assembler'#000+
+  '07032_W_Calling an overload function in assembler'#000+
   '07033_E_Unsupported symbol type for operand'#000+
   '07033_E_Unsupported symbol type for operand'#000+
-  '07034_E_Constant value out of bounds'#000+
+  '07034_E_Constant value out',' of bounds'#000+
   '07035_E_Error converting decimal $1'#000+
   '07035_E_Error converting decimal $1'#000+
   '07036_E_Error converting octal $1'#000+
   '07036_E_Error converting octal $1'#000+
   '07037_E_Error converting binary $1'#000+
   '07037_E_Error converting binary $1'#000+
-  '07038_E_Error converting hexadecima','l $1'#000+
+  '07038_E_Error converting hexadecimal $1'#000+
   '07039_H_$1 translated to $2'#000+
   '07039_H_$1 translated to $2'#000+
   '07040_W_$1 is associated to an overloaded function'#000+
   '07040_W_$1 is associated to an overloaded function'#000+
-  '07041_E_Cannot use SELF outside a method'#000+
+  '07041','_E_Cannot use SELF outside a method'#000+
   '07042_E_Cannot use OLDEBP outside a nested procedure'#000+
   '07042_E_Cannot use OLDEBP outside a nested procedure'#000+
   '07043_W_Procedures can'#039't return any value in asm code'#000+
   '07043_W_Procedures can'#039't return any value in asm code'#000+
-  '07044_E_','SEG not supported'#000+
+  '07044_E_SEG not supported'#000+
   '07045_E_Size suffix and destination or source size do not match'#000+
   '07045_E_Size suffix and destination or source size do not match'#000+
-  '07046_W_Size suffix and destination or source size do not match'#000+
+  '07046_W','_Size suffix and destination or source size do not match'#000+
   '07047_E_Assembler syntax error'#000+
   '07047_E_Assembler syntax error'#000+
   '07048_E_Invalid combination of opcode and operands'#000+
   '07048_E_Invalid combination of opcode and operands'#000+
-  '07049_E_Asse','mbler syntax error in operand'#000+
+  '07049_E_Assembler syntax error in operand'#000+
   '07050_E_Assembler syntax error in constant'#000+
   '07050_E_Assembler syntax error in constant'#000+
-  '07051_E_Invalid String expression'#000+
+  '07051_E_Invalid ','String expression'#000+
   '07052_W_constant with symbol $1 for address which is not on a pointer'#000+
   '07052_W_constant with symbol $1 for address which is not on a pointer'#000+
   '07053_E_Unrecognized opcode $1'#000+
   '07053_E_Unrecognized opcode $1'#000+
-  '07054_E_Invalid or missing opcod','e'#000+
+  '07054_E_Invalid or missing opcode'#000+
   '07055_E_Invalid combination of prefix and opcode: $1'#000+
   '07055_E_Invalid combination of prefix and opcode: $1'#000+
-  '07056_E_Invalid combination of override and opcode: $1'#000+
+  '07056_E_Invalid combination of ove','rride and opcode: $1'#000+
   '07057_E_Too many operands on line'#000+
   '07057_E_Too many operands on line'#000+
   '07058_W_NEAR ignored'#000+
   '07058_W_NEAR ignored'#000+
   '07059_W_FAR ignored'#000+
   '07059_W_FAR ignored'#000+
   '07060_E_Duplicate local symbol $1'#000+
   '07060_E_Duplicate local symbol $1'#000+
-  '07061_E_Undefined loc','al symbol $1'#000+
+  '07061_E_Undefined local symbol $1'#000+
   '07062_E_Unknown label identifier $1'#000+
   '07062_E_Unknown label identifier $1'#000+
   '07063_E_Invalid register name'#000+
   '07063_E_Invalid register name'#000+
-  '07064_E_Invalid floating point register name'#000+
+  '07064_E_In','valid floating point register name'#000+
   '07066_W_Modulo not supported'#000+
   '07066_W_Modulo not supported'#000+
   '07067_E_Invalid floating point constant $1'#000+
   '07067_E_Invalid floating point constant $1'#000+
   '07068_E_Invalid floating point expression'#000+
   '07068_E_Invalid floating point expression'#000+
-  '07','069_E_Wrong symbol type'#000+
+  '07069_E_Wrong symbol type'#000+
   '07070_E_Cannot index a local var or parameter with a register'#000+
   '07070_E_Cannot index a local var or parameter with a register'#000+
-  '07071_E_Invalid segment override expression'#000+
+  '070','71_E_Invalid segment override expression'#000+
   '07072_W_Identifier $1 supposed external'#000+
   '07072_W_Identifier $1 supposed external'#000+
   '07073_E_Strings not allowed as constants'#000+
   '07073_E_Strings not allowed as constants'#000+
-  '07074_No type of variable spe','cified'#000+
+  '07074_No type of variable specified'#000+
   '07075_E_assembler code not returned to text section'#000+
   '07075_E_assembler code not returned to text section'#000+
-  '07076_E_Not a directive or local symbol $1'#000+
+  '07076_E_Not a directive or loc','al symbol $1'#000+
   '07077_E_Using a defined name as a local label'#000+
   '07077_E_Using a defined name as a local label'#000+
   '07078_E_Dollar token is used without an identifier'#000+
   '07078_E_Dollar token is used without an identifier'#000+
-  '07079_W_32bit constant created for addres','s'#000+
+  '07079_W_32bit constant created for address'#000+
   '07080_N_.align is target specific, use .balign or .p2align'#000+
   '07080_N_.align is target specific, use .balign or .p2align'#000+
-  '07081_E_Can'#039't access fields directly for parameters'#000+
+  '07081_E_Can'#039't access fields ','directly for parameters'#000+
   '07082_E_Can'#039't access fields of objects/classes directly'#000+
   '07082_E_Can'#039't access fields of objects/classes directly'#000+
   '07083_E_No size specified and unable to determine the size of the oper'+
   '07083_E_No size specified and unable to determine the size of the oper'+
-  'a','nds'#000+
+  'ands'#000+
   '07084_E_Cannot use RESULT in this function'#000+
   '07084_E_Cannot use RESULT in this function'#000+
-  '07086_W_"$1" without operand translated into "$1 %st,%st(1)"'#000+
+  '07086_W_"$1" without operand translated in','to "$1 %st,%st(1)"'#000+
   '07087_W_"$1 %st(n)" translated into "$1 %st,%st(n)"'#000+
   '07087_W_"$1 %st(n)" translated into "$1 %st,%st(n)"'#000+
   '07088_W_"$1 %st(n)" translated into "$1 %st(n),%st"'#000+
   '07088_W_"$1 %st(n)" translated into "$1 %st(n),%st"'#000+
-  '07089_E_Char < not allowed h','ere'#000+
+  '07089_E_Char < not allowed here'#000+
   '07090_E_Char > not allowed here'#000+
   '07090_E_Char > not allowed here'#000+
   '07093_W_ALIGN not supported'#000+
   '07093_W_ALIGN not supported'#000+
-  '07094_E_Inc and Dec cannot be together'#000+
+  '07094_E_Inc and Dec canno','t be together'#000+
   '07095_E_Invalid reglist for movem'#000+
   '07095_E_Invalid reglist for movem'#000+
   '07096_E_Reglist invalid for opcode'#000+
   '07096_E_Reglist invalid for opcode'#000+
   '07097_E_Higher cpu mode required ($1)'#000+
   '07097_E_Higher cpu mode required ($1)'#000+
-  '07098_W_No size specified and ','unable to determine the size of the op'+
-  'erands, using DWORD as default'#000+
-  '07099_E_Syntax error while trying to parse a shifter operand'#000+
+  '07098_W_No size specified and unable to determine the size of the oper'+
+  'ands, using DWORD as default'#000+
+  '07099_E_Syntax error',' while trying to parse a shifter operand'#000+
   '07100_E_Address of packed component is not at a byte boundary'#000+
   '07100_E_Address of packed component is not at a byte boundary'#000+
-  '07101_W_No size specified and unable to determin','e the size of the op'+
-  'erands, using BYTE as default'#000+
-  '07102_W_Use of +offset(%ebp) for parameters invalid here'#000+
+  '07101_W_No size specified and unable to determine the size of the oper'+
+  'ands, using BYTE as default'#000+
+  '07102_W_Use of +offset(%ebp) for parame','ters invalid here'#000+
   '07103_W_Use of +offset(%ebp) is not compatible with regcall convention'+
   '07103_W_Use of +offset(%ebp) is not compatible with regcall convention'+
   #000+
   #000+
-  '07104_W_Use of -offset(%ebp) is not recommended for local vari','able a'+
-  'ccess'#000+
+  '07104_W_Use of -offset(%ebp) is not recommended for local variable acc'+
+  'ess'#000+
   '07105_W_Use of -offset(%esp), access may cause a crash or value may be'+
   '07105_W_Use of -offset(%esp), access may cause a crash or value may be'+
   ' lost'#000+
   ' lost'#000+
-  '07106_E_VMTOffset must be used in combination with a virtual method, a'+
-  'nd "$1" is not virtual'#000+
+  '0','7106_E_VMTOffset must be used in combination with a virtual method,'+
+  ' and "$1" is not virtual'#000+
   '07107_E_Generating PIC, but reference is not PIC-safe'#000+
   '07107_E_Generating PIC, but reference is not PIC-safe'#000+
-  '07108','_E_All registers in a register set must be of the same kind and'+
-  ' width'#000+
-  '07109_E_A register set cannot be empty'#000+
+  '07108_E_All registers in a register set must be of the same kind and w'+
+  'idth'#000+
+  '07109_E_A register ','set cannot be empty'#000+
   '07110_W_@GOTPCREL is useless and potentially dangereous for local symb'+
   '07110_W_@GOTPCREL is useless and potentially dangereous for local symb'+
   'ols'#000+
   'ols'#000+
   '08000_F_Too many assembler files'#000+
   '08000_F_Too many assembler files'#000+
-  '08001_F_Selected assembl','er output not supported'#000+
+  '08001_F_Selected assembler output not supported'#000+
   '08002_F_Comp not supported'#000+
   '08002_F_Comp not supported'#000+
-  '08003_F_Direct not support for binary writers'#000+
+  '08003_F_Direct not support for binary ','writers'#000+
   '08004_E_Allocating of data is only allowed in bss section'#000+
   '08004_E_Allocating of data is only allowed in bss section'#000+
   '08005_F_No binary writer selected'#000+
   '08005_F_No binary writer selected'#000+
   '08006_E_Asm: Opcode $1 not in table'#000+
   '08006_E_Asm: Opcode $1 not in table'#000+
-  '08007_E_Asm: $1',' invalid combination of opcode and operands'#000+
-  '08008_E_Asm: 16 Bit references not supported'#000+
+  '08007_E_Asm: $1 invalid combination of opcode and operands'#000+
+  '08008_E_Asm: 16 Bit references not supported'#000,
   '08009_E_Asm: Invalid effective address'#000+
   '08009_E_Asm: Invalid effective address'#000+
   '08010_E_Asm: Immediate or reference expected'#000+
   '08010_E_Asm: Immediate or reference expected'#000+
   '08011_E_Asm: $1 value exceeds bounds $2'#000+
   '08011_E_Asm: $1 value exceeds bounds $2'#000+
-  '08012_E_Asm: Short jump is ','out of range $1'#000+
+  '08012_E_Asm: Short jump is out of range $1'#000+
   '08013_E_Asm: Undefined label $1'#000+
   '08013_E_Asm: Undefined label $1'#000+
-  '08014_E_Asm: Comp type not supported for this target'#000+
+  '08014_E_Asm: Comp type not supported for ','this target'#000+
   '08015_E_Asm: Extended type not supported for this target'#000+
   '08015_E_Asm: Extended type not supported for this target'#000+
   '08016_E_Asm: Duplicate label $1'#000+
   '08016_E_Asm: Duplicate label $1'#000+
   '08017_E_Asm: Redefined label $1'#000+
   '08017_E_Asm: Redefined label $1'#000+
-  '08018_E_Asm: First',' defined here'#000+
+  '08018_E_Asm: First defined here'#000+
   '08019_E_Asm: Invalid register $1'#000+
   '08019_E_Asm: Invalid register $1'#000+
-  '08020_E_Asm: 16 or 32 Bit references not supported'#000+
+  '08020_E_Asm: 16 or 32 Bit references not s','upported'#000+
   '08021_E_Asm: 64 Bit operands not supported'#000+
   '08021_E_Asm: 64 Bit operands not supported'#000+
   '09000_W_Source operating system redefined'#000+
   '09000_W_Source operating system redefined'#000+
   '09001_I_Assembling (pipe) $1'#000+
   '09001_I_Assembling (pipe) $1'#000+
-  '09002_E_Can'#039't create assembl','er file: $1'#000+
+  '09002_E_Can'#039't create assembler file: $1'#000+
   '09003_E_Can'#039't create object file: $1'#000+
   '09003_E_Can'#039't create object file: $1'#000+
   '09004_E_Can'#039't create archive file: $1'#000+
   '09004_E_Can'#039't create archive file: $1'#000+
-  '09005_E_Assembler $1 not found, switching to external assembling'#000+
+  '09','005_E_Assembler $1 not found, switching to external assembling'#000+
   '09006_T_Using assembler: $1'#000+
   '09006_T_Using assembler: $1'#000+
   '09007_E_Error while assembling exitcode $1'#000+
   '09007_E_Error while assembling exitcode $1'#000+
-  '09008_E_Can'#039't cal','l the assembler, error $1 switching to external'+
-  ' assembling'#000+
+  '09008_E_Can'#039't call the assembler, error $1 switching to external a'+
+  'ssembling'#000+
   '09009_I_Assembling $1'#000+
   '09009_I_Assembling $1'#000+
-  '09010_I_Assembling with smartlinking $1'#000+
+  '09010_I_','Assembling with smartlinking $1'#000+
   '09011_W_Object $1 not found, Linking may fail !'#000+
   '09011_W_Object $1 not found, Linking may fail !'#000+
   '09012_W_Library $1 not found, Linking may fail !'#000+
   '09012_W_Library $1 not found, Linking may fail !'#000+
-  '09013_E_Error while li','nking'#000+
+  '09013_E_Error while linking'#000+
   '09014_E_Can'#039't call the linker, switching to external linking'#000+
   '09014_E_Can'#039't call the linker, switching to external linking'#000+
   '09015_I_Linking $1'#000+
   '09015_I_Linking $1'#000+
-  '09016_E_Util $1 not found, switching to external linking'#000+
+  '090','16_E_Util $1 not found, switching to external linking'#000+
   '09017_T_Using util $1'#000+
   '09017_T_Using util $1'#000+
   '09018_E_Creation of Executables not supported'#000+
   '09018_E_Creation of Executables not supported'#000+
-  '09019_E_Creation of Dynamic/S','hared Libraries not supported'#000+
+  '09019_E_Creation of Dynamic/Shared Libraries not supported'#000+
   '09020_I_Closing script $1'#000+
   '09020_I_Closing script $1'#000+
-  '09021_E_resource compiler "$1" not found, switching to external mode'#000+
+  '09021_E_resource compiler "$1" no','t found, switching to external mode'+
+  #000+
   '09022_I_Compiling resource $1'#000+
   '09022_I_Compiling resource $1'#000+
   '09023_T_unit $1 can'#039't be statically linked, switching to smart lin'+
   '09023_T_unit $1 can'#039't be statically linked, switching to smart lin'+
   'king'#000+
   'king'#000+
-  '09024_T_unit $','1 can'#039't be smart linked, switching to static linki'+
-  'ng'#000+
-  '09025_T_unit $1 can'#039't be shared linked, switching to static linkin'+
-  'g'#000+
+  '09024_T_unit $1 can'#039't be smart linked, switching to static linking'+
+  #000+
+  '09025_T_unit $1 can'#039't be shared link','ed, switching to static link'+
+  'ing'#000+
   '09026_E_unit $1 can'#039't be smart or static linked'#000+
   '09026_E_unit $1 can'#039't be smart or static linked'#000+
   '09027_E_unit $1 can'#039't be shared or static linked'#000+
   '09027_E_unit $1 can'#039't be shared or static linked'#000+
-  '09028_D_Calling resour','ce compiler "$1" with "$2" as command line'#000+
+  '09028_D_Calling resource compiler "$1" with "$2" as command line'#000+
   '09029_E_Error while compiling resources'#000+
   '09029_E_Error while compiling resources'#000+
-  '09030_E_Can'#039't call the resource compiler "$1", switching to extern'+
-  'al mode'#000+
+  '09030_','E_Can'#039't call the resource compiler "$1", switching to exte'+
+  'rnal mode'#000+
   '09031_E_Can'#039't open resource file "$1"'#000+
   '09031_E_Can'#039't open resource file "$1"'#000+
   '09032_E_Can'#039't write resource file "$1"'#000+
   '09032_E_Can'#039't write resource file "$1"'#000+
-  '09128_','F_Can'#039't post process executable $1'#000+
+  '09128_F_Can'#039't post process executable $1'#000+
   '09129_F_Can'#039't open executable $1'#000+
   '09129_F_Can'#039't open executable $1'#000+
-  '09130_X_Size of Code: $1 bytes'#000+
+  '09130_X_Size of Code:',' $1 bytes'#000+
   '09131_X_Size of initialized data: $1 bytes'#000+
   '09131_X_Size of initialized data: $1 bytes'#000+
   '09132_X_Size of uninitialized data: $1 bytes'#000+
   '09132_X_Size of uninitialized data: $1 bytes'#000+
   '09133_X_Stack space reserved: $1 bytes'#000+
   '09133_X_Stack space reserved: $1 bytes'#000+
-  '09134_X_Stack ','space committed: $1 bytes'#000+
+  '09134_X_Stack space committed: $1 bytes'#000+
   '09200_F_Executable image size is too big for $1 target.'#000+
   '09200_F_Executable image size is too big for $1 target.'#000+
-  '09201_W_Object file "$1" contains 32-bit absolute relocation to symbol'+
-  ' "$2".'#000+
+  '09201_W','_Object file "$1" contains 32-bit absolute relocation to symb'+
+  'ol "$2".'#000+
   '10000_T_Unitsearch: $1'#000+
   '10000_T_Unitsearch: $1'#000+
   '10001_T_PPU Loading $1'#000+
   '10001_T_PPU Loading $1'#000+
   '10002_U_PPU Name: $1'#000+
   '10002_U_PPU Name: $1'#000+
-  '10003_U_PPU Fl','ags: $1'#000+
+  '10003_U_PPU Flags: $1'#000+
   '10004_U_PPU Crc: $1'#000+
   '10004_U_PPU Crc: $1'#000+
   '10005_U_PPU Time: $1'#000+
   '10005_U_PPU Time: $1'#000+
   '10006_U_PPU File too short'#000+
   '10006_U_PPU File too short'#000+
-  '10007_U_PPU Invalid Header (no PPU at the begin)'#000+
+  '10007_U_PPU I','nvalid Header (no PPU at the begin)'#000+
   '10008_U_PPU Invalid Version $1'#000+
   '10008_U_PPU Invalid Version $1'#000+
   '10009_U_PPU is compiled for another processor'#000+
   '10009_U_PPU is compiled for another processor'#000+
-  '10010_U_PPU is compiled for another ta','rget'#000+
+  '10010_U_PPU is compiled for another target'#000+
   '10011_U_PPU Source: $1'#000+
   '10011_U_PPU Source: $1'#000+
   '10012_U_Writing $1'#000+
   '10012_U_Writing $1'#000+
   '10013_F_Can'#039't Write PPU-File'#000+
   '10013_F_Can'#039't Write PPU-File'#000+
-  '10014_F_Error reading PPU-File'#000+
+  '10014_F_Error',' reading PPU-File'#000+
   '10015_F_unexpected end of PPU-File'#000+
   '10015_F_unexpected end of PPU-File'#000+
   '10016_F_Invalid PPU-File entry: $1'#000+
   '10016_F_Invalid PPU-File entry: $1'#000+
   '10017_F_PPU Dbx count problem'#000+
   '10017_F_PPU Dbx count problem'#000+
   '10018_E_Illegal unit name: $1'#000+
   '10018_E_Illegal unit name: $1'#000+
-  '100','19_F_Too much units'#000+
+  '10019_F_Too much units'#000+
   '10020_F_Circular unit reference between $1 and $2'#000+
   '10020_F_Circular unit reference between $1 and $2'#000+
-  '10021_F_Can'#039't compile unit $1, no sources available'#000+
+  '10021_F_Can'#039't compi','le unit $1, no sources available'#000+
   '10022_F_Can'#039't find unit $1 used by $2'#000+
   '10022_F_Can'#039't find unit $1 used by $2'#000+
   '10023_W_Unit $1 was not found but $2 exists'#000+
   '10023_W_Unit $1 was not found but $2 exists'#000+
-  '10024_F_Unit $1 searched but $2 foun','d'#000+
+  '10024_F_Unit $1 searched but $2 found'#000+
   '10025_W_Compiling the system unit requires the -Us switch'#000+
   '10025_W_Compiling the system unit requires the -Us switch'#000+
-  '10026_F_There were $1 errors compiling module, stopping'#000+
+  '10026_F_There were $1 errors ','compiling module, stopping'#000+
   '10027_U_Load from $1 ($2) unit $3'#000+
   '10027_U_Load from $1 ($2) unit $3'#000+
   '10028_U_Recompiling $1, checksum changed for $2'#000+
   '10028_U_Recompiling $1, checksum changed for $2'#000+
-  '10029_U_Recompiling $1, source found only'#000,
+  '10029_U_Recompiling $1, source found only'#000+
   '10030_U_Recompiling unit, static lib is older than ppufile'#000+
   '10030_U_Recompiling unit, static lib is older than ppufile'#000+
-  '10031_U_Recompiling unit, shared lib is older than ppufile'#000+
+  '10031_U_Recompiling unit, shar','ed lib is older than ppufile'#000+
   '10032_U_Recompiling unit, obj and asm are older than ppufile'#000+
   '10032_U_Recompiling unit, obj and asm are older than ppufile'#000+
   '10033_U_Recompiling unit, obj is older than asm'#000+
   '10033_U_Recompiling unit, obj is older than asm'#000+
-  '10034_U_Parsi','ng interface of $1'#000+
+  '10034_U_Parsing interface of $1'#000+
   '10035_U_Parsing implementation of $1'#000+
   '10035_U_Parsing implementation of $1'#000+
   '10036_U_Second load for unit $1'#000+
   '10036_U_Second load for unit $1'#000+
-  '10037_U_PPU Check file $1 time $2'#000+
+  '1','0037_U_PPU Check file $1 time $2'#000+
   '10040_W_Can'#039't recompile unit $1, but found modifed include files'#000+
   '10040_W_Can'#039't recompile unit $1, but found modifed include files'#000+
-  '10041_U_File $1 is newer than the one used for creati','ng PPU file $2'#000+
+  '10041_U_File $1 is newer than the one used for creating PPU file $2'#000+
   '10042_U_Trying to use a unit which was compiled with a different FPU m'+
   '10042_U_Trying to use a unit which was compiled with a different FPU m'+
-  'ode'#000+
+  'ode'#000,
   '10043_U_Loading interface units from $1'#000+
   '10043_U_Loading interface units from $1'#000+
   '10044_U_Loading implementation units from $1'#000+
   '10044_U_Loading implementation units from $1'#000+
   '10045_U_Interface CRC changed for unit $1'#000+
   '10045_U_Interface CRC changed for unit $1'#000+
-  '10046_U_Implementation C','RC changed for unit $1'#000+
+  '10046_U_Implementation CRC changed for unit $1'#000+
   '10047_U_Finished compiling unit $1'#000+
   '10047_U_Finished compiling unit $1'#000+
-  '10048_U_Adding dependency: $1 depends on $2'#000+
+  '10048_U_Adding dependency: $1 d','epends on $2'#000+
   '10049_U_No reload, is caller: $1'#000+
   '10049_U_No reload, is caller: $1'#000+
   '10050_U_No reload, already in second compile: $1'#000+
   '10050_U_No reload, already in second compile: $1'#000+
   '10051_U_Flag for reload: $1'#000+
   '10051_U_Flag for reload: $1'#000+
   '10052_U_Forced reloading'#000+
   '10052_U_Forced reloading'#000+
-  '100','53_U_Previous state of $1: $2'#000+
+  '10053_U_Previous state of $1: $2'#000+
   '10054_U_Already compiling $1, setting second compile'#000+
   '10054_U_Already compiling $1, setting second compile'#000+
-  '10055_U_Loading unit $1'#000+
+  '10055_','U_Loading unit $1'#000+
   '10056_U_Finished loading unit $1'#000+
   '10056_U_Finished loading unit $1'#000+
   '10057_U_Registering new unit $1'#000+
   '10057_U_Registering new unit $1'#000+
   '10058_U_Re-resolving unit $1'#000+
   '10058_U_Re-resolving unit $1'#000+
-  '10059_U_Skipping re-resolving unit $1, ','still loading used units'#000+
+  '10059_U_Skipping re-resolving unit $1, still loading used units'#000+
   '10060_U_Unloading resource unit $1 (not needed)'#000+
   '10060_U_Unloading resource unit $1 (not needed)'#000+
-  '10061_E_Unit $1 was compiled using a different whole program optimizat'+
-  'ion feedback input ($2, $3); recompile it without wpo or use the same '+
-  'wpo feedback input file for',' this compilation invocation'#000+
-  '10062_U_Indirect interface (objects/classes) CRC changed for unit $1'#000+
+  '10061_E_Unit $1 ','was compiled using a different whole program optimiz'+
+  'ation feedback input ($2, $3); recompile it without wpo or use the sam'+
+  'e wpo feedback input file for this compilation invocation'#000+
+  '10062_U_Indirect interface (objects/classes) CRC changed for',' unit $1'+
+  #000+
   '11000_O_$1 [options] <inputfile> [options]'#000+
   '11000_O_$1 [options] <inputfile> [options]'#000+
   '11001_W_Only one source file supported, changing source file to compil'+
   '11001_W_Only one source file supported, changing source file to compil'+
   'e from "$1" into "$2"'#000+
   'e from "$1" into "$2"'#000+
-  '11002_W','_DEF file can be created only for OS/2'#000+
+  '11002_W_DEF file can be created only for OS/2'#000+
   '11003_E_nested response files are not supported'#000+
   '11003_E_nested response files are not supported'#000+
-  '11004_F_No source file name in command line'#000+
+  '11','004_F_No source file name in command line'#000+
   '11005_N_No option inside $1 config file'#000+
   '11005_N_No option inside $1 config file'#000+
   '11006_E_Illegal parameter: $1'#000+
   '11006_E_Illegal parameter: $1'#000+
   '11007_H_-? writes help pages'#000+
   '11007_H_-? writes help pages'#000+
-  '11008_F_To','o many config files nested'#000+
+  '11008_F_Too many config files nested'#000+
   '11009_F_Unable to open file $1'#000+
   '11009_F_Unable to open file $1'#000+
-  '11010_D_Reading further options from $1'#000+
+  '11010_D_Reading further options',' from $1'#000+
   '11011_W_Target is already set to: $1'#000+
   '11011_W_Target is already set to: $1'#000+
   '11012_W_Shared libs not supported on DOS platform, reverting to static'+
   '11012_W_Shared libs not supported on DOS platform, reverting to static'+
   #000+
   #000+
-  '11013_F_In options file $1 at line',' $2 too many \var{\#IF(N)DEFs} enc'+
-  'ountered'#000+
-  '11014_F_In options file $1 at line $2 unexpected \var{\#ENDIFs} encoun'+
-  'tered'#000+
+  '11013_F_In options file $1 at line $2 too many \var{\#IF(N)DEFs} encou'+
+  'ntered'#000+
+  '11014_F_In options file $1 at line $2 unexpect','ed \var{\#ENDIFs} enco'+
+  'untered'#000+
   '11015_F_Open conditional at the end of the options file'#000+
   '11015_F_Open conditional at the end of the options file'#000+
-  '11016_W_Debug information generation is not supported by this exe','cut'+
-  'able'#000+
+  '11016_W_Debug information generation is not supported by this executab'+
+  'le'#000+
   '11017_H_Try recompiling with -dGDB'#000+
   '11017_H_Try recompiling with -dGDB'#000+
   '11018_W_You are using the obsolete switch $1'#000+
   '11018_W_You are using the obsolete switch $1'#000+
-  '11019_W_You are using the obsolete switch $1, please use $2'#000+
+  '1','1019_W_You are using the obsolete switch $1, please use $2'#000+
   '11020_N_Switching assembler to default source writing assembler'#000+
   '11020_N_Switching assembler to default source writing assembler'#000+
-  '11021_W_Assembler output sel','ected "$1" is not compatible with "$2"'#000+
+  '11021_W_Assembler output selected "$1" is not compatible with "$2"'#000+
   '11022_W_"$1" assembler use forced'#000+
   '11022_W_"$1" assembler use forced'#000+
-  '11026_T_Reading options from file $1'#000+
+  '11026_T_Reading ','options from file $1'#000+
   '11027_T_Reading options from environment $1'#000+
   '11027_T_Reading options from environment $1'#000+
   '11028_D_Handling option "$1"'#000+
   '11028_D_Handling option "$1"'#000+
   '11029_O_*** press enter ***'#000+
   '11029_O_*** press enter ***'#000+
-  '11030_H_Start of reading conf','ig file $1'#000+
+  '11030_H_Start of reading config file $1'#000+
   '11031_H_End of reading config file $1'#000+
   '11031_H_End of reading config file $1'#000+
   '11032_D_interpreting option "$1"'#000+
   '11032_D_interpreting option "$1"'#000+
-  '11036_D_interpreting firstpass option "$1"'#000+
+  '11036_D','_interpreting firstpass option "$1"'#000+
   '11033_D_interpreting file option "$1"'#000+
   '11033_D_interpreting file option "$1"'#000+
   '11034_D_Reading config file "$1"'#000+
   '11034_D_Reading config file "$1"'#000+
   '11035_D_found source file name "$1"'#000+
   '11035_D_found source file name "$1"'#000+
-  '11039_E_','Unknown code page'#000+
+  '11039_E_Unknown code page'#000+
   '11040_F_Config file $1 is a directory'#000+
   '11040_F_Config file $1 is a directory'#000+
-  '11041_W_Assembler output selected "$1" cannot generate debug info, deb'+
-  'ugging disabled'#000+
+  '11041_W_Assembler output selected',' "$1" cannot generate debug info, d'+
+  'ebugging disabled'#000+
   '11042_W_Use of ppc386.cfg is deprecated, please use fpc.cfg instead'#000+
   '11042_W_Use of ppc386.cfg is deprecated, please use fpc.cfg instead'#000+
-  '11043_F_In options file $1 at ','line $2 \var{\#ELSE} directive without'+
-  ' \var{\#IF(N)DEF} found'#000+
-  '11044_F_Option "$1" is not, or not yet, supported on the current targe'+
-  't platform'#000+
+  '11043_F_In options file $1 at line $2 \var{\#ELSE} directive without \'+
+  'var{\#IF(N)DEF} found'#000+
+  '11044_F_Option "$1" is not,',' or not yet, supported on the current tar'+
+  'get platform'#000+
   '11045_F_The feature "$1" is not, or not yet, supported on the selected'+
   '11045_F_The feature "$1" is not, or not yet, supported on the selected'+
   ' target platform'#000+
   ' target platform'#000+
-  '11046_N_DW','ARF debug information cannot be used with smart linking on'+
-  ' this target, switching to static linking'#000+
+  '11046_N_DWARF debug information cannot be used with smart linking on t'+
+  'his target, switching to stat','ic linking'#000+
   '11047_W_Option "$1" is ignored for the current target platform.'#000+
   '11047_W_Option "$1" is ignored for the current target platform.'#000+
   '11048_W_Disabling external debug information because it is unsupported'+
   '11048_W_Disabling external debug information because it is unsupported'+
-  ' for t','he selected target/debug format combination.'#000+
-  '12000_F_Cannot open whole program optimization feedback file "$1"'#000+
+  ' for the selected target/debug format combination.'#000+
+  '12000_F_Cannot open whole program optimizati','on feedback file "$1"'#000+
   '12001_D_Processing whole program optimization information in wpo feedb'+
   '12001_D_Processing whole program optimization information in wpo feedb'+
   'ack file "$1"'#000+
   'ack file "$1"'#000+
-  '12002_D_Finished processing the whole program',' optimization informati'+
-  'on in wpo feedback file "$1"'#000+
-  '12003_E_Expected section header, but got "$2" at line $1 of wpo feedba'+
-  'ck file'#000+
+  '12002_D_Finished processing the whole program optimization information'+
+  ' in wpo feedback file "$1"'#000+
+  '12003_E_Expected section header, but ','got "$2" at line $1 of wpo feed'+
+  'back file'#000+
   '12004_W_No handler registered for whole program optimization section "'+
   '12004_W_No handler registered for whole program optimization section "'+
-  '$2" at line $1 of wpo feedback file, ign','oring'#000+
+  '$2" at line $1 of wpo feedback file, ignoring'#000+
   '12005_D_Found whole program optimization section "$1" with information'+
   '12005_D_Found whole program optimization section "$1" with information'+
   ' about "$2"'#000+
   ' about "$2"'#000+
-  '12006_F_The selected whole program optimizations require a previously '+
-  'generated feedback file (use -Fw to specify)'#000+
-  '12007_E_No collected information nece','ssary to perform "$1" whole pro'+
-  'gram optimization found'#000+
-  '12008_F_Specify a whole program optimization feedback file to store th'+
-  'e generated info in (using -FW)'#000+
+  '1','2006_F_The selected whole program optimizations require a previousl'+
+  'y generated feedback file (use -Fw to specify)'#000+
+  '12007_E_No collected information necessary to perform "$1" whole progr'+
+  'am optimization found'#000+
+  '12008_F_Specify a whole program op','timization feedback file to store '+
+  'the generated info in (using -FW)'#000+
   '12009_E_Not generating any whole program optimization information, yet'+
   '12009_E_Not generating any whole program optimization information, yet'+
-  ' a feedback f','ile was specified (using -FW)'#000+
-  '12010_E_Not performing any whole program optimizations, yet an input f'+
-  'eedback file was specified (using -Fw)'#000+
+  ' a feedback file was specified (using -FW)'#000+
+  '12010_E_Not performing any whole program optimizations, yet',' an input'+
+  ' feedback file was specified (using -Fw)'#000+
   '12011_D_Skipping whole program optimization section "$1", because not '+
   '12011_D_Skipping whole program optimization section "$1", because not '+
-  'needed by the requested optimiz','ations'#000+
+  'needed by the requested optimizations'#000+
   '12012_W_Overriding previously read information for "$1" from feedback '+
   '12012_W_Overriding previously read information for "$1" from feedback '+
-  'input file using information in section "$2"'#000+
+  'input file u','sing information in section "$2"'#000+
   '12013_E_Cannot extract symbol liveness information from program when s'+
   '12013_E_Cannot extract symbol liveness information from program when s'+
   'tripping symbols, use -Xs-'#000+
   'tripping symbols, use -Xs-'#000+
-  '12014_E_Cannot extrac','t symbol liveness information from program when'+
-  ' when not linking'#000+
-  '12015_F_Cannot find "$1" or "$2" to extract symbol liveness informatio'+
-  'n from linked program'#000+
+  '12014_E_Cannot extract symbol liveness information from program when w'+
+  'hen not linking'#000+
+  '12015_F_Cannot find "$1"',' or "$2" to extract symbol liveness informat'+
+  'ion from linked program'#000+
   '12016_E_Error during reading symbol liveness information produced by "'+
   '12016_E_Error during reading symbol liveness information produced by "'+
   '$1"'#000+
   '$1"'#000+
-  '12017_F_E','rror executing "$1" (exitcode: $2) to extract symbol inform'+
-  'ation from linked program'#000+
-  '12018_E_Collection of symbol liveness information can only help when u'+
-  'sing smart linking, use -CX -XX'#000+
-  '12019_E_Cannot create specified whole program optimis','ation feedback '+
-  'file "$1"'#000+
-  '11023_Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPC'+
-  'CPU'#010+
-  'Copyright (c) 1993-2010 by Florian Klaempfl'#000+
+  '12017_F_Error executing "$1" (exitcode: $2) to extract symbol informat'+
+  'ion from linked program'#000+
+  '1201','8_E_Collection of symbol liveness information can only help when'+
+  ' using smart linking, use -CX -XX'#000+
+  '12019_E_Cannot create specified whole program optimisation feedback fi'+
+  'le "$1"'#000+
+  '11023_Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] fo','r $F'+
+  'PCCPU'#010+
+  'Copyright (c) 1993-2011 by Florian Klaempfl and others'#000+
   '11024_Free Pascal Compiler version $FPCVERSION'#010+
   '11024_Free Pascal Compiler version $FPCVERSION'#010+
   #010+
   #010+
   'Compiler Date      : $FPCDATE'#010+
   'Compiler Date      : $FPCDATE'#010+
-  'Compiler CPU Target',': $FPCCPU'#010+
+  'Compiler CPU Target: $FPCCPU'#010+
   #010+
   #010+
   'Supported targets:'#010+
   'Supported targets:'#010+
   '  $OSTARGETS'#010+
   '  $OSTARGETS'#010+
   #010+
   #010+
   'Supported CPU instruction sets:'#010+
   'Supported CPU instruction sets:'#010+
-  '  $INSTRUCTIONSETS'#010+
+  '  ','$INSTRUCTIONSETS'#010+
   #010+
   #010+
   'Supported FPU instruction sets:'#010+
   'Supported FPU instruction sets:'#010+
   '  $FPUINSTRUCTIONSETS'#010+
   '  $FPUINSTRUCTIONSETS'#010+
@@ -1063,311 +1068,311 @@ const msgtxt : array[0..000244,1..240] of char=(
   'Supported Optimizations:'#010+
   'Supported Optimizations:'#010+
   '  $OPTIMIZATIONS'#010+
   '  $OPTIMIZATIONS'#010+
   #010+
   #010+
-  'Supporte','d Whole Program Optimizations:'#010+
+  'Supported Whole Program Optimizations:'#010+
   '  All'#010+
   '  All'#010+
   '  $WPOPTIMIZATIONS'#010+
   '  $WPOPTIMIZATIONS'#010+
   #010+
   #010+
-  'Supported Microcontroller types:'#010+
+  'Supported Microcontro','ller types:'#010+
   '  $CONTROLLERTYPES'#010+
   '  $CONTROLLERTYPES'#010+
   #010+
   #010+
   'This program comes under the GNU General Public Licence'#010+
   'This program comes under the GNU General Public Licence'#010+
   'For more information read COPYING.FPC'#010+
   'For more information read COPYING.FPC'#010+
   #010+
   #010+
-  'Report bugs, suggestions, etc. to:'#010,
+  'Report bugs, suggestions, etc. to:'#010+
   '                 http://bugs.freepascal.org'#010+
   '                 http://bugs.freepascal.org'#010+
   'or'#010+
   'or'#010+
-  '                 [email protected]'#000+
+  '                 bugs@freepasca','l.org'#000+
   '11025_**0*_Put + after a boolean switch option to enable it, - to disa'+
   '11025_**0*_Put + after a boolean switch option to enable it, - to disa'+
   'ble it'#010+
   'ble it'#010+
   '**1a_The compiler doesn'#039't delete the generated assembler file'#010+
   '**1a_The compiler doesn'#039't delete the generated assembler file'#010+
-  '**2al_List source','code lines in assembler file'#010+
+  '**2al_List sourcecode lines in assembler file'#010+
   '**2an_List node info in assembler file'#010+
   '**2an_List node info in assembler file'#010+
-  '*L2ap_Use pipes instead of creating temporary assembler files'#010+
+  '*L2ap_Use ','pipes instead of creating temporary assembler files'#010+
   '**2ar_List register allocation/release info in assembler file'#010+
   '**2ar_List register allocation/release info in assembler file'#010+
-  '**2at_List temp allocation/release info in assem','bler file'#010+
+  '**2at_List temp allocation/release info in assembler file'#010+
   '**1A<x>_Output format:'#010+
   '**1A<x>_Output format:'#010+
   '**2Adefault_Use default assembler'#010+
   '**2Adefault_Use default assembler'#010+
-  '3*2Aas_Assemble using GNU AS'#010+
+  '3*2Aas_Asse','mble using GNU AS'#010+
   '3*2Amacho_Mach-O (Darwin, Intel 32 bit) using internal writer'#010+
   '3*2Amacho_Mach-O (Darwin, Intel 32 bit) using internal writer'#010+
   '3*2Anasmcoff_COFF (Go32v2) file using Nasm'#010+
   '3*2Anasmcoff_COFF (Go32v2) file using Nasm'#010+
-  '3*2Anasmelf_ELF32 (Linux) file using Na','sm'#010+
+  '3*2Anasmelf_ELF32 (Linux) file using Nasm'#010+
   '3*2Anasmwin32_Win32 object file using Nasm'#010+
   '3*2Anasmwin32_Win32 object file using Nasm'#010+
-  '3*2Anasmwdosx_Win32/WDOSX object file using Nasm'#010+
+  '3*2Anasmwdosx_Win32/WDOSX object',' file using Nasm'#010+
   '3*2Awasm_Obj file using Wasm (Watcom)'#010+
   '3*2Awasm_Obj file using Wasm (Watcom)'#010+
   '3*2Anasmobj_Obj file using Nasm'#010+
   '3*2Anasmobj_Obj file using Nasm'#010+
   '3*2Amasm_Obj file using Masm (Microsoft)'#010+
   '3*2Amasm_Obj file using Masm (Microsoft)'#010+
-  '3*2Atasm_Obj file using Tasm (Borl','and)'#010+
+  '3*2Atasm_Obj file using Tasm (Borland)'#010+
   '3*2Aelf_ELF (Linux) using internal writer'#010+
   '3*2Aelf_ELF (Linux) using internal writer'#010+
-  '3*2Acoff_COFF (Go32v2) using internal writer'#010+
+  '3*2Acoff_COFF (Go32v2) using in','ternal writer'#010+
   '3*2Apecoff_PE-COFF (Win32) using internal writer'#010+
   '3*2Apecoff_PE-COFF (Win32) using internal writer'#010+
   '4*2Aas_Assemble using GNU AS'#010+
   '4*2Aas_Assemble using GNU AS'#010+
   '6*2Aas_Unix o-file using GNU AS'#010+
   '6*2Aas_Unix o-file using GNU AS'#010+
   '6*2Agas_GNU Motorola assembler'#010+
   '6*2Agas_GNU Motorola assembler'#010+
-  '6*2Amit','_MIT Syntax (old GAS)'#010+
+  '6*2Amit_MIT Syntax (old GAS)'#010+
   '6*2Amot_Standard Motorola assembler'#010+
   '6*2Amot_Standard Motorola assembler'#010+
-  'A*2Aas_Assemble using GNU AS'#010+
+  'A*2Aas_Assemble usin','g GNU AS'#010+
   'P*2Aas_Assemble using GNU AS'#010+
   'P*2Aas_Assemble using GNU AS'#010+
   'S*2Aas_Assemble using GNU AS'#010+
   'S*2Aas_Assemble using GNU AS'#010+
   '**1b_Generate browser info'#010+
   '**1b_Generate browser info'#010+
   '**2bl_Generate local symbol info'#010+
   '**2bl_Generate local symbol info'#010+
   '**1B_Build all modules'#010+
   '**1B_Build all modules'#010+
-  '**1C<x>_Code',' generation options:'#010+
+  '**1C<x>_Code generation options:'#010+
   '**2C3<x>_Turn on ieee error checking for constants'#010+
   '**2C3<x>_Turn on ieee error checking for constants'#010+
-  '**2Ca<x>_Select ABI, see fpc -i for possible values'#010+
+  '**2Ca<','x>_Select ABI, see fpc -i for possible values'#010+
   '**2Cb_Generate big-endian code'#010+
   '**2Cb_Generate big-endian code'#010+
   '**2Cc<x>_Set default calling convention to <x>'#010+
   '**2Cc<x>_Set default calling convention to <x>'#010+
-  '**2CD_Create also dynamic library (not',' supported)'#010+
+  '**2CD_Create also dynamic library (not supported)'#010+
   '**2Ce_Compilation with emulated floating point opcodes'#010+
   '**2Ce_Compilation with emulated floating point opcodes'#010+
-  '**2Cf<x>_Select fpu instruction set to use, see fpc -i for possible va'+
-  'lues'#010+
+  '**2Cf<x>_Se','lect fpu instruction set to use, see fpc -i for possible '+
+  'values'#010+
   '**2CF<x>_Minimal floating point constant precision (default, 32, 64)'#010+
   '**2CF<x>_Minimal floating point constant precision (default, 32, 64)'#010+
   '**2Cg_Generate PIC code'#010+
   '**2Cg_Generate PIC code'#010+
-  '**2Ch','<n>_<n> bytes heap (between 1023 and 67107840)'#010+
+  '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#010+
   '**2Ci_IO-checking'#010+
   '**2Ci_IO-checking'#010+
-  '**2Cn_Omit linking stage'#010+
+  '**2Cn_Omit li','nking stage'#010+
   '**2Co_Check overflow of integer operations'#010+
   '**2Co_Check overflow of integer operations'#010+
   '**2CO_Check for possible overflow of integer operations'#010+
   '**2CO_Check for possible overflow of integer operations'#010+
-  '**2Cp<x>_Select instruction set, see fpc -i for pos','sible values'#010+
+  '**2Cp<x>_Select instruction set, see fpc -i for possible values'#010+
   '**2CP<x>=<y>_ packing settings'#010+
   '**2CP<x>=<y>_ packing settings'#010+
-  '**3CPPACKSET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 '+
-  'and 8'#010+
+  '**3CPPACKSET=<y>_ <y> set allocati','on: 0, 1 or DEFAULT or NORMAL, 2, '+
+  '4 and 8'#010+
   '**2Cr_Range checking'#010+
   '**2Cr_Range checking'#010+
   '**2CR_Verify object method call validity'#010+
   '**2CR_Verify object method call validity'#010+
   '**2Cs<n>_Set stack checking size to <n>'#010+
   '**2Cs<n>_Set stack checking size to <n>'#010+
-  '**2Ct_Stack checki','ng (for testing only, see manual)'#010+
+  '**2Ct_Stack checking (for testing only, see manual)'#010+
   '**2CX_Create also smartlinked library'#010+
   '**2CX_Create also smartlinked library'#010+
-  '**1d<x>_Defines the symbol <x>'#010+
+  '**1d<x','>_Defines the symbol <x>'#010+
   '**1D_Generate a DEF file'#010+
   '**1D_Generate a DEF file'#010+
   '**2Dd<x>_Set description to <x>'#010+
   '**2Dd<x>_Set description to <x>'#010+
   '**2Dv<x>_Set DLL version to <x>'#010+
   '**2Dv<x>_Set DLL version to <x>'#010+
   '*O2Dw_PM application'#010+
   '*O2Dw_PM application'#010+
-  '**1e<x>_Set path to executa','ble'#010+
+  '**1e<x>_Set path to executable'#010+
   '**1E_Same as -Cn'#010+
   '**1E_Same as -Cn'#010+
   '**1fPIC_Same as -Cg'#010+
   '**1fPIC_Same as -Cg'#010+
   '**1F<x>_Set file names and paths:'#010+
   '**1F<x>_Set file names and paths:'#010+
-  '**2Fa<x>[,y]_(for a program) load units <x> and [y] before uses is par'+
-  'sed'#010+
+  '**2','Fa<x>[,y]_(for a program) load units <x> and [y] before uses is p'+
+  'arsed'#010+
   '**2Fc<x>_Set input codepage to <x>'#010+
   '**2Fc<x>_Set input codepage to <x>'#010+
   '**2FC<x>_Set RC compiler binary name to <x>'#010+
   '**2FC<x>_Set RC compiler binary name to <x>'#010+
-  '**2Fd_Disabl','e the compiler'#039's internal directory cache'#010+
-  '**2FD<x>_Set the directory where to search for compiler utilities'#010+
+  '**2Fd_Disable the compiler'#039's internal directory cache'#010+
+  '**2FD<x>_Set the directory where to ','search for compiler utilities'#010+
   '**2Fe<x>_Redirect error output to <x>'#010+
   '**2Fe<x>_Redirect error output to <x>'#010+
   '**2Ff<x>_Add <x> to framework path (Darwin only)'#010+
   '**2Ff<x>_Add <x> to framework path (Darwin only)'#010+
   '**2FE<x>_Set exe/unit output path to <x>'#010+
   '**2FE<x>_Set exe/unit output path to <x>'#010+
-  '**2F','i<x>_Add <x> to include path'#010+
+  '**2Fi<x>_Add <x> to include path'#010+
   '**2Fl<x>_Add <x> to library path'#010+
   '**2Fl<x>_Add <x> to library path'#010+
-  '**2FL<x>_Use <x> as dynamic linker'#010+
+  '**2FL<x>_Use <x>',' as dynamic linker'#010+
   '**2Fm<x>_Load unicode conversion table from <x>.txt in the compiler di'+
   '**2Fm<x>_Load unicode conversion table from <x>.txt in the compiler di'+
   'r'#010+
   'r'#010+
   '**2Fo<x>_Add <x> to object path'#010+
   '**2Fo<x>_Add <x> to object path'#010+
   '**2Fr<x>_Load error message file <x>'#010+
   '**2Fr<x>_Load error message file <x>'#010+
-  '**','2FR<x>_Set resource (.res) linker to <x>'#010+
+  '**2FR<x>_Set resource (.res) linker to <x>'#010+
   '**2Fu<x>_Add <x> to unit path'#010+
   '**2Fu<x>_Add <x> to unit path'#010+
-  '**2FU<x>_Set unit output path to <x>, overrides -FE'#010+
+  '**2FU<x','>_Set unit output path to <x>, overrides -FE'#010+
   '**2FW<x>_Store generated whole-program optimization feedback in <x>'#010+
   '**2FW<x>_Store generated whole-program optimization feedback in <x>'#010+
-  '**2Fw<x>_Load previously stored whole-program opt','imization feedback '+
-  'from <x>'#010+
-  '*g1g_Generate debug information (default format for target)'#010+
+  '**2Fw<x>_Load previously stored whole-program optimization feedback fr'+
+  'om <x>'#010+
+  '*g1g_Generate debug information (default format fo','r target)'#010+
   '*g2gc_Generate checks for pointers'#010+
   '*g2gc_Generate checks for pointers'#010+
   '*g2gh_Use heaptrace unit (for memory leak/corruption debugging)'#010+
   '*g2gh_Use heaptrace unit (for memory leak/corruption debugging)'#010+
-  '*g2gl_Use line info unit (show more info with backtra','ces)'#010+
+  '*g2gl_Use line info unit (show more info with backtraces)'#010+
   '*g2go<x>_Set debug information options'#010+
   '*g2go<x>_Set debug information options'#010+
-  '*g3godwarfsets_ Enable DWARF '#039'set'#039' type debug information (bre'+
-  'aks gdb < 6.5)'#010+
+  '*g3godwarfsets_ Enable DWARF '#039'set'#039,' type debug information (br'+
+  'eaks gdb < 6.5)'#010+
   '*g3gostabsabsincludes_ Store absolute/full include file paths in Stabs'+
   '*g3gostabsabsincludes_ Store absolute/full include file paths in Stabs'+
   #010+
   #010+
-  '*g3godwarfmethodclassprefix_ Prefix method names',' in DWARF with class'+
-  ' name'#010+
+  '*g3godwarfmethodclassprefix_ Prefix method names in DWARF with class n'+
+  'ame'#010+
   '*g2gp_Preserve case in stabs symbol names'#010+
   '*g2gp_Preserve case in stabs symbol names'#010+
-  '*g2gs_Generate Stabs debug information'#010+
+  '*g2gs_Gene','rate Stabs debug information'#010+
   '*g2gt_Trash local variables (to detect uninitialized uses)'#010+
   '*g2gt_Trash local variables (to detect uninitialized uses)'#010+
   '*g2gv_Generates programs traceable with Valgrind'#010+
   '*g2gv_Generates programs traceable with Valgrind'#010+
-  '*g2gw_Generate DWARFv2 de','bug information (same as -gw2)'#010+
+  '*g2gw_Generate DWARFv2 debug information (same as -gw2)'#010+
   '*g2gw2_Generate DWARFv2 debug information'#010+
   '*g2gw2_Generate DWARFv2 debug information'#010+
-  '*g2gw3_Generate DWARFv3 debug information'#010+
+  '*g2gw','3_Generate DWARFv3 debug information'#010+
   '*g2gw4_Generate DWARFv4 debug information (experimental)'#010+
   '*g2gw4_Generate DWARFv4 debug information (experimental)'#010+
   '**1i_Information'#010+
   '**1i_Information'#010+
   '**2iD_Return compiler date'#010+
   '**2iD_Return compiler date'#010+
-  '**2iV_Return short compi','ler version'#010+
+  '**2iV_Return short compiler version'#010+
   '**2iW_Return full compiler version'#010+
   '**2iW_Return full compiler version'#010+
   '**2iSO_Return compiler OS'#010+
   '**2iSO_Return compiler OS'#010+
-  '**2iSP_Return compiler host processor'#010+
+  '**2iS','P_Return compiler host processor'#010+
   '**2iTO_Return target OS'#010+
   '**2iTO_Return target OS'#010+
   '**2iTP_Return target processor'#010+
   '**2iTP_Return target processor'#010+
   '**1I<x>_Add <x> to include path'#010+
   '**1I<x>_Add <x> to include path'#010+
   '**1k<x>_Pass <x> to the linker'#010+
   '**1k<x>_Pass <x> to the linker'#010+
-  '**1l_Write ','logo'#010+
+  '**1l_Write logo'#010+
   '**1M<x>_Set language mode to <x>'#010+
   '**1M<x>_Set language mode to <x>'#010+
   '**2Mfpc_Free Pascal dialect (default)'#010+
   '**2Mfpc_Free Pascal dialect (default)'#010+
-  '**2Mobjfpc_FPC mode with Object Pascal support'#010+
+  '**','2Mobjfpc_FPC mode with Object Pascal support'#010+
   '**2Mdelphi_Delphi 7 compatibility mode'#010+
   '**2Mdelphi_Delphi 7 compatibility mode'#010+
   '**2Mtp_TP/BP 7.0 compatibility mode'#010+
   '**2Mtp_TP/BP 7.0 compatibility mode'#010+
-  '**2Mmacpas_Macintosh Pascal dialects compa','tibility mode'#010+
+  '**2Mmacpas_Macintosh Pascal dialects compatibility mode'#010+
   '**1n_Do not read the default config files'#010+
   '**1n_Do not read the default config files'#010+
-  '**1N<x>_Node tree optimizations'#010+
+  '**1N<x>_Node tree opti','mizations'#010+
   '**2Nu_Unroll loops'#010+
   '**2Nu_Unroll loops'#010+
   '**1o<x>_Change the name of the executable produced to <x>'#010+
   '**1o<x>_Change the name of the executable produced to <x>'#010+
   '**1O<x>_Optimizations:'#010+
   '**1O<x>_Optimizations:'#010+
   '**2O-_Disable optimizations'#010+
   '**2O-_Disable optimizations'#010+
-  '**2O1_Level 1 optimizati','ons (quick and debugger friendly)'#010+
-  '**2O2_Level 2 optimizations (-O1 + quick optimizations)'#010+
+  '**2O1_Level 1 optimizations (quick and debugger friendly)'#010+
+  '**2O2_Level 2 optimizations (-O1 + quick opt','imizations)'#010+
   '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+
   '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+
   '**2Oa<x>=<y>_Set alignment'#010+
   '**2Oa<x>=<y>_Set alignment'#010+
-  '**2Oo[NO]<x>_Enable or disable optimizations, see fpc -i for possibl','e'+
-  ' values'#010+
-  '**2Op<x>_Set target cpu for optimizing, see fpc -i for possible values'+
-  #010+
+  '**2Oo[NO]<x>_Enable or disable optimizations, see fpc -i for possible '+
+  'values'#010+
+  '**2Op<x>_Set target cpu for optimizing, see fpc -i for possible value',
+  's'#010+
   '**2OW<x>_Generate whole-program optimization feedback for optimization'+
   '**2OW<x>_Generate whole-program optimization feedback for optimization'+
   ' <x>, see fpc -i for possible values'#010+
   ' <x>, see fpc -i for possible values'#010+
-  '**2Ow<x>_Perform whole-program optimization <x>, see ','fpc -i for poss'+
-  'ible values'#010+
+  '**2Ow<x>_Perform whole-program optimization <x>, see fpc -i for possib'+
+  'le values'#010+
   '**2Os_Optimize for size rather than speed'#010+
   '**2Os_Optimize for size rather than speed'#010+
-  '**1pg_Generate profile code for gprof (defines FPC_PROFILE)'#010+
+  '**1pg_Gen','erate profile code for gprof (defines FPC_PROFILE)'#010+
   '**1R<x>_Assembler reading style:'#010+
   '**1R<x>_Assembler reading style:'#010+
   '**2Rdefault_Use default assembler for target'#010+
   '**2Rdefault_Use default assembler for target'#010+
-  '3*2Ratt_Read AT&T style assembler',#010+
+  '3*2Ratt_Read AT&T style assembler'#010+
   '3*2Rintel_Read Intel style assembler'#010+
   '3*2Rintel_Read Intel style assembler'#010+
   '6*2RMOT_Read motorola style assembler'#010+
   '6*2RMOT_Read motorola style assembler'#010+
-  '**1S<x>_Syntax options:'#010+
+  '**','1S<x>_Syntax options:'#010+
   '**2S2_Same as -Mobjfpc'#010+
   '**2S2_Same as -Mobjfpc'#010+
   '**2Sc_Support operators like C (*=,+=,/= and -=)'#010+
   '**2Sc_Support operators like C (*=,+=,/= and -=)'#010+
   '**2Sa_Turn on assertions'#010+
   '**2Sa_Turn on assertions'#010+
   '**2Sd_Same as -Mdelphi'#010+
   '**2Sd_Same as -Mdelphi'#010+
-  '**2Se<x>_Error optio','ns. <x> is a combination of the following:'#010+
-  '**3*_<n> : Compiler halts after the <n> errors (default is 1)'#010+
+  '**2Se<x>_Error options. <x> is a combination of the following:'#010+
+  '**3*_<n> : Compiler halts after the',' <n> errors (default is 1)'#010+
   '**3*_w : Compiler also halts after warnings'#010+
   '**3*_w : Compiler also halts after warnings'#010+
   '**3*_n : Compiler also halts after notes'#010+
   '**3*_n : Compiler also halts after notes'#010+
   '**3*_h : Compiler also halts after hints'#010+
   '**3*_h : Compiler also halts after hints'#010+
-  '**2Sg_Ena','ble LABEL and GOTO (default in -Mtp and -Mdelphi)'#010+
-  '**2Sh_Use ansistrings by default instead of shortstrings'#010+
+  '**2Sg_Enable LABEL and GOTO (default in -Mtp and -Mdelphi)'#010+
+  '**2Sh_Use ansistrings by def','ault instead of shortstrings'#010+
   '**2Si_Turn on inlining of procedures/functions declared as "inline"'#010+
   '**2Si_Turn on inlining of procedures/functions declared as "inline"'#010+
   '**2Sk_Load fpcylix unit'#010+
   '**2Sk_Load fpcylix unit'#010+
   '**2SI<x>_Set interface style to <x>'#010+
   '**2SI<x>_Set interface style to <x>'#010+
-  '**3SI','com_COM compatible interface (default)'#010+
+  '**3SIcom_COM compatible interface (default)'#010+
   '**3SIcorba_CORBA compatible interface'#010+
   '**3SIcorba_CORBA compatible interface'#010+
-  '**2Sm_Support macros like C (global)'#010+
+  '*','*2Sm_Support macros like C (global)'#010+
   '**2So_Same as -Mtp'#010+
   '**2So_Same as -Mtp'#010+
   '**2Ss_Constructor name must be init (destructor must be done)'#010+
   '**2Ss_Constructor name must be init (destructor must be done)'#010+
-  '**2Sx_Enable exception keywords (default in D','elphi/ObjFPC modes)'#010+
+  '**2Sx_Enable exception keywords (default in Delphi/ObjFPC modes)'#010+
   '**1s_Do not call assembler and linker'#010+
   '**1s_Do not call assembler and linker'#010+
-  '**2sh_Generate script to link on host'#010+
+  '**2sh_Generate scrip','t to link on host'#010+
   '**2st_Generate script to link on target'#010+
   '**2st_Generate script to link on target'#010+
   '**2sr_Skip register allocation phase (use with -alr)'#010+
   '**2sr_Skip register allocation phase (use with -alr)'#010+
   '**1T<x>_Target operating system:'#010+
   '**1T<x>_Target operating system:'#010+
-  '3*2Tdarwin_Darwin/','Mac OS X'#010+
+  '3*2Tdarwin_Darwin/Mac OS X'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
-  '3*2Tfreebsd_FreeBSD'#010+
+  '3*2Tfreebsd_FreeBSD',#010+
   '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
   '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
   '3*2Tiphonesim_ iPhoneSimulator from iOS SDK 3.2+ (older versions: -Tda'+
   '3*2Tiphonesim_ iPhoneSimulator from iOS SDK 3.2+ (older versions: -Tda'+
   'rwin)'#010+
   'rwin)'#010+
   '3*2Tlinux_Linux'#010+
   '3*2Tlinux_Linux'#010+
   '3*2Tnetbsd_NetBSD'#010+
   '3*2Tnetbsd_NetBSD'#010+
-  '3*2','Tnetware_Novell Netware Module (clib)'#010+
-  '3*2Tnetwlibc_Novell Netware Module (libc)'#010+
+  '3*2Tnetware_Novell Netware Module (clib)'#010+
+  '3*2Tnetwlibc_Novell Netware Module (libc',')'#010+
   '3*2Topenbsd_OpenBSD'#010+
   '3*2Topenbsd_OpenBSD'#010+
   '3*2Tos2_OS/2 / eComStation'#010+
   '3*2Tos2_OS/2 / eComStation'#010+
   '3*2Tsunos_SunOS/Solaris'#010+
   '3*2Tsunos_SunOS/Solaris'#010+
   '3*2Tsymbian_Symbian OS'#010+
   '3*2Tsymbian_Symbian OS'#010+
   '3*2Tsolaris_Solaris'#010+
   '3*2Tsolaris_Solaris'#010+
   '3*2Twatcom_Watcom compatible DOS extender'#010+
   '3*2Twatcom_Watcom compatible DOS extender'#010+
-  '3*2T','wdosx_WDOSX DOS extender'#010+
+  '3*2Twdosx_WDOSX DOS extender'#010+
   '3*2Twin32_Windows 32 Bit'#010+
   '3*2Twin32_Windows 32 Bit'#010+
   '3*2Twince_Windows CE'#010+
   '3*2Twince_Windows CE'#010+
-  '4*2Tdarwin_Darwin/Mac OS X'#010+
+  '4*2Tdar','win_Darwin/Mac OS X'#010+
   '4*2Tlinux_Linux'#010+
   '4*2Tlinux_Linux'#010+
   '4*2Twin64_Win64 (64 bit Windows systems)'#010+
   '4*2Twin64_Win64 (64 bit Windows systems)'#010+
   '6*2Tamiga_Commodore Amiga'#010+
   '6*2Tamiga_Commodore Amiga'#010+
   '6*2Tatari_Atari ST/STe/TT'#010+
   '6*2Tatari_Atari ST/STe/TT'#010+
   '6*2Tlinux_Linux'#010+
   '6*2Tlinux_Linux'#010+
-  '6*2Tpalmos_PalmOS',#010+
+  '6*2Tpalmos_PalmOS'#010+
   'A*2Tdarwin_Darwin/iPhoneOS/iOS'#010+
   'A*2Tdarwin_Darwin/iPhoneOS/iOS'#010+
   'A*2Tlinux_Linux'#010+
   'A*2Tlinux_Linux'#010+
   'A*2Twince_Windows CE'#010+
   'A*2Twince_Windows CE'#010+
-  'P*2Tamiga_AmigaOS'#010+
+  'P*2Tamiga','_AmigaOS'#010+
   'P*2Tdarwin_Darwin/Mac OS X'#010+
   'P*2Tdarwin_Darwin/Mac OS X'#010+
   'P*2Tlinux_Linux'#010+
   'P*2Tlinux_Linux'#010+
   'P*2Tmacos_Mac OS (classic)'#010+
   'P*2Tmacos_Mac OS (classic)'#010+
   'P*2Tmorphos_MorphOS'#010+
   'P*2Tmorphos_MorphOS'#010+
   'S*2Tsolaris_Solaris'#010+
   'S*2Tsolaris_Solaris'#010+
   'S*2Tlinux_Linux'#010+
   'S*2Tlinux_Linux'#010+
-  '**1u<x>_Undefines the symbo','l <x>'#010+
+  '**1u<x>_Undefines the symbol <x>'#010+
   '**1U_Unit options:'#010+
   '**1U_Unit options:'#010+
-  '**2Un_Do not check where the unit name matches the file name'#010+
+  '**2Un_Do not check where the unit name matches the fi','le name'#010+
   '**2Ur_Generate release unit files (never automatically recompiled)'#010+
   '**2Ur_Generate release unit files (never automatically recompiled)'#010+
   '**2Us_Compile a system unit'#010+
   '**2Us_Compile a system unit'#010+
-  '**1v<x>_Be verbose. <x> is a combination of the following l','etters:'#010+
-  '**2*_e : Show errors (default)       0 : Show nothing (except errors)'#010+
+  '**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+
+  '**2*_e : Show errors (default)       0 : Show nothing (except errors)'#010,
   '**2*_w : Show warnings               u : Show unit info'#010+
   '**2*_w : Show warnings               u : Show unit info'#010+
   '**2*_n : Show notes                  t : Show tried/used files'#010+
   '**2*_n : Show notes                  t : Show tried/used files'#010+
-  '**2*_h : Show hints                  c : Sh','ow conditionals'#010+
+  '**2*_h : Show hints                  c : Show conditionals'#010+
   '**2*_i : Show general info           d : Show debug info'#010+
   '**2*_i : Show general info           d : Show debug info'#010+
-  '**2*_l : Show linenumbers            r : Rhide/GCC compatibility mode'#010+
-  '**2*_s : Show time stamps            q : Show message numbers'#010+
-  '**2*_a : Show everything           ','  x : Executable info (Win32 only'+
-  ')'#010+
-  '**2*_b : Write file names messages   p : Write tree.log with parse tre'+
+  '**2*_','l : Show linenumbers            r : Rhide/GCC compatibility mod'+
   'e'#010+
   'e'#010+
+  '**2*_s : Show time stamps            q : Show message numbers'#010+
+  '**2*_a : Show everything             x : Executable info (Win32 only)'#010+
+  '**2*_b : Write file names messages   p : Wr','ite tree.log with parse t'+
+  'ree'#010+
   '**2*_    with full path              v : Write fpcdebug.txt with'#010+
   '**2*_    with full path              v : Write fpcdebug.txt with'#010+
   '**2*_                                    lots of debugging info'#010+
   '**2*_                                    lots of debugging info'#010+
-  '**2*','_m<x>,<y> : Don'#039't show messages numbered <x> and <y>'#010+
-  '3*1W<x>_Target-specific options (targets)'#010+
+  '**2*_m<x>,<y> : Don'#039't show messages numbered <x> and <y>'#010+
+  '3*1W<x>_Target-specific o','ptions (targets)'#010+
   'A*1W<x>_Target-specific options (targets)'#010+
   'A*1W<x>_Target-specific options (targets)'#010+
   'P*1W<x>_Target-specific options (targets)'#010+
   'P*1W<x>_Target-specific options (targets)'#010+
   'p*1W<x>_Target-specific options (targets)'#010+
   'p*1W<x>_Target-specific options (targets)'#010+
-  '3*2Wb_Create a bund','le instead of a library (Darwin)'#010+
-  'P*2Wb_Create a bundle instead of a library (Darwin)'#010+
+  '3*2Wb_Create a bundle instead of a library (Darwin)'#010+
+  'P*2Wb_Create a bundle instead of a library (D','arwin)'#010+
   'p*2Wb_Create a bundle instead of a library (Darwin)'#010+
   'p*2Wb_Create a bundle instead of a library (Darwin)'#010+
   '3*2WB_Create a relocatable image (Windows)'#010+
   '3*2WB_Create a relocatable image (Windows)'#010+
   'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
   'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
-  '3*2WC_Sp','ecify console type application (EMX, OS/2, Windows)'#010+
-  'A*2WC_Specify console type application (Windows)'#010+
+  '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
+  'A*2WC_Specify console type',' application (Windows)'#010+
   'P*2WC_Specify console type application (Classic Mac OS)'#010+
   'P*2WC_Specify console type application (Classic Mac OS)'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
-  'A*2WD_Use DEFFILE to ','export functions of DLL or EXE (Windows)'#010+
-  '3*2We_Use external resources (Darwin)'#010+
+  'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
+  '3*2We_Use external resources (Darwin)',#010+
   '4*2We_Use external resources (Darwin)'#010+
   '4*2We_Use external resources (Darwin)'#010+
   'A*2We_Use external resources (Darwin)'#010+
   'A*2We_Use external resources (Darwin)'#010+
   'P*2We_Use external resources (Darwin)'#010+
   'P*2We_Use external resources (Darwin)'#010+
   'p*2We_Use external resources (Darwin)'#010+
   'p*2We_Use external resources (Darwin)'#010+
-  '3*2WF_Spe','cify full-screen type application (EMX, OS/2)'#010+
-  '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
+  '3*2WF_Specify full-screen type application (EMX, OS/2)'#010+
+  '3*2WG_Specify graphic type appli','cation (EMX, OS/2, Windows)'#010+
   'A*2WG_Specify graphic type application (Windows)'#010+
   'A*2WG_Specify graphic type application (Windows)'#010+
   'P*2WG_Specify graphic type application (Classic Mac OS)'#010+
   'P*2WG_Specify graphic type application (Classic Mac OS)'#010+
-  '3*2Wi_Use internal resources ','(Darwin)'#010+
+  '3*2Wi_Use internal resources (Darwin)'#010+
   'P*2Wi_Use internal resources (Darwin)'#010+
   'P*2Wi_Use internal resources (Darwin)'#010+
-  'p*2Wi_Use internal resources (Darwin)'#010+
+  'p*2Wi_Use internal resources (D','arwin)'#010+
   '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
-  '3*2WR_Generate ','relocation code (Windows)'#010+
+  '3*2WR_Generate relocation code (Windows)'#010+
   'A*2WR_Generate relocation code (Windows)'#010+
   'A*2WR_Generate relocation code (Windows)'#010+
-  'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
+  'P*2WT_Speci','fy MPW tool type application (Classic Mac OS)'#010+
   '3*2WX_Enable executable stack (Linux)'#010+
   '3*2WX_Enable executable stack (Linux)'#010+
   'A*2WX_Enable executable stack (Linux)'#010+
   'A*2WX_Enable executable stack (Linux)'#010+
   'p*2WX_Enable executable stack (Linux)'#010+
   'p*2WX_Enable executable stack (Linux)'#010+
-  'P*','2WX_Enable executable stack (Linux)'#010+
+  'P*2WX_Enable executable stack (Linux)'#010+
   '**1X_Executable options:'#010+
   '**1X_Executable options:'#010+
-  '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
-  'ux)'#010+
+  '**2Xc_Pass --shar','ed/-dynamic to the linker (BeOS, Darwin, FreeBSD, L'+
+  'inux)'#010+
   '**2Xd_Do not use standard library search path (needed for cross compil'+
   '**2Xd_Do not use standard library search path (needed for cross compil'+
   'e)'#010+
   'e)'#010+
   '**2Xe_Use external linker'#010+
   '**2Xe_Use external linker'#010+
-  '**2Xg_','Create debuginfo in a separate file and add a debuglink sectio'+
-  'n to executable'#010+
+  '**2Xg_Create debuginfo in a separate file and add a debuglink section '+
+  'to executable'#010,
   '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
   '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
   '**2Xi_Use internal linker'#010+
   '**2Xi_Use internal linker'#010+
   '**2Xm_Generate link map'#010+
   '**2Xm_Generate link map'#010+
-  '**2XM<x>_Set the name of the '#039'main'#039' program ','routine (default'+
-  ' is '#039'main'#039')'#010+
-  '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
+  '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
+  's '#039'main'#039')'#010+
+  '**2XP<x>_Prepend the binutils names with the prefi','x <x>'#010+
   '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+
   '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+
   'ile, see the ld manual for more information) (BeOS, Linux)'#010+
   'ile, see the ld manual for more information) (BeOS, Linux)'#010+
-  '**2XR<x>_Prepend <x> to all lin','ker search paths (BeOS, Darwin, FreeB'+
-  'SD, Linux, Mac OS, Solaris)'#010+
-  '**2Xs_Strip all symbols from executable'#010+
+  '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
+  ', Linux, Mac OS, Solaris)'#010+
+  '**2Xs_Strip a','ll symbols from executable'#010+
   '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
   '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
   '**2Xt_Link with static libraries (-static is passed to linker)'#010+
   '**2Xt_Link with static libraries (-static is passed to linker)'#010+
-  '**','2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
+  '**2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
   '**1*_'#010+
-  '**1?_Show this help'#010+
+  '**1?_Sho','w this help'#010+
   '**1h_Shows this help without waiting'
   '**1h_Shows this help without waiting'
 );
 );

+ 21 - 1
compiler/ncal.pas

@@ -201,6 +201,9 @@ interface
           function can_be_inlined: boolean;
           function can_be_inlined: boolean;
 
 
           property nextpara : tnode read right write right;
           property nextpara : tnode read right write right;
+          { third is reused to store the parameter name (only while parsing
+            vardispatch calls, never in real node tree) and copy of 'high'
+            parameter tree when the parameter is an open array of managed type }
           property parametername : tnode read third write third;
           property parametername : tnode read third write third;
 
 
           { returns whether the evaluation of this parameter involves a
           { returns whether the evaluation of this parameter involves a
@@ -620,6 +623,8 @@ implementation
          old_array_constructor:=allow_array_constructor;
          old_array_constructor:=allow_array_constructor;
          allow_array_constructor:=true;
          allow_array_constructor:=true;
          typecheckpass(left);
          typecheckpass(left);
+         if assigned(third) then
+           typecheckpass(third);
          allow_array_constructor:=old_array_constructor;
          allow_array_constructor:=old_array_constructor;
          if codegenerror then
          if codegenerror then
           resultdef:=generrordef
           resultdef:=generrordef
@@ -635,6 +640,8 @@ implementation
         if not assigned(left.resultdef) then
         if not assigned(left.resultdef) then
           get_paratype;
           get_paratype;
         firstpass(left);
         firstpass(left);
+        if assigned(third) then
+          firstpass(third);
         expectloc:=left.expectloc;
         expectloc:=left.expectloc;
       end;
       end;
 
 
@@ -2492,6 +2499,7 @@ implementation
         varargspara,
         varargspara,
         currpara : tparavarsym;
         currpara : tparavarsym;
         hiddentree : tnode;
         hiddentree : tnode;
+        paradef  : tdef;
       begin
       begin
         pt:=tcallparanode(left);
         pt:=tcallparanode(left);
         oldppt:=pcallparanode(@left);
         oldppt:=pcallparanode(@left);
@@ -2527,7 +2535,19 @@ implementation
                   if not assigned(pt) or (i=0) then
                   if not assigned(pt) or (i=0) then
                     internalerror(200304081);
                     internalerror(200304081);
                   { we need the information of the previous parameter }
                   { we need the information of the previous parameter }
-                  hiddentree:=gen_high_tree(pt.left,tparavarsym(procdefinition.paras[i-1]).vardef);
+                  paradef:=tparavarsym(procdefinition.paras[i-1]).vardef;
+                  hiddentree:=gen_high_tree(pt.left,paradef);
+                  { for open array of managed type, a copy of high parameter is
+                    necessary to properly initialize before the call }
+                  if is_open_array(paradef) and
+                    (tparavarsym(procdefinition.paras[i-1]).varspez=vs_out) and
+                     is_managed_type(tarraydef(paradef).elementdef) then
+                    begin
+                      typecheckpass(hiddentree);
+                      {this eliminates double call to fpc_dynarray_high, if any}
+                      maybe_load_in_temp(hiddentree);
+                      oldppt^.third:=hiddentree.getcopy;
+                    end;
                 end
                 end
               else
               else
                 if vo_is_typinfo_para in currpara.varoptions then
                 if vo_is_typinfo_para in currpara.varoptions then

+ 10 - 1
compiler/ncgcal.pas

@@ -167,7 +167,16 @@ implementation
                 is_managed_type(left.resultdef) then
                 is_managed_type(left.resultdef) then
                begin
                begin
                  location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false,sizeof(pint));
                  location_get_data_ref(current_asmdata.CurrAsmList,left.location,href,false,sizeof(pint));
-                 cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
+                 if is_open_array(resultdef) then
+                   begin
+                     if third=nil then
+                       InternalError(201103063);
+                     secondpass(third);
+                     cg.g_array_rtti_helper(current_asmdata.CurrAsmList,tarraydef(resultdef).elementdef,
+                       href,third.location,'FPC_DECREF_ARRAY');
+                   end
+                 else
+                   cg.g_decrrefcount(current_asmdata.CurrAsmList,left.resultdef,href);
                end;
                end;
 
 
              paramanager.createtempparaloc(current_asmdata.CurrAsmList,aktcallnode.procdefinition.proccalloption,parasym,not followed_by_stack_tainting_call_cached,tempcgpara);
              paramanager.createtempparaloc(current_asmdata.CurrAsmList,aktcallnode.procdefinition.proccalloption,parasym,not followed_by_stack_tainting_call_cached,tempcgpara);

+ 56 - 141
compiler/ncgmem.pas

@@ -59,6 +59,7 @@ interface
          function get_mul_size : aint;
          function get_mul_size : aint;
        private
        private
          procedure rangecheck_array;
          procedure rangecheck_array;
+         procedure rangecheck_string;
        protected
        protected
          {# This routine is used to calculate the address of the reference.
          {# This routine is used to calculate the address of the reference.
             On entry reg contains the index in the array,
             On entry reg contains the index in the array,
@@ -635,6 +636,10 @@ implementation
          hreg : tregister;
          hreg : tregister;
          paraloc1,paraloc2 : tcgpara;
          paraloc1,paraloc2 : tcgpara;
        begin
        begin
+         { omit range checking when this is an array access to a pointer which has been
+           typecasted from an array }
+         if (ado_isconvertedpointer in tarraydef(left.resultdef).arrayoptions) then
+           exit;
          paraloc1.init;
          paraloc1.init;
          paraloc2.init;
          paraloc2.init;
          if is_open_array(left.resultdef) or
          if is_open_array(left.resultdef) or
@@ -690,6 +695,45 @@ implementation
          paraloc2.done;
          paraloc2.done;
        end;
        end;
 
 
+    procedure tcgvecnode.rangecheck_string;
+      var
+        paraloc1,
+        paraloc2: tcgpara;
+      begin
+        paraloc1.init;
+        paraloc2.init;
+        case tstringdef(left.resultdef).stringtype of
+          { it's the same for ansi- and wide strings }
+          st_unicodestring,
+          st_widestring,
+          st_ansistring:
+            begin
+              paramanager.getintparaloc(pocall_default,1,paraloc1);
+              paramanager.getintparaloc(pocall_default,2,paraloc2);
+              cg.a_load_loc_cgpara(current_asmdata.CurrAsmList,left.location,paraloc1);
+              cg.a_load_loc_cgpara(current_asmdata.CurrAsmList,right.location,paraloc2);
+
+              paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
+              paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc2);
+              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
+              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resultdef).stringtypname)+'_RANGECHECK',false);
+              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
+            end;
+
+          st_shortstring:
+            begin
+              {!!!!!!!!!!!!!!!!!}
+              { if this one is implemented making use of the high parameter for openshortstrings, update ncgutils.do_get_used_regvars() too (JM) }
+            end;
+
+          st_longstring:
+            begin
+              {!!!!!!!!!!!!!!!!!}
+            end;
+        end;
+        paraloc1.done;
+        paraloc2.done;
+      end;
 
 
     procedure tcgvecnode.pass_generate_code;
     procedure tcgvecnode.pass_generate_code;
 
 
@@ -697,7 +741,6 @@ implementation
          offsetdec,
          offsetdec,
          extraoffset : aint;
          extraoffset : aint;
          t        : tnode;
          t        : tnode;
-         href     : treference;
          otl,ofl  : tasmlabel;
          otl,ofl  : tasmlabel;
          newsize  : tcgsize;
          newsize  : tcgsize;
          mulsize,
          mulsize,
@@ -726,8 +769,7 @@ implementation
 
 
          { an ansistring needs to be dereferenced }
          { an ansistring needs to be dereferenced }
          if is_ansistring(left.resultdef) or
          if is_ansistring(left.resultdef) or
-            is_widestring(left.resultdef) or
-            is_unicodestring(left.resultdef) then
+            is_wide_or_unicode_string(left.resultdef) then
            begin
            begin
               if nf_callunique in flags then
               if nf_callunique in flags then
                 internalerror(200304236);
                 internalerror(200304236);
@@ -754,18 +796,6 @@ implementation
                   internalerror(2002032218);
                   internalerror(2002032218);
               end;
               end;
 
 
-              { check for a zero length string,
-                we can use the ansistring routine here }
-              if (cs_check_range in current_settings.localswitches) then
-                begin
-                   paramanager.getintparaloc(pocall_default,1,paraloc1);
-                   cg.a_load_reg_cgpara(current_asmdata.CurrAsmList,OS_ADDR,location.reference.base,paraloc1);
-                   paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
-                   cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-                   cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resultdef).stringtypname)+'_CHECKZERO',false);
-                   cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-                end;
-
               { in ansistrings/widestrings S[1] is p<w>char(S)[0] !! }
               { in ansistrings/widestrings S[1] is p<w>char(S)[0] !! }
               if is_ansistring(left.resultdef) then
               if is_ansistring(left.resultdef) then
                 offsetdec:=1
                 offsetdec:=1
@@ -828,84 +858,16 @@ implementation
          if right.nodetype=ordconstn then
          if right.nodetype=ordconstn then
            begin
            begin
               { offset can only differ from 0 if arraydef }
               { offset can only differ from 0 if arraydef }
-              case left.resultdef.typ of
-                arraydef :
-                  begin
-		     { do not do any range checking when this is an array access to a pointer which has been
-		       typecasted from an array }
-		     if (not (ado_isconvertedpointer in tarraydef(left.resultdef).arrayoptions)) then
-		       begin
-                     	if not(is_open_array(left.resultdef)) and
-                           not(is_array_of_const(left.resultdef)) and
-                           not(is_dynamic_array(left.resultdef)) then
-                          begin
-                            if (tordconstnode(right).value.svalue>tarraydef(left.resultdef).highrange) or
-                               (tordconstnode(right).value.svalue<tarraydef(left.resultdef).lowrange) then
-                              begin
-                                { this should be caught in the typecheckpass! (JM) }
-                                if (cs_check_range in current_settings.localswitches) then
-                                  CGMessage(parser_e_range_check_error)
-                                else
-                                  CGMessage(parser_w_range_check_error);
-                              end;
-                           end
-                         else
-                           begin
-                              { range checking for open and dynamic arrays needs
-                                runtime code }
-                              secondpass(right);
-                              if (cs_check_range in current_settings.localswitches) then
-                                rangecheck_array;
-                           end;
-		       end;
+              if cs_check_range in current_settings.localswitches then
+                begin
+                  secondpass(right);
+                  case left.resultdef.typ of
+                    arraydef :
+                      rangecheck_array;
+                    stringdef :
+                      rangecheck_string;
                   end;
                   end;
-                stringdef :
-                  begin
-                    if (cs_check_range in current_settings.localswitches) then
-                     begin
-                       case tstringdef(left.resultdef).stringtype of
-                         { it's the same for ansi- and wide strings }
-                         st_unicodestring,
-                         st_widestring,
-                         st_ansistring:
-                           begin
-                              paramanager.getintparaloc(pocall_default,1,paraloc1);
-                              paramanager.getintparaloc(pocall_default,2,paraloc2);
-                              cg.a_load_const_cgpara(current_asmdata.CurrAsmList,OS_INT,tordconstnode(right).value.svalue,paraloc2);
-                              href:=location.reference;
-                              if not(tf_winlikewidestring in target_info.flags) or
-                                 (tstringdef(left.resultdef).stringtype<>st_widestring) then
-                                begin
-                                  dec(href.offset,sizeof(pint)-offsetdec);
-                                  cg.a_load_ref_cgpara(current_asmdata.CurrAsmList,OS_ADDR,href,paraloc1);
-                                end
-                              else
-                                begin
-                                  { winlike widestrings have a 4 byte length }
-                                  dec(href.offset,4-offsetdec);
-                                  cg.a_load_ref_cgpara(current_asmdata.CurrAsmList,OS_32,href,paraloc1);
-                                end;
-                              paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
-                              paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc2);
-                              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-                              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resultdef).stringtypname)+'_RANGECHECK',false);
-                              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-                           end;
-
-                         st_shortstring:
-                           begin
-                              {!!!!!!!!!!!!!!!!!}
-                              { if this one is implemented making use of the high parameter for openshortstrings, update ncgutils.do_get_used_regvars() too (JM) }
-                           end;
-
-                         st_longstring:
-                           begin
-                              {!!!!!!!!!!!!!!!!!}
-                           end;
-                       end;
-                     end;
-                   end;
-              end;
+                end;
               if not(is_packed_array(left.resultdef)) or
               if not(is_packed_array(left.resultdef)) or
                  ((mulsize mod 8 = 0) and
                  ((mulsize mod 8 = 0) and
                   (ispowerof2(mulsize div 8,temp) or
                   (ispowerof2(mulsize div 8,temp) or
@@ -1015,56 +977,9 @@ implementation
               if cs_check_range in current_settings.localswitches then
               if cs_check_range in current_settings.localswitches then
                begin
                begin
                  if left.resultdef.typ=arraydef then
                  if left.resultdef.typ=arraydef then
-                   begin
-		     { do not do any range checking when this is an array access to a pointer which has been
-		       typecasted from an array }
-		     if (not (ado_isconvertedpointer in tarraydef(left.resultdef).arrayoptions)) then
-                       rangecheck_array
-                   end
+                   rangecheck_array
                  else if (left.resultdef.typ=stringdef) then
                  else if (left.resultdef.typ=stringdef) then
-                   begin
-                      case tstringdef(left.resultdef).stringtype of
-                         { it's the same for ansi- and wide strings }
-                         st_unicodestring,
-                         st_widestring,
-                         st_ansistring:
-                           begin
-                              paramanager.getintparaloc(pocall_default,1,paraloc1);
-                              paramanager.getintparaloc(pocall_default,2,paraloc2);
-                              cg.a_load_reg_cgpara(current_asmdata.CurrAsmList,OS_INT,right.location.register,paraloc2);
-                              href:=location.reference;
-                              dec(href.offset,sizeof(pint)-offsetdec);
-
-                              href:=location.reference;
-                              if not(tf_winlikewidestring in target_info.flags) or
-                                 (tstringdef(left.resultdef).stringtype<>st_widestring) then
-                                begin
-                                  dec(href.offset,sizeof(pint)-offsetdec);
-                                  cg.a_load_ref_cgpara(current_asmdata.CurrAsmList,OS_ADDR,href,paraloc1);
-                                end
-                              else
-                                begin
-                                  { winlike widestrings have a 4 byte length }
-                                  dec(href.offset,4-offsetdec);
-                                  cg.a_load_ref_cgpara(current_asmdata.CurrAsmList,OS_32,href,paraloc1);
-                                end;
-
-                              paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc1);
-                              paramanager.freecgpara(current_asmdata.CurrAsmList,paraloc2);
-                              cg.allocallcpuregisters(current_asmdata.CurrAsmList);
-                              cg.a_call_name(current_asmdata.CurrAsmList,'FPC_'+upper(tstringdef(left.resultdef).stringtypname)+'_RANGECHECK',false);
-                              cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
-                           end;
-                         st_shortstring:
-                           begin
-                              {!!!!!!!!!!!!!!!!!}
-                           end;
-                         st_longstring:
-                           begin
-                              {!!!!!!!!!!!!!!!!!}
-                           end;
-                      end;
-                   end;
+                   rangecheck_string;
                end;
                end;
 
 
               { insert the register and the multiplication factor in the
               { insert the register and the multiplication factor in the

+ 2 - 1
compiler/ncgrtti.pas

@@ -636,7 +636,8 @@ implementation
               { pocall_safecall   } 4,
               { pocall_safecall   } 4,
               { pocall_stdcall    } 3,
               { pocall_stdcall    } 3,
               { pocall_softfloat  } 10,
               { pocall_softfloat  } 10,
-              { pocall_mwpascal   } 11
+              { pocall_mwpascal   } 11,
+              { pocall_interrupt  } 12
              );
              );
 
 
            procedure write_para(parasym:tparavarsym);
            procedure write_para(parasym:tparavarsym);

+ 140 - 4
compiler/ncgutil.pas

@@ -161,6 +161,10 @@ interface
 
 
     procedure gen_pic_helpers(list : TAsmList);
     procedure gen_pic_helpers(list : TAsmList);
 
 
+    procedure gen_fpc_dummy(list : TAsmList);
+
+    procedure InsertInterruptTable;
+
 implementation
 implementation
 
 
   uses
   uses
@@ -1568,6 +1572,8 @@ implementation
     procedure init_paras(p:TObject;arg:pointer);
     procedure init_paras(p:TObject;arg:pointer);
       var
       var
         href : treference;
         href : treference;
+        hsym : tparavarsym;
+        eldef : tdef;
         tmpreg : tregister;
         tmpreg : tregister;
         list : TAsmList;
         list : TAsmList;
         needs_inittable,
         needs_inittable,
@@ -1591,7 +1597,18 @@ implementation
                      paramanager.push_addr_param(tparavarsym(p).varspez,tparavarsym(p).vardef,current_procinfo.procdef.proccalloption)) then
                      paramanager.push_addr_param(tparavarsym(p).varspez,tparavarsym(p).vardef,current_procinfo.procdef.proccalloption)) then
                      begin
                      begin
                        location_get_data_ref(list,tparavarsym(p).initialloc,href,is_open_array(tparavarsym(p).vardef),sizeof(pint));
                        location_get_data_ref(list,tparavarsym(p).initialloc,href,is_open_array(tparavarsym(p).vardef),sizeof(pint));
-                       cg.g_incrrefcount(list,tparavarsym(p).vardef,href);
+                       if is_open_array(tparavarsym(p).vardef) then
+                         begin
+                           { open arrays do not contain correct element count in their rtti,
+                             the actual count must be passed separately. }
+                           hsym:=tparavarsym(tsym(p).owner.Find('high'+tsym(p).name));
+                           eldef:=tarraydef(tparavarsym(p).vardef).elementdef;
+                           if not assigned(hsym) then
+                             internalerror(201003031);
+                           cg.g_array_rtti_helper(list,eldef,href,hsym.initialloc,'FPC_ADDREF_ARRAY');
+                         end
+                       else
+                         cg.g_incrrefcount(list,tparavarsym(p).vardef,href);
                      end;
                      end;
                  end;
                  end;
              vs_out :
              vs_out :
@@ -1616,7 +1633,18 @@ implementation
                        else
                        else
                          trash_reference(list,href,2);
                          trash_reference(list,href,2);
                      if needs_inittable then
                      if needs_inittable then
-                       cg.g_initialize(list,tparavarsym(p).vardef,href);
+                       begin
+                         if is_open_array(tparavarsym(p).vardef) then
+                           begin
+                             hsym:=tparavarsym(tsym(p).owner.Find('high'+tsym(p).name));
+                             eldef:=tarraydef(tparavarsym(p).vardef).elementdef;
+                             if not assigned(hsym) then
+                               internalerror(201103033);
+                             cg.g_array_rtti_helper(list,eldef,href,hsym.initialloc,'FPC_INITIALIZE_ARRAY');
+                           end
+                         else
+                           cg.g_initialize(list,tparavarsym(p).vardef,href);
+                       end;
                    end;
                    end;
                end;
                end;
              else if do_trashing and
              else if do_trashing and
@@ -1649,6 +1677,8 @@ implementation
       var
       var
         list : TAsmList;
         list : TAsmList;
         href : treference;
         href : treference;
+        hsym : tparavarsym;
+        eldef : tdef;
       begin
       begin
         if not(tsym(p).typ=paravarsym) then
         if not(tsym(p).typ=paravarsym) then
           exit;
           exit;
@@ -1659,7 +1689,16 @@ implementation
             begin
             begin
               include(current_procinfo.flags,pi_needs_implicit_finally);
               include(current_procinfo.flags,pi_needs_implicit_finally);
               location_get_data_ref(list,tparavarsym(p).localloc,href,is_open_array(tparavarsym(p).vardef),sizeof(pint));
               location_get_data_ref(list,tparavarsym(p).localloc,href,is_open_array(tparavarsym(p).vardef),sizeof(pint));
-              cg.g_decrrefcount(list,tparavarsym(p).vardef,href);
+              if is_open_array(tparavarsym(p).vardef) then
+                begin
+                  hsym:=tparavarsym(tsym(p).owner.Find('high'+tsym(p).name));
+                  eldef:=tarraydef(tparavarsym(p).vardef).elementdef;
+                  if not assigned(hsym) then
+                    internalerror(201003032);
+                  cg.g_array_rtti_helper(list,eldef,href,hsym.initialloc,'FPC_DECREF_ARRAY');
+                end
+              else
+                cg.g_decrrefcount(list,tparavarsym(p).vardef,href);
             end;
             end;
          end;
          end;
         { open arrays can contain elements requiring init/final code, so the else has been removed here }
         { open arrays can contain elements requiring init/final code, so the else has been removed here }
@@ -2496,7 +2535,10 @@ implementation
             sectype:=sec_bss;
             sectype:=sec_bss;
           end;
           end;
         maybe_new_object_file(list);
         maybe_new_object_file(list);
-        new_section(list,sectype,lower(sym.mangledname),varalign);
+        if sym.section<>'' then
+          new_section(list,sec_user,sym.section,varalign)
+        else
+         new_section(list,sectype,lower(sym.mangledname),varalign);
         if (sym.owner.symtabletype=globalsymtable) or
         if (sym.owner.symtabletype=globalsymtable) or
            create_smartlink or
            create_smartlink or
            DLLSource or
            DLLSource or
@@ -3092,4 +3134,98 @@ implementation
 {$endif i386}
 {$endif i386}
       end;
       end;
 
 
+
+    procedure gen_fpc_dummy(list : TAsmList);
+      begin
+{$ifdef i386}
+        { fix me! }
+        list.concat(Taicpu.Op_const_reg(A_MOV,S_L,1,NR_EAX));
+        list.concat(Taicpu.Op_const(A_RET,S_W,12));
+{$endif i386}
+      end;
+
+
+    procedure InsertInterruptTable;
+
+      procedure WriteVector(const name: string);
+        var
+          ai: taicpu;
+        begin
+{$IFDEF arm}
+          if current_settings.cputype in [cpu_armv7m, cpu_cortexm3] then
+            current_asmdata.asmlists[al_globals].concat(tai_const.Createname(name,0))
+          else
+            begin
+              ai:=taicpu.op_sym(A_B,current_asmdata.RefAsmSymbol(name));
+              ai.is_jmp:=true;
+              current_asmdata.asmlists[al_globals].concat(ai);
+            end;
+{$ENDIF arm}
+        end;
+
+      function GetInterruptTableLength: longint;
+        begin
+{$if defined(ARM)}
+          result:=interruptvectors[current_settings.controllertype];
+{$else}
+          result:=0;
+{$endif}
+        end;
+
+      var
+        hp: tused_unit;
+        sym: tsym;
+        i, i2: longint;
+        interruptTable: array of tprocdef;
+        pd: tprocdef;
+      begin
+        SetLength(interruptTable, GetInterruptTableLength);
+        FillChar(interruptTable[0], length(interruptTable)*sizeof(pointer), 0);
+
+        hp:=tused_unit(usedunits.first);
+        while assigned(hp) do
+          begin
+            for i := 0 to hp.u.symlist.Count-1 do
+              begin
+                sym:=tsym(hp.u.symlist[i]);
+                if not assigned(sym) then
+                  continue;
+                if sym.typ = procsym then
+                  begin
+                    for i2 := 0 to tprocsym(sym).ProcdefList.Count-1 do
+                      begin
+                        pd:=tprocdef(tprocsym(sym).ProcdefList[i2]);
+                        if pd.interruptvector >= 0 then
+                          begin
+                            if pd.interruptvector > high(interruptTable) then
+                              Internalerror(2011030602);
+                            if interruptTable[pd.interruptvector] <> nil then
+                              internalerror(2011030601);
+
+                            interruptTable[pd.interruptvector]:=pd;
+                            break;
+                          end;
+                      end;
+                  end;
+              end;
+            hp:=tused_unit(hp.next);
+          end;
+
+        new_section(current_asmdata.asmlists[al_globals],sec_init,'VECTORS',sizeof(pint));
+        current_asmdata.asmlists[al_globals].concat(Tai_symbol.Createname_global('VECTORS',AT_DATA,0));
+{$IFDEF arm}
+        if current_settings.cputype in [cpu_armv7m, cpu_cortexm3] then
+          current_asmdata.asmlists[al_globals].concat(tai_const.Createname('_stack_top',0)); { ARMv7-M processors have the initial stack value at address 0 }
+{$ENDIF arm}
+
+        for i:=0 to high(interruptTable) do
+          begin
+            if interruptTable[i]<>nil then
+              writeVector(interruptTable[i].mangledname)
+            else
+              writeVector('DefaultHandler'); { Default handler name }
+          end;
+      end;
+
+
 end.
 end.

+ 0 - 11
compiler/nset.pas

@@ -229,17 +229,6 @@ implementation
              exit;
              exit;
           end;
           end;
 
 
-         if (right.nodetype=typen) then
-           begin
-             { we need to create a setconstn }
-             pst:=createsetconst(tsetdef(ttypenode(right).resultdef));
-             t:=csetconstnode.create(pst,ttypenode(right).resultdef);
-             dispose(pst);
-             right.free;
-             right:=t;
-             typecheckpass(right);
-           end;
-
          typecheckpass(left);
          typecheckpass(left);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          set_varstate(left,vs_read,[vsf_must_be_valid]);
          if codegenerror then
          if codegenerror then

+ 9 - 2
compiler/ogbase.pas

@@ -482,6 +482,7 @@ interface
         procedure GenerateLibraryImports(ImportLibraryList:TFPHashObjectList);virtual;
         procedure GenerateLibraryImports(ImportLibraryList:TFPHashObjectList);virtual;
         procedure GenerateDebugLink(const dbgname:string;dbgcrc:cardinal);
         procedure GenerateDebugLink(const dbgname:string;dbgcrc:cardinal);
         function WriteExeFile(const fn:string):boolean;
         function WriteExeFile(const fn:string):boolean;
+        procedure ParseScript (linkscript:TCmdStrList); virtual;
         property Writer:TObjectWriter read FWriter;
         property Writer:TObjectWriter read FWriter;
         property ExeSectionList:TFPHashObjectList read FExeSectionList;
         property ExeSectionList:TFPHashObjectList read FExeSectionList;
         property ObjDataList:TFPObjectList read FObjDataList;
         property ObjDataList:TFPObjectList read FObjDataList;
@@ -544,7 +545,7 @@ implementation
 
 
     procedure TObjSymbol.SetAddress(apass:byte;aobjsec:TObjSection;abind:TAsmsymbind;atyp:Tasmsymtype);
     procedure TObjSymbol.SetAddress(apass:byte;aobjsec:TObjSection;abind:TAsmsymbind;atyp:Tasmsymtype);
       begin
       begin
-        if not(abind in [AB_GLOBAL,AB_LOCAL,AB_COMMON]) then
+        if not(abind in [AB_GLOBAL,AB_LOCAL,AB_COMMON,AB_IMPORT]) then
           internalerror(200603016);
           internalerror(200603016);
         if not assigned(aobjsec) then
         if not assigned(aobjsec) then
           internalerror(200603017);
           internalerror(200603017);
@@ -823,7 +824,7 @@ implementation
 
 
     function TObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
     function TObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
       const
       const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           'code',
           'code',
           'Data',
           'Data',
           'Data',
           'Data',
@@ -902,6 +903,7 @@ implementation
     function TObjData.sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;
     function TObjData.sectiontype2options(atype:TAsmSectiontype):TObjSectionOptions;
       const
       const
         secoptions : array[TAsmSectiontype] of TObjSectionOptions = ([],
         secoptions : array[TAsmSectiontype] of TObjSectionOptions = ([],
+          {user} [oso_Data,oso_load,oso_write,oso_executable,oso_keep],
           {code} [oso_Data,oso_load,oso_readonly,oso_executable,oso_keep],
           {code} [oso_Data,oso_load,oso_readonly,oso_executable,oso_keep],
           {Data} [oso_Data,oso_load,oso_write,oso_keep],
           {Data} [oso_Data,oso_load,oso_write,oso_keep],
 { TODO: Fix sec_rodata be read-only-with-relocs}
 { TODO: Fix sec_rodata be read-only-with-relocs}
@@ -1549,6 +1551,11 @@ implementation
       end;
       end;
 
 
 
 
+    procedure TExeOutput.ParseScript (linkscript:TCmdStrList);
+      begin
+      end;
+
+
     function  TExeOutput.FindExeSection(const aname:string):TExeSection;
     function  TExeOutput.FindExeSection(const aname:string):TExeSection;
       begin
       begin
         result:=TExeSection(ExeSectionList.Find(aname));
         result:=TExeSection(ExeSectionList.Find(aname));

+ 22 - 16
compiler/ogcoff.pas

@@ -488,7 +488,7 @@ implementation
        SymbolMaxGrow = 200*sizeof(coffsymbol);
        SymbolMaxGrow = 200*sizeof(coffsymbol);
        StrsMaxGrow   = 8192;
        StrsMaxGrow   = 8192;
 
 
-       coffsecnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+       coffsecnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text','.data','.data','.data','.bss','.tls',
           '.text','.data','.data','.data','.bss','.tls',
           '.pdata',{pdata}
           '.pdata',{pdata}
           '.text', {stub}
           '.text', {stub}
@@ -1031,22 +1031,28 @@ const pemagic : array[0..3] of byte = (
         sep     : string[3];
         sep     : string[3];
         secname : string;
         secname : string;
       begin
       begin
-        secname:=coffsecnames[atype];
-        if create_smartlink_sections and
-           (aname<>'') then
-          begin
-            case aorder of
-              secorder_begin :
-                sep:='.b_';
-              secorder_end :
-                sep:='.z_';
-              else
-                sep:='.n_';
-            end;
-            result:=secname+sep+aname
-          end
+        { section type user gives the user full controll on the section name }
+        if atype=sec_user then
+          result:=aname
         else
         else
-          result:=secname;
+          begin
+            secname:=coffsecnames[atype];
+            if create_smartlink_sections and
+               (aname<>'') then
+              begin
+                case aorder of
+                  secorder_begin :
+                    sep:='.b_';
+                  secorder_end :
+                    sep:='.z_';
+                  else
+                    sep:='.n_';
+                end;
+                result:=secname+sep+aname
+              end
+            else
+              result:=secname;
+          end;
       end;
       end;
 
 
 
 

+ 29 - 23
compiler/ogelf.pas

@@ -584,7 +584,7 @@ implementation
 
 
     function TElfObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
     function TElfObjData.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
       const
       const
-        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
 {$ifdef userodata}
 {$ifdef userodata}
           '.text','.data','.data','.rodata','.bss','.threadvar',
           '.text','.data','.data','.rodata','.bss','.threadvar',
 {$else userodata}
 {$else userodata}
@@ -639,7 +639,7 @@ implementation
           '.obcj_nlcatlist',
           '.obcj_nlcatlist',
           '.objc_protolist'
           '.objc_protolist'
         );
         );
-        secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('',
+        secnames_pic : array[TAsmSectiontype] of string[length('__DATA, __datacoal_nt,coalesced')] = ('','',
           '.text',
           '.text',
           '.data.rel',
           '.data.rel',
           '.data.rel',
           '.data.rel',
@@ -700,30 +700,36 @@ implementation
         sep : string[3];
         sep : string[3];
         secname : string;
         secname : string;
       begin
       begin
-        if (cs_create_pic in current_settings.moduleswitches) and
-           not(target_info.system in systems_darwin) then
-          secname:=secnames_pic[atype]
+        { section type user gives the user full controll on the section name }
+        if atype=sec_user then
+          result:=aname
         else
         else
-          secname:=secnames[atype];
-        if (atype=sec_fpc) and (Copy(aname,1,3)='res') then
           begin
           begin
-            result:=secname+'.'+aname;
-            exit;
+            if (cs_create_pic in current_settings.moduleswitches) and
+               not(target_info.system in systems_darwin) then
+              secname:=secnames_pic[atype]
+            else
+              secname:=secnames[atype];
+            if (atype=sec_fpc) and (Copy(aname,1,3)='res') then
+              begin
+                result:=secname+'.'+aname;
+                exit;
+              end;
+            if create_smartlink_sections and (aname<>'') then
+              begin
+                case aorder of
+                  secorder_begin :
+                    sep:='.b_';
+                  secorder_end :
+                    sep:='.z_';
+                  else
+                    sep:='.n_';
+                end;
+                result:=secname+sep+aname
+              end
+            else
+              result:=secname;
           end;
           end;
-        if create_smartlink_sections and (aname<>'') then
-          begin
-            case aorder of
-              secorder_begin :
-                sep:='.b_';
-              secorder_end :
-                sep:='.z_';
-              else
-                sep:='.n_';
-            end;
-            result:=secname+sep+aname
-          end
-        else
-          result:=secname;
       end;
       end;
 
 
 
 

+ 1 - 0
compiler/ogmacho.pas

@@ -180,6 +180,7 @@ implementation
         = ('sec_debug_frame','__debug_info','__debug_line','__debug_abbrev');
         = ('sec_debug_frame','__debug_info','__debug_line','__debug_abbrev');
     begin
     begin
       case atype of
       case atype of
+        sec_user: Result:=aname;
         sec_bss:  Result:=MakeSectionName(seg_DATA, '__common');
         sec_bss:  Result:=MakeSectionName(seg_DATA, '__common');
         sec_stab: Result:='.stabs';
         sec_stab: Result:='.stabs';
         sec_stabstr: Result:='.stabsstr';
         sec_stabstr: Result:='.stabsstr';

+ 1516 - 0
compiler/ognlm.pas

@@ -0,0 +1,1516 @@
+{
+    Copyright (c) 1998-2006 by Peter Vreman
+    Copyright (c) 2011 by Armin Diehl
+
+    Contains the binary netware nlm executable writer
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+ ****************************************************************************
+}
+unit ognlm;
+
+{$i fpcdefs.inc}
+
+interface
+
+    uses
+       { common }
+       cclasses,globtype,
+       { target }
+       systems,
+       aasmbase,assemble,link,
+       { output }
+       ogbase,
+       owbase,
+       ogcoff;
+
+{*****************************************************************************
+                    NLM File structures and constants
+*****************************************************************************}
+
+{
+
+LString0 -> 1 byte Length, Text, #0
+LString  -> 1 byte length, Text
+
+Basic NLM File Structure:
+
+FixedHeader
+  nlm32_i386_external_fixed_header     130 bytes
+
+VarHdr1
+  NLM Description: LString0              2+n bytes
+  Stacksize                              4 bytes
+  reserved = 0                           4 bytes
+  ' LONG'                                5 bytes
+  NLM screen name: LString0              2+n bytes
+  NLM thread name: LString0              2+n bytes
+
+Optional Headers beginning with stamp (without '')
+'VeRsIoN#':   nlm32_i386_external_version_header     32 bytes
+'CoPyRiGhT=': LString0                              2+n bytes
+'MeSsAgEs':   nlm32_i386_external_extended_header   124 bytes
+'CuStHeAd':   nlm32_i386_external_custom_header
+'CyGnUsEx':   nlm32_i386_external_cygnus_ext_header 16 bytes
+
+.text
+.data
+.relocs=
+  addr(32),addr(32),...
+  addr and $80000000 > 0 -> FixupToSeg=.text else .data
+  addr and $40000000 > 0 -> FixupInSeg=.text else .data
+.importedSymbols
+  name   LString                                   1+n bytes
+  number of references r                             4 bytes
+  addresses                                        r*4 bytes
+.exportedSymbols
+  name   LString                                   1+n bytes
+  addr                                               4 bytes
+    addr and $80000000 > 0 -> .text else .data
+  ...
+.modules
+
+.nlmdebugrecs
+  type (0=.data,1=.code,2,..=????)                   1 byte
+  addr                                               4 bytes
+  name LString                                     1+n bytes
+  ...
+
+}
+
+
+const NLM_MAX_DESCRIPTION_LENGTH = 127;
+      NLM_MAX_SCREEN_NAME_LENGTH = 71;
+      NLM_MAX_THREAD_NAME_LENGTH = 71;   // some netware docs limit this to 12 ?
+      NLM_OLD_THREAD_NAME_LENGTH = 5;
+      NLM_HEADER_VERSION         = 4;
+      NLM_DEFAULT_STACKSIZE      = (32 * 1024);
+      NLM_VERSION_STAMP          = 'VeRsIoN#';
+      NLM_COPYRIGHT_STAMP        = 'CoPyRiGhT=';
+      NLM_CYGNUS_STAMP           = 'CyGnUsEx';
+      NLM_MESSAGES_STAMP         = 'MeSsAgEs';
+      NLM_CUSTOM_STAMP           = 'CuStHeAd';
+      NLM_SIGNATURE              = 'NetWare Loadable Module'#$1A;
+      NLM_FLAGS_REENTRANT        = 1;
+      NLM_FLAGS_MULTILOAD        = 2;
+      NLM_FLAGS_SYNCHRONIZE      = 4;
+      NLM_FLAGS_PSEUDOPREEMPTION = 8;
+      NLM_FLAGS_OSDOMAIN         = $10;
+      NLM_FLAGS_AUTOUNLOAD       = $40;
+
+
+  type
+    uint32 = longword;
+
+    nlm32_i386_external_fixed_header = packed record
+        signature                  : array[0..23] of char;
+        version                    : uint32;
+        (* The name of the module, which must be a DOS name (1-8 characters followed
+           by a period and a 1-3 character extension).  The first byte is the byte
+           length of the name and the last byte is a null terminator byte.  This
+           field is fixed length, and any unused bytes should be null bytes.  The
+           value is set by the OUTPUT keyword to NLMLINK. *)
+        moduleName                 : string[13]; //array[0..13] of byte;
+        codeImageOffset            : uint32;     // The byte offset of the code image from the start of the file.
+        codeImageSize              : uint32;     // The size of the code image, in bytes.
+        dataImageOffset            : uint32;     // The byte offset of the data image from the start of the file.
+        dataImageSize              : uint32;     // The size of the data image, in bytes.
+        uninitializedDataSize      : uint32;     // The size of the uninitialized data region that the loader has to be
+                                                 // allocated at load time.  Uninitialized data follows the initialized
+                                                 // data in the NLM address space.
+        customDataOffset           : uint32;     // The byte offset of the custom data from the start of the file.  The
+                                                 // custom data is set by the CUSTOM keyword to NLMLINK.  It is possible
+                                                 // for this to be EOF if there is no custom data.
+        customDataSize             : uint32;     // The size of the custom data, in bytes.
+        moduleDependencyOffset     : uint32;     // The byte offset of the module dependencies from the start of the file.
+                                                 // The module dependencies are determined by the MODULE keyword in NLMLINK.
+        numberOfModuleDependencies : uint32;     // he number of module dependencies at the moduleDependencyOffset.
+        relocationFixupOffset      : uint32;     // The byte offset of the relocation fixup data from the start of the file
+        numberOfRelocationFixups   : uint32;
+        externalReferencesOffset   : uint32;
+        numberOfExternalReferences : uint32;
+        publicsOffset              : uint32;
+        numberOfPublics            : uint32;
+        debugInfoOffset            : uint32;     // The byte offset of the internal debug info from the start of the file.
+                                                 // It is possible for this to be EOF if there is no debug info.
+        numberOfDebugRecords       : uint32;
+        codeStartOffset            : uint32;
+        exitProcedureOffset        : uint32;
+        checkUnloadProcedureOffset : uint32;
+        moduleType                 : uint32;
+        flags                      : uint32;
+      end;
+
+
+  { The version header is one of the optional auxiliary headers and
+     follows the fixed length and variable length NLM headers.  }
+  { The header is recognized by "VeRsIoN#" in the stamp field.  }
+
+     nlm32_i386_external_version_header = packed record
+          stamp           : array[0..7] of char;  // VeRsIoN#
+          majorVersion,
+          minorVersion,
+          revision,
+          year,
+          month,
+          day             : uint32;
+       end;
+  { The header is recognized by "MeSsAgEs" in the stamp field.  }
+
+     nlm32_i386_external_extended_header = packed record
+          stamp                        : array[0..7] of char;  // MeSsAgEs
+          languageID                   : uint32;
+          messageFileOffset            : uint32;
+          messageFileLength            : uint32;
+          messageCount                 : uint32;
+          helpFileOffset               : uint32;
+          helpFileLength               : uint32;
+          RPCDataOffset                : uint32;
+          RPCDataLength                : uint32;
+          sharedCodeOffset             : uint32;
+          sharedCodeLength             : uint32;
+          sharedDataOffset             : uint32;
+          sharedDataLength             : uint32;
+          sharedRelocationFixupOffset  : uint32;
+          sharedRelocationFixupCount   : uint32;
+          sharedExternalReferenceOffset: uint32;
+          sharedExternalReferenceCount : uint32;
+          sharedPublicsOffset          : uint32;
+          sharedPublicsCount           : uint32;
+          sharedDebugRecordOffset      : uint32;
+          sharedDebugRecordCount       : uint32;
+          SharedInitializationOffset   : uint32;
+          SharedExitProcedureOffset    : uint32;
+          productID : longint;
+          reserved0 : longint;
+          reserved1 : longint;
+          reserved2 : longint;
+          reserved3 : longint;
+          reserved4 : longint;
+          reserved5 : longint;
+       end;
+
+     nlm32_i386_external_custom_header = packed record
+          stamp       : array[0..7] of char;  // CuStHeAd
+          hdrLength   : uint32;
+          dataOffset  : uint32;
+          dataLength  : uint32;
+          //dataStamp   : array[0..7] of char;
+          //hdr         : uint32;
+       end;
+  { The internal Cygnus header is written out externally as a custom
+     header.  We don't try to replicate that structure here.   }
+  { The header is recognized by "CyGnUsEx" in the stamp field.  }
+  { File location of debugging information.   }
+  { Length of debugging information.   }
+
+     nlm32_i386_external_cygnus_ext_header = packed record
+          stamp       : array[0..7] of char;  // CyGnUsEx
+          offset      : uint32;
+          length      : uint32;
+       end;
+
+
+//------------------
+
+
+       TNLMExeSection = class(TExeSection)
+       public
+         constructor createnw(AList:TFPHashObjectList;const n:string);
+       end;
+
+       TsecType = (Section_text,Section_data,Section_other);
+
+       TNLMexeoutput = class(texeoutput)
+       private
+         FRelocsGenerated,FImportsGenerated : boolean;
+         FNumRelocs         : longword;
+         FNumExternals      : longword;
+         FNumModules        : longword;
+         FNumDebugSymbols   : longword;
+         fSizeWoDebugSyms   : longword;
+         FnumExports        : longword;
+         NlmSymbols         : TDynamicArray;
+         ExeSecsListSize    : longint;
+         nlmImpNames,                            // name of import. module name as import
+         nlmImports         : TFPHashObjectList; // name of import, list of relocs as object
+         headerAlignBytes   : longint;
+         FexportFunctionOffsets:TFPList;    // offsets in .exports for function addresses, an offset of $80000000 is needed
+
+         nlmHeader          : nlm32_i386_external_fixed_header;
+         nlmVersionHeader   : nlm32_i386_external_version_header;
+         nlmExtHeader       : nlm32_i386_external_extended_header;
+         nlmCustHeader      : nlm32_i386_external_custom_header;
+         nlmHelpFileName    : TCmdStr;
+         nlmMessagesFileName: TCmdStr;
+         nlmXdcFileName     : TCmdStr;
+         nlmCopyright       : string;
+         nlmThreadname      : string;
+         nlmScreenname      : string;
+         nlmDescription     : string;
+
+         function  totalheadersize:longword;
+         procedure createNlm_symbol(const name:shortstring;value:longword;secType:TSecType);
+         procedure globalsyms_create_symbol(p:TObject;arg:pointer);
+         procedure ExeSectionList_write_header(p:TObject;arg:pointer);
+         procedure ExeSectionList_calc_size(p:TObject;arg:pointer);
+         procedure ExeSectionList_write_data(p:TObject;arg:pointer);
+         procedure GenerateImports;
+         procedure GenerateExports;
+         procedure GenerateRelocs;
+         procedure ExeSectionList_pass2_header(p:TObject;arg:pointer);
+       protected
+         function writedata:boolean;override;
+       public
+         constructor create; override;
+         destructor destroy; override;
+         procedure MemPos_Header;override;
+         procedure DataPos_Header;override;
+         procedure fillNlmVersionHeader;
+         procedure GenerateLibraryImports(ImportLibraryList:TFPHashObjectList);override;
+         procedure Order_End;override;
+         procedure MemPos_ExeSection(const aname:string);override;
+         procedure DataPos_ExeSection(const aname:string);override;
+         procedure NLMwriteString (const s : string; terminateWithZero : boolean);
+         procedure objNLMwriteString (const s : string; terminateWithZero : boolean);
+         procedure ParseScript (linkscript:TCmdStrList); override;
+       end;
+
+    var
+      {for symbols defined in linker script. To generate a fixup we
+       need to know the segment (.text,.bss or .code) of the symbol
+       Pointer in list is used as TsecType
+       Filled by TInternalLinkerNetware.DefaultLinkScript }
+      nlmSpecialSymbols_Segments : TFPHashList;
+
+    type
+
+      TNLMCoffObjInput = class(TCoffObjInput)
+         constructor create;override;
+       end;
+
+       TNLMCoffassembler = class(tinternalassembler)
+         constructor create(smart:boolean);override;
+       end;
+
+      TNLMCoffObjData = class(TCoffObjData)
+         constructor create(const n:string);override;
+       end;
+
+      TNLMCoffObjOutput = class(TCoffObjOutput)
+         constructor create(AWriter:TObjectWriter);override;
+       end;
+
+      TNLMCoffObjSection = class(TCoffObjSection)
+         constructor create(AList:TFPHashObjectList;const Aname:string;Aalign:shortint;Aoptions:TObjSectionOptions);override;
+       end;
+
+implementation
+
+    uses
+{$ifdef win32}
+       Windows,
+{$endif win32}
+       SysUtils,
+       cutils,verbose,globals,
+       fmodule,aasmdata,
+       ogmap,export
+       ;
+
+
+{****************************************************************************
+                                 Helpers
+****************************************************************************}
+type
+  TStringObj = class (TObject)
+     fValue : string;
+     constructor create (value:string);
+     property value : string read fValue write fValue;
+  end;
+
+  constructor TStringObj.create(value:string);
+  begin
+    inherited create;
+    fValue := value;
+  end;
+
+
+
+function SectionType (aName : string) : TSecType;
+var s : string;
+    seg: ptruint;
+begin
+  s := copy(aName,1,5);
+  if s = '.text' then result := Section_text else
+    if (s = '.data') or (copy(s,1,4)='.bss') then result := Section_data else
+      if s[1] <> '.' then
+        begin
+          seg := ptruint(nlmSpecialSymbols_Segments.Find(aName));
+          if seg <> 0 then
+            result := TSecType(seg)
+          else
+            result := Section_other;
+        end else
+      result := Section_other;
+end;
+
+{****************************************************************************
+                              TNLMexesection
+****************************************************************************}
+
+
+    constructor TNLMExeSection.createnw(AList:TFPHashObjectList;const n:string);
+      begin
+        inherited create(AList,n);
+      end;
+
+
+{****************************************************************************
+                              TNLMexeoutput
+****************************************************************************}
+
+    constructor TNLMexeoutput.create;
+      begin
+        inherited create;
+        CExeSection:=TNLMExeSection;
+        CObjData:=TNLMCoffObjData;
+        MaxMemPos:=$7FFFFFFF;
+        SectionMemAlign:=$0;
+        SectionDataAlign:=0;
+        RelocSection := true;  // always needed for NLM's
+        nlmImports := TFPHashObjectList.create(true);
+        nlmImpNames := TFPHashObjectList.create(false);
+        NlmSymbols := TDynamicArray.create(4096);
+        FexportFunctionOffsets := TFPList.Create;
+      end;
+
+    destructor TNLMexeoutput.destroy;
+      begin
+        if assigned(nlmImports) then
+          nlmImports.Free;
+        if assigned(nlmImpNames) then
+          nlmImpNames.Free;
+        if assigned(nlmSymbols) then
+          nlmSymbols.Free;
+        if assigned(FexportFunctionOffsets) then
+          FexportFunctionOffsets.Free;
+        inherited destroy;
+      end;
+
+    procedure TNLMexeoutput.createNlm_symbol(const name:shortstring;value:longword;secType:TSecType);
+      var
+        b:byte;
+      begin
+        //Comment (V_Debug,'TNLMexeoutput.write_symbol '+name);
+        {  type (0=.data,1=.code,2,..=????)                   1 byte
+           addr                                               4 bytes
+           name LString                                     1+n bytes }
+        case secType of
+          Section_Text : b := 1;
+          Section_Data : b := 0
+        else
+          exit;
+        end;
+        nlmSymbols.write(b,sizeof(b));
+        assert (sizeof(value)<>4);
+        nlmSymbols.write(value,sizeof(value));
+        nlmSymbols.write(name[0],length(name)+1);
+        inc(FNumDebugSymbols);
+      end;
+
+
+    procedure TNLMexeoutput.globalsyms_create_symbol(p:TObject;arg:pointer);
+      var
+        value  : longword;
+        exesec : TExeSection;
+        i : integer;
+        secType : TsecType;
+      begin
+        if not assigned(texesymbol(p).objsymbol) then
+          internalerror(200603053);
+        with texesymbol(p).objsymbol do
+          begin
+            exesec:=TExeSection(objsection.exesection);
+            { There is no exesection defined for special internal symbols
+              like __image_base__ }
+            if assigned(exesec) then
+              begin
+                //secval:=exesec.secsymidx;
+                value:=address-exesec.mempos;
+              end
+            else
+              begin
+                value:=address;
+              end;
+            { reloctype address to the section in the executable }
+            secType := SectionType(objsection.Name);
+            if (secType = Section_Text) or (secType = Section_Data) then
+              begin
+                i := nlmImports.FindIndexOf(texesymbol(p).name);
+                if i < 0 then
+                  createNlm_symbol(name,value,secType);
+              end;
+          end;
+      end;
+
+
+
+(*
+function SecOpts(SecOptions:TObjSectionOptions):string;
+    begin
+      result := '[';
+      if oso_Data in SecOptions then result := result + 'oso_Data ';
+       { Is loaded into memory }
+      if oso_load in SecOptions then result := result + 'oso_load ';
+       { Not loaded into memory }
+      if oso_noload in SecOptions then result := result + 'oso_noload ';
+       { Read only }
+      if oso_readonly in SecOptions then result := result + 'oso_readonly ';
+       { Read/Write }
+      if oso_write in SecOptions then result := result + 'oso_write ';
+       { Contains executable instructions }
+      if oso_executable in SecOptions then result := result + 'oso_executable ';
+       { Never discard section }
+      if oso_keep in SecOptions then result := result + 'oso_keep ';
+       { Special common symbols }
+      if oso_common in SecOptions then result := result + 'oso_common ';
+       { Contains debug info and can be stripped }
+      if oso_debug in SecOptions then result := result + 'oso_debug ';
+       { Contains only strings }
+      if oso_strings in SecOptions then result := result + 'oso_strings ';
+      result := result + ']';
+    end;
+*)
+
+    procedure TNLMexeoutput.ExeSectionList_calc_size(p:TObject;arg:pointer);
+      var
+        objsec : TObjSection;
+        i    : longint;
+      begin
+        with texesection(p) do
+          begin
+            { don't write normal section if writing only debug info }
+            if (ExeWriteMode=ewm_dbgonly) and
+               not(oso_debug in SecOptions) then
+              exit;
+
+            if oso_data in secoptions then
+              begin
+                inc (fSizeWoDebugSyms,(Align(fSizeWoDebugSyms,SectionDataAlign)-fSizeWoDebugSyms));
+                for i:=0 to ObjSectionList.Count-1 do
+                  begin
+                    objsec:=TObjSection(ObjSectionList[i]);
+                    if oso_data in objsec.secoptions then
+                      begin
+                        inc(fSizeWoDebugSyms,objsec.size);
+                        inc(fSizeWoDebugSyms,objsec.dataalignbytes);
+                      end;
+                  end;
+              end;
+          end;
+      end;
+
+
+
+    procedure TNLMexeoutput.ExeSectionList_write_Data(p:TObject;arg:pointer);
+      var
+        objsec : TObjSection;
+        i,j    : longint;
+        b      : byte;
+      begin
+
+        with texesection(p) do
+          begin
+            { don't write normal section if writing only debug info }
+            if (ExeWriteMode=ewm_dbgonly) and
+               not(oso_debug in SecOptions) then
+              exit;
+
+            if oso_data in secoptions then
+              begin
+                //if Align(FWriter.Size,SectionDataAlign)-FWriter.Size>0 then
+                //  writeln (name,' align ',Align(FWriter.Size,SectionDataAlign)-FWriter.Size,' SectionDataAlign:',SectionDataAlign);
+                FWriter.Writezeros(Align(FWriter.Size,SectionDataAlign)-FWriter.Size);
+                for i:=0 to ObjSectionList.Count-1 do
+                  begin
+                    objsec:=TObjSection(ObjSectionList[i]);
+                    if oso_data in objsec.secoptions then
+                      begin
+                        if assigned(exemap) then
+                          if objsec.data.size > 0 then
+                            exemap.Add('  0x'+hexstr(objsec.DataPos,8)+': '+objsec.name);
+                        //writeln ('   ',objsec.name,'  size:',objsec.size,'  relocs:',objsec.ObjRelocations.count,'  DataPos:',objsec.DataPos,' MemPos:',objsec.MemPos);
+                        {for j := 0 to objsec.ObjRelocations.count-1 do
+                          begin
+                            objreloc := TObjRelocation(objsec.ObjRelocations[j]);
+                            with objreloc do
+                            begin
+                              write('        reloc DataOffset: ',DataOffset,'  OrgSize:',OrgSize,' typ:',typ);
+                              if assigned(symbol) then
+                                write(' Name: '#39,symbol.Name,#39' bind:',symbol.bind,' address:',symbol.address,' Size:',symbol.size);
+                              writeln;
+                            end;
+                          end;}
+                        if not assigned(objsec.data) then
+                          internalerror(200603042);
+                        if copy (objsec.Name,1,5) = '.text' then
+                          begin        // write NOP's instead of zero's for .text, makes disassemble possible
+                            b := $90;  // NOP
+                            if objsec.DataAlignBytes > 0 then
+                              for j := 1 to objsec.DataAlignBytes do
+                                FWriter.write(b,1);
+                          end else
+                            FWriter.writezeros(objsec.dataalignbytes);
+                        //if objsec.dataalignbytes>0 then
+                        //  writeln ('  ',name,'  alignbytes: ',objsec.dataalignbytes);
+                        if objsec.DataPos<>FWriter.Size then
+                            internalerror(200602251);
+                        FWriter.writearray(objsec.data);
+                      end else
+                      begin
+                        if assigned(exemap) then //TExeMap
+                          exemap.Add('                  skipping: '+objsec.name);
+                      end;
+                  end;
+              end;
+          end;
+      end;
+
+
+    function TNLMexeoutput.totalheadersize:longword;
+      var
+        varHdrSize,
+        optHdrSize,
+        hdrSize: longword;
+      begin
+        optHdrSize := 0;
+        inc(optHdrSize,2+length(nlmDescription));
+        inc(optHdrSize,8); // Stacksize+reserved
+        inc(optHdrSize,NLM_OLD_THREAD_NAME_LENGTH);
+        inc(optHdrSize,2+length(nlmScreenname));
+        inc(optHdrSize,2+length(nlmThreadname));
+
+        varHdrSize := 0;
+        if nwcopyright <> '' then
+          inc(varHdrSize,sizeof(NLM_COPYRIGHT_STAMP)+2+length(nlmCopyright));
+        hdrSize := sizeof(nlm32_i386_external_fixed_header)+
+                   sizeof(nlm32_i386_external_extended_header)+
+                   sizeof(nlm32_i386_external_custom_header)+
+                   sizeof(nlm32_i386_external_version_header)+     // always
+                   sizeof(nlm32_i386_external_cygnus_ext_header)+  // CyGnUsEx
+                   varHdrSize+optHdrSize+
+                   8;  // empty stamp
+        result := hdrSize;
+      end;
+
+
+    procedure TNLMexeoutput.MemPos_Header;
+      begin
+        { calculate start positions after the headers }
+        currmempos:=0;
+      end;
+
+
+  procedure TNLMexeoutput.ExeSectionList_write_header(p:TObject;arg:pointer);
+  var
+    nam : string;
+    u32,al : longword;
+    alignAmount:longint;
+      begin
+        with tExeSection(p) do
+          begin
+            //comment (v_debug,'ExeSectionList_write_header: '+name);
+            nam := name;
+            alignAmount := 4 - ((length (nam) + 1) MOD 4);
+            FWriter.write(nam[1],length(nam));
+            FWriter.WriteZeros(1+alignAmount);
+            al := 0;
+            // for .stab we have to ignore leading zeros due to alignment in file
+            if nam='.stab' then
+              if assigned(ObjSectionList[0]) then
+                al := TObjSection(ObjSectionList[0]).dataalignbytes;
+            u32 := dataPos+al; FWriter.write(u32,sizeof(u32));
+            u32 := size-al; FWriter.write(u32,sizeof(u32));
+          end;
+      end;
+
+
+
+    procedure TNLMexeoutput.ExeSectionList_pass2_header(p:TObject;arg:pointer);
+    var len,alignAmount:longint;
+      begin
+        {list of sections, extension of binutils,CuStHeAd points to this list
+          The format of the section information is:
+           null terminated section name
+           zeroes to adjust to 4 byte boundary
+           4 byte section data file pointer
+           4 byte section size }
+
+        with TExeSection(p) do
+          begin
+            alignAmount := 4 - ((length (Name) + 1) MOD 4);
+            len := length(name) + 1 + alignAmount + 8;
+            if ObjSectionList.Count>0 then
+              inc(len,TObjSection(ObjSectionList[0]).dataalignbytes);
+            inc(plongint(arg)^,len);
+          end;
+      end;
+
+    procedure TNLMexeoutput.DataPos_Header;
+      begin
+        ExeSecsListSize:=0;
+        ExeSectionList.ForEachCall(@ExeSectionList_pass2_header,@ExeSecsListSize);
+
+        headerAlignBytes := align(totalheadersize+ExeSecsListSize,16)-(totalheadersize+ExeSecsListSize);  // align as in TObjData.sectiontype2align
+        currdatapos:=totalheadersize+ExeSecsListSize+headerAlignBytes;
+      end;
+
+
+    procedure TNLMexeoutput.fillNlmVersionHeader;
+    var
+        hour,min,sec,hsec,Year,Month,Day : word;
+    begin
+      DecodeTime(Time,hour,min,sec,hsec);
+      DecodeDate(Date,year,month,day);
+      nlmVersionHeader.stamp := NLM_VERSION_STAMP;
+      if nlmVersionHeader.year = 0 then
+        begin
+          nlmVersionHeader.year := Year;
+          nlmVersionHeader.month := Month;
+          nlmVersionHeader.day := Day;
+        end;
+    end;
+
+
+
+    function TNLMexeoutput.writedata:boolean;
+      var
+        dummyLong       : array[0..4] of char;
+        textExeSec,
+        dataExeSec,
+        bssExeSec,
+        relocsExeSec,
+        exportsExeSec,
+        importsExeSec,
+        xdcExeSec,
+        messagesExeSec,
+        helpExeSec,
+        customExeSec    : TExeSection;
+        hassymbols      : boolean;
+        nlmCygnusHeader : nlm32_i386_external_cygnus_ext_header;
+        ModuleName      : string;
+        exesym          : TExeSymbol;
+        expOffset       : PtrUInt;
+        expAddr         : longword;
+        i               : integer;
+
+      begin
+        result:=false;
+        textExeSec:=FindExeSection('.text');
+        dataExeSec:=FindExeSection('.data');
+        bssExeSec:=FindExeSection('.bss');
+        relocsExeSec:=FindExeSection('.reloc');
+        importsExeSec:=FindExeSection('.imports');
+        exportsExeSec:=FindExeSection('.exports');
+        xdcExeSec:=FindExeSection('.xdc');
+        messagesExeSec:=FindExeSection('.messages');
+        helpExeSec:=FindExeSection('.help');
+        customExeSec:=FindExeSection('.custom');
+
+        // exported function need the upper bit in the address
+        // to be set (=CODE), do this here to avoid another
+        // reloc type. The ExportFunctionOffsets list was
+        // filled in GenerateExports
+        if FexportFunctionOffsets.Count>0 then
+          begin
+            if not assigned(exportsExeSec) then
+              internalerror(201103201);   // we have to have a .export section
+            if not assigned(exportsExeSec.ObjSectionList[0]) then
+              internalerror(201103202);   // nothing in the .exports section but we have data in FexportFunctionOffsets
+            for i := 0 to FexportFunctionOffsets.Count-1 do
+              begin
+                expOffset := PtrUint(FexportFunctionOffsets[i]);
+                if TObjSection(exportsExeSec.ObjSectionList[0]).Data.size < expOffset+3 then
+                  internalerror(201103203);  // offset in FexportFunctionOffsets out of range
+                with TObjSection(exportsExeSec.ObjSectionList[0]) do
+                begin  // set the upper bit of address to indicate .text
+                  Data.seek(expOffset);
+                  Data.read(expAddr,4);
+                  Data.seek(expOffset);
+                  expAddr := expAddr or $80000000;
+                  Data.write(expAddr,4);
+                end;
+              end;
+           end;
+
+        if not assigned(TextExeSec) or
+           not assigned(RelocsExeSec) or
+           not assigned(DataExeSec) then
+          internalerror(200602231);   // we have to have .data, .text and .reloc
+        { do we need to write symbols? }
+        hassymbols:=(ExeWriteMode=ewm_dbgonly) or
+                    (
+                     (ExeWriteMode=ewm_exefull) and
+                     not(cs_link_strip in current_settings.globalswitches)
+                    );
+
+        { Initial header, will be updated later }
+        nlmHeader.signature := NLM_SIGNATURE;
+        nlmHeader.version := NLM_HEADER_VERSION;
+        moduleName := upperCase(current_module.exefilename^);
+        nlmHeader.moduleName := moduleName;
+        nlmHeader.codeImageOffset := TextExeSec.DataPos+TObjSection(TextExeSec.ObjSectionList[0]).dataalignbytes; // ??? may be that align has to be moved to fixups/imports
+        nlmHeader.codeImageSize := TextExeSec.Size;
+        nlmHeader.dataImageOffset := DataExeSec.DataPos;
+        nlmHeader.dataImageSize := DataExeSec.Size;
+        if assigned(BSSExeSec) then
+          nlmHeader.uninitializedDataSize:=BSSExeSec.Size;
+        if assigned(customExeSec) then
+          begin
+            nlmHeader.customDataOffset := customExeSec.DataPos;
+            nlmHeader.customDataSize := customExeSec.Size;
+          end;
+        if FNumModules > 0 then
+          begin
+            nlmHeader.moduleDependencyOffset := FindExeSection('.modules').DataPos+4;  // 4 bytes dummy
+            nlmHeader.numberOfModuleDependencies := FNumModules;
+          end;
+        nlmHeader.relocationFixupOffset := relocsExeSec.DataPos;
+        nlmHeader.numberOfRelocationFixups := FNumRelocs;
+        nlmHeader.externalReferencesOffset := importsExeSec.DataPos+4;  // 4 bytes dummy
+        nlmHeader.numberOfExternalReferences := FNumExternals;
+        if assigned(exportsExeSec) then
+          if exportsExeSec.Size>0 then
+          begin
+            nlmHeader.publicsOffset := exportsExeSec.dataPos;
+            nlmHeader.numberOfPublics := FnumExports;
+          end;
+        nlmHeader.codeStartOffset := EntrySym.Address;
+
+        {exit function}
+        exesym:=texesymbol(ExeSymbolList.Find('_Stop'));
+        if assigned(exesym) then
+          nlmHeader.exitProcedureOffset := exesym.ObjSymbol.address;
+
+        {check exit function}
+        exesym:=texesymbol(ExeSymbolList.Find('FPC_NW_CHECKFUNCTION'));
+        if assigned(exesym) then
+          nlmHeader.checkUnloadProcedureOffset := exesym.ObjSymbol.address;
+
+        // calc file pos after all exesections
+        fSizeWoDebugSyms := totalheadersize + ExeSecsListSize + headerAlignBytes;
+        ExeSectionList.ForEachCall(@ExeSectionList_calc_size,nil);
+
+        nlmExtHeader.stamp := NLM_MESSAGES_STAMP;
+        //extHeader.languageID    // TODO: where to get this from ?
+        if assigned(messagesExeSec) then
+          begin
+           nlmExtHeader.messageFileOffset := messagesExeSec.DataPos;
+           nlmExtHeader.messageFileLength := messagesExeSec.Size;
+          end;
+        //nlmExtHeader.messageCount  // TODO: how is messageCount set ?
+        if assigned(helpExeSec) then
+          begin
+           nlmExtHeader.helpFileOffset := helpExeSec.DataPos;
+           nlmExtHeader.helpFileLength := helpExeSec.Size;
+          end;
+        //nlmExtHeader.productID     // TODO: were does this came from ?
+        if assigned(xdcExeSec) then
+          begin
+            nlmExtHeader.RPCDataOffset  := xdcExeSec.DataPos;
+            nlmExtHeader.RPCDataLength  := xdcExeSec.Size;
+          end;
+
+        if hassymbols then
+        begin
+          nlmHeader.debugInfoOffset := fSizeWoDebugSyms;
+          ExeSymbolList.ForEachCall(@globalsyms_create_symbol,nil);
+          nlmHeader.numberOfDebugRecords := FNumDebugSymbols;
+        end;
+
+        fillNlmVersionHeader;
+        FWriter.write(nlmHeader,sizeof(nlmHeader));
+
+        { variable header }
+        NLMWriteString(nlmDescription,true);
+        if stacksize < NLM_DEFAULT_STACKSIZE then stacksize := NLM_DEFAULT_STACKSIZE;
+        FWriter.Write(stacksize,4);
+        FWriter.writezeros(4);
+        dummyLong := ' LONG';
+        FWriter.Write(dummyLong,sizeof(dummyLong));  // old thread name
+        NLMWriteString(nlmScreenname,true);
+        NLMWriteString(nlmThreadname,true);
+
+        {version}
+        FWriter.Write(nlmVersionHeader,sizeof(nlmVersionHeader));
+        {copyright}
+        if nlmCopyright <> '' then
+        begin
+          FWriter.write(NLM_COPYRIGHT_STAMP,sizeof(NLM_COPYRIGHT_STAMP));
+          NLMWriteString(nlmCopyright,true);
+        end;
+        {messages}
+        FWriter.write(nlmExtHeader,sizeof(nlmExtHeader));
+
+        {custhead}
+        nlmCustHeader.stamp := NLM_CUSTOM_STAMP;
+        nlmCustHeader.dataLength := ExeSecsListSize;
+        nlmCustHeader.dataOffset := totalheadersize;
+        nlmCustHeader.hdrLength := $10;               // why 16 ?, this is what binutils write
+        FWriter.write(nlmCustHeader,sizeof(nlmCustHeader));
+
+        {CyGnUsEx}
+        // bfd has a strange way to read the sections:
+        // the section directory is written under CuStHeAd
+        // when bfd finds the neader "CyGnUsEx", it uses the
+        // offset and size from CuStHeAd to read the section table
+
+        nlmCygnusHeader.stamp  := NLM_CYGNUS_STAMP;  // CyGnUsEx
+        // ld writes some unknown values here, bfd irgnores the values at all
+        // lets write the offset and length of the segment table
+        nlmCygnusHeader.offset := nlmCustHeader.dataLength;
+        nlmCygnusHeader.length := nlmCustHeader.dataOffset;
+        FWriter.write(nlmCygnusHeader,sizeof(nlmCygnusHeader));
+        FWriter.WriteZeros(8);   // empty stamp + align next to 16 bytes
+
+        if FWriter.Size<>totalheadersize then
+          internalerror(201103061);               // headersize <> header written
+
+        { Section headers, CuStHeAd points to this section, not needed by
+          netware. Can be used to find the section in the nlm file, binutils
+          will use this section }
+        ExeSectionList.ForEachCall(@ExeSectionList_write_header,nil);
+        FWriter.WriteZeros(headerAlignBytes);
+        if FWriter.Size<>totalheadersize+ExeSecsListSize+headerAlignBytes then
+          internalerror(201103062);
+        { Section data }
+        if assigned(exemap) then
+          begin
+            exemap.Add('');
+            exemap.Add('NLM file offsets:');
+          end;
+        ExeSectionList.ForEachCall(@ExeSectionList_write_data,nil);
+
+        if hassymbols then
+          FWriter.writearray(NlmSymbols);  // specific symbols for the internal netware debugger
+
+        result:=true;
+      end;
+
+
+
+    procedure TNLMexeoutput.GenerateLibraryImports(ImportLibraryList:TFPHashObjectList);
+      var
+        idata5objsection : TObjSection;
+        basedllname : string;
+
+        function AddImport(const afuncname,amangledname:string; isvar:boolean):TObjSymbol;
+        var
+          secname:string;
+        begin
+          //Comment (V_Debug,'TNLMexeoutput.GenerateLibraryImports.AddImport '+afuncName);
+          result:=nil;
+          if assigned(exemap) then
+            exemap.Add(' Importing Function '+afuncname);
+
+          if not isvar then
+            with internalobjdata do
+            begin
+              secname:=basedllname+'_i_'+amangledname;
+              idata5objsection:=createsection(sec_idata5, secname);
+              internalobjdata.SetSection(idata5objsection);
+              result:=internalobjdata.SymbolDefine('_'+amangledname,AB_IMPORT,AT_FUNCTION);
+            end;
+        end;
+
+      var
+        i,j           : longint;
+        ImportLibrary : TImportLibrary;
+        ImportSymbol  : TImportSymbol;
+        exesym        : TExeSymbol;
+        importAddressList : TFPObjectList;
+      begin
+        if ImportLibraryList.Count > 0 then
+          begin
+            {objsec:=}internalObjData.createsection('.imports',0,[oso_data,oso_keep]);
+            i := 0;
+            internalobjdata.writebytes(i,4);  // dummy to avoid deletion
+            {objsec:=}internalObjData.createsection('.modules',0,[oso_data,oso_keep]);
+            internalobjdata.writebytes(i,4);  // dummy to avoid deletion
+          end;
+        for i:=0 to ImportLibraryList.Count-1 do
+          begin
+            ImportLibrary:=TImportLibrary(ImportLibraryList[i]);
+            idata5objsection:=nil;
+            for j:=0 to ImportLibrary.ImportSymbolList.Count-1 do
+              begin
+                ImportSymbol:=TImportSymbol(ImportLibrary.ImportSymbolList[j]);
+                exesym:=TExeSymbol(ExeSymbolList.Find(ImportSymbol.MangledName));
+                if assigned(exesym) and
+                   (exesym.State<>symstate_defined) then
+                  begin
+                    basedllname:=ExtractFileName(ImportLibrary.Name);
+                    exesym.objsymbol:=AddImport(ImportSymbol.Name,ImportSymbol.MangledName,ImportSymbol.IsVar);
+                    exesym.State:=symstate_defined;
+                    importAddressList := TFPObjectList.create(false);
+                    nlmImports.Add(ImportSymbol.Name,importAddressList);
+                    if pos('.',basedllname) = 0 then
+                      basedllname := basedllname + '.nlm';
+                    nlmImpNames.Add(ImportSymbol.Name,TStringObj.create(lower(basedllname)));
+                  end;
+              end;
+          end;
+
+        PackUnresolvedExeSymbols('after DLL imports');
+        GenerateExports;
+      end;
+
+
+
+    procedure TNLMexeoutput.GenerateImports;
+    var
+        exesec,
+        impexesec  : TExeSection;
+        objsec     : TObjSection;
+        objreloc   : TObjRelocation;
+        i,j,k      : integer;
+        importAddressList : TFPObjectList;
+        name,mName : string;
+        b          : byte;
+        modules    : string;
+        modName    : TStringObj;
+    begin
+      if FImportsGenerated then exit;
+      FImportsGenerated := true;
+      impexesec:=FindExeSection('.imports');
+      if impexesec=nil then exit;
+
+      for i:=0 to ExeSectionList.Count-1 do
+        begin
+          exesec:=TExeSection(ExeSectionList[i]);
+          for j:=0 to exesec.ObjSectionList.count-1 do
+            begin
+              objsec:=TObjSection(exesec.ObjSectionList[j]);
+              if j=0 then
+                begin
+                  exesec.DataPos:=objSec.DataPos;
+                  exesec.MemPos:=objSec.MemPos;
+                end;
+              if (copy(objsec.name,1,5) <> '.text') and (copy(objsec.name,1,4) <> '.bss') and (copy(objsec.name,1,5) <> '.data') then
+                  continue;
+              for k:=0 to objsec.ObjRelocations.Count-1 do
+                begin
+                  objreloc := TObjRelocation(objsec.ObjRelocations[k]);
+                  if assigned(objreloc.symbol) then
+                    begin
+                      //writeln (objreloc.symbol.name,' ',objreloc.symbol.bind);
+                      if objreloc.symbol.bind = AB_IMPORT then
+                        begin
+                          importAddressList := TFPObjectList(nlmImports.Find(objreloc.symbol.name));
+                          if assigned(importAddressList) then
+                            begin
+                              objreloc.objsection := objsec;   // points to idata5
+                              importAddressList.Add(objreloc);
+                            end else
+                            begin
+                              comment(v_error,objreloc.symbol.name+' is external but not defined in nlm imports');
+                            end;
+                        end;
+                    end
+                end;
+            end;
+        end;
+
+      modules := '';
+      for i := 0 to nlmImports.count-1 do
+        begin
+          importAddressList := TFPObjectList(nlmImports.Items[i]);
+          if importAddressList.Count > 0 then
+            begin
+              name := nlmImports.NameOfIndex(i);
+
+              // find the module to be imported and add it to the list
+              // of modules to be auto loaded
+              modName := TStringObj(nlmImpNames.Find(name));
+              if assigned(modName) then
+                begin
+                  mName := modName.Value;
+                  if mName <> '' then
+                    if copy(mName,1,1) <> '!' then  // special, with ! only the imp will be included but no module is autoloaded, needed i.e. for netware.imp
+                      begin
+                        if pos(mName+';',modules) < 1 then
+                          begin
+                            modules := modules + mName + ';';
+                            inc(FNumModules);
+                          end;
+                      end;
+                end;
+              internalobjdata.SetSection(TObjSection(impexesec.ObjSectionList[0]));
+              objNLMwriteString (name,false);           // name of symbol
+              k := importAddressList.Count;
+              internalobjdata.writebytes(k,sizeof(k));    // number of references
+              inc(FNumExternals);
+              for j := 0 to importAddressList.Count-1 do
+                begin
+                  objreloc := TObjRelocation(importAddressList[j]);
+                  objsec := objreloc.objsection;
+                  if oso_executable in objreloc.objsection.SecOptions then
+                    begin
+                      if objreloc.typ <> RELOC_RELATIVE then comment(v_error,'reference to external symbols must be RELOC_RELATIVE');
+                      // TODO: how to check if size is 4 ????
+
+                      k := objsec.MemPos + objreloc.DataOffset;
+                      k := k or $40000000;
+                      // TODO: data|code if we support importing data symbols
+                      //       i do not know if this is possible with netware
+                      internalobjdata.writebytes(k,sizeof(k));    // address
+
+                      // the netware loader requires an offset at the import address
+                      // for call = E8 this is -4
+                      // TODO: how can we check the needed offset ??
+                      if objreloc.DataOffset > 0 then
+                        begin
+                          objsec.Data.seek(objreloc.DataOffset-1);
+                          objsec.data.read(b,1);
+                          if b <> $E8 then
+                            comment(v_error,'no rcall (E8) before imported symbol target address');
+                          k := -4;
+                          objsec.Data.write(k,sizeof(k));
+                        end else
+                        begin
+                          objsec.Data.seek(objreloc.DataOffset);
+                          k := 0;
+                          objsec.Data.write(k,sizeof(k));
+                        end;
+                        objreloc.typ := RELOC_NONE;  // to avoid that TCoffObjSection.fixuprelocs changes the address again
+                    end else
+                      comment(v_error,'Importing of symbols only supported for .text');
+                end;
+            end;
+        end;
+
+      exesec := FindExeSection('.modules');
+      if not assigned(exesec) then internalerror(201103272);  // exe section .modules does not exist ???
+      internalobjdata.SetSection(TObjSection(exesec.ObjSectionList[0]));
+      for i := 1 to FNumModules do
+        begin
+          name := GetToken(modules,';');
+          objNLMwriteString (name,false);
+        end;
+    end;
+
+
+    procedure TNLMexeoutput.GenerateExports;
+    var
+        hp  : texported_item;  { for exports }
+        len : byte;
+        addr: longword;
+        exesym : texesymbol;
+    begin
+      internalObjData.createsection('.exports',0,[oso_data,oso_keep]);
+      {name   LString                                   1+n bytes
+      addr                                               4 bytes
+      addr and $80000000 > 0 -> .text else .data}
+      hp:=texported_item(current_module._exports.first);
+      if assigned(hp) then
+        if assigned(exemap) then
+           exemap.Add('');
+      while assigned(hp) do
+        begin
+          { Export the Symbol }
+          if assigned(exemap) then
+            exemap.Add(' Exporting Function '+hp.sym.prettyname+' as '+hp.name^);
+          len := length(hp.name^);
+          internalobjdata.writebytes(len,1);
+          internalobjdata.writebytes(hp.name^[1],len);
+          exesym:=texesymbol(ExeSymbolList.Find(hp.sym.prettyname));
+          if not assigned(exesym) then
+          begin
+            comment(v_error,'exported symbol '+hp.sym.prettyname+' not found');
+            exit;
+          end;
+          // for exported functions we have to set the upper bit
+          // this will be done in .writedata
+          if not hp.is_var then
+            FexportFunctionOffsets.Add(pointer(PtrUInt(internalobjdata.CurrObjSec.Size)));
+          internalobjdata.writereloc(0,4,exesym.ObjSymbol,RELOC_ABSOLUTE32);
+
+          addr := 0;
+          internalobjdata.writebytes(addr,4);
+          inc(FnumExports);
+          hp:=texported_item(hp.next);
+        end;
+    end;
+
+    procedure TNLMexeoutput.GenerateRelocs;
+
+      var
+        exesec : TExeSection;
+        objsec : TObjSection;
+        objreloc : TObjRelocation;
+        i,j,k : longint;
+        offset : longword;
+        inSec,toSec : TsecType;
+        targetSectionName : string;
+
+      begin
+        if not RelocSection or FRelocsGenerated then
+          exit;
+        exesec:=FindExeSection('.reloc');
+        if exesec=nil then
+          exit;
+        objsec:=internalObjData.createsection('.reloc',0,exesec.SecOptions+[oso_data]);
+        exesec.AddObjSection(objsec);
+        for i:=0 to ExeSectionList.Count-1 do
+          begin
+            exesec:=TExeSection(ExeSectionList[i]);
+            for j:=0 to exesec.ObjSectionList.count-1 do
+              begin
+                objsec:=TObjSection(exesec.ObjSectionList[j]);
+                //writeln ('Relocs for ',exesec.name,' - ',objsec.name);
+                { create relocs only for sections which are loaded in memory }
+                if not (oso_load in objsec.SecOptions) then
+                  continue;
+                { create relocs only for .text and .data }
+                inSec := SectionType (objsec.name);
+                if (inSec <> Section_Text) and (inSec <> Section_Data) then
+                  continue;
+
+                for k:=0 to objsec.ObjRelocations.Count-1 do
+                  begin
+                    objreloc:=TObjRelocation(objsec.ObjRelocations[k]);
+                    if objreloc.typ <> RELOC_ABSOLUTE then
+                      continue;
+                    offset:=objsec.MemPos+objreloc.dataoffset;
+                    targetSectionName := '';
+                    if objreloc.symbol <> nil then
+                    begin
+                      // writeln ('  MemPos',objsec.MemPos,' dataOfs:',objreloc.dataoffset,' ',objsec.name,'   objreloc.symbol: ',objreloc.symbol.name,'  objreloc.symbol.objsection.name: ',objreloc.symbol.objsection.name,' ',objreloc.symbol.Typ,' ',objreloc.symbol.bind,' ',objreloc.Typ);
+                      if objreloc.symbol.objsection.name[1] <> '.' then
+                        targetSectionName := objreloc.symbol.name                       // specials like __bss_start__
+                      else                                                              // dont use objsection.name because it begins with *
+                        targetSectionName := copy(objreloc.symbol.objsection.name,1,5); // all others begin with .segment, we only have to check for .text, .data or .bss
+                    end else
+                      internalerror(2011030603);
+
+                    toSec := SectionType(targetSectionName);
+
+                    if (toSec = Section_Text) or (toSec = Section_Data) then
+                    begin
+                      if (inSec = Section_text) then offset := offset or $40000000;
+                      if (toSec = Section_text) then offset := offset or $80000000;
+                      internalObjData.writebytes(offset,4);
+                      inc(FNumRelocs);
+                    end;
+                  end;
+              end;
+          end;
+        FRelocsGenerated:=true;
+      end;
+
+
+    procedure TNLMexeoutput.Order_End;
+      var
+        exesec : TExeSection;
+      begin
+        inherited;
+        exesec:=FindExeSection('.reloc');
+        if exesec=nil then
+          exit;
+        exesec.SecOptions:=exesec.SecOptions + [oso_Data,oso_keep,oso_load];
+      end;
+
+
+      procedure TNLMexeoutput.MemPos_ExeSection(const aname:string);
+        begin
+          if aname='.reloc' then
+            GenerateRelocs;
+          if aname='.imports' then
+            GenerateImports;
+          if aname='.data' then
+            currMemPos := 0;  // both, data and code in the nlm have a start offset of 0
+          inherited;
+        end;
+
+
+      procedure TNLMexeoutput.DataPos_ExeSection(const aname:string);
+        begin
+          inherited;
+        end;
+
+
+      procedure TNLMexeoutput.NLMwriteString (const s : string; terminateWithZero : boolean);
+      var len : byte;
+        begin
+          if length(s) > 254 then len := 254 else len := length(s);
+          FWriter.Write(len,1);
+          if len > 0 then
+            FWriter.write(s[1],len);
+          if terminateWithZero then
+            FWriter.writeZeros(1);
+        end;
+
+
+      procedure TNLMexeoutput.objNLMwriteString (const s : string; terminateWithZero : boolean);
+      var len : byte;
+        begin
+          if length(s) > 254 then len := 254 else len := length(s);
+          Internalobjdata.writebytes(len,1);
+          if len > 0 then
+            Internalobjdata.writebytes(s[1],len);
+          if terminateWithZero then
+          begin
+            len := 0;
+            Internalobjdata.writebytes(s[1],len);
+          end;
+        end;
+
+      { parse netware specific linker options }
+      procedure TNLMexeoutput.ParseScript (linkscript:TCmdStrList);
+      var
+        hp : TCmdStrListItem;
+        opt,keyword,s : string;
+        i : integer;
+
+          function toInteger(s:string; min,max:integer; var res:integer):boolean;
+          var
+            code:word;
+          begin
+            result := false;
+            val (s,res,code);
+            if code<>0 then exit;
+            if (res < min) or (res > max) then exit;
+            result := true;
+          end;
+
+
+          procedure loadFile (const secName, fileName, Desc : string);
+          var
+            fileBuf : array [0..4095] of char;
+            bytesRead : longint;
+            fileH : THandle;
+            fn : TCmdStr;
+
+            begin
+              fn := fileName;
+              if not fileExists(fn) then
+               if not unitsearchpath.FindFile(fileName,true,fn) then
+                 begin
+                   comment(v_error,'can not find '+desc+' file '+fileName);
+                   exit;
+                 end;
+               fileH := fileOpen (fn,fmOpenRead);
+               if fileH = -1 then
+                 begin
+                   comment(v_error,'can not open '+desc+' file '+fn);
+                   exit;
+                  end;
+               { load file into section  }
+               internalObjData.createsection(secName,0,[oso_data,oso_keep]);
+               repeat
+                 bytesRead := fileRead(fileH,fileBuf,sizeof(fileBuf));
+                 if bytesRead > 0 then
+                   internalobjdata.writebytes(fileBuf,bytesRead);
+               until bytesRead < sizeof(fileBuf);
+               fileClose(fileH);
+            end;
+
+        begin
+          hp:=TCmdStrListItem(linkscript.first);
+          while assigned(hp) do
+            begin
+              opt:=hp.str;
+              if (opt='') or (opt[1]='#') then
+                continue;
+              keyword:=Upper(GetToken(opt,' '));
+              if keyword = 'AUTOUNLOAD' then
+                begin
+                  nlmHeader.flags:=nlmHeader.flags or NLM_FLAGS_AUTOUNLOAD;
+                end else
+              if keyword = 'COPYRIGHT' then
+                begin
+                  nlmCopyright := GetToken(opt,' ');
+                end else
+              if keyword = 'CUSTOM' then
+                begin
+                  loadFile ('.custom',GetToken(opt,' '),'custom data');
+                end;
+              if keyword = 'DATE' then  // month day 4-digit-year
+              begin
+                if not toInteger(GetToken(opt,' '),1,12,i) then comment(v_error,'DATE: invalid month')
+                  else nlmVersionHeader.month := i;
+                if not toInteger(GetToken(opt,' '),1,31,i) then comment(v_error,'DATE: invalid day')
+                  else nlmVersionHeader.day := i;
+                if not toInteger(GetToken(opt,' '),1900,3000,i) then comment(v_error,'DATE: invalid year')
+                  else nlmVersionHeader.year := i;
+              end else
+              if keyword = 'DEBUG' then
+              begin
+                // ignore
+              end else
+              if keyword = 'DESCRIPTION' then
+                begin
+                  nlmDescription := GetToken(opt,' ');
+                  if length (nlmDescription) > NLM_MAX_DESCRIPTION_LENGTH then
+                    nlmDescription := copy (nlmDescription,1,NLM_MAX_DESCRIPTION_LENGTH);
+                end else
+              if keyword = 'FLAG' then
+                begin
+                  s := upper(GetToken(opt,' '));
+                  if (not toInteger(GetToken(opt,' '),1,$FFFFFFF,i)) or ((s <> 'ON') and (S <> 'OFF')) then comment(v_error,'FLAG: invalid') else
+                    if (s='ON') then
+                      nlmHeader.flags:=nlmHeader.flags or i else
+                    nlmHeader.flags:=nlmHeader.flags and ($FFFFFFF-i);
+                end else
+              if keyword = 'HELP' then
+                begin
+                  loadFile ('.help',GetToken(opt,' '),'help');
+                end else
+              if keyword = 'MESSAGES' then
+                begin
+                  loadFile ('.messages',GetToken(opt,' '),'message');
+                end else
+              if keyword = 'MULTIPLE' then
+                begin
+                  nlmHeader.flags:=nlmHeader.flags or NLM_FLAGS_MULTILOAD;
+                end else
+              if keyword = 'OS_DOMAIN' then
+                begin
+                  nlmHeader.flags:=nlmHeader.flags or NLM_FLAGS_OSDOMAIN;
+                end else
+              if keyword = 'PSEUDOPREEMPTION' then
+                begin
+                  nlmHeader.flags:=nlmHeader.flags or NLM_FLAGS_PSEUDOPREEMPTION;
+                end else
+              if keyword = 'REENTRANT' then
+                begin
+                  nlmHeader.flags:=nlmHeader.flags or NLM_FLAGS_REENTRANT;
+                end else
+              if keyword = 'SCREENNAME' then
+                begin
+                  nlmScreenname := GetToken(opt,' ');
+                  if length(nlmScreenname) > NLM_MAX_SCREEN_NAME_LENGTH then
+                   nlmScreenName := copy (nlmScreenName,1,NLM_MAX_SCREEN_NAME_LENGTH);
+                end else
+              if (keyword = 'STACK') or (keyword = 'STACKSIZE') then
+                begin
+                   if (not toInteger(GetToken(opt,' '),1,$FFFFFFF,i)) then comment(v_error,'invalid stacksize') else
+                     stacksize := i;
+                end else
+              if keyword = 'SYNCHRONIZE' then
+                begin
+                  nlmHeader.flags:=nlmHeader.flags or NLM_FLAGS_SYNCHRONIZE;
+                end else
+              if keyword = 'THREADNAME' then
+                begin
+                  nlmThreadname := GetToken(opt,' ');
+                  if length(nlmThreadname) > NLM_MAX_THREAD_NAME_LENGTH then
+                    nlmThreadname := copy (nlmThreadname,1,NLM_MAX_THREAD_NAME_LENGTH);
+                end else
+              if keyword = 'TYPE' then
+                begin
+                   if (not toInteger(GetToken(opt,' '),1,16,i)) then comment(v_error,'invalid TYPE') else
+                     nlmHeader.moduleType := i;  // TODO: set executable extension (.DSK, .LAN, ...)
+                end else
+              if keyword = 'VERSION' then
+                begin
+                   if (not toInteger(GetToken(opt,' '),0,$FFFFFFF,i)) then comment(v_error,'invalid major version') else
+                     nlmVersionHeader.majorVersion := i;
+                   if (not toInteger(GetToken(opt,' '),0,99,i)) then comment(v_error,'invalid minor version') else
+                     nlmVersionHeader.minorVersion := i;
+                   if (not toInteger(GetToken(opt,' '),0,$FFFFFFF,i)) then comment(v_error,'invalid minor version') else
+                     if i > 26 then
+                       nlmVersionHeader.revision := 0 else
+                       nlmVersionHeader.revision := i;
+                end else
+              if keyword = 'XDCDATA' then
+                begin
+                  loadFile ('.xdc',GetToken(opt,' '),'xdc');
+                end;
+                { TODO: check for unknown options. This means all handled option
+                  (also in link.pas) have to be flagged if processed }
+              hp:=TCmdStrListItem(hp.next);
+            end;
+        end;
+
+{****************************************************************************
+                                TNLMCoffObjData
+****************************************************************************}
+
+    constructor TNLMCoffObjData.create(const n:string);
+      begin
+        inherited createcoff(n,true,TNLMCoffObjSection);
+      end;
+
+
+{****************************************************************************
+                               TNLMoffObjSection
+****************************************************************************}
+
+    constructor TNLMCoffObjSection.create(AList:TFPHashObjectList;const aname:string;aalign:shortint;aoptions:TObjSectionOptions);
+      begin
+        inherited create(alist,aname,aalign,aoptions);
+      end;
+
+
+    constructor TNLMCoffObjOutput.create(AWriter:TObjectWriter);
+      begin
+        // ??????
+        // if win32=false, .stabs and .stabstr will be written without oso_debug
+        // Without oso_debug the sections will be removed by the linker
+        inherited createcoff(AWriter,{win32}true);
+        cobjdata:=TNLMCoffObjData;
+      end;
+
+{****************************************************************************
+                                 TDJCoffAssembler
+****************************************************************************}
+
+    constructor TNLMCoffAssembler.Create(smart:boolean);
+      begin
+        inherited Create(smart);
+        CObjOutput:=TNLMCoffObjOutput;
+      end;
+
+    constructor TNLMCoffObjInput.create;
+      begin
+        inherited createcoff(true);
+        cobjdata:=TNLMCoffObjData;
+      end;
+
+{*****************************************************************************
+                                  Initialize
+*****************************************************************************}
+const
+    as_i386_nlmcoff_info : tasminfo =
+          (
+            id     : as_i386_nlmcoff;
+            idtxt  : 'NLMCOFF';
+            asmbin : '';
+            asmcmd : '';
+            supported_targets : [system_i386_Netware,system_i386_netwlibc];
+            flags : [af_outputbinary,af_smartlink_sections];
+            labelprefix : '.L';
+            comment : '';
+          );
+
+
+
+initialization
+{$ifdef i386}
+  RegisterAssembler(as_i386_nlmcoff_info,TNLMCoffAssembler);
+{$endif i386}
+end.

+ 2 - 2
compiler/owar.pas

@@ -262,11 +262,11 @@ implementation
 
 
     procedure tarobjectwriter.writear;
     procedure tarobjectwriter.writear;
       var
       var
-        arf      : TCFileStream;
+        arf      : TCCustomFileStream;
         fixup,l,
         fixup,l,
         relocs,i : longint;
         relocs,i : longint;
       begin
       begin
-        arf:=TCFileStream.Create(arfn,fmCreate);
+        arf:=CFileStreamClass.Create(arfn,fmCreate);
         if CStreamError<>0 then
         if CStreamError<>0 then
           begin
           begin
              Message1(exec_e_cant_create_archivefile,arfn);
              Message1(exec_e_cant_create_archivefile,arfn);

+ 4 - 4
compiler/owbase.pas

@@ -31,7 +31,7 @@ uses
 type
 type
   tobjectwriter=class
   tobjectwriter=class
   private
   private
-    f      : TCFileStream;
+    f      : TCCustomFileStream;
     opened : boolean;
     opened : boolean;
     buf    : pchar;
     buf    : pchar;
     bufidx : longword;
     bufidx : longword;
@@ -54,7 +54,7 @@ type
 
 
   tobjectreader=class
   tobjectreader=class
   private
   private
-    f      : TCFileStream;
+    f      : TCCustomFileStream;
     opened : boolean;
     opened : boolean;
     buf    : pchar;
     buf    : pchar;
     ffilename : string;
     ffilename : string;
@@ -108,7 +108,7 @@ end;
 function tobjectwriter.createfile(const fn:string):boolean;
 function tobjectwriter.createfile(const fn:string):boolean;
 begin
 begin
   createfile:=false;
   createfile:=false;
-  f:=TCFileStream.Create(fn,fmCreate);
+  f:=CFileStreamClass.Create(fn,fmCreate);
   if CStreamError<>0 then
   if CStreamError<>0 then
     begin
     begin
        Message1(exec_e_cant_create_objectfile,fn);
        Message1(exec_e_cant_create_objectfile,fn);
@@ -233,7 +233,7 @@ end;
 function tobjectreader.openfile(const fn:string):boolean;
 function tobjectreader.openfile(const fn:string):boolean;
 begin
 begin
   openfile:=false;
   openfile:=false;
-  f:=TCFileStream.Create(fn,fmOpenRead);
+  f:=CFileStreamClass.Create(fn,fmOpenRead);
   if CStreamError<>0 then
   if CStreamError<>0 then
     begin
     begin
        Comment(V_Error,'Can''t open object file: '+fn);
        Comment(V_Error,'Can''t open object file: '+fn);

+ 4 - 2
compiler/paramgr.pas

@@ -366,7 +366,8 @@ implementation
               i386 isn't affected anyways because it uses the stack to push parameters
               i386 isn't affected anyways because it uses the stack to push parameters
               on arm it reduces executable size of the compiler by 2.1 per cent (FK) }
               on arm it reduces executable size of the compiler by 2.1 per cent (FK) }
             { Does it fit a register? }
             { Does it fit a register? }
-            if (not can_use_final_stack_loc or
+            if ((not can_use_final_stack_loc and
+                 use_fixed_stack) or
                 not is_stack_paraloc(paraloc)) and
                 not is_stack_paraloc(paraloc)) and
                (len<=sizeof(pint)) and
                (len<=sizeof(pint)) and
                (paraloc^.size in [OS_8,OS_16,OS_32,OS_64,OS_128,OS_S8,OS_S16,OS_S32,OS_S64,OS_S128]) then
                (paraloc^.size in [OS_8,OS_16,OS_32,OS_64,OS_128,OS_S8,OS_S16,OS_S32,OS_S64,OS_S128]) then
@@ -382,7 +383,8 @@ implementation
                 newparaloc^.register:=cg.getmmregister(list,paraloc^.size);
                 newparaloc^.register:=cg.getmmregister(list,paraloc^.size);
               LOC_REFERENCE :
               LOC_REFERENCE :
                 begin
                 begin
-                  if can_use_final_stack_loc and
+                  if (can_use_final_stack_loc or
+                      not use_fixed_stack) and
                      is_stack_paraloc(paraloc) then
                      is_stack_paraloc(paraloc) then
                     duplicatecgparaloc(paraloc,newparaloc)
                     duplicatecgparaloc(paraloc,newparaloc)
                   else
                   else

+ 4 - 3
compiler/pdecl.pas

@@ -397,7 +397,6 @@ implementation
          typename,orgtypename : TIDString;
          typename,orgtypename : TIDString;
          newtype  : ttypesym;
          newtype  : ttypesym;
          sym      : tsym;
          sym      : tsym;
-         srsymtable : TSymtable;
          hdef     : tdef;
          hdef     : tdef;
          defpos,storetokenpos : tfileposinfo;
          defpos,storetokenpos : tfileposinfo;
          old_block_type : tblock_type;
          old_block_type : tblock_type;
@@ -462,8 +461,10 @@ implementation
                current_scanner.startrecordtokens(generictokenbuf);
                current_scanner.startrecordtokens(generictokenbuf);
              end;
              end;
 
 
-           { is the type already defined? }
-           searchsym(typename,sym,srsymtable);
+           { is the type already defined? -- must be in the current symtable,
+             not in a nested symtable or one higher up the stack -> don't
+             use searchsym & frinds! }
+           sym:=tsym(symtablestack.top.find(typename));
            newtype:=nil;
            newtype:=nil;
            { found a symbol with this name? }
            { found a symbol with this name? }
            if assigned(sym) then
            if assigned(sym) then

+ 2 - 1
compiler/pdecobj.pas

@@ -280,12 +280,13 @@ implementation
 
 
     procedure handleImplementedProtocol(intfdef : tobjectdef);
     procedure handleImplementedProtocol(intfdef : tobjectdef);
       begin
       begin
+        intfdef:=find_real_objcclass_definition(intfdef,false);
         if not is_objcprotocol(intfdef) then
         if not is_objcprotocol(intfdef) then
           begin
           begin
              Message1(type_e_protocol_type_expected,intfdef.typename);
              Message1(type_e_protocol_type_expected,intfdef.typename);
              exit;
              exit;
           end;
           end;
-        if (oo_is_forward in intfdef.objectoptions) then
+        if ([oo_is_forward,oo_is_formal] * intfdef.objectoptions <> []) then
           begin
           begin
              Message1(parser_e_forward_protocol_declaration_must_be_resolved,intfdef.objrealname^);
              Message1(parser_e_forward_protocol_declaration_must_be_resolved,intfdef.objrealname^);
              exit;
              exit;

+ 15 - 2
compiler/pdecsub.pas

@@ -1611,9 +1611,22 @@ begin
 end;
 end;
 
 
 procedure pd_interrupt(pd:tabstractprocdef);
 procedure pd_interrupt(pd:tabstractprocdef);
+
+var v: Tconstexprint;
+
 begin
 begin
   if pd.parast.symtablelevel>normal_function_level then
   if pd.parast.symtablelevel>normal_function_level then
     Message(parser_e_dont_nest_interrupt);
     Message(parser_e_dont_nest_interrupt);
+
+  if target_info.system in systems_interrupt_table then
+    begin
+      if token<>_SEMICOLON then
+        begin
+          pd.proccalloption:=pocall_interrupt;
+          v:=get_intconst;
+          Tprocdef(pd).interruptvector:=v.uvalue;
+        end;
+    end;
 end;
 end;
 
 
 procedure pd_abstract(pd:tabstractprocdef);
 procedure pd_abstract(pd:tabstractprocdef);
@@ -3084,7 +3097,7 @@ const
                 can be in a different location because of the calling convention, eg. L-R vs. R-L order (PFV) }
                 can be in a different location because of the calling convention, eg. L-R vs. R-L order (PFV) }
               (
               (
                (compare_paras(currpd.paras,fwpd.paras,cp_none,[cpo_comparedefaultvalue,cpo_ignorehidden,cpo_openequalisexact,cpo_ignoreuniv])=te_exact) and
                (compare_paras(currpd.paras,fwpd.paras,cp_none,[cpo_comparedefaultvalue,cpo_ignorehidden,cpo_openequalisexact,cpo_ignoreuniv])=te_exact) and
-               (fwpd.returndef=currpd.returndef)
+               (compare_defs(fwpd.returndef,currpd.returndef,nothingn)=te_exact)
               ) then
               ) then
              begin
              begin
                { Check if we've found the forwarddef, if found then
                { Check if we've found the forwarddef, if found then
@@ -3155,7 +3168,7 @@ const
                    if ((m_repeat_forward in current_settings.modeswitches) or
                    if ((m_repeat_forward in current_settings.modeswitches) or
                        not is_bareprocdef(currpd)) and
                        not is_bareprocdef(currpd)) and
                       ((compare_paras(currpd.paras,fwpd.paras,cp_all,paracompopt)<>te_exact) or
                       ((compare_paras(currpd.paras,fwpd.paras,cp_all,paracompopt)<>te_exact) or
-                       (fwpd.returndef<>currpd.returndef)) then
+                       (compare_defs(fwpd.returndef,currpd.returndef,nothingn)<>te_exact)) then
                      begin
                      begin
                        MessagePos1(currpd.fileinfo,parser_e_header_dont_match_forward,
                        MessagePos1(currpd.fileinfo,parser_e_header_dont_match_forward,
                                    fwpd.fullprocname(false));
                                    fwpd.fullprocname(false));

+ 30 - 0
compiler/pdecvar.pas

@@ -1041,6 +1041,17 @@ implementation
     end;
     end;
 
 
 
 
+    procedure try_consume_sectiondirective(var asection: ansistring);
+      begin
+        if idtoken=_SECTION then
+          begin
+            consume(_ID);
+            asection:=get_stringconst;
+            consume(_SEMICOLON);
+          end;
+      end;
+
+
     procedure read_var_decls(options:Tvar_dec_options);
     procedure read_var_decls(options:Tvar_dec_options);
 
 
         procedure read_default_value(sc : TFPObjectList);
         procedure read_default_value(sc : TFPObjectList);
@@ -1253,6 +1264,7 @@ implementation
          hintsymoptions  : tsymoptions;
          hintsymoptions  : tsymoptions;
          deprecatedmsg   : pshortstring;
          deprecatedmsg   : pshortstring;
          old_block_type  : tblock_type;
          old_block_type  : tblock_type;
+         section : ansistring;
       begin
       begin
          old_block_type:=block_type;
          old_block_type:=block_type;
          block_type:=bt_var;
          block_type:=bt_var;
@@ -1394,6 +1406,24 @@ implementation
                 ) then
                 ) then
                read_public_and_external_sc(sc);
                read_public_and_external_sc(sc);
 
 
+             { try to parse a section directive }
+             if (target_info.system in systems_embedded) and (idtoken=_SECTION) then
+               begin
+                 try_consume_sectiondirective(section);
+                 if section<>'' then
+                   begin
+                     for i:=0 to sc.count-1 do
+                       begin
+                         vs:=tabstractvarsym(sc[i]);
+                         if (vs.varoptions *[vo_is_external,vo_is_weak_external])<>[] then
+                           Message(parser_e_externals_no_section);
+                         if vs.typ<>staticvarsym then
+                           Message(parser_e_section_no_locals);
+                         tstaticvarsym(vs).section:=section;
+                       end;
+                   end;
+               end;
+
              { allocate normal variable (non-external and non-typed-const) staticvarsyms }
              { allocate normal variable (non-external and non-typed-const) staticvarsyms }
              for i:=0 to sc.count-1 do
              for i:=0 to sc.count-1 do
                begin
                begin

+ 6 - 6
compiler/pexpr.pas

@@ -1451,7 +1451,7 @@ implementation
                         {  e.g., "with classinstance do field := 5"), then    }
                         {  e.g., "with classinstance do field := 5"), then    }
                         { let do_member_read handle it                        }
                         { let do_member_read handle it                        }
                         if (srsym.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
                         if (srsym.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
-                          do_member_read(tobjectdef(hdef),getaddr,srsym,p1,again,[])
+                          do_member_read(tabstractrecorddef(hdef),getaddr,srsym,p1,again,[])
                         else
                         else
                           { otherwise it's a regular record subscript }
                           { otherwise it's a regular record subscript }
                           p1:=csubscriptnode.create(srsym,p1);
                           p1:=csubscriptnode.create(srsym,p1);
@@ -1507,7 +1507,7 @@ implementation
                                if assigned(srsym) then
                                if assigned(srsym) then
                                  check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
                                  check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
                                consume(_ID);
                                consume(_ID);
-                               do_member_read(tobjectdef(hdef),false,srsym,p1,again,[]);
+                               do_member_read(tabstractrecorddef(hdef),false,srsym,p1,again,[]);
                              end
                              end
                            else
                            else
                             begin
                             begin
@@ -1522,7 +1522,7 @@ implementation
                                 begin
                                 begin
                                   check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
                                   check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
                                       consume(_ID);
                                       consume(_ID);
-                                      do_member_read(tobjectdef(hdef),getaddr,srsym,p1,again,[]);
+                                      do_member_read(tabstractrecorddef(hdef),getaddr,srsym,p1,again,[]);
                                 end
                                 end
                               else
                               else
                                 Message1(sym_e_id_no_member,orgpattern);
                                 Message1(sym_e_id_no_member,orgpattern);
@@ -1547,7 +1547,7 @@ implementation
                                  begin
                                  begin
                                    check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
                                    check_hints(srsym,srsym.symoptions,srsym.deprecatedmsg);
                                    consume(_ID);
                                    consume(_ID);
-                                   do_member_read(tobjectdef(hdef),getaddr,srsym,p1,again,[]);
+                                   do_member_read(tabstractrecorddef(hdef),getaddr,srsym,p1,again,[]);
                                  end
                                  end
                                 else
                                 else
                                  begin
                                  begin
@@ -1597,7 +1597,7 @@ implementation
                         { not srsymtable.symtabletype since that can be }
                         { not srsymtable.symtabletype since that can be }
                         { withsymtable as well                          }
                         { withsymtable as well                          }
                         if (srsym.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
                         if (srsym.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
-                          do_member_read(tobjectdef(hdef),getaddr,srsym,p1,again,[])
+                          do_member_read(tabstractrecorddef(hdef),getaddr,srsym,p1,again,[])
                         else
                         else
                           { no procsyms in records (yet) }
                           { no procsyms in records (yet) }
                           internalerror(2007012006);
                           internalerror(2007012006);
@@ -1630,7 +1630,7 @@ implementation
                         { not srsymtable.symtabletype since that can be }
                         { not srsymtable.symtabletype since that can be }
                         { withsymtable as well                          }
                         { withsymtable as well                          }
                         if (srsym.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
                         if (srsym.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
-                          do_member_read(tobjectdef(hdef),getaddr,srsym,p1,again,[])
+                          do_member_read(tabstractrecorddef(hdef),getaddr,srsym,p1,again,[])
                         else
                         else
                           { no propertysyms in records (yet) }
                           { no propertysyms in records (yet) }
                           internalerror(2009111510);
                           internalerror(2009111510);

+ 2 - 4
compiler/pinline.pas

@@ -620,14 +620,12 @@ implementation
          begin
          begin
            destppn:=tcallparanode(ppn.right);
            destppn:=tcallparanode(ppn.right);
            { create call to fpc_initialize/finalize_array }
            { create call to fpc_initialize/finalize_array }
-           npara:=ccallparanode.create(cordconstnode.create
-                     (destppn.left.resultdef.size,s32inttype,true),
-                  ccallparanode.create(ctypeconvnode.create
+           npara:=ccallparanode.create(ctypeconvnode.create
                      (ppn.left,s32inttype),
                      (ppn.left,s32inttype),
                   ccallparanode.create(caddrnode.create_internal
                   ccallparanode.create(caddrnode.create_internal
                      (crttinode.create(tstoreddef(destppn.left.resultdef),initrtti,rdt_normal)),
                      (crttinode.create(tstoreddef(destppn.left.resultdef),initrtti,rdt_normal)),
                   ccallparanode.create(caddrnode.create_internal
                   ccallparanode.create(caddrnode.create_internal
-                     (destppn.left),nil))));
+                     (destppn.left),nil)));
            if isinit then
            if isinit then
              newblock:=ccallnode.createintern('fpc_initialize_array',npara)
              newblock:=ccallnode.createintern('fpc_initialize_array',npara)
            else
            else

+ 8 - 15
compiler/pmodules.pas

@@ -29,7 +29,6 @@ interface
     procedure proc_package;
     procedure proc_package;
     procedure proc_program(islibrary : boolean);
     procedure proc_program(islibrary : boolean);
 
 
-
 implementation
 implementation
 
 
     uses
     uses
@@ -47,13 +46,8 @@ implementation
        pexports,
        pexports,
        objcgutl,
        objcgutl,
        wpobase,
        wpobase,
-       scanner,pbase,pexpr,psystem,psub,pdecsub,ptype
-       ,cpuinfo
-{$ifdef i386}
-       { fix me! }
-       ,cpubase
-{$endif i386}
-       ;
+       scanner,pbase,pexpr,psystem,psub,pdecsub,ptype,
+       cpuinfo;
 
 
 
 
     procedure create_objectfile;
     procedure create_objectfile;
@@ -715,7 +709,7 @@ implementation
           end;
           end;
 
 
         { CPU targets with microcontroller support can add a controller specific unit }
         { CPU targets with microcontroller support can add a controller specific unit }
-{$if defined(ARM)}
+{$if defined(ARM) or defined(AVR)}
         if (target_info.system in systems_embedded) and (current_settings.controllertype<>ct_none) then
         if (target_info.system in systems_embedded) and (current_settings.controllertype<>ct_none) then
           AddUnit(controllerunitstr[current_settings.controllertype]);
           AddUnit(controllerunitstr[current_settings.controllertype]);
 {$endif ARM}
 {$endif ARM}
@@ -1908,11 +1902,7 @@ implementation
 
 
          new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0);
          new_section(current_asmdata.asmlists[al_procedures],sec_code,'',0);
          current_asmdata.asmlists[al_procedures].concat(tai_symbol.createname_global('_DLLMainCRTStartup',AT_FUNCTION,0));
          current_asmdata.asmlists[al_procedures].concat(tai_symbol.createname_global('_DLLMainCRTStartup',AT_FUNCTION,0));
-{$ifdef i386}
-         { fix me! }
-         current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_const_reg(A_MOV,S_L,1,NR_EAX));
-         current_asmdata.asmlists[al_procedures].concat(Taicpu.Op_const(A_RET,S_W,12));
-{$endif i386}
+         gen_fpc_dummy(current_asmdata.asmlists[al_procedures]);
          current_asmdata.asmlists[al_procedures].concat(tai_const.createname('_FPCDummy',0));
          current_asmdata.asmlists[al_procedures].concat(tai_const.createname('_FPCDummy',0));
 
 
          { leave when we got an error }
          { leave when we got an error }
@@ -2174,7 +2164,7 @@ implementation
 
 
          { Insert _GLOBAL_OFFSET_TABLE_ symbol if system uses it }
          { Insert _GLOBAL_OFFSET_TABLE_ symbol if system uses it }
          maybe_load_got;
          maybe_load_got;
-  
+
          { create whole program optimisation information }
          { create whole program optimisation information }
          current_module.wpoinfo:=tunitwpoinfo.create;
          current_module.wpoinfo:=tunitwpoinfo.create;
 
 
@@ -2363,6 +2353,9 @@ implementation
          InsertWideInitsTablesTable;
          InsertWideInitsTablesTable;
          InsertMemorySizes;
          InsertMemorySizes;
 
 
+         if target_info.system in systems_interrupt_table then
+           InsertInterruptTable;
+
          { Insert symbol to resource info }
          { Insert symbol to resource info }
          InsertResourceInfo(resources_used);
          InsertResourceInfo(resources_used);
 
 

+ 1 - 0
compiler/powerpc/agppcmpw.pas

@@ -70,6 +70,7 @@ interface
 
 
       secnames : array[TAsmSectiontype] of string[10] = (
       secnames : array[TAsmSectiontype] of string[10] = (
         '',      {none}
         '',      {none}
+        '',      {user}
         'csect', {code}
         'csect', {code}
         'csect', {data}
         'csect', {data}
         'csect', {read only data}
         'csect', {read only data}

+ 70 - 41
compiler/ppu.pas

@@ -26,7 +26,7 @@ unit ppu;
 interface
 interface
 
 
   uses
   uses
-    globtype,constexp;
+    globtype,constexp,cstreams;
 
 
 { Also write the ppu if only crc if done, this can be used with ppudump to
 { Also write the ppu if only crc if done, this can be used with ppudump to
   see the differences between the intf and implementation }
   see the differences between the intf and implementation }
@@ -186,9 +186,11 @@ type
     nr   : byte;
     nr   : byte;
   end;
   end;
 
 
+  { tppufile }
+
   tppufile=class
   tppufile=class
   private
   private
-    f        : file;
+    f        : TCCustomFileStream;
     mode     : byte; {0 - Closed, 1 - Reading, 2 - Writing}
     mode     : byte; {0 - Closed, 1 - Reading, 2 - Writing}
     fname    : string;
     fname    : string;
     fsize    : integer;
     fsize    : integer;
@@ -260,6 +262,7 @@ type
     function getaword:aword;
     function getaword:aword;
     function  getreal:ppureal;
     function  getreal:ppureal;
     function  getstring:string;
     function  getstring:string;
+    function  getansistring:ansistring;
     procedure getnormalset(var b);
     procedure getnormalset(var b);
     procedure getsmallset(var b);
     procedure getsmallset(var b);
     function  skipuntilentry(untilb:byte):boolean;
     function  skipuntilentry(untilb:byte):boolean;
@@ -280,10 +283,11 @@ type
     procedure putaword(i:aword);
     procedure putaword(i:aword);
     procedure putreal(d:ppureal);
     procedure putreal(d:ppureal);
     procedure putstring(const s:string);
     procedure putstring(const s:string);
+    procedure putansistring(const s:ansistring);
     procedure putnormalset(const b);
     procedure putnormalset(const b);
     procedure putsmallset(const b);
     procedure putsmallset(const b);
-    procedure tempclose;
-    function  tempopen:boolean;
+    procedure tempclose;        // MG: not used, obsolete?
+    function  tempopen:boolean; // MG: not used, obsolete?
   end;
   end;
 
 
 implementation
 implementation
@@ -356,10 +360,7 @@ begin
   if Mode<>0 then
   if Mode<>0 then
    begin
    begin
      Flush;
      Flush;
-     {$I-}
-      system.close(f);
-     {$I+}
-     if ioresult<>0 then;
+     f.Free;
      Mode:=0;
      Mode:=0;
      closed:=true;
      closed:=true;
    end;
    end;
@@ -415,21 +416,17 @@ var
   i      : integer;
   i      : integer;
 begin
 begin
   openfile:=false;
   openfile:=false;
-  assign(f,fname);
-  ofmode:=filemode;
-  filemode:=$0;
-  {$I-}
-   reset(f,1);
-  {$I+}
-  filemode:=ofmode;
-  if ioresult<>0 then
-   exit;
+  try
+    f:=CFileStreamClass.Create(fname,fmOpenRead)
+  except
+    exit;
+  end;
   closed:=false;
   closed:=false;
 {read ppuheader}
 {read ppuheader}
-  fsize:=filesize(f);
+  fsize:=f.Size;
   if fsize<sizeof(tppuheader) then
   if fsize<sizeof(tppuheader) then
    exit;
    exit;
-  blockread(f,header,sizeof(tppuheader),i);
+  i:=f.Read(header,sizeof(tppuheader));
   { The header is always stored in little endian order }
   { The header is always stored in little endian order }
   { therefore swap if on a big endian machine          }
   { therefore swap if on a big endian machine          }
 {$IFDEF ENDIAN_BIG}
 {$IFDEF ENDIAN_BIG}
@@ -478,7 +475,7 @@ end;
 procedure tppufile.reloadbuf;
 procedure tppufile.reloadbuf;
 begin
 begin
   inc(bufstart,bufsize);
   inc(bufstart,bufsize);
-  blockread(f,buf^,ppubufsize,bufsize);
+  bufsize:=f.Read(buf^,ppubufsize);
   bufidx:=0;
   bufidx:=0;
 end;
 end;
 
 
@@ -789,6 +786,22 @@ begin
 end;
 end;
 
 
 
 
+function tppufile.getansistring: ansistring;
+var
+  l : longint;
+begin
+  l:=getlongint;
+  if entryidx+l>entry.size then
+   begin
+     error:=true;
+     exit;
+   end;
+  SetLength(Result,l);
+  ReadData(result[1],l);
+  inc(entryidx,l);
+end;
+
+
 procedure tppufile.getsmallset(var b);
 procedure tppufile.getsmallset(var b);
 var
 var
   i : longint;
   i : longint;
@@ -827,6 +840,8 @@ end;
 *****************************************************************************}
 *****************************************************************************}
 
 
 function tppufile.createfile:boolean;
 function tppufile.createfile:boolean;
+var
+  ok: boolean;
 begin
 begin
   createfile:=false;
   createfile:=false;
 {$ifdef INTFPPU}
 {$ifdef INTFPPU}
@@ -838,24 +853,26 @@ begin
 {$endif}
 {$endif}
   if not crc_only then
   if not crc_only then
     begin
     begin
-      assign(f,fname);
       {$ifdef MACOS}
       {$ifdef MACOS}
       {FPas is FreePascal's creator code on MacOS. See systems/mac_crea.txt}
       {FPas is FreePascal's creator code on MacOS. See systems/mac_crea.txt}
       SetDefaultMacOSCreator('FPas');
       SetDefaultMacOSCreator('FPas');
       SetDefaultMacOSFiletype('FPPU');
       SetDefaultMacOSFiletype('FPPU');
       {$endif}
       {$endif}
-      {$I-}
-      rewrite(f,1);
-      {$I+}
+      ok:=false;
+      try
+        f:=CFileStreamClass.Create(fname,fmCreate);
+        ok:=true;
+      except
+      end;
       {$ifdef MACOS}
       {$ifdef MACOS}
       SetDefaultMacOSCreator('MPS ');
       SetDefaultMacOSCreator('MPS ');
       SetDefaultMacOSFiletype('TEXT');
       SetDefaultMacOSFiletype('TEXT');
       {$endif}
       {$endif}
-      if ioresult<>0 then
+      if not ok then
        exit;
        exit;
       Mode:=2;
       Mode:=2;
     {write header for sure}
     {write header for sure}
-      blockwrite(f,header,sizeof(tppuheader));
+      f.Write(header,sizeof(tppuheader));
     end;
     end;
   bufsize:=ppubufsize;
   bufsize:=ppubufsize;
   bufstart:=sizeof(tppuheader);
   bufstart:=sizeof(tppuheader);
@@ -904,10 +921,10 @@ begin
     header.symlistsize:=swapendian(header.symlistsize);
     header.symlistsize:=swapendian(header.symlistsize);
 {$endif not FPC_BIG_ENDIAN}
 {$endif not FPC_BIG_ENDIAN}
 { write header and restore filepos after it }
 { write header and restore filepos after it }
-  opos:=filepos(f);
-  seek(f,0);
-  blockwrite(f,header,sizeof(tppuheader));
-  seek(f,opos);
+  opos:=f.Position;
+  f.Position:=0;
+  f.Write(header,sizeof(tppuheader));
+  f.Position:=opos;
 end;
 end;
 
 
 
 
@@ -915,7 +932,7 @@ procedure tppufile.writebuf;
 begin
 begin
   if not crc_only and
   if not crc_only and
      (bufidx <> 0) then
      (bufidx <> 0) then
-    blockwrite(f,buf^,bufidx);
+    f.Write(buf^,bufidx);
   inc(bufstart,bufidx);
   inc(bufstart,bufidx);
   bufidx:=0;
   bufidx:=0;
 end;
 end;
@@ -985,10 +1002,10 @@ begin
       {flush to be sure}
       {flush to be sure}
         WriteBuf;
         WriteBuf;
       {write entry}
       {write entry}
-        opos:=filepos(f);
-        seek(f,entrystart);
-        blockwrite(f,entry,sizeof(tppuentry));
-        seek(f,opos);
+        opos:=f.Position;
+        f.Position:=entrystart;
+        f.write(entry,sizeof(tppuentry));
+        f.Position:=opos;
       end;
       end;
      entrybufstart:=bufstart;
      entrybufstart:=bufstart;
    end
    end
@@ -1131,6 +1148,16 @@ procedure tppufile.putstring(const s:string);
   end;
   end;
 
 
 
 
+procedure tppufile.putansistring(const s: ansistring);
+  var
+    l : longint;
+  begin
+    l:=length(s);
+    putdata(l,4);
+    putdata(s[1],l);
+  end;
+
+
 procedure tppufile.putsmallset(const b);
 procedure tppufile.putsmallset(const b);
   var
   var
     l : longint;
     l : longint;
@@ -1152,11 +1179,8 @@ procedure tppufile.tempclose;
   begin
   begin
     if not closed then
     if not closed then
      begin
      begin
-       closepos:=filepos(f);
-       {$I-}
-        system.close(f);
-       {$I+}
-       if ioresult<>0 then;
+       closepos:=f.Position;
+       f.Free;
        closed:=true;
        closed:=true;
        tempclosed:=true;
        tempclosed:=true;
      end;
      end;
@@ -1170,6 +1194,10 @@ function tppufile.tempopen:boolean;
     tempopen:=false;
     tempopen:=false;
     if not closed or not tempclosed then
     if not closed or not tempclosed then
      exit;
      exit;
+    // MG: not sure, if this is correct
+
+    f.Position:=0;
+    (*
     ofm:=filemode;
     ofm:=filemode;
     filemode:=0;
     filemode:=0;
     {$I-}
     {$I-}
@@ -1178,11 +1206,12 @@ function tppufile.tempopen:boolean;
     filemode:=ofm;
     filemode:=ofm;
     if ioresult<>0 then
     if ioresult<>0 then
      exit;
      exit;
+    *)
     closed:=false;
     closed:=false;
     tempclosed:=false;
     tempclosed:=false;
 
 
   { restore state }
   { restore state }
-    seek(f,closepos);
+    f.Position:=closepos;
     tempopen:=true;
     tempopen:=true;
   end;
   end;
 
 

+ 65 - 0
compiler/procinfo.pas

@@ -47,10 +47,17 @@ unit procinfo;
 
 
 
 
     type
     type
+       tsavedlabels = array[Boolean] of TAsmLabel;
+
        {# This object gives information on the current routine being
        {# This object gives information on the current routine being
           compiled.
           compiled.
        }
        }
        tprocinfo = class(tlinkedlistitem)
        tprocinfo = class(tlinkedlistitem)
+       private
+          { list to store the procinfo's of the nested procedures }
+          nestedprocs : tlinkedlist;
+          procedure addnestedproc(child: tprocinfo);
+       public
           { pointer to parent in nested procedures }
           { pointer to parent in nested procedures }
           parent : tprocinfo;
           parent : tprocinfo;
           {# the definition of the routine itself }
           {# the definition of the routine itself }
@@ -123,6 +130,18 @@ unit procinfo;
 
 
           { Allocate got register }
           { Allocate got register }
           procedure allocate_got_register(list: TAsmList);virtual;
           procedure allocate_got_register(list: TAsmList);virtual;
+
+          { Destroy the entire procinfo tree, starting from the outermost parent }
+          procedure destroy_tree;
+
+          { Store CurrTrueLabel and CurrFalseLabel to saved and generate new ones }
+          procedure save_jump_labels(out saved: tsavedlabels);
+
+          { Restore CurrTrueLabel and CurrFalseLabel from saved }
+          procedure restore_jump_labels(const saved: tsavedlabels);
+
+          function get_first_nestedproc: tprocinfo;
+          function has_nestedprocs: boolean;
        end;
        end;
        tcprocinfo = class of tprocinfo;
        tcprocinfo = class of tprocinfo;
 
 
@@ -165,15 +184,61 @@ implementation
         CurrTrueLabel:=nil;
         CurrTrueLabel:=nil;
         CurrFalseLabel:=nil;
         CurrFalseLabel:=nil;
         maxpushedparasize:=0;
         maxpushedparasize:=0;
+        if Assigned(parent) and (parent.procdef.parast.symtablelevel>=normal_function_level) then
+          parent.addnestedproc(Self);
       end;
       end;
 
 
 
 
     destructor tprocinfo.destroy;
     destructor tprocinfo.destroy;
       begin
       begin
+         nestedprocs.free;
          aktproccode.free;
          aktproccode.free;
          aktlocaldata.free;
          aktlocaldata.free;
       end;
       end;
 
 
+    procedure tprocinfo.destroy_tree;
+      var
+        hp: tprocinfo;
+      begin
+        hp:=Self;
+        while Assigned(hp.parent) do
+          hp:=hp.parent;
+        hp.Free;
+      end;
+
+    procedure tprocinfo.addnestedproc(child: tprocinfo);
+      begin
+        if nestedprocs=nil then
+          nestedprocs:=TLinkedList.Create;
+        nestedprocs.insert(child);
+      end;
+
+    function tprocinfo.get_first_nestedproc: tprocinfo;
+      begin
+        if assigned(nestedprocs) then
+          result:=tprocinfo(nestedprocs.first)
+        else
+          result:=nil;
+      end;
+
+    function tprocinfo.has_nestedprocs: boolean;
+      begin
+        result:=assigned(nestedprocs) and (nestedprocs.count>0);
+      end;
+
+    procedure tprocinfo.save_jump_labels(out saved: tsavedlabels);
+      begin
+        saved[false]:=CurrFalseLabel;
+        saved[true]:=CurrTrueLabel;
+        current_asmdata.getjumplabel(CurrTrueLabel);
+        current_asmdata.getjumplabel(CurrFalseLabel);
+      end;
+
+    procedure tprocinfo.restore_jump_labels(const saved: tsavedlabels);
+      begin
+        CurrFalseLabel:=saved[false];
+        CurrTrueLabel:=saved[true];
+      end;
 
 
     procedure tprocinfo.allocate_push_parasize(size:longint);
     procedure tprocinfo.allocate_push_parasize(size:longint);
       begin
       begin

+ 6 - 19
compiler/psub.pas

@@ -45,10 +45,7 @@ interface
         stackcheck_asmnode,
         stackcheck_asmnode,
         init_asmnode,
         init_asmnode,
         final_asmnode : tasmnode;
         final_asmnode : tasmnode;
-        { list to store the procinfo's of the nested procedures }
-        nestedprocs : tlinkedlist;
         dfabuilder : TDFABuilder;
         dfabuilder : TDFABuilder;
-        constructor create(aparent:tprocinfo);override;
         destructor  destroy;override;
         destructor  destroy;override;
         procedure printproc(pass:string);
         procedure printproc(pass:string);
         procedure generate_code;
         procedure generate_code;
@@ -555,16 +552,8 @@ implementation
                                   TCGProcInfo
                                   TCGProcInfo
 ****************************************************************************}
 ****************************************************************************}
 
 
-    constructor tcgprocinfo.create(aparent:tprocinfo);
-      begin
-        inherited Create(aparent);
-        nestedprocs:=tlinkedlist.create;
-      end;
-
-
      destructor tcgprocinfo.destroy;
      destructor tcgprocinfo.destroy;
        begin
        begin
-         nestedprocs.free;
          if assigned(code) then
          if assigned(code) then
            code.free;
            code.free;
          inherited destroy;
          inherited destroy;
@@ -794,10 +783,10 @@ implementation
 
 
     function tcgprocinfo.has_assembler_child : boolean;
     function tcgprocinfo.has_assembler_child : boolean;
       var
       var
-        hp : tcgprocinfo;
+        hp : tprocinfo;
       begin
       begin
         result:=false;
         result:=false;
-        hp:=tcgprocinfo(nestedprocs.first);
+        hp:=get_first_nestedproc;
         while assigned(hp) do
         while assigned(hp) do
           begin
           begin
             if (hp.flags*[pi_has_assembler_block,pi_is_assembler])<>[] then
             if (hp.flags*[pi_has_assembler_block,pi_is_assembler])<>[] then
@@ -805,7 +794,7 @@ implementation
                 result:=true;
                 result:=true;
                 exit;
                 exit;
               end;
               end;
-            hp:=tcgprocinfo(hp.next);
+            hp:=tprocinfo(hp.next);
           end;
           end;
       end;
       end;
 
 
@@ -1549,7 +1538,7 @@ implementation
           { generate code for this procedure }
           { generate code for this procedure }
           pi.generate_code;
           pi.generate_code;
           { process nested procs }
           { process nested procs }
-          hpi:=tcgprocinfo(pi.nestedprocs.first);
+          hpi:=tcgprocinfo(pi.get_first_nestedproc);
           while assigned(hpi) do
           while assigned(hpi) do
            begin
            begin
              do_generate_code(hpi);
              do_generate_code(hpi);
@@ -1602,7 +1591,7 @@ implementation
         { We can't support inlining for procedures that have nested
         { We can't support inlining for procedures that have nested
           procedures because the nested procedures use a fixed offset
           procedures because the nested procedures use a fixed offset
           for accessing locals in the parent procedure (PFV) }
           for accessing locals in the parent procedure (PFV) }
-        if (tcgprocinfo(current_procinfo).nestedprocs.count>0) then
+        if current_procinfo.has_nestedprocs then
           begin
           begin
             if (df_generic in current_procinfo.procdef.defoptions) then
             if (df_generic in current_procinfo.procdef.defoptions) then
               Comment(V_Error,'Generic methods cannot have nested procedures')
               Comment(V_Error,'Generic methods cannot have nested procedures')
@@ -1618,9 +1607,7 @@ implementation
         { When it's a nested procedure then defer the code generation,
         { When it's a nested procedure then defer the code generation,
           when back at normal function level then generate the code
           when back at normal function level then generate the code
           for all defered nested procedures and the current procedure }
           for all defered nested procedures and the current procedure }
-        if isnestedproc then
-          tcgprocinfo(current_procinfo.parent).nestedprocs.insert(current_procinfo)
-        else
+        if not isnestedproc then
           begin
           begin
             if not(df_generic in current_procinfo.procdef.defoptions) then
             if not(df_generic in current_procinfo.procdef.defoptions) then
               do_generate_code(tcgprocinfo(current_procinfo));
               do_generate_code(tcgprocinfo(current_procinfo));

+ 97 - 48
compiler/ptype.pas

@@ -40,9 +40,6 @@ interface
 
 
     procedure resolve_forward_types;
     procedure resolve_forward_types;
 
 
-    { reads a type identifier }
-    procedure id_type(var def : tdef;isforwarddef:boolean);
-
     { reads a string, file type or a type identifier }
     { reads a string, file type or a type identifier }
     procedure single_type(var def:tdef;options:TSingleTypeOptions);
     procedure single_type(var def:tdef;options:TSingleTypeOptions);
 
 
@@ -389,7 +386,96 @@ implementation
       end;
       end;
 
 
 
 
-    procedure id_type(var def : tdef;isforwarddef:boolean);
+    procedure id_type(var def : tdef;isforwarddef,checkcurrentrecdef:boolean); forward;
+
+    { def is the outermost type in which other types have to be searched
+
+      isforward indicates whether the current definition can be a forward definition
+
+      if assigned, currentstructstack is a list of tabstractrecorddefs that, from
+      last to first, are child types of def that are not yet visible via the
+      normal symtable searching routines because they are types that are currently
+      being parsed (so using id_type on them after pushing def on the
+      symtablestack would result in errors because they'd come back as errordef)
+    }
+    procedure parse_nested_types(var def: tdef; isforwarddef: boolean; currentstructstack: tfpobjectlist);
+      var
+        t2: tdef;
+        structstackindex: longint;
+      begin
+        if assigned(currentstructstack) then
+          structstackindex:=currentstructstack.count-1
+        else
+          structstackindex:=-1;
+        { handle types inside classes, e.g. TNode.TLongint }
+        while (token=_POINT) do
+          begin
+            if parse_generic then
+              begin
+                 consume(_POINT);
+                 consume(_ID);
+              end
+             else if is_class_or_object(def) or is_record(def) then
+               begin
+                 consume(_POINT);
+                 if (structstackindex>=0) and
+                    (tabstractrecorddef(currentstructstack[structstackindex]).objname^=pattern) then
+                   begin
+                     def:=tdef(currentstructstack[structstackindex]);
+                     dec(structstackindex);
+                     consume(_ID);
+                   end
+                 else
+                   begin
+                     structstackindex:=-1;
+                     symtablestack.push(tabstractrecorddef(def).symtable);
+                     t2:=generrordef;
+                     id_type(t2,isforwarddef,false);
+                     symtablestack.pop(tabstractrecorddef(def).symtable);
+                     def:=t2;
+                   end;
+               end
+             else
+               break;
+          end;
+      end;
+
+
+    function try_parse_structdef_nested_type(out def: tdef; basedef: tabstractrecorddef; isfowarddef: boolean): boolean;
+      var
+        structdef : tdef;
+        structdefstack : tfpobjectlist;
+      begin
+         { use of current parsed object:
+           classes, objects, records can be used also in themself }
+         structdef:=basedef;
+         structdefstack:=nil;
+         while assigned(structdef) and (structdef.typ in [objectdef,recorddef]) do
+           begin
+             if (tabstractrecorddef(structdef).objname^=pattern) then
+               begin
+                 consume(_ID);
+                 def:=structdef;
+                 { we found the top-most match, now check how far down we can
+                   follow }
+                 structdefstack:=tfpobjectlist.create(false);
+                 structdef:=basedef;
+                 while (structdef<>def) do
+                   begin
+                     structdefstack.add(structdef);
+                     structdef:=tabstractrecorddef(structdef.owner.defowner);
+                   end;
+                 parse_nested_types(def,isfowarddef,structdefstack);
+                 structdefstack.free;
+                 result:=true;
+                 exit;
+               end;
+             structdef:=tdef(tabstractrecorddef(structdef).owner.defowner);
+           end;
+         result:=false;
+      end;
+
+    procedure id_type(var def : tdef;isforwarddef,checkcurrentrecdef:boolean);
     { reads a type definition }
     { reads a type definition }
     { to a appropriating tdef, s gets the name of   }
     { to a appropriating tdef, s gets the name of   }
     { the type to allow name mangling          }
     { the type to allow name mangling          }
@@ -407,17 +493,9 @@ implementation
          pos:=current_tokenpos;
          pos:=current_tokenpos;
          { use of current parsed object:
          { use of current parsed object:
            classes, objects, records can be used also in themself }
            classes, objects, records can be used also in themself }
-         structdef:=current_structdef;
-         while assigned(structdef) and (structdef.typ in [objectdef,recorddef]) do
-           begin
-             if (structdef.objname^=pattern) then
-               begin
-                 consume(_ID);
-                 def:=structdef;
-                 exit;
-               end;
-             structdef:=tabstractrecorddef(structdef.owner.defowner);
-           end;
+         if checkcurrentrecdef and
+            try_parse_structdef_nested_type(def,current_structdef,isforwarddef) then
+           exit;
          { Use the special searchsym_type that search only types }
          { Use the special searchsym_type that search only types }
          searchsym_type(s,srsym,srsymtable);
          searchsym_type(s,srsym,srsymtable);
          { handle unit specification like System.Writeln }
          { handle unit specification like System.Writeln }
@@ -518,26 +596,8 @@ implementation
                      end
                      end
                    else
                    else
                      begin
                      begin
-                       id_type(def,stoIsForwardDef in options);
-                       { handle types inside classes, e.g. TNode.TLongint }
-                       while (token=_POINT) do
-                         begin
-                           if parse_generic then
-                             begin
-                                consume(_POINT);
-                                consume(_ID);
-                             end
-                            else if is_class_or_object(def) or is_record(def) then
-                              begin
-                                symtablestack.push(tabstractrecorddef(def).symtable);
-                                consume(_POINT);
-                                id_type(t2,stoIsForwardDef in options);
-                                symtablestack.pop(tabstractrecorddef(def).symtable);
-                                def:=t2;
-                              end
-                            else
-                              break;
-                         end;
+                       id_type(def,stoIsForwardDef in options,true);
+                       parse_nested_types(def,stoIsForwardDef in options,nil);
                      end;
                      end;
                  end;
                  end;
 
 
@@ -945,19 +1005,8 @@ implementation
            { use of current parsed object:
            { use of current parsed object:
              classes, objects, records can be used also in themself }
              classes, objects, records can be used also in themself }
            if (token=_ID) then
            if (token=_ID) then
-             begin
-               structdef:=current_structdef;
-               while assigned(structdef) and (structdef.typ in [objectdef,recorddef]) do
-                 begin
-                   if (tabstractrecorddef(structdef).objname^=pattern) then
-                     begin
-                       consume(_ID);
-                       def:=structdef;
-                       exit;
-                     end;
-                   structdef:=tdef(structdef.owner.defowner);
-                 end;
-             end;
+             if try_parse_structdef_nested_type(def,current_structdef,false) then
+               exit;
            { Generate a specialization in FPC mode? }
            { Generate a specialization in FPC mode? }
            dospecialize:=not(m_delphi in current_settings.modeswitches) and try_to_consume(_SPECIALIZE);
            dospecialize:=not(m_delphi in current_settings.modeswitches) and try_to_consume(_SPECIALIZE);
            { we can't accept a equal in type }
            { we can't accept a equal in type }

+ 1 - 1
compiler/regvars.pas

@@ -148,7 +148,7 @@ implementation
       if (cs_opt_regvar in current_settings.optimizerswitches) and
       if (cs_opt_regvar in current_settings.optimizerswitches) and
         { we have to store regvars back to memory in this case (the nested }
         { we have to store regvars back to memory in this case (the nested }
         { procedures can access the variables of the parent)               }
         { procedures can access the variables of the parent)               }
-        (tcgprocinfo(current_procinfo).nestedprocs.count = 0) and
+        (not current_procinfo.has_nestedprocs) and
          not(pi_has_assembler_block in current_procinfo.flags) and
          not(pi_has_assembler_block in current_procinfo.flags) and
          not(pi_uses_exceptions in current_procinfo.flags) then
          not(pi_uses_exceptions in current_procinfo.flags) then
         begin
         begin

+ 2 - 1
compiler/symconst.pas

@@ -423,7 +423,8 @@ type
     vo_is_msgsel,
     vo_is_msgsel,
     { first field of variant part of a record }
     { first field of variant part of a record }
     vo_is_first_field,
     vo_is_first_field,
-    vo_volatile
+    vo_volatile,
+    vo_has_section
   );
   );
   tvaroptions=set of tvaroption;
   tvaroptions=set of tvaroption;
 
 

+ 25 - 9
compiler/symdef.pas

@@ -76,6 +76,7 @@ interface
           function  is_publishable : boolean;override;
           function  is_publishable : boolean;override;
           function  needs_inittable : boolean;override;
           function  needs_inittable : boolean;override;
           function  rtti_mangledname(rt:trttitype):string;override;
           function  rtti_mangledname(rt:trttitype):string;override;
+          function  OwnerHierarchyName: string; override;
           function  in_currentunit: boolean;
           function  in_currentunit: boolean;
           { regvars }
           { regvars }
           function is_intregable : boolean;
           function is_intregable : boolean;
@@ -550,6 +551,8 @@ interface
           interfacedef : boolean;
           interfacedef : boolean;
           { true if the procedure has a forward declaration }
           { true if the procedure has a forward declaration }
           hasforward  : boolean;
           hasforward  : boolean;
+          { interrupt vector }
+          interruptvector : longint;
           constructor create(level:byte);
           constructor create(level:byte);
           constructor ppuload(ppufile:tcompilerppufile);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor  destroy;override;
           destructor  destroy;override;
@@ -1029,6 +1032,22 @@ implementation
       end;
       end;
 
 
 
 
+    function tstoreddef.OwnerHierarchyName: string;
+      var
+        tmp: tdef;
+      begin
+        tmp:=self;
+        result:='';
+        repeat
+          if tmp.owner.symtabletype in [ObjectSymtable,recordsymtable] then
+            tmp:=tdef(tmp.owner.defowner)
+          else
+            break;
+          result:=tabstractrecorddef(tmp).objrealname^+'.'+result;
+        until tmp=nil;
+      end;
+
+
     function tstoreddef.in_currentunit: boolean;
     function tstoreddef.in_currentunit: boolean;
       var
       var
         st: tsymtable;
         st: tsymtable;
@@ -2684,15 +2703,7 @@ implementation
       var
       var
         tmp: tabstractrecorddef;
         tmp: tabstractrecorddef;
       begin
       begin
-        Result:=objrealname^;
-        tmp:=self;
-        repeat
-          if tmp.owner.symtabletype in [ObjectSymtable,recordsymtable] then
-            tmp:=tabstractrecorddef(tmp.owner.defowner)
-          else
-            break;
-          Result:=tmp.objrealname^+'.'+Result;
-        until tmp=nil;
+        Result:=OwnerHierarchyName+objrealname^;
       end;
       end;
 
 
     function tabstractrecorddef.search_enumerator_get: tprocdef;
     function tabstractrecorddef.search_enumerator_get: tprocdef;
@@ -3322,6 +3333,7 @@ implementation
 {$ifdef i386}
 {$ifdef i386}
           fpu_used:=maxfpuregs;
           fpu_used:=maxfpuregs;
 {$endif i386}
 {$endif i386}
+         interruptvector:=-1;
       end;
       end;
 
 
 
 
@@ -3360,6 +3372,8 @@ implementation
          else
          else
            import_name:=nil;
            import_name:=nil;
          import_nr:=ppufile.getword;
          import_nr:=ppufile.getword;
+         if target_info.system in systems_interrupt_table then
+           interruptvector:=ppufile.getlongint;
          if (po_msgint in procoptions) then
          if (po_msgint in procoptions) then
            messageinf.i:=ppufile.getlongint;
            messageinf.i:=ppufile.getlongint;
          if (po_msgstr in procoptions) then
          if (po_msgstr in procoptions) then
@@ -3496,6 +3510,8 @@ implementation
          if po_has_importname in procoptions then
          if po_has_importname in procoptions then
            ppufile.putstring(import_name^);
            ppufile.putstring(import_name^);
          ppufile.putword(import_nr);
          ppufile.putword(import_nr);
+         if target_info.system in systems_interrupt_table then
+           ppufile.putlongint(interruptvector);
          if (po_msgint in procoptions) then
          if (po_msgint in procoptions) then
            ppufile.putlongint(messageinf.i);
            ppufile.putlongint(messageinf.i);
          if (po_msgstr in procoptions) then
          if (po_msgstr in procoptions) then

+ 5 - 0
compiler/symsym.pas

@@ -200,6 +200,7 @@ interface
       private
       private
           _mangledname : pshortstring;
           _mangledname : pshortstring;
       public
       public
+          section : ansistring;
           constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
           constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
           constructor create_dll(const n : string;vsp:tvarspez;def:tdef);
           constructor create_dll(const n : string;vsp:tvarspez;def:tdef);
           constructor create_C(const n,mangled : string;vsp:tvarspez;def:tdef);
           constructor create_C(const n,mangled : string;vsp:tvarspez;def:tdef);
@@ -1312,6 +1313,8 @@ implementation
            _mangledname:=stringdup(ppufile.getstring)
            _mangledname:=stringdup(ppufile.getstring)
          else
          else
            _mangledname:=nil;
            _mangledname:=nil;
+         if vo_has_section in varoptions then
+           section:=ppufile.getansistring;
       end;
       end;
 
 
 
 
@@ -1336,6 +1339,8 @@ implementation
          inherited ppuwrite(ppufile);
          inherited ppuwrite(ppufile);
          if vo_has_mangledname in varoptions then
          if vo_has_mangledname in varoptions then
            ppufile.putstring(_mangledname^);
            ppufile.putstring(_mangledname^);
+         if vo_has_section in varoptions then
+           ppufile.putansistring(section);
          ppufile.writeentry(ibstaticvarsym);
          ppufile.writeentry(ibstaticvarsym);
       end;
       end;
 
 

+ 1 - 0
compiler/symtable.pas

@@ -2199,6 +2199,7 @@ implementation
       var
       var
         hashedid : THashedIDString;
         hashedid : THashedIDString;
       begin
       begin
+        result:=false;
         hashedid.id:=s;
         hashedid.id:=s;
         srsymtable:=recordh.symtable;
         srsymtable:=recordh.symtable;
         srsym:=tsym(srsymtable.FindWithHash(hashedid));
         srsym:=tsym(srsymtable.FindWithHash(hashedid));

+ 7 - 4
compiler/symtype.pas

@@ -73,6 +73,7 @@ interface
          function  mangledparaname:string;
          function  mangledparaname:string;
          function  getmangledparaname:string;virtual;
          function  getmangledparaname:string;virtual;
          function  rtti_mangledname(rt:trttitype):string;virtual;abstract;
          function  rtti_mangledname(rt:trttitype):string;virtual;abstract;
+         function  OwnerHierarchyName: string; virtual; abstract;
          function  size:asizeint;virtual;abstract;
          function  size:asizeint;virtual;abstract;
          function  packedbitsize:asizeint;virtual;
          function  packedbitsize:asizeint;virtual;
          function  alignment:shortint;virtual;abstract;
          function  alignment:shortint;virtual;abstract;
@@ -258,12 +259,13 @@ implementation
 
 
     function tdef.typename:string;
     function tdef.typename:string;
       begin
       begin
+        result:=OwnerHierarchyName;
         if assigned(typesym) and
         if assigned(typesym) and
            not(typ in [procvardef,procdef]) and
            not(typ in [procvardef,procdef]) and
            (typesym.realname[1]<>'$') then
            (typesym.realname[1]<>'$') then
-          result:=typesym.realname
+          result:=result+typesym.realname
         else
         else
-          result:=GetTypeName;
+          result:=result+GetTypeName;
       end;
       end;
 
 
 
 
@@ -275,10 +277,11 @@ implementation
 
 
     function tdef.typesymbolprettyname:string;
     function tdef.typesymbolprettyname:string;
       begin
       begin
+        result:=OwnerHierarchyName;
         if assigned(typesym) then
         if assigned(typesym) then
-          result:=typesym.prettyname
+          result:=result+typesym.prettyname
         else
         else
-          result:='<no type symbol>'
+          result:=result+'<no type symbol>'
       end;
       end;
 
 
     function tdef.mangledparaname:string;
     function tdef.mangledparaname:string;

+ 3 - 0
compiler/systems.pas

@@ -185,6 +185,7 @@ interface
              ,as_ggas                  { gnu assembler called "gas" instead of "as" }
              ,as_ggas                  { gnu assembler called "gas" instead of "as" }
              ,as_i386_nasmhaiku
              ,as_i386_nasmhaiku
              ,as_powerpc_vasm
              ,as_powerpc_vasm
+             ,as_i386_nlmcoff
        );
        );
 
 
        tar = (ar_none
        tar = (ar_none
@@ -448,6 +449,8 @@ interface
 
 
        systems_internal_sysinit = [system_i386_linux,system_i386_win32];
        systems_internal_sysinit = [system_i386_linux,system_i386_win32];
 
 
+       systems_interrupt_table = [{system_arm_embedded}];
+
        { all symbian systems }
        { all symbian systems }
        systems_symbian = [system_i386_symbian,system_arm_symbian];
        systems_symbian = [system_i386_symbian,system_arm_symbian];
 
 

+ 5 - 5
compiler/systems/i_nwm.pas

@@ -34,7 +34,7 @@ unit i_nwm;
             system       : system_i386_netware;
             system       : system_i386_netware;
             name         : 'Netware for i386(clib)';
             name         : 'Netware for i386(clib)';
             shortname    : 'Netware';
             shortname    : 'Netware';
-            flags        : [tf_smartlink_library];
+            flags        : [tf_smartlink_library,tf_smartlink_sections,tf_dwarf_only_local_labels];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'NETWAREUNITS';
             unit_env     : 'NETWAREUNITS';
             extradefines : 'NETWARE_CLIB';
             extradefines : 'NETWARE_CLIB';
@@ -50,18 +50,18 @@ unit i_nwm;
             resobjext    : '.or';
             resobjext    : '.or';
             sharedlibext : '.nlm';
             sharedlibext : '.nlm';
             staticlibext : '.a';
             staticlibext : '.a';
-            staticlibprefix : '';
+            staticlibprefix : 'libp';
             sharedlibprefix : '';
             sharedlibprefix : '';
             sharedClibext : '.nlm';
             sharedClibext : '.nlm';
             staticClibext : '.a';
             staticClibext : '.a';
-            staticClibprefix : '';
+            staticClibprefix : 'lib';
             sharedClibprefix : '';
             sharedClibprefix : '';
-            importlibprefix : 'imp';
+            importlibprefix : 'libimp';
             importlibext : '.a';
             importlibext : '.a';
             Cprefix      : '';
             Cprefix      : '';
             newline      : #13#10;
             newline      : #13#10;
             dirsep       : '/';
             dirsep       : '/';
-            assem        : as_i386_elf32;
+            assem        : as_i386_nlmcoff; // as_i386_elf32;
             assemextern  : as_gas;
             assemextern  : as_gas;
             link         : nil;
             link         : nil;
             linkextern   : nil;
             linkextern   : nil;

+ 1 - 1
compiler/systems/i_wii.pas

@@ -86,7 +86,7 @@ unit i_wii;
                 maxCrecordalign : 8
                 maxCrecordalign : 8
               );
               );
             first_parm_offset : 8;
             first_parm_offset : 8;
-            stacksize    : 32*1024*1024;
+            stacksize    : 131072;  // 128 kb 
             abi : abi_powerpc_sysv;
             abi : abi_powerpc_sysv;
           );
           );
 
 

+ 1 - 1
compiler/systems/t_embed.pas

@@ -267,7 +267,7 @@ begin
       Add('{');
       Add('{');
       Add('     .text :');
       Add('     .text :');
       Add('    {');
       Add('    {');
-      Add('    *(.init, .init.*)');
+      Add('    KEEP(*(.init, .init.*))');
       Add('    *(.text, .text.*)');
       Add('    *(.text, .text.*)');
       Add('    *(.strings)');
       Add('    *(.strings)');
       Add('    *(.rodata, .rodata.*)');
       Add('    *(.rodata, .rodata.*)');

+ 432 - 5
compiler/systems/t_nwm.pas

@@ -97,7 +97,7 @@ implementation
     verbose,systems,globtype,globals,
     verbose,systems,globtype,globals,
     symconst,script,
     symconst,script,
     fmodule,aasmbase,aasmtai,aasmdata,aasmcpu,cpubase,symsym,symdef,
     fmodule,aasmbase,aasmtai,aasmdata,aasmcpu,cpubase,symsym,symdef,
-    import,export,link,i_nwm,ogbase
+    import,export,link,i_nwm,ogbase, ogcoff, ognlm, cclasses
     {$ifdef netware} ,dos {$endif}
     {$ifdef netware} ,dos {$endif}
     ;
     ;
 
 
@@ -123,6 +123,16 @@ implementation
       function  MakeExecutable:boolean;override;
       function  MakeExecutable:boolean;override;
     end;
     end;
 
 
+    TInternalLinkerNetware = class(TInternalLinker)
+        prelude : string;
+        constructor create;override;
+        destructor destroy;override;
+        procedure DefaultLinkScript;override;
+        procedure InitSysInitUnitName;override;
+        procedure ConcatEntryName; virtual;
+        Function  MakeSharedLibrary:boolean;override;
+      end;
+
 Const tmpLinkFileName = 'link~tmp._o_';
 Const tmpLinkFileName = 'link~tmp._o_';
       minStackSize = 32768;
       minStackSize = 32768;
 
 
@@ -330,10 +340,26 @@ begin
 
 
   { add objectfiles, start with nwpre always }
   { add objectfiles, start with nwpre always }
   LinkRes.Add ('INPUT(');
   LinkRes.Add ('INPUT(');
-  s2 := FindObjectFile('nwpre','',false);
+  if target_info.system = system_i386_netwlibc then
+   begin
+     s2 := FindObjectFile('nwplibc','',false);
+     if s2 = '' then
+       s2 := FindObjectFile('libcpre.gcc','',false);
+   end else
+     s2 := FindObjectFile('nwpre','',false);
   Comment (V_Debug,'adding Object File '+s2);
   Comment (V_Debug,'adding Object File '+s2);
   {$ifndef netware} LinkRes.Add (s2); {$else} LinkRes.Add (FExpand(s2)); {$endif}
   {$ifndef netware} LinkRes.Add (s2); {$else} LinkRes.Add (FExpand(s2)); {$endif}
 
 
+  if target_info.system = system_i386_netwlibc then
+   begin
+     if isDll then  {needed to provide main}
+       s2 := FindObjectFile('nwl_dlle','',false)
+     else
+       s2 := FindObjectFile('nwl_main','',false);
+     Comment (V_Debug,'adding Object File '+s2);
+     {$ifndef netware} LinkRes.Add (s2); {$else} LinkRes.Add (FExpand(s2)); {$endif}
+    end;
+
   { main objectfiles, add to linker input }
   { main objectfiles, add to linker input }
   while not ObjectFiles.Empty do
   while not ObjectFiles.Empty do
   begin
   begin
@@ -355,9 +381,20 @@ begin
   {$endif}
   {$endif}
 
 
   { start and stop-procedures }
   { start and stop-procedures }
-  NLMConvLinkFile.Add ('START _Prelude');  { defined in rtl/netware/nwpre.as }
-  NLMConvLinkFile.Add ('EXIT _Stop');                             { nwpre.as }
-  NLMConvLinkFile.Add ('CHECK FPC_NW_CHECKFUNCTION');            { system.pp }
+
+  if target_info.system = system_i386_netwlibc then
+    begin
+      NLMConvLinkFile.Add ('START _LibCPrelude');
+      NLMConvLinkFile.Add ('EXIT _LibCPostlude');
+      NLMConvLinkFile.Add ('CHECK _LibCCheckUnload');
+      NLMConvLinkFile.Add ('REENTRANT');            { needed by older libc versions }
+    end else
+    begin
+      NLMConvLinkFile.Add ('START _Prelude');  { defined in rtl/netware/nwpre.as }
+      NLMConvLinkFile.Add ('EXIT _Stop');                             { nwpre.as }
+      NLMConvLinkFile.Add ('CHECK FPC_NW_CHECKFUNCTION');            { system.pp }
+    end;
+
 
 
   if not (cs_link_strip in current_settings.globalswitches) then
   if not (cs_link_strip in current_settings.globalswitches) then
   begin
   begin
@@ -549,6 +586,395 @@ begin
 end;
 end;
 
 
 
 
+{****************************************************************************
+                            TInternalLinkerNetware
+****************************************************************************}
+
+    constructor TInternalLinkerNetware.Create;
+      begin
+        inherited Create;
+        CExeoutput:=TNLMexeoutput;
+        CObjInput:=TNLMCoffObjInput;
+        nlmSpecialSymbols_Segments := TFPHashList.create;
+      end;
+
+    destructor TInternalLinkerNetware.destroy;
+      begin
+        if assigned(nlmSpecialSymbols_Segments) then
+          begin
+            nlmSpecialSymbols_Segments.Free;
+            nlmSpecialSymbols_Segments := nil;
+          end;
+        inherited destroy;
+      end;
+
+    procedure TInternalLinkerNetware.DefaultLinkScript;
+      var
+        s,s2 : TCmdStr;
+        secname,
+        secnames : string;
+        hasCopyright,
+        hasScreenname,
+        hasThreadname,
+        hasVersion,
+        hasDescription,
+        hasStacksize: boolean;
+        t : text;
+
+
+
+        procedure addLinkerOption(s : string);
+        var op : string;
+        begin
+          if s = '' then exit;
+          if s[1]  = '#' then exit;
+          LinkScript.Concat(s);
+          op := upper(GetToken(s,' '));
+          {check for options via -k that can also be specified vie
+           compiler directives in source, -k options will override
+           options in source}
+          if op = 'COPYRIGHT' then hasCopyright := true else
+          if op = 'SCREENNAME' then hasScreenname := true else
+          if op = 'THREADNAME' then hasThreadname := true else
+          if op = 'VERSION' then hasVersion := true else
+          if op = 'DESCRIPTION' then hasDescription := true else
+          if (op = 'STACK') or (op = 'STACKSIZE') then hasStacksize := true;
+        end;
+
+        { add linker scropt specified by -k@FileName }
+        procedure addLinkerOptionsFile (fileName : string);
+        var
+          t : text;
+          option : string;
+          fn : TCmdStr;
+        begin
+          fn := fileName;
+          if not sysutils.fileExists(fn) then
+            if not includesearchpath.FindFile(fileName,true,fn) then
+            begin
+              comment(v_error,'linker options file "'+fileName+'" not found');
+              exit;
+            end;
+          assign(t,fn); reset(t);
+          while not eof(t) do
+            begin
+              readln(t,option);
+              addLinkerOption(option);
+            end;
+          close(t);
+        end;
+
+        { add  linker options specified by command line parameter -k }
+        procedure addLinkerOptions;
+        var
+          s,option : string;
+          p : integer;
+        begin
+          s := ParaLinkOptions;
+          option := GetToken(s,';');
+          while option <> '' do
+          begin
+            if copy(option,1,1)='@' then
+            begin
+              delete(option,1,1);
+              addLinkerOptionsFile(option);
+            end else
+              addLinkerOption(option);
+            option := GetToken(s,';');
+          end;
+        end;
+
+        { default: nwpre but can be specified via linker options
+          bacuse this has to be the first object, we have to scan
+          linker options before adding other options }
+
+        function findPreludeInFile (fileName : string):string;
+        var
+          t : text;
+          option,s : string;
+          fn : TCmdStr;
+        begin
+          result := '';
+          fn := fileName;
+          if not sysutils.fileExists(fn) then
+            if not includesearchpath.FindFile(fileName,true,fn) then
+            begin
+              comment(v_error,'linker options file "'+fileName+'" not found');
+              exit;
+            end;
+          assign(t,fn); reset(t);
+          while not eof(t) do
+            begin
+              readln(t,option);
+              option := upper(GetToken(s,' '));
+              if option='PRELUDE' then
+                begin
+                  result := getToken(s,' ');
+                  close(t);
+                  exit;
+                end;
+            end;
+          close(t);
+        end;
+
+        function findPrelude : string;
+        var
+          s,option,keyword : string;
+          p : integer;
+        begin
+          s := ParaLinkOptions;
+          option := GetToken(s,';');
+          while option <> '' do
+          begin
+            if copy(option,1,1)='@' then
+            begin
+              delete(option,1,1);
+              result := findPreludeInFile(option);
+              if result <> '' then exit;
+            end else
+            begin
+              keyword := GetToken(option,' ');
+              if keyword = 'PRELUDE' then
+                begin
+                  result := GetToken(option,' ');
+                  exit;
+                end;
+            end;
+            option := GetToken(s,';');
+          end;
+          if target_info.system = system_i386_netwlibc then
+            result := 'libcpre'
+          else
+            result := 'nwpre';
+        end;
+
+      begin
+        with LinkScript do
+          begin
+            prelude := findPrelude;  // needs to be first object, can be specified by -k"PRELUDE ObjFileName"
+            if prelude = '' then internalerror(201103271);
+            if pos ('.',prelude) = 0 then prelude := prelude + '.o';
+            s2 := FindObjectFile(prelude,'',false);
+            Comment (V_Debug,'adding init Object File '+s2);
+            Concat('READOBJECT '+MaybeQuoted(s2));
+            while not ObjectFiles.Empty do
+              begin
+                s:=ObjectFiles.GetFirst;
+                if s<>'' then
+                begin
+                  Concat('READOBJECT '+MaybeQuoted(s));
+                  Comment (V_Debug,'adding Object File '+s);
+                end;
+              end;
+            while not StaticLibFiles.Empty do
+              begin
+                s:=StaticLibFiles.GetFirst;
+                if s<>'' then
+                begin
+                  Comment (V_Debug,'adding StaticLibFile '+s);
+                  Concat('READSTATICLIBRARY '+MaybeQuoted(s));
+                end;
+              end;
+           { While not SharedLibFiles.Empty do
+              begin
+                S:=SharedLibFiles.GetFirst;
+                if FindLibraryFile(s,target_info.staticClibprefix,target_info.importlibext,s2) then
+                begin
+                  Comment (V_Debug,'adding LibraryFile '+s);
+                  Concat('READSTATICLIBRARY '+MaybeQuoted(s2));
+                end else
+                  Comment(V_Error,'Import library not found for '+S);
+              end;}
+            if IsSharedLibrary then
+              Concat('ISSHAREDLIBRARY');
+            ConcatEntryName;
+            Concat('IMAGEBASE $' + hexStr(0, SizeOf(imagebase)*2));
+            Concat('HEADER');
+            Concat('EXESECTION .text');
+            Concat('  SYMBOL __text_start__');  nlmSpecialSymbols_Segments.Add('__text_start__',pointer(ptruint(Section_text)));
+            Concat('  OBJSECTION .text*');
+            Concat('  SYMBOL ___CTOR_LIST__');  nlmSpecialSymbols_Segments.Add('___CTOR_LIST__',pointer(ptruint(Section_text)));
+            Concat('  SYMBOL __CTOR_LIST__');   nlmSpecialSymbols_Segments.Add('__CTOR_LIST__',pointer(ptruint(Section_text)));
+            Concat('  LONG -1');
+            Concat('  OBJSECTION .ctor*');
+            Concat('  LONG 0');
+            Concat('  SYMBOL ___DTOR_LIST__');  nlmSpecialSymbols_Segments.Add('___DTOR_LIST__',pointer(ptruint(Section_text)));
+            Concat('  SYMBOL __DTOR_LIST__');   nlmSpecialSymbols_Segments.Add('__DTOR_LIST__',pointer(ptruint(Section_text)));
+            Concat('  LONG -1');
+            Concat('  OBJSECTION .dtor*');
+            Concat('  LONG 0');
+            Concat('  SYMBOL etext');           nlmSpecialSymbols_Segments.Add('etext',pointer(ptruint(Section_text)));
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .data');
+            Concat('  SYMBOL __data_start__');  nlmSpecialSymbols_Segments.Add('__data_start__',pointer(ptruint(Section_data)));
+            Concat('  OBJSECTION .data*');
+            Concat('  OBJSECTION .fpc*');
+            Concat('  SYMBOL edata');           nlmSpecialSymbols_Segments.Add('edata',pointer(ptruint(Section_data)));
+            Concat('  SYMBOL __data_end__');    nlmSpecialSymbols_Segments.Add('__data_end__',pointer(ptruint(Section_data)));
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .bss');
+            Concat('  SYMBOL __bss_start__');   nlmSpecialSymbols_Segments.Add('__bss_start__',pointer(ptruint(Section_data)));
+            Concat('  OBJSECTION .bss*');
+            Concat('  SYMBOL __bss_end__');     nlmSpecialSymbols_Segments.Add('__bss_end__',pointer(ptruint(Section_data)));
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .imports');
+            Concat('  SYMBOL __imports_start__');
+            Concat('  OBJSECTION .imports*');
+            Concat('  SYMBOL __imports_end__');
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .modules');
+            Concat('  SYMBOL __modules_start__');
+            Concat('  OBJSECTION .modules*');
+            Concat('  SYMBOL __modules_end__');
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .exports');
+            Concat('  SYMBOL __exports_start__');
+            Concat('  OBJSECTION .exports*');
+            Concat('  SYMBOL __exports_end__');
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .reloc');
+            Concat('  SYMBOL __reloc_start__');
+            Concat('  OBJSECTION .reloc*');
+            Concat('  SYMBOL __reloc_end__');
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .xdc');
+            Concat('  OBJSECTION .xdc*');
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .custom');
+            Concat('  OBJSECTION .custom*');
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .messages');
+            Concat('  OBJSECTION .messages*');
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .help');
+            Concat('  OBJSECTION .help*');
+            Concat('ENDEXESECTION');
+
+            Concat('EXESECTION .rdata');
+            Concat('  SYMBOL ___RUNTIME_PSEUDO_RELOC_LIST__');
+            Concat('  SYMBOL __RUNTIME_PSEUDO_RELOC_LIST__');
+            Concat('  OBJSECTION .rdata_runtime_pseudo_reloc');
+            Concat('  SYMBOL ___RUNTIME_PSEUDO_RELOC_LIST_END__');
+            Concat('  SYMBOL __RUNTIME_PSEUDO_RELOC_LIST_END__');
+            Concat('  OBJSECTION .rdata*');
+            Concat('  OBJSECTION .rodata*');
+            Concat('ENDEXESECTION');
+            Concat('EXESECTION .pdata');
+            Concat('  OBJSECTION .pdata');
+            Concat('ENDEXESECTION');
+            secnames:='.edata,.rsrc,.gnu_debuglink,'+
+                      '.debug_aranges,.debug_pubnames,.debug_info,.debug_abbrev,.debug_line,.debug_frame,.debug_str,.debug_loc,'+
+                      '.debug_macinfo,.debug_weaknames,.debug_funcnames,.debug_typenames,.debug_varnames,.debug_ranges';
+            repeat
+              secname:=gettoken(secnames,',');
+              if secname='' then
+                break;
+              Concat('EXESECTION '+secname);
+              Concat('  OBJSECTION '+secname+'*');
+              Concat('ENDEXESECTION');
+            until false;
+            { Can't use the generic rules, because that will add also .stabstr to .stab }
+            Concat('EXESECTION .stab');
+            Concat('  OBJSECTION .stab');
+            Concat('ENDEXESECTION');
+            Concat('EXESECTION .stabstr');
+            Concat('  OBJSECTION .stabstr');
+            Concat('ENDEXESECTION');
+            Concat('STABS');
+            Concat('SYMBOLS');
+            Concat('');
+
+            hasCopyright := false;
+            hasScreenname := false;
+            hasThreadname := false;
+            hasVersion := false;
+            hasDescription := false;
+            hasStacksize := false;
+            addLinkerOptions;
+            if not hasCopyright then
+              if nwcopyright <> '' then
+                Concat('COPYRIGHT "'+nwCopyright+'"');
+            if not hasScreenname then
+              if nwscreenname <> '' then
+                Concat('SCREENNAME "'+nwscreenname+'"');
+            if not hasThreadname then
+              if nwthreadname <> '' then
+                Concat('THREADNAME "'+nwthreadname+'"');
+            if not hasVersion then
+              Concat('VERSION '+tostr(dllmajor)+' '+tostr(dllminor)+' '+tostr(dllrevision));
+            if not hasDescription then
+              if description <> '' then
+                Concat ('DESCRIPTION "'+description+'"');
+            if not hasStacksize then
+              if MaxStackSizeSetExplicity then
+              begin
+                if stacksize < minStackSize then stacksize := minStackSize;
+                Concat ('STACKSIZE '+tostr(stacksize));
+              end else
+                Concat ('STACKSIZE '+tostr(minStackSize));
+              if target_info.system = system_i386_netwlibc then
+                Concat ('REENTRANT');            { needed by older libc versions }
+          end;
+
+        // add symbols needed by nwpre. We have not loaded the ppu,
+        // therefore we do not know the externals so read it from nwpre.imp
+        s := ChangeFileExt(prelude,'.imp');  // nwpre.imp
+        if not librarysearchpath.FindFile(s,true,s2) then
+          begin
+            comment(v_error,s+' not found');
+            exit;
+          end;
+        assign(t,s2); reset(t);
+        while not eof(t) do
+          begin
+            readln(t,s);
+            s := trimspace(s);
+            if (length(s) > 0) then
+              if copy(s,1,1) <> '#' then
+                AddImportSymbol('!clib',s,0,false);
+          end;
+        close(t);
+      end;
+
+
+    procedure TInternalLinkerNetware.InitSysInitUnitName;
+      begin
+        //if target_info.system=system_i386_netware then
+        //  GlobalInitSysInitUnitName(self);
+      end;
+
+    procedure TInternalLinkerNetware.ConcatEntryName;
+      begin
+        with LinkScript do
+          begin
+            if IsSharedLibrary then
+              begin
+                Concat('ISSHAREDLIBRARY');
+                Concat('ENTRYNAME _Prelude')
+              end
+            else
+              begin
+                Concat('ENTRYNAME _Prelude')
+              end;
+          end;
+      end;
+
+
+    Function  TInternalLinkerNetware.MakeSharedLibrary:boolean;
+    begin
+      Comment(V_Error,'Make shared library not supported for netware');
+    end;
+
 {*****************************************************************************
 {*****************************************************************************
                                      Initialize
                                      Initialize
 *****************************************************************************}
 *****************************************************************************}
@@ -556,6 +982,7 @@ end;
 
 
 initialization
 initialization
   RegisterExternalLinker(system_i386_netware_info,TLinkerNetware);
   RegisterExternalLinker(system_i386_netware_info,TLinkerNetware);
+  RegisterInternalLinker(system_i386_netware_info,TInternalLinkerNetware);
   RegisterImport(system_i386_netware,TImportLibNetware);
   RegisterImport(system_i386_netware,TImportLibNetware);
   RegisterExport(system_i386_netware,TExportLibNetware);
   RegisterExport(system_i386_netware,TExportLibNetware);
   RegisterTarget(system_i386_netware_info);
   RegisterTarget(system_i386_netware_info);

+ 1 - 2
compiler/systems/t_wii.pas

@@ -562,9 +562,8 @@ begin
 
 
 { Call linker }
 { Call linker }
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
   SplitBinCmd(Info.ExeCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$OPT',Info.ExtraOptions);
-
   Replace(cmdstr,'$EXE',(maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename^,'.elf')))));
   Replace(cmdstr,'$EXE',(maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename^,'.elf')))));
+  Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
   Replace(cmdstr,'$RES',(maybequoted(ScriptFixFileName(outputexedir+Info.ResName))));
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$STRIP',StripStr);

+ 2 - 0
compiler/tokens.pas

@@ -203,6 +203,7 @@ type
     _PRIVATE,
     _PRIVATE,
     _PROGRAM,
     _PROGRAM,
     _R12BASE,
     _R12BASE,
+    _SECTION,
     _STDCALL,
     _STDCALL,
     _SYSCALL,
     _SYSCALL,
     _VARARGS,
     _VARARGS,
@@ -497,6 +498,7 @@ const
       (str:'PRIVATE'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'PRIVATE'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'PROGRAM'       ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'PROGRAM'       ;special:false;keyword:m_all;op:NOTOKEN),
       (str:'R12BASE'       ;special:false;keyword:m_none;op:NOTOKEN),   { Syscall variation on MorphOS }
       (str:'R12BASE'       ;special:false;keyword:m_none;op:NOTOKEN),   { Syscall variation on MorphOS }
+      (str:'SECTION'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'STDCALL'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'STDCALL'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'SYSCALL'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'SYSCALL'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'VARARGS'       ;special:false;keyword:m_none;op:NOTOKEN),
       (str:'VARARGS'       ;special:false;keyword:m_none;op:NOTOKEN),

+ 27 - 521
compiler/utils/samplecfg

@@ -5,30 +5,6 @@
 #  Generate Sample Free Pascal configuration file
 #  Generate Sample Free Pascal configuration file
 #
 #
 
 
-setgccdir() {
-# Find path to libgcc.a
-GCCSPEC=`(gcc -v $@ 2>&1)| head -n 1| awk '{ print $4 } '`
-if [ -z "$GCCSPEC" ] ; then
-  GCCSPEC=`gcc -print-libgcc-file-name $@ 2>/dev/null`
-fi
-GCCDIR=`dirname "$GCCSPEC"`
-}
-
-
-setgccdirarch() {
-# First argument is fpc define for CPU type; remaining args are passed to gcc to set corresponding architecture
-FPCDEFINE=$1
-shift
-setgccdir $@
-
-if [ -z "$GCCDIR" ] ; then
-  return
-fi
-GCCDIR="#ifdef $FPCDEFINE
--Fl$GCCDIR
-#endif"
-}
-
 HOSTOS=`uname -s | tr A-Z a-z`
 HOSTOS=`uname -s | tr A-Z a-z`
 echo Running on $HOSTOS
 echo Running on $HOSTOS
 
 
@@ -47,18 +23,23 @@ else
 fi
 fi
 FPCBIN=`dirname "$1"`/../../bin/fpc
 FPCBIN=`dirname "$1"`/../../bin/fpc
 FPBIN=`dirname "$1"`/../../bin/fp
 FPBIN=`dirname "$1"`/../../bin/fp
+FPPKGBIN=`dirname "$1"`/../../bin/fppkg
 sysfpdirbase=`dirname "$1"`/`"$FPCBIN" -iV`
 sysfpdirbase=`dirname "$1"`/`"$FPCBIN" -iV`
 sysfpdirbase2=$sysfpdirbase/ide
 sysfpdirbase2=$sysfpdirbase/ide
 sysfpdir=$sysfpdirbase2/text
 sysfpdir=$sysfpdirbase2/text
-fpctargetos=`"$FPCBIN" -iTO`
 
 
 # Detect if we have write permission in sysdir.
 # Detect if we have write permission in sysdir.
 if [ -w "$sysdir" ] ; then
 if [ -w "$sysdir" ] ; then
   echo Write permission in $sysdir.
   echo Write permission in $sysdir.
   fpccfgfile="$sysdir"/fpc.cfg
   fpccfgfile="$sysdir"/fpc.cfg
+  fppkgfile="$sysdir"/fppkg.cfg
+  defaultfile="$sysdir"/fppkg/default
+  compilerconfigdir="-d CompilerConfigDir=$sysdir/fppkg"
 else
 else
   echo No write premission in $sysdir.
   echo No write premission in $sysdir.
   fpccfgfile="$HOME"/.fpc.cfg
   fpccfgfile="$HOME"/.fpc.cfg
+  fppkgfile="$HOME"/.config/fppkg.cfg
+  defaultfile="$HOME"/.fppkg/config/default
 fi
 fi
 #
 #
 
 
@@ -69,388 +50,24 @@ if [ -f "$FPBIN" ] ; then
   fpinifile="$HOME"/.fp/fp.ini
   fpinifile="$HOME"/.fp/fp.ini
   fpcfgfile="$HOME"/.fp/fp.cfg
   fpcfgfile="$HOME"/.fp/fp.cfg
 
 
-# Detect if we have write permission in sysfpdirbase.
-  if [ -w "$sysfpdirbase" ] ; then
-    echo Write permission in $sysfpdirbase.
-    if ! [ -d "$sysfpdirbase2" ] ; then
-      echo Directory $sysfpdirbase2 did not exist, attempting to create it now
-      mkdir $sysfpdirbase2  >/dev/null 2>&1
-      echo Attempting to create directory $sysfpdir
-      mkdir $sysfpdir  >/dev/null 2>&1
-    elif ! [ -d "$sysfpdir" ] ; then
-      echo Directory $sysfpdir did not exist, attempting to create it now
-      mkdir $sysfpdir  >/dev/null 2>&1
-    fi
-    if [ -w "$sysfpdir" ] ; then
-      fpinifile="$sysfpdir"/fp.ini
-      fpcfgfile="$sysfpdir"/fp.cfg
-    fi
+# Detect if we have write permission in sysfpdir, or that the directory can be made
+  if ( [ -d "$sysfpdirbase" ] && [ -w "$sysfpdirbase" ] && ! [ -d "$sysfpdirbase2" ] ) ||
+     ( [ -d "$sysfpdirbase2" ] && [ -w "$sysfpdirbase2" ] && ! [ -d "$sysfpdir" ] ) ||
+     ( [ -d "$sysfpdir" ] && [ -w "$sysfpdir" ] ) ; then
+    fpinifile="$sysfpdir"/fp.ini
+    fpcfgfile="$sysfpdir"/fp.cfg
   fi
   fi
 #
 #
-
-# When the local FP IDE configuration is used, check if the directory exists
-  if [ $fpcfgfile = "$HOME"/.fp/fp.cfg -a ! -d "$HOME"/.fp ] ; then
-    echo Directory $HOME/.fp did not exist, attempting to create it now
-    mkdir "$HOME"/.fp >/dev/null 2>&1     
-  fi
-fi
-#
-
-if [ -f "$fpccfgfile" ] ; then
-  mv "$fpccfgfile" "$fpccfgfile.orig"  >/dev/null 2>&1
-  if [ $? = 0 ]; then
-    echo Saved old compiler config to $fpccfgfile.orig
-  else
-    echo Could not save old compiler config. Bailing out...
-    exit
-  fi
 fi
 fi
 
 
-if [ -f "$FPBIN" ] ; then
-  if [ -f "$fpinifile" ] ; then
-    mv "$fpinifile" "$fpinifile.orig"  >/dev/null 2>&1
-    if [ $? = 0 ]; then
-      echo Saved old fp.ini to $fpinifile.orig
-    else
-      echo Could not save old fp.ini. Bailing out...
-      exit
-    fi
-  fi
-
-  if [ -f "$fpcfgfile" ] ; then
-    mv "$fpcfgfile" "$fpcfgfile.orig"  >/dev/null 2>&1
-    if [ $? = 0 ]; then
-      echo Saved old fp.cfg to $fpcfgfile.orig
-    else
-      echo Could not save old fp.cfg. Bailing out...
-      exit
-    fi
-  fi
-fi
-
-setgccdir
-GCCDIR2=""
-GCCDIR3=""
-GCCDIR4=""
-
-singlearch() {
-  if [ -d "$GCCDIR" ]; then	
-    echo Found libgcc.a in "$GCCDIR"
-    GCCDIR=-Fl$GCCDIR
-  fi
-}
-
-# include ports tree dir for FreeBSDers.
-case "$HOSTOS" in
- freebsd)
-    GCCDIR=-Fl/usr/local/lib
-     ;;
- openbsd)
-    GCCDIR=-Fl/usr/local/lib
-     ;;
- netbsd)
-   GCCDIR=-Fl/usr/pkg/lib
-     ;;
- darwin)
-   setgccdirarch cpupowerpc -arch ppc
-   GCCDIR2="$GCCDIR"
-   setgccdirarch cpupowerpc64 -arch ppc64
-   GCCDIR3="$GCCDIR"
-   setgccdirarch cpui386 -arch i386
-   GCCDIR4="$GCCDIR"
-   setgccdirarch cpux86_64 -arch x86_64
-     ;;
-  linux)
-    case `"$FPCBIN" -PP` in
-      i?86|x86_64|amd64)
-      # Allow for the possibility of both 32 and 64 bit compilation on same system
-        setgccdirarch cpui386 -m32
-        GCCDIR4="$GCCDIR"
-        setgccdirarch cpux86_64 -m64
-        ;;
-      powerpc|powerpc64)
-      # Allow for the possibility of both 32 and 64 bit compilation on same system
-        setgccdirarch cpupowerpc -m32
-	GCCDIR4="$GCCDIR"
-	setgccdirarch cpupowerpc64 -m64
-	;;
-      # Add cases for other linux dual architectures here
-      *) singlearch # Default          
-        ;;
-    esac
-    ;;
-
- *) singlearch
-    ;;
-   
-esac
-
-CPUCROSSIFDEF1="#DEFINE NEEDCROSSBINUTILS"
-CPUCROSSIFDEF2=""
-
-case `"$FPCBIN" -PP` in
-  i?86|x86_64|amd64)
-    # Cross-binutils are not needed to compile for i386 on an x86_64 system
-    CPUCROSSIFDEF1="
-#IFNDEF CPUI386
-#IFNDEF CPUAMD64
-#DEFINE NEEDCROSSBINUTILS
-#ENDIF
-#ENDIF
-"
-    CPUCROSSIFDEF2="
-#IFNDEF $HOSTOS
-#DEFINE NEEDCROSSBINUTILS
-#ENDIF
-"
-  ;;
-  *)
-    CPUCROSSIFDEF1="#DEFINE NEEDCROSSBINUTILS"
-    CPUCROSSIFDEF2=""
-  ;;
-esac
-
-# darwin->darwin does not need cross binutils
-case "$HOSTOS" in
-  darwin)
-    CPUCROSSIFDEF2="
-#ifdef darwin
-#undef NEEDCROSSBINUTILS
-#endif
-"
-  ;;
-esac
-
-
 # set right path to FPC with $fpcversion
 # set right path to FPC with $fpcversion
 FPCPATH=`dirname "$1"`/\$fpcversion
 FPCPATH=`dirname "$1"`/\$fpcversion
+# set right prefix to FPC
+FPCGLOBALPREFIX=`dirname "$1"`/../../
 
 
 # Write (.)fpc.cfg
 # Write (.)fpc.cfg
 echo Writing sample configuration file to $fpccfgfile
 echo Writing sample configuration file to $fpccfgfile
-cat <<EOFCFG > $fpccfgfile
-#
-# Example fpc.cfg for Free Pascal Compiler
-#
-
-# ----------------------
-# Defines (preprocessor)
-# ----------------------
-
-#
-# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
-#
-# -d is the same as #DEFINE
-# -u is the same as #UNDEF
-#
-
-#
-# Some examples (for switches see below, and the -? helppages)
-#
-# Try compiling with the -dRELEASE or -dDEBUG on the commandline
-#
-
-# For a release compile with optimizes and strip debuginfo
-#IFDEF RELEASE
-  -O2
-  -Xs
-  #WRITE Compiling Release Version
-#ENDIF
-
-# For a debug version compile with debuginfo and all codegeneration checks on
-#IFDEF DEBUG
-  -g
-  -Crtoi
-  #WRITE Compiling Debug Version
-#ENDIF
-
-# set binutils prefix
-$CPUCROSSIFDEF1
-$CPUCROSSIFDEF2
-
-#IFDEF FPC_CROSSCOMPILING
-#IFDEF NEEDCROSSBINUTILS
-  -XP\$fpctarget-
-#ENDIF NEEDCROSSBINUTILS
-#ENDIF
-
-# assembling
-#ifdef darwin
-# use pipes instead of temporary files for assembling
--ap
-#endif
-
-# ----------------
-# Parsing switches
-# ----------------
-
-# Pascal language mode
-#      -Mfpc      free pascal dialect (default)
-#      -Mobjfpc   switch some Delphi 2 extensions on
-#      -Mdelphi   tries to be Delphi compatible
-#      -Mtp       tries to be TP/BP 7.0 compatible
-#      -Mgpc      tries to be gpc compatible
-#      -Mmacpas   tries to be compatible to the macintosh pascal dialects
-#
-# Turn on Object Pascal extensions by default
-#-Mobjfpc
-
-# Assembler reader mode
-#      -Rdefault  use default assembler
-#      -Ratt      read AT&T style assembler
-#      -Rintel    read Intel style assembler
-#
-# All assembler blocks are AT&T styled by default
-#-Ratt
-
-# Semantic checking
-#      -S2        same as -Mobjfpc
-#      -Sc        supports operators like C (*=,+=,/= and -=)
-#      -Sa        include assertion code.
-#      -Sd        same as -Mdelphi
-#      -Se<x>     error options. <x> is a combination of the following:
-#         <n> : compiler stops after the <n> errors (default is 1)
-#         w : compiler stops also after warnings
-#         n : compiler stops also after notes
-#         h : compiler stops also after hints
-#      -Sg        allow LABEL and GOTO
-#      -Sh        Use ansistrings
-#      -Si        support C++ styled INLINE
-#      -Sk        load fpcylix unit
-#      -SI<x>     set interface style to <x>
-#         -SIcom     COM compatible interface (default)
-#         -SIcorba   CORBA compatible interface
-#      -Sm        support macros like C (global)
-#      -So        same as -Mtp
-#      -Sp        same as -Mgpc
-#      -Ss        constructor name must be init (destructor must be done)
-#      -Sx        enable exception keywords (default in Delphi/ObjFPC modes)
-#
-# Allow goto, inline, C-operators, C-vars
--Sgic
-
-# ---------------
-# Code generation
-# ---------------
-
-# Uncomment the next line if you always want static/dynamic units by default
-# (can be overruled with -CD, -CS at the commandline)
-#-CS
-#-CD
-
-# Set the default heapsize to 8Mb
-#-Ch8000000
-
-# Set default codegeneration checks (iocheck, overflow, range, stack)
-#-Ci
-#-Co
-#-Cr
-#-Ct
-
-# Optimizer switches
-# -Os        generate smaller code
-# -O1        level 1 optimizations (quick optimizations, debuggable)
-# -O2        level 2 optimizations (-O1 + optimizations which make debugging more difficult)
-# -O3        level 3 optimizations (-O2 + optimizations which also may make the program slower rather than faster)
-# -Op<x>     set target cpu for optimizing, see fpc -i for possible values
-#
-# See "fpc -i" also for more fine-grained control over which optimizations
-# to perform
-
-#ifdef darwin
-#ifdef cpui386
--Cppentiumm
--Oppentiumm
-#endif
-#endif
-
-# -----------------------
-# Set Filenames and Paths
-# -----------------------
-
-# Slashes are also allowed under dos
-
-# path to the messagefile, not necessary anymore but can be used to override
-# the default language
-#-Fr$FPCPATH/msg/errore.msg
-#-Fr$FPCPATH/msg/errorn.msg
-
-# searchpath for units and other system dependent things
--Fu$FPCPATH/units/\$fpctarget
--Fu$FPCPATH/units/\$fpctarget/*
--Fu$FPCPATH/units/\$fpctarget/rtl
-#-Fu~/fpc/packages/base/*/units/$fpctarget;~/fpc/fcl/units/$fpctarget;~/fpc/rtl/units/$fpctarget
-
-#IFDEF FPCAPACHE_1_3
--Fu$FPCPATH/units/\$fpctarget/httpd13/
-#ELSE
-#IFDEF FPCAPACHE_2_0
--Fu$FPCPATH/units/\$fpctarget/httpd20
-#ELSE
--Fu$FPCPATH/units/\$fpctarget/httpd22
-#ENDIF
-#ENDIF
-
-# searchpath for libraries
-$GCCDIR
-$GCCDIR2
-$GCCDIR3
-$GCCDIR4
-#-Fl/pp/lib
-#-Fl/lib;/usr/lib
-
-
-# -------------
-# Linking
-# -------------
-
-# generate always debugging information for GDB (slows down the compiling
-# process)
-#      -gc        generate checks for pointers
-#      -gd        use dbx
-#      -gg        use gsym
-#      -gh        use heap trace unit (for memory leak debugging)
-#      -gl        use line info unit to show more info for backtraces
-#      -gv        generates programs tracable with valgrind
-#      -gw        generate dwarf debugging info
-#
-# Enable debuginfo and use the line info unit by default
-#-gl
-
-# always pass an option to the linker
-#-k-s
-
-# Always strip debuginfo from the executable
--Xs
-
-
-# -------------
-# Miscellaneous
-# -------------
-
-# Write always a nice FPC logo ;)
--l
-
-# Verbosity
-#      e : Show errors (default)       d : Show debug info
-#      w : Show warnings               u : Show unit info
-#      n : Show notes                  t : Show tried/used files
-#      h : Show hints                  c : Show conditionals
-#      i : Show general info           d : Show debug info
-#      l : Show linenumbers            r : Rhide/GCC compatibility mode
-#      a : Show everything             x : Executable info (Win32 only)
-#      b : Write file names messages with full path
-#      v : write fpcdebug.txt with     p : Write tree.log with parse tree
-#          lots of debugging info
-#
-# Display Info, Warnings and Notes
--viwn
-# If you don't want so much verbosity use
-#-vw
-
-#
-# That's all folks
-#
-EOFCFG
+fpcmkcfg -d "basepath=$FPCPATH" -o $fpccfgfile
 
 
 if ! [ -f "$FPBIN" ] ; then
 if ! [ -f "$FPBIN" ] ; then
   exit
   exit
@@ -458,132 +75,21 @@ fi
 
 
 # Write fp.cfg
 # Write fp.cfg
 echo Writing sample configuration file to $fpcfgfile
 echo Writing sample configuration file to $fpcfgfile
-cat <<EOFFPCFG > $fpcfgfile
-#IFDEF NORMAL
- -Ci
- -XS
- -T$fpctargetos
- -Sg
- -O1
- -Fu$FPCPATH/units/\$fpctarget
- -Fu$FPCPATH/units/\$fpctarget\*
- -Fu$FPCPATH/units/\$fpctarget\rtl
- $GCCDIR
- $GCCDIR2
- $GCCDIR3
- $GCCDIR4
- -g-
- -p-
- -b-
-#ENDIF
-
-#IFDEF DEBUG
- -Ci
- -XS
- -T$fpctargetos
- -Sg
- -Cr
- -Co
- -Fu$FPCPATH/units/\$fpctarget
- -Fu$FPCPATH/units/\$fpctarget\*
- -Fu$FPCPATH/units/\$fpctarget\rtl
- $GCCDIR
- $GCCDIR2
- $GCCDIR3
- $GCCDIR4
- -g
- -p-
- -b-
-#ENDIF
-
-#IFDEF RELEASE
- -XS
- -T$fpctargetos
- -Sg
- -O2
- -Fu$FPCPATH/units/\$fpctarget
- -Fu$FPCPATH/units/\$fpctarget\*
- -Fu$FPCPATH/units/\$fpctarget\rtl
- $GCCDIR
- $GCCDIR2
- $GCCDIR3
- $GCCDIR4
- -g-
- -p-
- -b-
-#ENDIF
-EOFFPCFG
+fpcmkcfg -p -1 -d "basepath=$FPCPATH" -o $fpcfgfile
 
 
 # Write fp.ini
 # Write fp.ini
 echo Writing sample configuration file to $fpinifile
 echo Writing sample configuration file to $fpinifile
-cat <<EOFFPINI > $fpinifile
-[Compile]
-CompileMode=DEBUG
-
-[Editor]
-DefaultTabSize=8
-DefaultFlags=20599
-DefaultSaveExt=.pas
-DefaultIndentSize=1
-
-[Highlight]
-Exts="*.pas;*.pp;*.inc"
-NeedsTabs="make*;make*.*"
-
-[SourcePath]
-SourceList=""
-
-[Mouse]
-DoubleDelay=8
-ReverseButtons=0
-AltClickAction=6
-CtrlClickAction=1
-
-[Search]
-FindFlags=4
+fpcmkcfg -p -2 -o $fpinifile
 
 
-[Breakpoints]
-Count=0
-
-[Watches]
-Count=0
-
-[Preferences]
-DesktopFileFlags=209
-CenterCurrentLineWhileDebugging=1
-AutoSaveFlags=7
-MiscOptions=6
-DesktopLocation=1
-
-[Misc]
-ShowReadme=1
+# Do not write fppkg configuration when fppkg is not available
+if ! [ -f "$FPPKGBIN" ] ; then
+  exit
+fi
 
 
-[Files]
-OpenExts="*.pas;*.pp;*.inc"
+# Write fppkg.cfg
+echo Writing sample configuration file to $fppkgfile
+fpcmkcfg -p -3 $compilerconfigdir -o $fppkgfile
 
 
-[Tools]
-Title1="svn ~u~p (curr. dir)"
-Program1="svn"
-Params1="up \$CAP_MSG()"
-HotKey1=23296
-Title2="svn c~i~ (curr. dir)"
-Program2="svn"
-Params2="ci \$CAP_MSG()"
-HotKey2=23552
-Title3="svn ~d~iff"
-Program3="svn"
-Params3="diff \$CAP_MSG() \$EDNAME"
-HotKey3=23808
-Title4="svn ~l~og"
-Program4="svn"
-Params4="log \$CAP_MSG() \$EDNAME"
-HotKey4=34560
-Title5="svn ~b~lame"
-Program5="svn"
-Params5="blame \$CAP_MSG() \$EDNAME"
-HotKey5=34816
-Title6="svn ~a~dd"
-Program6="svn"
-Params6="add \$CAP_MSG() \$EDNAME"
-HotKey6=0'
-EOFFPINI
+# Write default
+echo Writing sample configuration file to $defaultfile
+fpcmkcfg -p -4 -d "GlobalPrefix=$FPCGLOBALPREFIX" -o $defaultfile

+ 3 - 3
compiler/x86/agx86int.pas

@@ -59,7 +59,7 @@ implementation
     const
     const
       line_length = 70;
       line_length = 70;
 
 
-      secnames : array[TAsmSectiontype] of string[4] = ('',
+      secnames : array[TAsmSectiontype] of string[4] = ('','',
         'CODE','DATA','DATA','DATA','BSS','',
         'CODE','DATA','DATA','DATA','BSS','',
         '','','','','','',
         '','','','','','',
         '','','','',
         '','','','',
@@ -109,7 +109,7 @@ implementation
         ''
         ''
       );
       );
 
 
-      secnamesml64 : array[TAsmSectiontype] of string[7] = ('',
+      secnamesml64 : array[TAsmSectiontype] of string[7] = ('','',
         '_TEXT','_DATE','_DATA','_DATA','_BSS','',
         '_TEXT','_DATE','_DATA','_DATA','_BSS','',
         '','','','',
         '','','','',
         'idata$2','idata$4','idata$5','idata$6','idata$7','edata',
         'idata$2','idata$4','idata$5','idata$6','idata$7','edata',
@@ -978,7 +978,7 @@ implementation
 
 
       { better do this at end of WriteTree, but then there comes a trouble with
       { better do this at end of WriteTree, but then there comes a trouble with
         al_const which does not have leading ait_section and thus goes out of segment }
         al_const which does not have leading ait_section and thus goes out of segment }
-        
+
       { TODO: probably ml64 needs 'closing' last section, too }
       { TODO: probably ml64 needs 'closing' last section, too }
       if LastSecType <> sec_none then
       if LastSecType <> sec_none then
         AsmWriteLn('_'+secnames[LasTSecType]+#9#9'ENDS');
         AsmWriteLn('_'+secnames[LasTSecType]+#9#9'ENDS');

+ 431 - 4
compiler/x86/x86ins.dat

@@ -2557,7 +2557,9 @@ xmmreg,mem            \1\x66\301\323\2\x0F\xE3\110          WILLAMETTE,SSE2,SM
 [PEXTRW]
 [PEXTRW]
 (Ch_All, Ch_None, Ch_None)
 (Ch_All, Ch_None, Ch_None)
 reg32,mmxreg,imm      \2\x0F\xC5\110\22               KATMAI,MMX,SB,AR2
 reg32,mmxreg,imm      \2\x0F\xC5\110\22               KATMAI,MMX,SB,AR2
-reg32,xmmreg,imm      \1\x66\323\2\x0F\xC5\110\26       WILLAMETTE,SSE2,SB,AR2
+reg32,xmmreg,imm      \1\x66\323\2\x0F\xC5\110\26                    SSE4
+mem32,xmmreg,imm      \1\x66\300\323\3\x0F\x3A\x15\101\26            SSE4
+
 
 
 [PINSRW]
 [PINSRW]
 (Ch_All, Ch_None, Ch_None)
 (Ch_All, Ch_None, Ch_None)
@@ -3269,7 +3271,7 @@ mem,xmmreg              \333\300\323\2\x0F\x2B\101                   SSE4,SD
 
 
 [MOVNTSD]
 [MOVNTSD]
 (Ch_All, Ch_None, Ch_None)
 (Ch_All, Ch_None, Ch_None)
-mem,xmmreg              \300\334\325\323\2\x0F\x2B\\101                SSE4 ;,SQ
+mem,xmmreg              \300\334\325\323\2\x0F\x2B\101                SSE4 ;,SQ
 
 
 [INSERTQ]
 [INSERTQ]
 (Ch_All, Ch_None, Ch_None)
 (Ch_All, Ch_None, Ch_None)
@@ -3287,7 +3289,432 @@ xmmreg,xmmreg           \336\323\2\x0F\x79\110                        SSE4
 reg16,regmem            \320\333\301\323\2\x0F\xBD\110                386,SM,SSE4
 reg16,regmem            \320\333\301\323\2\x0F\xBD\110                386,SM,SSE4
 reg32|64,regmem         \321\333\301\323\2\x0F\xBD\110                386,SM,SSE4
 reg32|64,regmem         \321\333\301\323\2\x0F\xBD\110                386,SM,SSE4
 
 
+;*******************************************************************************
+;**********SSSE3****************************************************************
+;*******************************************************************************
+;Use SSE4, but need special flag for SSSE3 insructions set
+[PABSB]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x1C\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x1C\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x1C\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x1C\110               SSE4
+
+[PABSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x1D\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x1D\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x1D\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x1D\110               SSE4
+
+[PABSD]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x1E\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x1E\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x1E\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x1E\110               SSE4
+
+[PALIGNR]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg,imm     \331\3\x0F\x3A\x0F\110\26                      SSE4
+mmxreg,mem,imm        \301\331\3\x0F\x3A\x0F\110\26                  SSE4
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0F\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0F\110\26            SSE4
+
+[PHADDW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x01\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x01\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x01\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x01\110               SSE4
+
+[PHADDD]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x02\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x02\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x02\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x02\110               SSE4
+
+[PHADDSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x03\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x03\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x03\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x03\110               SSE4
+
+[PHSUBW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x05\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x05\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x05\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x05\110               SSE4
+
+[PHSUBD]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x06\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x06\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x06\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x06\110               SSE4
+
+[PHSUBSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x07\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x07\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x07\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x07\110               SSE4
+
+[PMADDUBSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x04\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x04\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x04\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x04\110               SSE4
+
+[PMULHRSW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x0B\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x0B\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x0B\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x0B\110               SSE4
+
+[PSHUFB]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x00\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x00\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x00\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x00\110               SSE4
+
+[PSIGNB]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x08\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x08\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x08\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x08\110               SSE4
+
+[PSIGNW]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x09\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x09\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x09\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x09\110               SSE4
+
+[PSIGND]
+(Ch_All, Ch_None, Ch_None)
+mmxreg,mmxreg         \331\3\x0F\x38\x0A\110                         SSE4
+mmxreg,mem            \301\331\3\x0F\x38\x0A\110                     SSE4
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x0A\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x0A\110               SSE4
+;*******************************************************************************
+;**********SSE4.1***************************************************************
+;*******************************************************************************
+[BLENDPS] ;By hands delete 'or ot_signed' from i386tab.inc or x8664tab.inc
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0C\110\26          SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0C\110\26      SSE4
+
+[BLENDPD] ;By hands delete 'or ot_signed' from i386tab.inc or x8664tab.inc 
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\2\x0F\x3A\375\1\x0D\110\26          SSE4
+xmmreg,mem,imm        \1\x66\301\331\2\x0F\x3A\375\1\x0D\110\26      SSE4
+
+[BLENDVPS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x14\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x14\110               SSE4
+
+[BLENDVPD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x15\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x15\110               SSE4
+
+[DPPS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x40\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x40\110\26            SSE4
+
+[DPPD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x41\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x41\110\26            SSE4
+
+[EXTRACTPS]
+(Ch_All, Ch_None, Ch_None)
+mem,xmmreg,imm       \1\x66\325\3\x0F\x3A\x17\101\26    SSE4
+reg32|64,xmmreg,imm  \1\x66\300\3\x0F\x3A\x17\101\26    SSE4
+
+[INSERTPS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x21\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x21\110\26            SSE4
+
+[MOVNTDQA]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x2A\110               SSE4
+
+[MPSADBW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x42\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x42\110\26            SSE4
+
+[PACKUSDW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x2B\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x2B\110               SSE4
+
+[PBLENDVB]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x10\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x10\110               SSE4
+
+[PBLENDW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0E\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0E\110\26            SSE4
+
+[PCMPEQQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x29\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x29\110               SSE4
+
+[PEXTRB]
+(Ch_All, Ch_None, Ch_None)
+reg32,xmmreg,imm      \1\x66\323\3\x0F\x3A\x14\101\26                SSE4
+mem8,xmmreg,imm       \1\x66\300\323\3\x0F\x3A\x14\101\26            SSE4
+
+;PEXTRW - Look is prev. implementation
+
+[PEXTRD]
+(Ch_All, Ch_None, Ch_None)
+reg32,xmmreg,imm      \1\x66\323\3\x0F\x3A\x16\101\26                SSE4
+mem32,xmmreg,imm      \1\x66\300\323\3\x0F\x3A\x16\101\26            SSE4
+
+[PEXTRQ]
+(Ch_All, Ch_None, Ch_None)
+reg64,xmmreg,imm      \1\x66\326\3\x0F\x3A\x16\101\26                SSE4
+mem64,xmmreg,imm      \1\x66\300\326\3\x0F\x3A\x16\101\26            SSE4
+
+[PHMINPOSUW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x41\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x41\110               SSE4
+
+[PINSRB]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,reg32,imm      \1\x66\331\3\x0F\x3A\x20\110\26                SSE4
+xmmreg,mem8,imm       \1\x66\301\331\3\x0F\x3A\x20\110\26            SSE4
+
+[PINSRD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,reg32,imm      \1\x66\331\3\x0F\x3A\x22\110\26                SSE4
+xmmreg,mem32,imm      \1\x66\301\331\3\x0F\x3A\x22\110\26            SSE4
+
+[PINSRQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,reg64,imm      \1\x66\326\3\x0F\x3A\x22\110\26                SSE4
+xmmreg,mem64,imm      \1\x66\301\326\3\x0F\x3A\x22\110\26            SSE4
+
+[PMAXSB]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3C\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3C\110               SSE4
+
+[PMAXSD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3D\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3D\110               SSE4
+
+[PMAXUD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3F\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3F\110               SSE4
+
+[PMAXUW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3E\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3E\110               SSE4
+
+[PMINSB]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x38\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x38\110               SSE4
+
+[PMINSD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x39\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x39\110               SSE4
+
+[PMINUW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3A\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3A\110               SSE4
+
+[PMINUD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x3B\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x3B\110               SSE4
+
+[PMOVSXBW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x20\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x20\110               SSE4
+
+[PMOVSXBD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x21\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x21\110               SSE4
+
+[PMOVSXBQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x22\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x22\110               SSE4
+
+[PMOVSXWD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x23\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x23\110               SSE4
+
+[PMOVSXWQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x24\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x24\110               SSE4
+
+[PMOVSXDQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x25\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x25\110               SSE4
+
+[PMOVZXBW]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x30\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x30\110               SSE4
+
+[PMOVZXBD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x31\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x31\110               SSE4
+
+[PMOVZXBQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x32\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x32\110               SSE4
+
+[PMOVZXWD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x33\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x33\110               SSE4
+
+[PMOVZXWQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x34\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x34\110               SSE4
+
+[PMOVZXDQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x35\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x35\110               SSE4
+
+[PMULDQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x28\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x28\110               SSE4
+
+[PTEST]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x17\110                   SSE4
+
+[ROUNDPS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x08\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x08\110\26            SSE4
+
+[ROUNDPD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x09\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x09\110\26            SSE4
+
+[ROUNDSS]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0A\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0A\110\26            SSE4
+
+[ROUNDSD]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\x0B\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\x0B\110\26            SSE4
+;*******************************************************************************
+;**********SSE4.2***************************************************************
+;*******************************************************************************
+[PCMPESTRI]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm      \1\x66\331\3\x0F\x3A\x61\110\26               SSE4
+xmmreg,mem,imm         \1\x66\301\331\3\x0F\x3A\x61\110\26           SSE4
+[PCMPESTRM]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm      \1\x66\331\3\x0F\x3A\x60\110\26               SSE4
+xmmreg,mem,imm         \1\x66\301\331\3\x0F\x3A\x60\110\26           SSE4
+[PCMPISTRI]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm      \1\x66\331\3\x0F\x3A\x63\110\26               SSE4
+xmmreg,mem,imm         \1\x66\301\331\3\x0F\x3A\x63\110\26           SSE4
+[PCMPISTRM]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm      \1\x66\331\3\x0F\x3A\x62\110\26               SSE4
+xmmreg,mem,imm         \1\x66\301\331\3\x0F\x3A\x62\110\26           SSE4
+[PCMPGTQ]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\x37\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\x37\110               SSE4
+;   CRC32
 [POPCNT,popcntX]
 [POPCNT,popcntX]
 (Ch_All, Ch_None, Ch_None)
 (Ch_All, Ch_None, Ch_None)
-reg16,regmem            \320\333\301\323\2\x0F\xB8\110                386,SM,SSE4
-reg32|64,regmem         \321\333\301\323\2\x0F\xB8\110                386,SM,SSE4
+reg16,rm16             \1\xF3\301\320\2\x0F\xB8\110                  386,SM,SSE4
+reg32,rm32             \1\xF3\301\320\2\x0F\xB8\110                  386,SM,SSE4
+reg64,rm64             \1\xF3\301\320\2\x0F\xB8\110                  386,SM,SSE4
+;*******************************************************************************
+;**********AES******************************************************************
+;*******************************************************************************
+;Use SSE4, but need special flag for AES insructions set
+
+[AESENC]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDC\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDC\110               SSE4
+
+[AESENCLAST]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDD\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDD\110               SSE4
+
+[AESDEC]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDE\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDE\110               SSE4
+
+[AESDECLAST]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDF\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDF\110               SSE4
+
+[AESIMC]
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg         \1\x66\331\3\x0F\x38\xDB\110                   SSE4
+xmmreg,mem            \1\x66\301\331\3\x0F\x38\xDB\110               SSE4
+
+[AESKEYGEN] ;AESKEYGENASIST
+(Ch_All, Ch_None, Ch_None)
+xmmreg,xmmreg,imm     \1\x66\331\3\x0F\x3A\xDF\110\26                SSE4
+xmmreg,mem,imm        \1\x66\301\331\3\x0F\x3A\xDF\110\26            SSE4
+;*******************************************************************************
+;*******************************************************************************
+;*******************************************************************************
+[STOSQ]
+(Ch_RRAX, Ch_WMemEDI, Ch_RWRDI)
+void                   \2\x48\xAB                                    X86_64  
+
+[LODSQ]
+(Ch_WRAX, Ch_RWRSI, Ch_None)
+void                   \2\x48\xAD                                    X86_64    
+
+[CMPSQ]
+(Ch_All, Ch_None, Ch_None)
+void                   \2\x48\xA7                                    X86_64

+ 7 - 2
compiler/x86_64/cgcpu.pas

@@ -90,8 +90,13 @@ unit cgcpu;
         else
         else
           { in intf. wrapper code generation }
           { in intf. wrapper code generation }
           framepointer:=RS_FRAME_POINTER_REG;
           framepointer:=RS_FRAME_POINTER_REG;
-        rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_RBX,RS_RSI,RS_RDI,
-          RS_R8,RS_R9,RS_R10,RS_R11,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[framepointer]);
+        if target_info.system=system_x86_64_win64 then
+          rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_R8,RS_R9,RS_R10,
+            RS_R11,RS_RBX,RS_RSI,RS_RDI,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[framepointer])
+        else
+          rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,[RS_RAX,RS_RDX,RS_RCX,RS_RSI,RS_RDI,RS_R8,
+            RS_R9,RS_R10,RS_R11,RS_RBX,RS_R12,RS_R13,RS_R14,RS_R15],first_int_imreg,[framepointer]);
+
         rg[R_MMREGISTER]:=trgcpu.create(R_MMREGISTER,R_SUBWHOLE,[RS_XMM0,RS_XMM1,RS_XMM2,RS_XMM3,RS_XMM4,RS_XMM5,RS_XMM6,RS_XMM7,
         rg[R_MMREGISTER]:=trgcpu.create(R_MMREGISTER,R_SUBWHOLE,[RS_XMM0,RS_XMM1,RS_XMM2,RS_XMM3,RS_XMM4,RS_XMM5,RS_XMM6,RS_XMM7,
           RS_XMM8,RS_XMM9,RS_XMM10,RS_XMM11,RS_XMM12,RS_XMM13,RS_XMM14,RS_XMM15],first_mm_imreg,[]);
           RS_XMM8,RS_XMM9,RS_XMM10,RS_XMM11,RS_XMM12,RS_XMM13,RS_XMM14,RS_XMM15],first_mm_imreg,[]);
         rgfpu:=Trgx86fpu.create;
         rgfpu:=Trgx86fpu.create;

+ 78 - 1
compiler/x86_64/x8664ats.inc

@@ -602,5 +602,82 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufINT,
 attsufINT,
-attsufINT
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufINT,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE
 );
 );

+ 78 - 1
compiler/x86_64/x8664att.inc

@@ -602,5 +602,82 @@
 'insertq',
 'insertq',
 'extrq',
 'extrq',
 'lzcnt',
 'lzcnt',
-'popcnt'
+'pabsb',
+'pabsw',
+'pabsd',
+'palignr',
+'phaddw',
+'phaddd',
+'phaddsw',
+'phsubw',
+'phsubd',
+'phsubsw',
+'pmaddubsw',
+'pmulhrsw',
+'pshufb',
+'psignb',
+'psignw',
+'psignd',
+'blendps',
+'blendpd',
+'blendvps',
+'blendvpd',
+'dpps',
+'dppd',
+'extractps',
+'insertps',
+'movntdqa',
+'mpsadbw',
+'packusdw',
+'pblendvb',
+'pblendw',
+'pcmpeqq',
+'pextrb',
+'pextrd',
+'pextrq',
+'phminposuw',
+'pinsrb',
+'pinsrd',
+'pinsrq',
+'pmaxsb',
+'pmaxsd',
+'pmaxud',
+'pmaxuw',
+'pminsb',
+'pminsd',
+'pminuw',
+'pminud',
+'pmovsxbw',
+'pmovsxbd',
+'pmovsxbq',
+'pmovsxwd',
+'pmovsxwq',
+'pmovsxdq',
+'pmovzxbw',
+'pmovzxbd',
+'pmovzxbq',
+'pmovzxwd',
+'pmovzxwq',
+'pmovzxdq',
+'pmuldq',
+'ptest',
+'roundps',
+'roundpd',
+'roundss',
+'roundsd',
+'pcmpestri',
+'pcmpestrm',
+'pcmpistri',
+'pcmpistrm',
+'pcmpgtq',
+'popcnt',
+'aesenc',
+'aesenclast',
+'aesdec',
+'aesdeclast',
+'aesimc',
+'aeskeygen',
+'stosq',
+'lodsq',
+'cmpsq'
 );
 );

+ 78 - 1
compiler/x86_64/x8664int.inc

@@ -602,5 +602,82 @@
 'insertq',
 'insertq',
 'extrq',
 'extrq',
 'lzcnt',
 'lzcnt',
-'popcnt'
+'pabsb',
+'pabsw',
+'pabsd',
+'palignr',
+'phaddw',
+'phaddd',
+'phaddsw',
+'phsubw',
+'phsubd',
+'phsubsw',
+'pmaddubsw',
+'pmulhrsw',
+'pshufb',
+'psignb',
+'psignw',
+'psignd',
+'blendps',
+'blendpd',
+'blendvps',
+'blendvpd',
+'dpps',
+'dppd',
+'extractps',
+'insertps',
+'movntdqa',
+'mpsadbw',
+'packusdw',
+'pblendvb',
+'pblendw',
+'pcmpeqq',
+'pextrb',
+'pextrd',
+'pextrq',
+'phminposuw',
+'pinsrb',
+'pinsrd',
+'pinsrq',
+'pmaxsb',
+'pmaxsd',
+'pmaxud',
+'pmaxuw',
+'pminsb',
+'pminsd',
+'pminuw',
+'pminud',
+'pmovsxbw',
+'pmovsxbd',
+'pmovsxbq',
+'pmovsxwd',
+'pmovsxwq',
+'pmovsxdq',
+'pmovzxbw',
+'pmovzxbd',
+'pmovzxbq',
+'pmovzxwd',
+'pmovzxwq',
+'pmovzxdq',
+'pmuldq',
+'ptest',
+'roundps',
+'roundpd',
+'roundss',
+'roundsd',
+'pcmpestri',
+'pcmpestrm',
+'pcmpistri',
+'pcmpistrm',
+'pcmpgtq',
+'popcnt',
+'aesenc',
+'aesenclast',
+'aesdec',
+'aesdeclast',
+'aesimc',
+'aeskeygen',
+'stosq',
+'lodsq',
+'cmpsq'
 );
 );

+ 1 - 1
compiler/x86_64/x8664nop.inc

@@ -1,2 +1,2 @@
 { don't edit, this file is generated from x86ins.dat }
 { don't edit, this file is generated from x86ins.dat }
-1372;
+1555;

+ 78 - 1
compiler/x86_64/x8664op.inc

@@ -602,5 +602,82 @@ A_MOVNTSD,
 A_INSERTQ,
 A_INSERTQ,
 A_EXTRQ,
 A_EXTRQ,
 A_LZCNT,
 A_LZCNT,
-A_POPCNT
+A_PABSB,
+A_PABSW,
+A_PABSD,
+A_PALIGNR,
+A_PHADDW,
+A_PHADDD,
+A_PHADDSW,
+A_PHSUBW,
+A_PHSUBD,
+A_PHSUBSW,
+A_PMADDUBSW,
+A_PMULHRSW,
+A_PSHUFB,
+A_PSIGNB,
+A_PSIGNW,
+A_PSIGND,
+A_BLENDPS,
+A_BLENDPD,
+A_BLENDVPS,
+A_BLENDVPD,
+A_DPPS,
+A_DPPD,
+A_EXTRACTPS,
+A_INSERTPS,
+A_MOVNTDQA,
+A_MPSADBW,
+A_PACKUSDW,
+A_PBLENDVB,
+A_PBLENDW,
+A_PCMPEQQ,
+A_PEXTRB,
+A_PEXTRD,
+A_PEXTRQ,
+A_PHMINPOSUW,
+A_PINSRB,
+A_PINSRD,
+A_PINSRQ,
+A_PMAXSB,
+A_PMAXSD,
+A_PMAXUD,
+A_PMAXUW,
+A_PMINSB,
+A_PMINSD,
+A_PMINUW,
+A_PMINUD,
+A_PMOVSXBW,
+A_PMOVSXBD,
+A_PMOVSXBQ,
+A_PMOVSXWD,
+A_PMOVSXWQ,
+A_PMOVSXDQ,
+A_PMOVZXBW,
+A_PMOVZXBD,
+A_PMOVZXBQ,
+A_PMOVZXWD,
+A_PMOVZXWQ,
+A_PMOVZXDQ,
+A_PMULDQ,
+A_PTEST,
+A_ROUNDPS,
+A_ROUNDPD,
+A_ROUNDSS,
+A_ROUNDSD,
+A_PCMPESTRI,
+A_PCMPESTRM,
+A_PCMPISTRI,
+A_PCMPISTRM,
+A_PCMPGTQ,
+A_POPCNT,
+A_AESENC,
+A_AESENCLAST,
+A_AESDEC,
+A_AESDECLAST,
+A_AESIMC,
+A_AESKEYGEN,
+A_STOSQ,
+A_LODSQ,
+A_CMPSQ
 );
 );

+ 77 - 0
compiler/x86_64/x8664pro.inc

@@ -602,5 +602,82 @@
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_RRAX, Ch_WMemEDI, Ch_RWRDI)),
+(Ch: (Ch_WRAX, Ch_RWRSI, Ch_None)),
 (Ch: (Ch_All, Ch_None, Ch_None))
 (Ch: (Ch_All, Ch_None, Ch_None))
 );
 );

+ 1291 - 10
compiler/x86_64/x8664tab.inc

@@ -7705,7 +7705,14 @@
     ops     : 3;
     ops     : 3;
     optypes : (ot_reg32,ot_xmmreg,ot_immediate);
     optypes : (ot_reg32,ot_xmmreg,ot_immediate);
     code    : #1#102#211#2#15#197#72#22;
     code    : #1#102#211#2#15#197#72#22;
-    flags   : if_willamette or if_sse2 or if_sb or if_ar2
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRW;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#21#65#22;
+    flags   : if_sse4
   ),
   ),
   (
   (
     opcode  : A_PINSRW;
     opcode  : A_PINSRW;
@@ -9552,7 +9559,7 @@
     opcode  : A_MOVNTSD;
     opcode  : A_MOVNTSD;
     ops     : 2;
     ops     : 2;
     optypes : (ot_memory,ot_xmmreg,ot_none);
     optypes : (ot_memory,ot_xmmreg,ot_none);
-    code    : #192#220#213#211#2#15#43#0#65;
+    code    : #192#220#213#211#2#15#43#65;
     flags   : if_sse4
     flags   : if_sse4
   ),
   ),
   (
   (
@@ -9591,17 +9598,1291 @@
     flags   : if_386 or if_sm or if_sse4
     flags   : if_386 or if_sm or if_sse4
   ),
   ),
   (
   (
-    opcode  : A_POPCNT;
+    opcode  : A_PABSB;
     ops     : 2;
     ops     : 2;
-    optypes : (ot_reg16,ot_regmem,ot_none);
-    code    : #208#219#193#211#2#15#184#72;
-    flags   : if_386 or if_sm or if_sse4
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#28#72;
+    flags   : if_sse4
   ),
   ),
   (
   (
-    opcode  : A_POPCNT;
+    opcode  : A_PABSB;
     ops     : 2;
     ops     : 2;
-    optypes : (ot_reg32 or ot_bits64,ot_regmem,ot_none);
-    code    : #209#219#193#211#2#15#184#72;
-    flags   : if_386 or if_sm or if_sse4
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#28#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#29#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PABSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#30#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_immediate);
+    code    : #217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_mmxreg,ot_memory,ot_immediate);
+    code    : #193#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PALIGNR;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#15#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#1#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#2#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHADDSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#3#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#5#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#6#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHSUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#7#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMADDUBSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#4#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULHRSW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#11#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSHUFB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#0#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#8#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGNW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#9#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_mmxreg,ot_none);
+    code    : #217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_mmxreg,ot_memory,ot_none);
+    code    : #193#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PSIGND;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#10#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg or ot_signed,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#12#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg or ot_signed,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#12#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#2#15#58#253#1#13#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#2#15#58#253#1#13#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#20#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPS;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#20#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#21#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_BLENDVPD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#21#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#64#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#64#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#65#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_DPPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#65#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_EXTRACTPS;
+    ops     : 3;
+    optypes : (ot_memory,ot_xmmreg,ot_immediate);
+    code    : #1#102#213#3#15#58#23#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_EXTRACTPS;
+    ops     : 3;
+    optypes : (ot_reg32 or ot_bits64,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#3#15#58#23#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_INSERTPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#33#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_INSERTPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#33#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MOVNTDQA;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#42#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MPSADBW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#66#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_MPSADBW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#66#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PACKUSDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#43#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PACKUSDW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#43#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDVB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#16#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDVB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#16#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate or ot_signed);
+    code    : #1#102#217#3#15#58#14#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PBLENDW;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate or ot_signed);
+    code    : #1#102#193#217#3#15#58#14#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPEQQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#41#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPEQQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#41#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRB;
+    ops     : 3;
+    optypes : (ot_reg32,ot_xmmreg,ot_immediate);
+    code    : #1#102#211#3#15#58#20#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRB;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits8,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#20#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRD;
+    ops     : 3;
+    optypes : (ot_reg32,ot_xmmreg,ot_immediate);
+    code    : #1#102#211#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRD;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits32,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#211#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRQ;
+    ops     : 3;
+    optypes : (ot_reg64,ot_xmmreg,ot_immediate);
+    code    : #1#102#214#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PEXTRQ;
+    ops     : 3;
+    optypes : (ot_memory or ot_bits64,ot_xmmreg,ot_immediate);
+    code    : #1#102#192#214#3#15#58#22#65#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHMINPOSUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#65#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PHMINPOSUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#65#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRB;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg32,ot_immediate);
+    code    : #1#102#217#3#15#58#32#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRB;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits8,ot_immediate);
+    code    : #1#102#193#217#3#15#58#32#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg32,ot_immediate);
+    code    : #1#102#217#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits32,ot_immediate);
+    code    : #1#102#193#217#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRQ;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_reg64,ot_immediate);
+    code    : #1#102#214#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PINSRQ;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory or ot_bits64,ot_immediate);
+    code    : #1#102#193#214#3#15#58#34#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#60#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#60#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#61#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#61#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#63#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#63#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#62#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMAXUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#62#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#56#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSB;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#56#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#57#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINSD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#57#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#58#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#58#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#59#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMINUD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#59#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#32#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#32#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#33#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#33#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#34#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#34#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#35#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#35#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#36#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#36#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#37#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVSXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#37#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#48#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBW;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#48#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#49#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#49#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#50#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXBQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#50#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#51#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWD;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#51#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#52#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXWQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#52#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#53#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMOVZXDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#53#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#40#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PMULDQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#40#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PTEST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#23#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#8#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#8#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#9#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDPD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#9#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#10#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSS;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#10#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#11#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_ROUNDSD;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#11#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#97#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#97#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#96#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPESTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#96#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#99#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRI;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#99#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#98#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPISTRM;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#98#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPGTQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#55#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_PCMPGTQ;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#55#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg16,ot_regmem or ot_bits16,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg32,ot_regmem or ot_bits32,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_POPCNT;
+    ops     : 2;
+    optypes : (ot_reg64,ot_regmem or ot_bits64,ot_none);
+    code    : #1#243#193#208#2#15#184#72;
+    flags   : if_386 or if_sm or if_sse4
+  ),
+  (
+    opcode  : A_AESENC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#220#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#220#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENCLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#221#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESENCLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#221#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDEC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#222#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDEC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#222#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDECLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#223#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESDECLAST;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#223#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESIMC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_none);
+    code    : #1#102#217#3#15#56#219#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESIMC;
+    ops     : 2;
+    optypes : (ot_xmmreg,ot_memory,ot_none);
+    code    : #1#102#193#217#3#15#56#219#72;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESKEYGEN;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_xmmreg,ot_immediate);
+    code    : #1#102#217#3#15#58#223#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_AESKEYGEN;
+    ops     : 3;
+    optypes : (ot_xmmreg,ot_memory,ot_immediate);
+    code    : #1#102#193#217#3#15#58#223#72#22;
+    flags   : if_sse4
+  ),
+  (
+    opcode  : A_STOSQ;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none);
+    code    : #2#72#171;
+    flags   : if_x86_64
+  ),
+  (
+    opcode  : A_LODSQ;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none);
+    code    : #2#72#173;
+    flags   : if_x86_64
+  ),
+  (
+    opcode  : A_CMPSQ;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none);
+    code    : #2#72#167;
+    flags   : if_x86_64
   )
   )
 );
 );

+ 6 - 6
packages/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/02/21]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/02/07]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
@@ -9703,11 +9703,11 @@ winunits-base_shared: fcl-registry_shared fcl-base_shared
 winunits-base_smart: fcl-registry_smart fcl-base_smart
 winunits-base_smart: fcl-registry_smart fcl-base_smart
 winunits-base_debug: fcl-registry_debug fcl-base_debug
 winunits-base_debug: fcl-registry_debug fcl-base_debug
 winunits-base_release: fcl-registry_release fcl-base_release
 winunits-base_release: fcl-registry_release fcl-base_release
-winunits-jedi_all: winunits-base_all fcl-registry fcl-base_all
-winunits-jedi_shared: winunits-base_shared fcl-registry fcl-base_shared
-winunits-jedi_smart: winunits-base_smart fcl-registry fcl-base_smart
-winunits-jedi_debug: winunits-base_debug fcl-registry fcl-base_debug
-winunits-jedi_release: winunits-base_release fcl-registry fcl-base_release
+winunits-jedi_all: winunits-base_all fcl-registry_all fcl-base_all
+winunits-jedi_shared: winunits-base_shared fcl-registry_shared fcl-base_shared
+winunits-jedi_smart: winunits-base_smart fcl-registry_smart fcl-base_smart
+winunits-jedi_debug: winunits-base_debug fcl-registry_debug fcl-base_debug
+winunits-jedi_release: winunits-base_release fcl-registry_release fcl-base_release
 xforms_all: x11_all
 xforms_all: x11_all
 xforms_shared: x11_shared
 xforms_shared: x11_shared
 xforms_smart: x11_smart
 xforms_smart: x11_smart

+ 5 - 5
packages/Makefile.fpc

@@ -346,11 +346,11 @@ winunits-base_smart: fcl-registry_smart fcl-base_smart
 winunits-base_debug: fcl-registry_debug fcl-base_debug
 winunits-base_debug: fcl-registry_debug fcl-base_debug
 winunits-base_release: fcl-registry_release fcl-base_release
 winunits-base_release: fcl-registry_release fcl-base_release
 
 
-winunits-jedi_all: winunits-base_all fcl-registry fcl-base_all
-winunits-jedi_shared: winunits-base_shared fcl-registry fcl-base_shared
-winunits-jedi_smart: winunits-base_smart fcl-registry fcl-base_smart
-winunits-jedi_debug: winunits-base_debug fcl-registry fcl-base_debug
-winunits-jedi_release: winunits-base_release fcl-registry fcl-base_release
+winunits-jedi_all: winunits-base_all fcl-registry_all fcl-base_all
+winunits-jedi_shared: winunits-base_shared fcl-registry_shared fcl-base_shared
+winunits-jedi_smart: winunits-base_smart fcl-registry_smart fcl-base_smart
+winunits-jedi_debug: winunits-base_debug fcl-registry_debug fcl-base_debug
+winunits-jedi_release: winunits-base_release fcl-registry_release fcl-base_release
 
 
 
 
 xforms_all: x11_all
 xforms_all: x11_all

+ 45 - 10
packages/cdrom/src/cdromlin.inc

@@ -117,20 +117,55 @@ end;
 
 
 Function GetCDRomDevices(Var Devices : Array of string) : Integer;
 Function GetCDRomDevices(Var Devices : Array of string) : Integer;
 
 
-Var
-  S : String;
 
 
-begin
-  Result:=TestFSTab(Devices);
-  If (Result<1) then
+  Function AlreadyAdded(AName: String; AMax: Integer): Boolean;
+  var
+    I: Integer;
+  begin
+    Result := False;
+    for I := 0 to AMax do
+      if Devices[I] = AName then
+        Exit(True);
+  end;
+
+  // Resolves name if it's a symlink and adds it ensuring no dups
+  Function AddCdrom(ACDRom: String; I: Integer): Integer;
+  var
+    SInfo : stat;
+    RealName: String;
+  begin
+    Result := I;
+    if fpStat(PChar(ACDRom), SInfo) <> -1 then
     begin
     begin
-    S:=DetectCD;
-    If (S<>'') then
+      RealName := ACDRom;
+      if SInfo.st_mode and S_IFMT = S_IFLNK then
+        RealName := fpReadLink(ACDRom);
+
+      if not AlreadyAdded(RealName, I-1) then
       begin
       begin
-      Devices[0]:=S;
-      Result:=1;
+        Devices[I] := RealName;
+        Result := I+1;
       end;
       end;
-    end
+    end;
+  end;
+
+var
+  I,J: Integer;
+  CDRec: TCDSearchRec;
+  FSTab: array[0..10] of String;
+
+begin
+  I := 0;
+  // First Add Entries From FSTab
+  for J := 0 to TestFSTab(FSTab)-1 do
+    I := AddCdrom(FSTab[J], I);
+
+  //Now Do A Search
+  if FindFirstCD(CDRec) then
+  repeat
+    I := AddCdrom(CDRec.Name, I);
+  until FindNextCD(CDRec) = False;
+  Result := I;
 end;
 end;
 
 
 
 

Неке датотеке нису приказане због велике количине промена