Browse Source

merge to trunk r33457

git-svn-id: branches/maciej/smart_pointers@33458 -
maciej-izak 9 years ago
parent
commit
6b8d33862c
100 changed files with 2930 additions and 1216 deletions
  1. 64 5
      .gitattributes
  2. 1 2
      Makefile
  3. 1 2
      Makefile.fpc
  4. 16 12
      compiler/aarch64/cgcpu.pas
  5. 9 2
      compiler/aasmbase.pas
  6. 31 9
      compiler/aasmdata.pas
  7. 8 2
      compiler/aasmtai.pas
  8. 21 4
      compiler/aggas.pas
  9. 7 6
      compiler/arm/aasmcpu.pas
  10. 90 4
      compiler/arm/aoptcpu.pas
  11. 5 5
      compiler/arm/armins.dat
  12. 4 4
      compiler/arm/armtab.inc
  13. 20 8
      compiler/arm/cgcpu.pas
  14. 1 1
      compiler/arm/cpubase.pas
  15. 4 2
      compiler/arm/cpuinfo.pas
  16. 4 4
      compiler/arm/cpupara.pas
  17. 1 0
      compiler/arm/cpupi.pas
  18. 9 0
      compiler/arm/narmadd.pas
  19. 3 2
      compiler/arm/narmcal.pas
  20. 2 0
      compiler/arm/narmcnv.pas
  21. 111 1
      compiler/arm/narminl.pas
  22. 1 0
      compiler/arm/narmmat.pas
  23. 5 0
      compiler/arm/rgcpu.pas
  24. 34 3
      compiler/assemble.pas
  25. 3 3
      compiler/cgobj.pas
  26. 17 0
      compiler/cutils.pas
  27. 41 1
      compiler/dbgdwarf.pas
  28. 6 1
      compiler/entfile.pas
  29. 394 0
      compiler/fpcp.pas
  30. 131 0
      compiler/fpkg.pas
  31. 93 1
      compiler/fppu.pas
  32. 23 3
      compiler/globals.pas
  33. 7 3
      compiler/globtype.pas
  34. 1 1
      compiler/htypechk.pas
  35. 19 9
      compiler/i386/cgcpu.pas
  36. 3 0
      compiler/i386/cpuinfo.pas
  37. 10 1
      compiler/i386/i386att.inc
  38. 9 0
      compiler/i386/i386atts.inc
  39. 10 1
      compiler/i386/i386int.inc
  40. 1 1
      compiler/i386/i386nop.inc
  41. 10 1
      compiler/i386/i386op.inc
  42. 26 17
      compiler/i386/i386prop.inc
  43. 66 3
      compiler/i386/i386tab.inc
  44. 5 1
      compiler/i386/n386cal.pas
  45. 2 0
      compiler/i8086/cpuinfo.pas
  46. 10 1
      compiler/i8086/i8086att.inc
  47. 9 0
      compiler/i8086/i8086atts.inc
  48. 10 1
      compiler/i8086/i8086int.inc
  49. 1 1
      compiler/i8086/i8086nop.inc
  50. 10 1
      compiler/i8086/i8086op.inc
  51. 26 17
      compiler/i8086/i8086prop.inc
  52. 76 13
      compiler/i8086/i8086tab.inc
  53. 4 0
      compiler/jvm/agjasmin.pas
  54. 109 35
      compiler/jvm/njvmtcon.pas
  55. 1 1
      compiler/jvm/symcpu.pas
  56. 3 0
      compiler/llvm/agllvm.pas
  57. 147 269
      compiler/m68k/cgcpu.pas
  58. 3 2
      compiler/m68k/cpuinfo.pas
  59. 2 2
      compiler/m68k/hlcgcpu.pas
  60. 6 6
      compiler/m68k/n68kadd.pas
  61. 1 1
      compiler/m68k/n68kcnv.pas
  62. 1 1
      compiler/m68k/n68kinl.pas
  63. 2 2
      compiler/m68k/n68kmat.pas
  64. 3 3
      compiler/m68k/rgcpu.pas
  65. 1 0
      compiler/macho.pas
  66. 83 7
      compiler/mips/cpuelf.pas
  67. 26 38
      compiler/mips/racpugas.pas
  68. 1 1
      compiler/msg/errorct.msg
  69. 111 61
      compiler/msg/errord.msg
  70. 1 1
      compiler/msg/errorda.msg
  71. 112 63
      compiler/msg/errordu.msg
  72. 102 4
      compiler/msg/errore.msg
  73. 1 1
      compiler/msg/errores.msg
  74. 1 1
      compiler/msg/errorf.msg
  75. 1 1
      compiler/msg/errorfi.msg
  76. 1 1
      compiler/msg/errorhe.msg
  77. 1 1
      compiler/msg/errorheu.msg
  78. 1 1
      compiler/msg/errorid.msg
  79. 1 1
      compiler/msg/erroriu.msg
  80. 1 1
      compiler/msg/errorn.msg
  81. 1 1
      compiler/msg/errorpli.msg
  82. 1 1
      compiler/msg/errorpt.msg
  83. 1 1
      compiler/msg/errorptu.msg
  84. 1 1
      compiler/msg/errorr.msg
  85. 1 1
      compiler/msg/errorru.msg
  86. 1 1
      compiler/msg/errorues.msg
  87. 34 3
      compiler/msgidx.inc
  88. 539 506
      compiler/msgtxt.inc
  89. 4 0
      compiler/nadd.pas
  90. 6 0
      compiler/ncgbas.pas
  91. 2 2
      compiler/ncgcnv.pas
  92. 38 15
      compiler/ncgld.pas
  93. 23 6
      compiler/ncgmem.pas
  94. 31 5
      compiler/ncgrtti.pas
  95. 10 2
      compiler/ncgvmt.pas
  96. 5 2
      compiler/ncnv.pas
  97. 27 2
      compiler/ngenutil.pas
  98. 3 0
      compiler/nmem.pas
  99. 1 1
      compiler/node.pas
  100. 3 2
      compiler/nutils.pas

+ 64 - 5
.gitattributes

@@ -174,6 +174,8 @@ compiler/finput.pas svneol=native#text/plain
 compiler/fmodule.pas svneol=native#text/plain
 compiler/fpccrc.pas svneol=native#text/plain
 compiler/fpcdefs.inc svneol=native#text/plain
+compiler/fpcp.pas svneol=native#text/pascal
+compiler/fpkg.pas svneol=native#text/pascal
 compiler/fppu.pas svneol=native#text/plain
 compiler/gendef.pas svneol=native#text/plain
 compiler/generic/cpuinfo.pas svneol=native#text/plain
@@ -524,6 +526,7 @@ compiler/parser.pas svneol=native#text/plain
 compiler/pass_1.pas svneol=native#text/plain
 compiler/pass_2.pas svneol=native#text/plain
 compiler/pbase.pas svneol=native#text/plain
+compiler/pcp.pas svneol=native#text/pascal
 compiler/pdecl.pas svneol=native#text/plain
 compiler/pdecobj.pas svneol=native#text/plain
 compiler/pdecsub.pas svneol=native#text/plain
@@ -533,6 +536,7 @@ compiler/pexpr.pas svneol=native#text/plain
 compiler/pgentype.pas svneol=native#text/pascal
 compiler/pgenutil.pas svneol=native#text/pascal
 compiler/pinline.pas svneol=native#text/plain
+compiler/pkgutil.pas svneol=native#text/pascal
 compiler/pmodules.pas svneol=native#text/plain
 compiler/powerpc/agppcmpw.pas svneol=native#text/plain
 compiler/powerpc/agppcvasm.pas svneol=native#text/plain
@@ -1153,10 +1157,8 @@ packages/amunits/src/utilunits/doublebuffer.pas svneol=native#text/plain
 packages/amunits/src/utilunits/easyasl.pas svneol=native#text/plain
 packages/amunits/src/utilunits/hisoft.pas svneol=native#text/plain
 packages/amunits/src/utilunits/linklist.pas svneol=native#text/plain
-packages/amunits/src/utilunits/longarray.pas svneol=native#text/plain
 packages/amunits/src/utilunits/pastoc.pas svneol=native#text/plain
 packages/amunits/src/utilunits/pcq.pas svneol=native#text/plain
-packages/amunits/src/utilunits/systemvartags.pas svneol=native#text/plain
 packages/amunits/src/utilunits/tagsarray.pas svneol=native#text/plain
 packages/amunits/src/utilunits/timerutils.pas svneol=native#text/plain
 packages/amunits/src/utilunits/vartags.pas svneol=native#text/plain
@@ -1926,6 +1928,7 @@ packages/fcl-base/examples/b64test2.pp svneol=native#text/plain
 packages/fcl-base/examples/base64decodingtestcase.pas svneol=native#text/plain
 packages/fcl-base/examples/cachetest.pp svneol=native#text/plain
 packages/fcl-base/examples/cfgtest.pp svneol=native#text/plain
+packages/fcl-base/examples/contit.pp svneol=native#text/plain
 packages/fcl-base/examples/crittest.pp svneol=native#text/plain
 packages/fcl-base/examples/dbugsrv.pp svneol=native#text/plain
 packages/fcl-base/examples/debugtest.pp svneol=native#text/plain
@@ -1956,8 +1959,6 @@ packages/fcl-base/examples/intl/restest.pb.po svneol=native#text/plain
 packages/fcl-base/examples/intl/restest.ru.mo -text
 packages/fcl-base/examples/intl/restest.ru.po svneol=native#text/plain
 packages/fcl-base/examples/intl/resttest.po svneol=native#text/plain
-packages/fcl-base/examples/ipcclient.pp svneol=native#text/plain
-packages/fcl-base/examples/ipcserver.pp svneol=native#text/plain
 packages/fcl-base/examples/isockcli.pp svneol=native#text/plain
 packages/fcl-base/examples/isocksvr.pp svneol=native#text/plain
 packages/fcl-base/examples/istream.pp svneol=native#text/plain
@@ -2110,6 +2111,7 @@ packages/fcl-db/src/base/fields.inc svneol=native#text/plain
 packages/fcl-db/src/base/fpmake.inc svneol=native#text/plain
 packages/fcl-db/src/base/fpmake.pp svneol=native#text/plain
 packages/fcl-db/src/base/sqlscript.pp svneol=native#text/plain
+packages/fcl-db/src/base/sqltypes.pp svneol=native#text/plain
 packages/fcl-db/src/base/xmldatapacketreader.pp svneol=native#text/plain
 packages/fcl-db/src/codegen/Makefile svneol=native#text/plain
 packages/fcl-db/src/codegen/Makefile.fpc svneol=native#text/plain
@@ -2574,6 +2576,28 @@ packages/fcl-passrc/tests/tctypeparser.pas svneol=native#text/plain
 packages/fcl-passrc/tests/tcvarparser.pas svneol=native#text/plain
 packages/fcl-passrc/tests/testpassrc.lpi svneol=native#text/plain
 packages/fcl-passrc/tests/testpassrc.lpr svneol=native#text/plain
+packages/fcl-pdf/Makefile svneol=native#text/plain
+packages/fcl-pdf/Makefile.fpc svneol=native#text/plain
+packages/fcl-pdf/examples/poppy.jpg -text
+packages/fcl-pdf/examples/testfppdf.lpi svneol=native#text/plain
+packages/fcl-pdf/examples/testfppdf.lpr svneol=native#text/plain
+packages/fcl-pdf/fpmake.pp svneol=native#text/plain
+packages/fcl-pdf/readme.txt svneol=native#text/plain
+packages/fcl-pdf/src/fpparsettf.pp svneol=native#text/plain
+packages/fcl-pdf/src/fppdf.pp svneol=native#text/plain
+packages/fcl-pdf/src/fpttf.pp svneol=native#text/plain
+packages/fcl-pdf/src/fpttfencodings.pp svneol=native#text/plain
+packages/fcl-pdf/tests/fpparsettf_test.pas svneol=native#text/plain
+packages/fcl-pdf/tests/fppdf_test.pas svneol=native#text/plain
+packages/fcl-pdf/tests/fpttf_test.pas svneol=native#text/plain
+packages/fcl-pdf/tests/readme.txt svneol=native#text/plain
+packages/fcl-pdf/tests/testunits.inc svneol=native#text/plain
+packages/fcl-pdf/tests/unittests_console.lpi svneol=native#text/plain
+packages/fcl-pdf/tests/unittests_console.lpr svneol=native#text/plain
+packages/fcl-pdf/tests/unittests_gui.lpi svneol=native#text/plain
+packages/fcl-pdf/tests/unittests_gui.lpr svneol=native#text/plain
+packages/fcl-pdf/utils/mkpdffontdef.lpi svneol=native#text/plain
+packages/fcl-pdf/utils/mkpdffontdef.pp svneol=native#text/plain
 packages/fcl-process/Makefile svneol=native#text/plain
 packages/fcl-process/Makefile.fpc svneol=native#text/plain
 packages/fcl-process/Makefile.fpc.fpcmake svneol=native#text/plain
@@ -2586,6 +2610,10 @@ packages/fcl-process/examples/demoruncommand.pp svneol=native#text/plain
 packages/fcl-process/examples/echoparams.pp svneol=native#text/plain
 packages/fcl-process/examples/empty.pp svneol=native#text/pascal
 packages/fcl-process/examples/infinity.pp svneol=native#text/pascal
+packages/fcl-process/examples/ipcclient.lpi svneol=native#text/plain
+packages/fcl-process/examples/ipcclient.pp svneol=native#text/plain
+packages/fcl-process/examples/ipcserver.lpi svneol=native#text/plain
+packages/fcl-process/examples/ipcserver.pp svneol=native#text/plain
 packages/fcl-process/examples/waitonexit.pp svneol=native#text/pascal
 packages/fcl-process/fpmake.pp svneol=native#text/plain
 packages/fcl-process/src/amicommon/pipes.inc svneol=native#text/plain
@@ -2877,6 +2905,7 @@ packages/fcl-stl/src/garrayutils.pp svneol=native#text/plain
 packages/fcl-stl/src/gdeque.pp svneol=native#text/plain
 packages/fcl-stl/src/ghashmap.pp svneol=native#text/plain
 packages/fcl-stl/src/ghashset.pp svneol=native#text/plain
+packages/fcl-stl/src/glinkedlist.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
@@ -2891,6 +2920,7 @@ packages/fcl-stl/tests/gcompositetest.pp svneol=native#text/plain
 packages/fcl-stl/tests/gdequetest.pp svneol=native#text/plain
 packages/fcl-stl/tests/ghashmaptest.pp svneol=native#text/plain
 packages/fcl-stl/tests/ghashsettest.pp svneol=native#text/plain
+packages/fcl-stl/tests/glinkedlisttest.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
@@ -5836,6 +5866,7 @@ packages/morphunits/src/exec.pas svneol=native#text/plain
 packages/morphunits/src/gadtools.pas svneol=native#text/pascal
 packages/morphunits/src/get9.pas svneol=native#text/plain
 packages/morphunits/src/hardware.pas svneol=native#text/plain
+packages/morphunits/src/icon.pas svneol=native#text/pascal
 packages/morphunits/src/iffparse.pas svneol=native#text/plain
 packages/morphunits/src/input.pas svneol=native#text/plain
 packages/morphunits/src/inputevent.pas svneol=native#text/plain
@@ -5847,6 +5878,7 @@ packages/morphunits/src/muihelper.pas svneol=native#text/plain
 packages/morphunits/src/timer.pas svneol=native#text/plain
 packages/morphunits/src/tinygl.pas svneol=native#text/plain
 packages/morphunits/src/utility.pas svneol=native#text/plain
+packages/morphunits/src/workbench.pas svneol=native#text/pascal
 packages/mysql/Makefile svneol=native#text/plain
 packages/mysql/Makefile.fpc svneol=native#text/plain
 packages/mysql/Makefile.fpc.fpcmake svneol=native#text/plain
@@ -8181,6 +8213,7 @@ rtl/android/mipsel/prt0.as svneol=native#text/plain
 rtl/android/sysandroid.inc svneol=native#text/plain
 rtl/arm/arm.inc svneol=native#text/plain
 rtl/arm/armdefines.inc svneol=native#text/plain
+rtl/arm/cpu.pp svneol=native#text/pascal
 rtl/arm/divide.inc svneol=native#text/plain
 rtl/arm/int64p.inc svneol=native#text/plain
 rtl/arm/makefile.cpu svneol=native#text/plain
@@ -10845,6 +10878,8 @@ tests/tbs/tb0613.pp svneol=native#text/pascal
 tests/tbs/tb0614.pp svneol=native#text/pascal
 tests/tbs/tb0615.pp svneol=native#text/pascal
 tests/tbs/tb0616.pp svneol=native#text/pascal
+tests/tbs/tb0617.pp svneol=native#text/pascal
+tests/tbs/tb0618.pp svneol=native#text/plain
 tests/tbs/tb205.pp svneol=native#text/plain
 tests/tbs/tb610.pp svneol=native#text/pascal
 tests/tbs/tb613.pp svneol=native#text/plain
@@ -11534,6 +11569,7 @@ tests/test/cpu16/i8086/tmmt.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tprcdat1.pp svneol=native#text/plain
 tests/test/cpu16/i8086/tptrcon.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tptrsize.pp svneol=native#text/pascal
+tests/test/cpu16/i8086/tra1.pp svneol=native#text/pascal
 tests/test/cpu16/i8086/tretf1.pp svneol=native#text/plain
 tests/test/cpu16/i8086/tretf2.pp svneol=native#text/plain
 tests/test/cpu16/i8086/ttasm1.pp svneol=native#text/plain
@@ -11612,6 +11648,7 @@ tests/test/jvm/tsetansistr.pp svneol=native#text/plain
 tests/test/jvm/tsetstring.pp svneol=native#text/plain
 tests/test/jvm/tsmallintarr.pp svneol=native#text/plain
 tests/test/jvm/tstr.pp svneol=native#text/plain
+tests/test/jvm/tstring.pp svneol=native#text/plain
 tests/test/jvm/tstring1.pp svneol=native#text/plain
 tests/test/jvm/tstring9.pp svneol=native#text/plain
 tests/test/jvm/tstrreal1.pp svneol=native#text/plain
@@ -11633,6 +11670,7 @@ tests/test/jvm/tvirtclmeth.pp svneol=native#text/plain
 tests/test/jvm/tw20212.pp svneol=native#text/plain
 tests/test/jvm/tw22807.pp svneol=native#text/plain
 tests/test/jvm/tw24089.pp svneol=native#text/plain
+tests/test/jvm/tw29585.pp svneol=native#text/plain
 tests/test/jvm/twith.pp svneol=native#text/plain
 tests/test/jvm/uenum.pp svneol=native#text/plain
 tests/test/jvm/ujsetter.pp svneol=native#text/plain
@@ -11677,6 +11715,7 @@ tests/test/opt/tdfa14.pp svneol=native#text/pascal
 tests/test/opt/tdfa15.pp svneol=native#text/pascal
 tests/test/opt/tdfa16.pp svneol=native#text/pascal
 tests/test/opt/tdfa17.pp svneol=native#text/pascal
+tests/test/opt/tdfa18.pp svneol=native#text/pascal
 tests/test/opt/tdfa2.pp svneol=native#text/pascal
 tests/test/opt/tdfa3.pp svneol=native#text/pascal
 tests/test/opt/tdfa4.pp svneol=native#text/pascal
@@ -12090,7 +12129,9 @@ tests/test/textthr.pp svneol=native#text/plain
 tests/test/tfillchr.pp svneol=native#text/plain
 tests/test/tfinal1.pp svneol=native#text/pascal
 tests/test/tfinal2.pp svneol=native#text/pascal
-tests/test/tfma1.pp svneol=native#text/pascal
+tests/test/tfma1.inc svneol=native#text/plain
+tests/test/tfma1arm.pp svneol=native#text/pascal
+tests/test/tfma1x86.pp svneol=native#text/pascal
 tests/test/tforin1.pp svneol=native#text/pascal
 tests/test/tforin10.pp svneol=native#text/plain
 tests/test/tforin11.pp svneol=native#text/plain
@@ -12897,6 +12938,7 @@ tests/test/tutf8cpl.pp svneol=native#text/plain
 tests/test/tvarpropsetter1.pp svneol=native#text/plain
 tests/test/tvarpropsetter2.pp svneol=native#text/plain
 tests/test/tvarset1.pp svneol=native#text/plain
+tests/test/tw29833.pp svneol=native#text/plain
 tests/test/twarn1.pp svneol=native#text/pascal
 tests/test/tweaklib1.pp svneol=native#text/plain
 tests/test/tweaklib2.pp svneol=native#text/plain
@@ -13195,6 +13237,7 @@ tests/test/units/sysutils/tstrcmp.pp svneol=native#text/plain
 tests/test/units/sysutils/tstrtobool.pp svneol=native#text/plain
 tests/test/units/sysutils/tunifile.pp svneol=native#text/plain
 tests/test/units/sysutils/tuplow.pp svneol=native#text/plain
+tests/test/units/sysutils/twstralloc.pp svneol=native#text/plain
 tests/test/units/sysutils/twstrcmp.pp svneol=native#text/plain
 tests/test/units/ucomplex/tcsqr1.pp svneol=native#text/pascal
 tests/test/units/variants/tcustomvariant.pp svneol=native#text/plain
@@ -14894,6 +14937,7 @@ tests/webtbs/tw28718b.pp svneol=native#text/plain
 tests/webtbs/tw28718c.pp svneol=native#text/plain
 tests/webtbs/tw28718d.pp svneol=native#text/plain
 tests/webtbs/tw28748.pp svneol=native#text/plain
+tests/webtbs/tw28749.pp svneol=native#text/plain
 tests/webtbs/tw2876.pp svneol=native#text/plain
 tests/webtbs/tw28766.pp svneol=native#text/pascal
 tests/webtbs/tw28801.pp svneol=native#text/plain
@@ -14905,6 +14949,7 @@ tests/webtbs/tw2891.pp svneol=native#text/plain
 tests/webtbs/tw28916.pp svneol=native#text/pascal
 tests/webtbs/tw2892.pp svneol=native#text/plain
 tests/webtbs/tw28934.pp svneol=native#text/plain
+tests/webtbs/tw28948.pp svneol=native#text/plain
 tests/webtbs/tw28964.pp svneol=native#text/plain
 tests/webtbs/tw2897.pp svneol=native#text/plain
 tests/webtbs/tw2899.pp svneol=native#text/plain
@@ -14918,6 +14963,7 @@ tests/webtbs/tw29053.pp svneol=native#text/pascal
 tests/webtbs/tw29053b.pp svneol=native#text/pascal
 tests/webtbs/tw29064.pp svneol=native#text/plain
 tests/webtbs/tw2908.pp svneol=native#text/plain
+tests/webtbs/tw29080.pp svneol=native#text/pascal
 tests/webtbs/tw29086.pp -text svneol=native#text/plain
 tests/webtbs/tw29096.pp svneol=native#text/plain
 tests/webtbs/tw2911.pp svneol=native#text/plain
@@ -14938,19 +14984,32 @@ tests/webtbs/tw2942a.pp svneol=native#text/plain
 tests/webtbs/tw2942b.pp svneol=native#text/plain
 tests/webtbs/tw2943.pp svneol=native#text/plain
 tests/webtbs/tw2944.pp svneol=native#text/plain
+tests/webtbs/tw29444.pp svneol=native#text/pascal
 tests/webtbs/tw2946.pp svneol=native#text/plain
 tests/webtbs/tw29471.pp svneol=native#text/plain
 tests/webtbs/tw2949.pp svneol=native#text/plain
 tests/webtbs/tw2953.pp svneol=native#text/plain
 tests/webtbs/tw29546.pp svneol=native#text/pascal
+tests/webtbs/tw29547.pp svneol=native#text/plain
 tests/webtbs/tw2956.pp svneol=native#text/plain
 tests/webtbs/tw2958.pp svneol=native#text/plain
+tests/webtbs/tw29585.pp svneol=native#text/plain
 tests/webtbs/tw29609.pp svneol=native#text/pascal
+tests/webtbs/tw29620.pp svneol=native#text/plain
 tests/webtbs/tw2966.pp svneol=native#text/plain
+tests/webtbs/tw29669.pp svneol=native#text/plain
+tests/webtbs/tw29669a.pp svneol=native#text/plain
+tests/webtbs/tw29745.pp svneol=native#text/pascal
 tests/webtbs/tw2975.pp svneol=native#text/plain
 tests/webtbs/tw2976.pp svneol=native#text/plain
+tests/webtbs/tw29792.pp svneol=native#text/pascal
 tests/webtbs/tw2983.pp svneol=native#text/plain
 tests/webtbs/tw2984.pp svneol=native#text/plain
+tests/webtbs/tw29893.pp svneol=native#text/pascal
+tests/webtbs/tw29912.pp svneol=native#text/plain
+tests/webtbs/tw29923.pp svneol=native#text/plain
+tests/webtbs/tw29930.pp svneol=native#text/plain
+tests/webtbs/tw29958.pp svneol=native#text/pascal
 tests/webtbs/tw2998.pp svneol=native#text/plain
 tests/webtbs/tw2999.pp svneol=native#text/plain
 tests/webtbs/tw3004.pp svneol=native#text/plain

+ 1 - 2
Makefile

@@ -2850,8 +2850,7 @@ override TARGET_DIRS:=$(wildcard $(TARGET_DIRS))
 help:
 	@$(ECHO)
 	@$(ECHO) Targets
-	@$(ECHO)    all         Alias for build
-	@$(ECHO)    build       Build a new compiler and all packages
+	@$(ECHO)    all         Build a new compiler and all packages
 	@$(ECHO)    install     Install newly build files
 	@$(ECHO)    zipinstall  Create zip/tar of installed files
 	@$(ECHO)    singlezipinstall  Alias for zipinstall

+ 1 - 2
Makefile.fpc

@@ -232,8 +232,7 @@ override TARGET_DIRS:=$(wildcard $(TARGET_DIRS))
 help:
         @$(ECHO)
         @$(ECHO) Targets
-        @$(ECHO)    all         Alias for build
-        @$(ECHO)    build       Build a new compiler and all packages
+        @$(ECHO)    all         Build a new compiler and all packages
         @$(ECHO)    install     Install newly build files
         @$(ECHO)    zipinstall  Create zip/tar of installed files
         @$(ECHO)    singlezipinstall  Alias for zipinstall

+ 16 - 12
compiler/aarch64/cgcpu.pas

@@ -812,7 +812,7 @@ implementation
         if fromsize in [OS_64,OS_S64] then
           begin
             { split into two 32 bit loads }
-            hreg1:=makeregsize(register,OS_32);
+            hreg1:=getintregister(list,OS_32);
             hreg2:=getintregister(list,OS_32);
             if target_info.endian=endian_big then
               begin
@@ -831,6 +831,7 @@ implementation
                 inc(href.offset,4);
                 a_load_ref_reg(list,OS_32,OS_32,href,hreg2);
               end;
+            a_load_reg_reg(list,OS_32,OS_64,hreg1,register);
             list.concat(taicpu.op_reg_reg_const_const(A_BFI,register,makeregsize(hreg2,OS_64),32,32));
           end
        else
@@ -1340,7 +1341,7 @@ implementation
 
     procedure tcgaarch64.a_op_reg_reg_reg_checkoverflow(list: TAsmList; op: topcg; size: tcgsize; src1, src2, dst: tregister; setflags : boolean; var ovloc : tlocation);
       var
-        tmpreg1: tregister;
+        tmpreg1, tmpreg2: tregister;
       begin
         ovloc.loc:=LOC_VOID;
         { overflow can only occur with 64 bit calculations on 64 bit cpus }
@@ -1360,9 +1361,7 @@ implementation
                       ovloc.resflags:=F_CC
                   else
                     ovloc.resflags:=F_VS;
-                  { finished; since we won't call through to a_op_reg_reg_reg,
-                    adjust the result here if necessary }
-                  maybeadjustresult(list,op,size,dst);
+                  { finished }
                   exit;
                 end;
               OP_MUL:
@@ -1377,17 +1376,22 @@ implementation
                 end;
               OP_IMUL:
                 begin
-                  { check whether the sign bit of the (128 bit) result is the
-                    same as "sign bit of src1" xor "signbit of src2" (if so, no
-                    overflow and the xor-product of all sign bits is 0) }
+                  { check whether the upper 64 bits of the 128 bit multiplication
+                    result have the same value as the replicated sign bit of the
+                    lower 64 bits }
                   tmpreg1:=getintregister(list,OS_64);
                   list.concat(taicpu.op_reg_reg_reg(A_SMULH,tmpreg1,src2,src1));
-                  list.concat(taicpu.op_reg_reg_reg(A_EOR,tmpreg1,tmpreg1,src1));
-                  list.concat(taicpu.op_reg_reg_reg(A_EOR,tmpreg1,tmpreg1,src2));
-                  list.concat(taicpu.op_reg_const(A_TST,tmpreg1,$80000000));
+                  { calculate lower 64 bits (afterwards, because dst may be
+                    equal to src1 or src2) }
+                  a_op_reg_reg_reg(list,op,size,src1,src2,dst);
+                  { replicate sign bit }
+                  tmpreg2:=getintregister(list,OS_64);
+                  a_op_const_reg_reg(list,OP_SAR,OS_S64,63,dst,tmpreg2);
+                  list.concat(taicpu.op_reg_reg(A_CMP,tmpreg1,tmpreg2));
                   ovloc.loc:=LOC_FLAGS;
                   ovloc.resflags:=F_NE;
-                  { still have to perform the actual multiplication }
+                  { finished }
+                  exit;
                 end;
               OP_IDIV,
               OP_DIV:

+ 9 - 2
compiler/aasmbase.pas

@@ -42,7 +42,10 @@ interface
          { global in the current program/library, but not visible outside it }
          AB_PRIVATE_EXTERN,AB_LAZY,AB_IMPORT,
          { a symbol that's internal to the compiler and used as a temp }
-         AB_TEMP);
+         AB_TEMP,
+         { a global symbol that points to another global symbol and is only used
+           to allow indirect loading in case of packages and indirect imports }
+         AB_INDIRECT,AB_EXTERNAL_INDIRECT);
 
        TAsmsymtype=(
          AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL,
@@ -65,7 +68,9 @@ interface
     const
        asmlabeltypeprefix : array[TAsmLabeltype] of char = ('j','a','d','l','f','t','c');
        asmsymbindname : array[TAsmsymbind] of string[23] = ('none', 'external','common',
-       'local','global','weak external','private external','lazy','import','internal temp');
+       'local','global','weak external','private external','lazy','import','internal temp',
+       'indirect','external indirect');
+       asmsymbindindirect = [AB_INDIRECT,AB_EXTERNAL_INDIRECT];
 
     type
        TAsmSectiontype=(sec_none,
@@ -98,6 +103,8 @@ interface
          sec_debug_info,
          sec_debug_line,
          sec_debug_abbrev,
+         sec_debug_aranges,
+         sec_debug_ranges,
          { Yury: "sec_fpc is intended for storing fpc specific data
                   which must be recognized and processed specially by linker.
                   Currently fpc version string, dummy links to stab sections

+ 31 - 9
compiler/aasmdata.pas

@@ -62,6 +62,8 @@ interface
         al_dwarf_info,
         al_dwarf_abbrev,
         al_dwarf_line,
+        al_dwarf_aranges,
+        al_dwarf_ranges,
         al_picdata,
         al_indirectpicdata,
         al_resourcestrings,
@@ -114,6 +116,8 @@ interface
         'al_dwarf_info',
         'al_dwarf_abbrev',
         'al_dwarf_line',
+        'al_dwarf_aranges',
+        'al_dwarf_ranges',
         'al_picdata',
         'al_indirectpicdata',
         'al_resourcestrings',
@@ -169,7 +173,7 @@ interface
         function  DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype) : TAsmSymbol;
         function  DefineAsmSymbol(const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype) : TAsmSymbol;
         function  WeakRefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype=AT_NONE) : TAsmSymbol;
-        function  RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype=AT_NONE) : TAsmSymbol;
+        function  RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype=AT_NONE;indirect:boolean=false) : TAsmSymbol;
         function  GetAsmSymbol(const s : TSymStr) : TAsmSymbol;
         { create new assembler label }
         procedure getlabel(out l : TAsmLabel;alt:TAsmLabeltype);
@@ -217,6 +221,7 @@ implementation
 
     uses
       verbose,
+      symconst,
       aasmtai;
 
 {$ifdef MEMDEBUG}
@@ -406,8 +411,12 @@ implementation
     function TAsmData.DefineAsmSymbolByClass(symclass: TAsmSymbolClass; const s : TSymStr;_bind:TAsmSymBind;_typ:Tasmsymtype) : TAsmSymbol;
       var
         hp : TAsmSymbol;
+        namestr : TSymStr;
       begin
-        hp:=TAsmSymbol(FAsmSymbolDict.Find(s));
+        namestr:=s;
+        if _bind in asmsymbindindirect then
+          namestr:=namestr+suffix_indirect;
+        hp:=TAsmSymbol(FAsmSymbolDict.Find(namestr));
         if assigned(hp) then
          begin
            { Redefine is allowed, but the types must be the same. The redefine
@@ -429,9 +438,9 @@ implementation
                  should be ignored; a used cannot change anything about this,
                  so printing a warning/hint is not useful }
                if (_bind=AB_LOCAL) then
-                 Message3(asmw_w_changing_bind_type,s,asmsymbindname[hp.bind],asmsymbindname[_bind])
+                 Message3(asmw_w_changing_bind_type,namestr,asmsymbindname[hp.bind],asmsymbindname[_bind])
                else
-                 Message3(asmw_h_changing_bind_type,s,asmsymbindname[hp.bind],asmsymbindname[_bind]);
+                 Message3(asmw_h_changing_bind_type,namestr,asmsymbindname[hp.bind],asmsymbindname[_bind]);
 {$endif extdebug}
              end;
            hp.bind:=_bind;
@@ -439,7 +448,7 @@ implementation
         else
          begin
            { Not found, insert it. }
-           hp:=symclass.create(AsmSymbolDict,s,_bind,_typ);
+           hp:=symclass.create(AsmSymbolDict,namestr,_bind,_typ);
          end;
         result:=hp;
       end;
@@ -451,14 +460,27 @@ implementation
       end;
 
 
-    function TAsmData.RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype=AT_NONE) : TAsmSymbol;
+    function TAsmData.RefAsmSymbol(const s : TSymStr;_typ:Tasmsymtype;indirect:boolean) : TAsmSymbol;
+      var
+        namestr : TSymStr;
+        bind : tasmsymbind;
       begin
-        result:=TAsmSymbol(FAsmSymbolDict.Find(s));
+        namestr:=s;
+        if indirect then
+          begin
+            namestr:=namestr+suffix_indirect;
+            bind:=AB_EXTERNAL_INDIRECT;
+          end
+        else
+          begin
+            bind:=AB_EXTERNAL;
+          end;
+        result:=TAsmSymbol(FAsmSymbolDict.Find(namestr));
         if not assigned(result) then
-          result:=TAsmSymbol.create(AsmSymbolDict,s,AB_EXTERNAL,_typ)
+          result:=TAsmSymbol.create(AsmSymbolDict,namestr,bind,_typ)
         { one normal reference removes the "weak" character of a symbol }
         else if (result.bind=AB_WEAK_EXTERNAL) then
-          result.bind:=AB_EXTERNAL;
+          result.bind:=bind;
       end;
 
 

+ 8 - 2
compiler/aasmtai.pas

@@ -340,7 +340,12 @@ interface
         { supported by recent clang-based assemblers for data-in-code  }
         asd_data_region, asd_end_data_region,
         { ARM }
-        asd_thumb_func,asd_code
+        asd_thumb_func,asd_code,
+        { restricts the assembler only to those instructions, which are
+          available on the specified CPU; this represents directives such as
+          NASM's 'CPU 686' or MASM/TASM's '.686p'. Might not be supported by
+          all assemblers. }
+        asd_cpu
       );
 
       TAsmSehDirective=(
@@ -376,7 +381,8 @@ interface
         'data_region','end_data_region',
         { ARM }
         'thumb_func',
-        'code'
+        'code',
+        'cpu'
       );
       sehdirectivestr : array[TAsmSehDirective] of string[16]=(
         '.seh_proc','.seh_endproc',

+ 21 - 4
compiler/aggas.pas

@@ -232,7 +232,7 @@ implementation
           '.stabstr',
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.eh_frame',
-          '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
+          '.debug_frame','.debug_info','.debug_line','.debug_abbrev','.debug_aranges','.debug_ranges',
           '.fpc',
           '.toc',
           '.init',
@@ -291,7 +291,7 @@ implementation
           '.stabstr',
           '.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
           '.eh_frame',
-          '.debug_frame','.debug_info','.debug_line','.debug_abbrev',
+          '.debug_frame','.debug_info','.debug_line','.debug_abbrev','.debug_aranges','.debug_ranges',
           '.fpc',
           '.toc',
           '.init',
@@ -416,7 +416,7 @@ implementation
             result:='r';
 
           sec_stab,sec_stabstr,
-          sec_debug_frame,sec_debug_info,sec_debug_line,sec_debug_abbrev:
+          sec_debug_frame,sec_debug_info,sec_debug_line,sec_debug_abbrev,sec_debug_aranges,sec_debug_ranges:
             result:='n';
         else
           result:='';  { defaults to data+load }
@@ -1522,7 +1522,12 @@ implementation
 
     procedure TGNUAssembler.WriteDirectiveName(dir: TAsmDirective);
     begin
-      writer.AsmWrite('.'+directivestr[dir]+' ');
+      { TODO: implement asd_cpu for GAS => usually .arch or .cpu, but the CPU
+        name has to be translated as well }
+      if dir=asd_cpu then
+        writer.AsmWrite(asminfo^.comment+' CPU ')
+      else
+        writer.AsmWrite('.'+directivestr[dir]+' ');
     end;
 
 
@@ -1626,6 +1631,16 @@ implementation
                  result := '.section __DWARF,__debug_abbrev,regular,debug';
                  exit;
                end;
+            sec_debug_aranges:
+               begin
+                 result := '.section __DWARF,__debug_aranges,regular,debug';
+                 exit;
+               end;
+            sec_debug_ranges:
+               begin
+                 result := '.section __DWARF,__debug_ranges,regular,debug';
+                 exit;
+               end;
             sec_rodata:
               begin
                 result := '.const_data';
@@ -1739,6 +1754,8 @@ implementation
          sec_debug_info,
          sec_debug_line,
          sec_debug_abbrev,
+         sec_debug_aranges,
+         sec_debug_ranges,
          { ELF resources (+ references to stabs debug information sections) }
          sec_code (* sec_fpc *),
          { Table of contents section }

+ 7 - 6
compiler/arm/aasmcpu.pas

@@ -872,6 +872,7 @@ implementation
                 result:=operand_write
               else
                 result:=operand_read;
+            A_VFMA,A_VFMS,A_VFNMA,A_VFNMS,
             A_BFC:
               if opnr in [0] then
                 result:=operand_readwrite
@@ -2778,15 +2779,15 @@ implementation
 
       function MakeRegList(reglist: tcpuregisterset): word;
         var
-          i, w: word;
+          i, w: integer;
         begin
           result:=0;
-          w:=1;
+          w:=0;
           for i:=RS_R0 to RS_R15 do
             begin
               if i in reglist then
-                result:=result or w;
-              w:=w shl 1
+                result:=result or (1 shl w);
+              inc(w);
             end;
         end;
 
@@ -2979,9 +2980,9 @@ implementation
                   bytes:=bytes or (((oper[0]^.ref^.offset-8) shr 2) and $ffffff);
 
                   if (opcode<>A_BL) or (condition<>C_None) then
-                    objdata.writereloc(bytes,4,currsym,RELOC_RELATIVE_24)
+                    objdata.writereloc(aint(bytes),4,currsym,RELOC_RELATIVE_24)
                   else
-                    objdata.writereloc(bytes,4,currsym,RELOC_RELATIVE_CALL);
+                    objdata.writereloc(aint(bytes),4,currsym,RELOC_RELATIVE_CALL);
 
                   exit;
                 end;

+ 90 - 4
compiler/arm/aoptcpu.pas

@@ -39,6 +39,7 @@ Type
     procedure PeepHoleOptPass2;override;
     Function RegInInstruction(Reg: TRegister; p1: tai): Boolean;override;
     function RemoveSuperfluousMove(const p: tai; movp: tai; const optimizer: string): boolean;
+    function RemoveSuperfluousVMov(const p : tai; movp : tai; const optimizer : string) : boolean;
 
     { gets the next tai object after current that contains info relevant
       to the optimizer in p1 which used the given register or does a
@@ -92,7 +93,11 @@ Implementation
         (taicpu(p).opcode<>A_CBZ) and
         (taicpu(p).opcode<>A_CBNZ) and
         (taicpu(p).opcode<>A_PLD) and
-        ((taicpu(p).opcode<>A_BLX) or
+        (((taicpu(p).opcode<>A_BLX) and
+          { BL may need to be converted into BLX by the linker -- could possibly
+            be allowed in case it's to a local symbol of which we know that it
+            uses the same instruction set as the current one }
+          (taicpu(p).opcode<>A_BL)) or
          (taicpu(p).oper[0]^.typ=top_reg));
     end;
 
@@ -248,7 +253,8 @@ Implementation
 
       case p.opcode of
         { These operands do not write into a register at all }
-        A_CMP, A_CMN, A_TST, A_TEQ, A_B, A_BL, A_BX, A_BLX, A_SWI, A_MSR, A_PLD:
+        A_CMP, A_CMN, A_TST, A_TEQ, A_B, A_BL, A_BX, A_BLX, A_SWI, A_MSR, A_PLD,
+        A_VCMP:
           exit;
         {Take care of post/preincremented store and loads, they will change their base register}
         A_STR, A_LDR:
@@ -264,6 +270,11 @@ Implementation
             if p.opcode = A_STR then
               exit;
           end;
+        A_VSTR:
+          begin
+            Result := false;
+            exit;
+          end;
         { These four are writing into the first 2 register, UMLAL and SMLAL will also read from them }
         A_UMLAL, A_UMULL, A_SMLAL, A_SMULL:
           Result :=
@@ -278,7 +289,7 @@ Implementation
             (p.oper[2]^.reg = reg);
         }
         {Loads to all register in the registerset}
-        A_LDM:
+        A_LDM, A_VLDM:
           Result := (getsupreg(reg) in p.oper[1]^.regset^);
         A_POP:
           Result := (getsupreg(reg) in p.oper[0]^.regset^) or
@@ -428,6 +439,69 @@ Implementation
         end;
     end;
 
+
+  function TCpuAsmOptimizer.RemoveSuperfluousVMov(const p: tai; movp: tai; const optimizer: string):boolean;
+    var
+      alloc,
+      dealloc : tai_regalloc;
+      hp1 : tai;
+    begin
+      Result:=false;
+      if (MatchInstruction(movp, A_VMOV, [taicpu(p).condition], [taicpu(p).oppostfix]) or
+          ((taicpu(p).oppostfix in [PF_F64F32,PF_F64S16,PF_F64S32,PF_F64U16,PF_F64U32]) and MatchInstruction(movp, A_VMOV, [taicpu(p).condition], [PF_F64])) or
+          ((taicpu(p).oppostfix in [PF_F32F64,PF_F32S16,PF_F32S32,PF_F32U16,PF_F32U32]) and MatchInstruction(movp, A_VMOV, [taicpu(p).condition], [PF_F32]))
+         ) and
+         (taicpu(movp).ops=2) and
+         MatchOperand(taicpu(movp).oper[1]^, taicpu(p).oper[0]^.reg) and
+         { the destination register of the mov might not be used beween p and movp }
+         not(RegUsedBetween(taicpu(movp).oper[0]^.reg,p,movp)) and
+         { Take care to only do this for instructions which REALLY load to the first register.
+           Otherwise
+             vstr reg0, [reg1]
+             vmov reg2, reg0
+           will be optimized to
+             vstr reg2, [reg1]
+         }
+         regLoadedWithNewValue(taicpu(p).oper[0]^.reg, p) then
+        begin
+          dealloc:=FindRegDeAlloc(taicpu(p).oper[0]^.reg,tai(movp.Next));
+          if assigned(dealloc) then
+            begin
+              DebugMsg('Peephole '+optimizer+' removed superfluous vmov', movp);
+              result:=true;
+
+              { taicpu(p).oper[0]^.reg is not used anymore, try to find its allocation
+                and remove it if possible }
+              asml.Remove(dealloc);
+              alloc:=FindRegAllocBackward(taicpu(p).oper[0]^.reg,tai(p.previous));
+              if assigned(alloc) then
+                begin
+                  asml.Remove(alloc);
+                  alloc.free;
+                  dealloc.free;
+                end
+              else
+                asml.InsertAfter(dealloc,p);
+
+              { try to move the allocation of the target register }
+              GetLastInstruction(movp,hp1);
+              alloc:=FindRegAlloc(taicpu(movp).oper[0]^.reg,tai(hp1.Next));
+              if assigned(alloc) then
+                begin
+                  asml.Remove(alloc);
+                  asml.InsertBefore(alloc,p);
+                  { adjust used regs }
+                  IncludeRegInUsedRegs(taicpu(movp).oper[0]^.reg,UsedRegs);
+                end;
+
+              { finally get rid of the mov }
+              taicpu(p).loadreg(0,taicpu(movp).oper[0]^.reg);
+              asml.remove(movp);
+              movp.free;
+            end;
+        end;
+    end;
+
   {
     optimize
       add/sub reg1,reg1,regY/const
@@ -2139,7 +2213,19 @@ Implementation
                         DebugMsg('Peephole Bl2B done', p);
                       end;
                   end;
-
+                A_VADD,
+                A_VMUL,
+                A_VDIV,
+                A_VSUB,
+                A_VSQRT,
+                A_VNEG,
+                A_VCVT,
+                A_VABS:
+                  begin
+                    if GetNextInstructionUsingReg(p, hp1, taicpu(p).oper[0]^.reg) and
+                      RemoveSuperfluousVMov(p, hp1, 'VOpVMov2VOp') then
+                      Result:=true;
+                  end
               end;
           end;
       end;

+ 5 - 5
compiler/arm/armins.dat

@@ -1668,13 +1668,13 @@ vreg,vreg,vreg          \x92\xEE\xA0\xA\x40          THUMB32,VFPv4
 vreg,vreg,vreg          \x42\xE\xA0\xA\x40          ARM32,VFPv4
 
 [VFNMA]
-vreg,vreg,vreg          \x92\xEE\x90\xA\x00          THUMB32,VFPv4
-vreg,vreg,vreg          \x42\xE\x90\xA\x00          ARM32,VFPv4
-
-[VFNMS]
 vreg,vreg,vreg          \x92\xEE\x90\xA\x40          THUMB32,VFPv4
 vreg,vreg,vreg          \x42\xE\x90\xA\x40          ARM32,VFPv4
 
+[VFNMS]
+vreg,vreg,vreg          \x92\xEE\x90\xA\x00          THUMB32,VFPv4
+vreg,vreg,vreg          \x42\xE\x90\xA\x00          ARM32,VFPv4
+
 [VNEGcc]
 vreg,vreg               \x92\xEE\xB1\xA\x40         THUMB32,VFPv2
 vreg,vreg               \x42\xE\xB1\xA\x40         ARM32,VFPv2
@@ -1838,4 +1838,4 @@ fpureg,immshifter           \xA1\1\xD                     ARM32,FPA
 
 [LOGcc]
 fpureg,fpureg               \xA1\1\xB                     ARM32,FPA
-fpureg,immshifter           \xA1\1\xB                     ARM32,FPA
+fpureg,immshifter           \xA1\1\xB                     ARM32,FPA

+ 4 - 4
compiler/arm/armtab.inc

@@ -6101,28 +6101,28 @@
     opcode  : A_VFNMA;
     ops     : 3;
     optypes : (ot_vreg,ot_vreg,ot_vreg,ot_none,ot_none,ot_none);
-    code    : #146#238#144#10#0;
+    code    : #146#238#144#10#64;
     flags   : if_thumb32 or if_vfpv4
   ),
   (
     opcode  : A_VFNMA;
     ops     : 3;
     optypes : (ot_vreg,ot_vreg,ot_vreg,ot_none,ot_none,ot_none);
-    code    : #66#14#144#10#0;
+    code    : #66#14#144#10#64;
     flags   : if_arm32 or if_vfpv4
   ),
   (
     opcode  : A_VFNMS;
     ops     : 3;
     optypes : (ot_vreg,ot_vreg,ot_vreg,ot_none,ot_none,ot_none);
-    code    : #146#238#144#10#64;
+    code    : #146#238#144#10#0;
     flags   : if_thumb32 or if_vfpv4
   ),
   (
     opcode  : A_VFNMS;
     ops     : 3;
     optypes : (ot_vreg,ot_vreg,ot_vreg,ot_none,ot_none,ot_none);
-    code    : #66#14#144#10#64;
+    code    : #66#14#144#10#0;
     flags   : if_arm32 or if_vfpv4
   ),
   (

+ 20 - 8
compiler/arm/cgcpu.pas

@@ -290,7 +290,7 @@ unit cgcpu;
           non-overlapping subregs per register, so we can only use
           half the single precision registers for now (as sub registers of the
           double precision ones). }
-        if current_settings.fputype=fpu_vfpv3 then
+        if current_settings.fputype in [fpu_vfpv3,fpu_vfpv4] then
           rg[R_MMREGISTER]:=trgcpu.create(R_MMREGISTER,R_SUBFD,
               [RS_D0,RS_D1,RS_D2,RS_D3,RS_D4,RS_D5,RS_D6,RS_D7,
                RS_D16,RS_D17,RS_D18,RS_D19,RS_D20,RS_D21,RS_D22,RS_D23,RS_D24,RS_D25,RS_D26,RS_D27,RS_D28,RS_D29,RS_D30,RS_D31,
@@ -1922,9 +1922,13 @@ unit cgcpu;
                 end;
               fpu_vfpv2,
               fpu_vfpv3,
+              fpu_vfpv4,
               fpu_vfpv3_d16:
                 begin;
-                  mmregs:=rg[R_MMREGISTER].used_in_proc-paramanager.get_volatile_registers_mm(pocall_stdcall);
+                  { the *[0..31] is a hack to prevent that the compiler tries to save odd single-type registers,
+                    they have numbers>$1f which is not really correct as they should simply have the same numbers
+                    as the even ones by with a different subtype as it is done on x86 with al/ah }
+                  mmregs:=(rg[R_MMREGISTER].used_in_proc-paramanager.get_volatile_registers_mm(pocall_stdcall))*[0..31];
                 end;
             end;
             a_reg_alloc(list,NR_STACK_POINTER_REG);
@@ -2068,7 +2072,7 @@ unit cgcpu;
              begin
                reference_reset(ref,4);
                if (tg.direction*tarmprocinfo(current_procinfo).floatregstart>=1023) or
-                  (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv3_d16]) then
+                  (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv4,fpu_vfpv3_d16]) then
                  begin
                    if not is_shifter_const(tarmprocinfo(current_procinfo).floatregstart,shift) then
                      begin
@@ -2097,6 +2101,7 @@ unit cgcpu;
                    end;
                  fpu_vfpv2,
                  fpu_vfpv3,
+                 fpu_vfpv4,
                  fpu_vfpv3_d16:
                    begin
                      ref.index:=ref.base;
@@ -2106,7 +2111,8 @@ unit cgcpu;
                        postfix:=PF_IAX
                      else
                        postfix:=PF_IAD;}
-                     list.concat(taicpu.op_ref_regset(A_VSTM,ref,R_MMREGISTER,R_SUBFD,mmregs));
+                     if mmregs<>[] then
+                       list.concat(taicpu.op_ref_regset(A_VSTM,ref,R_MMREGISTER,R_SUBFD,mmregs));
                    end;
                end;
              end;
@@ -2157,10 +2163,14 @@ unit cgcpu;
                 end;
               fpu_vfpv2,
               fpu_vfpv3,
+              fpu_vfpv4,
               fpu_vfpv3_d16:
                 begin;
                   { restore vfp registers? }
-                  mmregs:=rg[R_MMREGISTER].used_in_proc-paramanager.get_volatile_registers_mm(pocall_stdcall);
+                  { the *[0..31] is a hack to prevent that the compiler tries to save odd single-type registers,
+                    they have numbers>$1f which is not really correct as they should simply have the same numbers
+                    as the even ones by with a different subtype as it is done on x86 with al/ah }
+                  mmregs:=(rg[R_MMREGISTER].used_in_proc-paramanager.get_volatile_registers_mm(pocall_stdcall))*[0..31];
                 end;
             end;
 
@@ -2169,7 +2179,7 @@ unit cgcpu;
               begin
                 reference_reset(ref,4);
                 if (tg.direction*tarmprocinfo(current_procinfo).floatregstart>=1023) or
-                   (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv3_d16]) then
+                   (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv4,fpu_vfpv3_d16]) then
                   begin
                     if not is_shifter_const(tarmprocinfo(current_procinfo).floatregstart,shift) then
                       begin
@@ -2197,6 +2207,7 @@ unit cgcpu;
                     end;
                   fpu_vfpv2,
                   fpu_vfpv3,
+                  fpu_vfpv4,
                   fpu_vfpv3_d16:
                     begin
                       ref.index:=ref.base;
@@ -2206,7 +2217,8 @@ unit cgcpu;
                         mmpostfix:=PF_IAX
                       else
                         mmpostfix:=PF_IAD;}
-                      list.concat(taicpu.op_ref_regset(A_VLDM,ref,R_MMREGISTER,R_SUBFD,mmregs));
+                     if mmregs<>[] then
+                       list.concat(taicpu.op_ref_regset(A_VLDM,ref,R_MMREGISTER,R_SUBFD,mmregs));
                     end;
                 end;
               end;
@@ -4219,7 +4231,7 @@ unit cgcpu;
         rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
             [RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5,RS_F6,RS_F7],first_fpu_imreg,[]);
 
-        if current_settings.fputype=fpu_vfpv3 then
+        if current_settings.fputype in [fpu_vfpv3,fpu_vfpv4] then
           rg[R_MMREGISTER]:=trgcpu.create(R_MMREGISTER,R_SUBFD,
               [RS_D0,RS_D1,RS_D2,RS_D3,RS_D4,RS_D5,RS_D6,RS_D7,
                RS_D16,RS_D17,RS_D18,RS_D19,RS_D20,RS_D21,RS_D22,RS_D23,RS_D24,RS_D25,RS_D26,RS_D27,RS_D28,RS_D29,RS_D30,RS_D31,

+ 1 - 1
compiler/arm/cpubase.pas

@@ -109,7 +109,7 @@ unit cpubase;
       { registers which may be destroyed by calls }
       VOLATILE_INTREGISTERS = [RS_R0..RS_R3,RS_R12..RS_R14];
       VOLATILE_FPUREGISTERS = [RS_F0..RS_F3];
-      VOLATILE_MMREGISTERS =  [RS_D0..RS_D7,RS_D16..RS_D31,RS_S1..RS_S15];
+      VOLATILE_MMREGISTERS =  [RS_D0..RS_D7,RS_D16..RS_D31];
 
       VOLATILE_INTREGISTERS_DARWIN = [RS_R0..RS_R3,RS_R9,RS_R12..RS_R14];
 

+ 4 - 2
compiler/arm/cpuinfo.pas

@@ -499,7 +499,9 @@ Const
        reference, but that's already done for stdcall) }
      pocall_mwpascal,
      { used for interrupt handling }
-     pocall_interrupt
+     pocall_interrupt,
+     { needed sometimes on android }
+     pocall_hardfloat
    ];
 
    cputypestr : array[tcputype] of string[8] = ('',
@@ -965,7 +967,7 @@ Const
       (controllertypestr:'THUMB2_BARE';	controllerunitstr:'THUMB2_BARE';	cputype:cpu_armv7m; fputype:fpu_soft; flashbase:$00000000;	flashsize:$00002000;	srambase:$20000000;	sramsize:$00000400)
     );
 
-   vfp_scalar = [fpu_vfpv2,fpu_vfpv3,fpu_vfpv3_d16,fpu_fpv4_s16];
+   vfp_scalar = [fpu_vfpv2,fpu_vfpv3,fpu_vfpv4,fpu_vfpv3_d16,fpu_fpv4_s16];
 
    { Supported optimizations, only used for information }
    supported_optimizerswitches = genericlevel1optimizerswitches+

+ 4 - 4
compiler/arm/cpupara.pas

@@ -129,12 +129,12 @@ unit cpupara;
             orddef:
               getparaloc:=LOC_REGISTER;
             floatdef:
-              if (target_info.abi = abi_eabihf) and
+              if ((target_info.abi=abi_eabihf) or (calloption=pocall_hardfloat)) and
                  (not isvariadic) then
                 getparaloc:=LOC_MMREGISTER
               else if (calloption in [pocall_cdecl,pocall_cppdecl,pocall_softfloat]) or
                  (cs_fp_emulation in current_settings.moduleswitches) or
-                 (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv3_d16,fpu_fpv4_s16]) then
+                 (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv4,fpu_vfpv3_d16,fpu_fpv4_s16]) then
                 { the ARM eabi also allows passing VFP values via VFP registers,
                   but Mac OS X doesn't seem to do that and linux only does it if
                   built with the "-mfloat-abi=hard" option }
@@ -626,7 +626,7 @@ unit cpupara;
         { Return in FPU register? }
         if result.def.typ=floatdef then
           begin
-            if target_info.abi = abi_eabihf then 
+            if (target_info.abi=abi_eabihf) or (p.proccalloption=pocall_hardfloat) then
               begin
                 paraloc^.loc:=LOC_MMREGISTER;
                 case retcgsize of
@@ -648,7 +648,7 @@ unit cpupara;
               end
             else if (p.proccalloption in [pocall_softfloat]) or
                (cs_fp_emulation in current_settings.moduleswitches) or
-               (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv3_d16,fpu_fpv4_s16]) then
+               (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv4,fpu_vfpv3_d16,fpu_fpv4_s16]) then
               begin
                 case retcgsize of
                   OS_64,

+ 1 - 0
compiler/arm/cpupi.pas

@@ -174,6 +174,7 @@ unit cpupi;
                 end;
               fpu_vfpv2,
               fpu_vfpv3,
+              fpu_vfpv4,
               fpu_vfpv3_d16:
                 begin
                   floatsavesize:=0;

+ 9 - 0
compiler/arm/narmadd.pas

@@ -34,6 +34,7 @@ interface
           function  GetResFlags(unsigned:Boolean):TResFlags;
           function  GetFpuResFlags:TResFlags;
        public
+          function use_fma : boolean;override;
           function pass_1 : tnode;override;
           function use_generic_mul32to64: boolean; override;
           function use_generic_mul64bit: boolean; override;
@@ -158,6 +159,12 @@ interface
       end;
 
 
+    function tarmaddnode.use_fma : boolean;
+      begin
+       Result:=current_settings.fputype in [fpu_vfpv4];
+      end;
+
+
     procedure tarmaddnode.second_addfloat;
       var
         op : TAsmOp;
@@ -200,6 +207,7 @@ interface
             end;
           fpu_vfpv2,
           fpu_vfpv3,
+          fpu_vfpv4,
           fpu_vfpv3_d16:
             begin
               { force mmreg as location, left right doesn't matter
@@ -299,6 +307,7 @@ interface
             end;
           fpu_vfpv2,
           fpu_vfpv3,
+          fpu_vfpv4,
           fpu_vfpv3_d16:
             begin
               hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,true);

+ 3 - 2
compiler/arm/narmcal.pas

@@ -45,9 +45,10 @@ implementation
   procedure tarmcallnode.set_result_location(realresdef: tstoreddef);
     begin
       if (realresdef.typ=floatdef) and 
-         (target_info.abi <> abi_eabihf) and
+         (target_info.abi<>abi_eabihf) and
+         (procdefinition.proccalloption<>pocall_hardfloat) and
          ((cs_fp_emulation in current_settings.moduleswitches) or
-          (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv3_d16,fpu_fpv4_s16])) then
+          (current_settings.fputype in [fpu_vfpv2,fpu_vfpv3,fpu_vfpv4,fpu_vfpv3_d16,fpu_fpv4_s16])) then
         begin
           { keep the fpu values in integer registers for now, the code
             generator will move them to memory or an mmregister when necessary

+ 2 - 0
compiler/arm/narmcnv.pas

@@ -116,6 +116,7 @@ implementation
                 expectloc:=LOC_FPUREGISTER;
               fpu_vfpv2,
               fpu_vfpv3,
+              fpu_vfpv4,
               fpu_vfpv3_d16,
               fpu_fpv4_s16:
                 expectloc:=LOC_MMREGISTER;
@@ -242,6 +243,7 @@ implementation
             end;
           fpu_vfpv2,
           fpu_vfpv3,
+          fpu_vfpv4,
           fpu_vfpv3_d16:
             begin
               location_reset(location,LOC_MMREGISTER,def_cgsize(resultdef));

+ 111 - 1
compiler/arm/narminl.pas

@@ -33,6 +33,7 @@ interface
         function first_abs_real: tnode; override;
         function first_sqr_real: tnode; override;
         function first_sqrt_real: tnode; override;
+        function first_fma : tnode; override;
         { atn,sin,cos,lgn isn't supported by the linux fpe
         function first_arctan_real: tnode; override;
         function first_ln_real: tnode; override;
@@ -50,6 +51,7 @@ interface
         }
         procedure second_prefetch; override;
         procedure second_abs_long; override;
+        procedure second_fma; override;
       private
         procedure load_fpu_location(out singleprec: boolean);
       end;
@@ -61,7 +63,8 @@ implementation
       globtype,verbose,globals,
       cpuinfo, defutil,symdef,aasmdata,aasmcpu,
       cgbase,cgutils,pass_1,pass_2,
-      cpubase,ncgutil,cgobj,cgcpu, hlcgobj;
+      cpubase,ncgutil,cgobj,cgcpu, hlcgobj,
+      ncal;
 
 {*****************************************************************************
                               tarminlinenode
@@ -85,6 +88,7 @@ implementation
             end;
           fpu_vfpv2,
           fpu_vfpv3,
+          fpu_vfpv4,
           fpu_vfpv3_d16,
           fpu_fpv4_s16:
             begin
@@ -125,6 +129,7 @@ implementation
                 expectloc:=LOC_FPUREGISTER;
               fpu_vfpv2,
               fpu_vfpv3,
+              fpu_vfpv4,
               fpu_vfpv3_d16:
                 expectloc:=LOC_MMREGISTER;
               fpu_fpv4_s16:
@@ -155,6 +160,7 @@ implementation
                 expectloc:=LOC_FPUREGISTER;
               fpu_vfpv2,
               fpu_vfpv3,
+              fpu_vfpv4,
               fpu_vfpv3_d16:
                 expectloc:=LOC_MMREGISTER;
               fpu_fpv4_s16:
@@ -185,6 +191,7 @@ implementation
                 expectloc:=LOC_FPUREGISTER;
               fpu_vfpv2,
               fpu_vfpv3,
+              fpu_vfpv4,
               fpu_vfpv3_d16:
                 expectloc:=LOC_MMREGISTER;
               fpu_fpv4_s16:
@@ -202,6 +209,19 @@ implementation
       end;
 
 
+     function tarminlinenode.first_fma : tnode;
+       begin
+         if (true) and
+           ((is_double(resultdef)) or (is_single(resultdef))) then
+           begin
+             expectloc:=LOC_MMREGISTER;
+             Result:=nil;
+           end
+         else
+           Result:=inherited first_fma;
+       end;
+
+
     { atn,sin,cos,lgn isn't supported by the linux fpe
     function tarminlinenode.first_arctan_real: tnode;
       begin
@@ -244,6 +264,7 @@ implementation
             current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_ABS,location.register,left.location.register),get_fpu_postfix(resultdef)));
           fpu_vfpv2,
           fpu_vfpv3,
+          fpu_vfpv4,
           fpu_vfpv3_d16:
             begin
               if singleprec then
@@ -280,6 +301,7 @@ implementation
             current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(A_MUF,location.register,left.location.register,left.location.register),get_fpu_postfix(resultdef)));
           fpu_vfpv2,
           fpu_vfpv3,
+          fpu_vfpv4,
           fpu_vfpv3_d16:
             begin
               if singleprec then
@@ -309,6 +331,7 @@ implementation
             current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg(A_SQT,location.register,left.location.register),get_fpu_postfix(resultdef)));
           fpu_vfpv2,
           fpu_vfpv3,
+          fpu_vfpv4,
           fpu_vfpv3_d16:
             begin
               if singleprec then
@@ -404,6 +427,93 @@ implementation
         cg.a_reg_dealloc(current_asmdata.CurrAsmList,NR_DEFAULTFLAGS);
       end;
 
+
+    procedure tarminlinenode.second_fma;
+      const
+        op : array[false..true,false..true] of TAsmOp =
+          { positive product }
+          (
+           { positive third operand }
+           (A_VFMA,
+           { negative third operand }
+            A_VFNMS),
+           { negative product }
+            { positive third operand }
+            (A_VFMS,
+             A_VFNMA)
+           );
+
+      var
+        paraarray : array[1..3] of tnode;
+        i : integer;
+        negop3,
+        negproduct : boolean;
+        oppostfix : TOpPostfix;
+      begin
+         if current_settings.fputype in [fpu_vfpv4] then
+           begin
+             negop3:=false;
+             negproduct:=false;
+             paraarray[1]:=tcallparanode(tcallparanode(tcallparanode(parameters).nextpara).nextpara).paravalue;
+             paraarray[2]:=tcallparanode(tcallparanode(parameters).nextpara).paravalue;
+             paraarray[3]:=tcallparanode(parameters).paravalue;
+
+             { check if a neg. node can be removed
+               this is possible because changing the sign of
+               a floating point number does not affect its absolute
+               value in any way
+             }
+             if paraarray[1].nodetype=unaryminusn then
+               begin
+                 paraarray[1]:=tunarynode(paraarray[1]).left;
+                 { do not release the unused unary minus node, it is kept and release together with the other nodes,
+                   only no code is generated for it }
+                 negproduct:=not(negproduct);
+               end;
+
+             if paraarray[2].nodetype=unaryminusn then
+               begin
+                 paraarray[2]:=tunarynode(paraarray[2]).left;
+                 { do not release the unused unary minus node, it is kept and release together with the other nodes,
+                   only no code is generated for it }
+                 negproduct:=not(negproduct);
+               end;
+
+             if paraarray[3].nodetype=unaryminusn then
+               begin
+                 paraarray[3]:=tunarynode(paraarray[3]).left;
+                 { do not release the unused unary minus node, it is kept and release together with the other nodes,
+                   only no code is generated for it }
+                 negop3:=true;
+               end;
+
+              for i:=1 to 3 do
+               secondpass(paraarray[i]);
+
+             { no memory operand is allowed }
+             for i:=1 to 3 do
+               begin
+                 if not(paraarray[i].location.loc in [LOC_MMREGISTER,LOC_CMMREGISTER]) then
+                   hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,paraarray[i].location,paraarray[i].resultdef,true);
+               end;
+
+             location_reset(location,LOC_MMREGISTER,paraarray[1].location.size);
+             location.register:=cg.getmmregister(current_asmdata.CurrAsmList,location.size);
+
+             hlcg.a_loadmm_reg_reg(current_asmdata.CurrAsmList,paraarray[3].resultdef,resultdef,
+               paraarray[3].location.register,location.register,mms_movescalar);
+             if is_double(resultdef) then
+               oppostfix:=PF_F64
+             else
+               oppostfix:=PF_F32;
+             current_asmdata.CurrAsmList.concat(setoppostfix(taicpu.op_reg_reg_reg(op[negproduct,negop3],
+               location.register,paraarray[1].location.register,paraarray[2].location.register),oppostfix));
+           end
+         else
+           internalerror(2014032301);
+      end;
+
+
 begin
   cinlinenode:=tarminlinenode;
 end.

+ 1 - 0
compiler/arm/narmmat.pas

@@ -409,6 +409,7 @@ implementation
             end;
           fpu_vfpv2,
           fpu_vfpv3,
+          fpu_vfpv4,
           fpu_vfpv3_d16:
             begin
               hlcg.location_force_mmregscalar(current_asmdata.CurrAsmList,left.location,left.resultdef,true);

+ 5 - 0
compiler/arm/rgcpu.pas

@@ -346,6 +346,11 @@ unit rgcpu;
               supreg:=getsupreg(reg);
               for i:=RS_D16 to RS_D31 do
                 add_edge(supreg,i);
+              { further, we cannot use the odd single registers as the register
+                allocator cannot handle overlapping registers so far }
+              for i in [RS_S1,RS_S3,RS_S5,RS_S7,RS_S9,RS_S11,RS_S13,RS_S15,RS_S17,RS_S19,
+                RS_S21,RS_S23,RS_S25,RS_S27,RS_S29,RS_S31] do
+                add_edge(supreg,i);
             end;
         end;
       end;

+ 34 - 3
compiler/assemble.pas

@@ -248,9 +248,7 @@ Implementation
       cclasses,
 {$endif memdebug}
       script,fmodule,verbose,
-{$if defined(m68k) or defined(arm)}
       cpuinfo,
-{$endif m68k or arm}
       aasmcpu,
       owar,owomflib
       ;
@@ -1482,6 +1480,7 @@ Implementation
       var
         objsym,
         objsymend : TObjSymbol;
+        cpu: tcputype;
       begin
         while assigned(hp) do
          begin
@@ -1562,6 +1561,16 @@ Implementation
                    asd_reference:
                      { ignore for now, but should be added}
                      ;
+                   asd_cpu:
+                     begin
+                       ObjData.CPUType:=cpu_none;
+                       for cpu:=low(tcputype) to high(tcputype) do
+                         if cputypestr[cpu]=tai_directive(hp).name then
+                           begin
+                             ObjData.CPUType:=cpu;
+                             break;
+                           end;
+                     end;
 {$ifdef ARM}
                    asd_thumb_func:
                      ObjData.ThumbFunc:=true;
@@ -1610,6 +1619,7 @@ Implementation
       var
         objsym,
         objsymend : TObjSymbol;
+        cpu: tcputype;
       begin
         while assigned(hp) do
          begin
@@ -1714,6 +1724,16 @@ Implementation
                    asd_code:
                      { ignore for now, but should be added}
                      ;
+                   asd_cpu:
+                     begin
+                       ObjData.CPUType:=cpu_none;
+                       for cpu:=low(tcputype) to high(tcputype) do
+                         if cputypestr[cpu]=tai_directive(hp).name then
+                           begin
+                             ObjData.CPUType:=cpu;
+                             break;
+                           end;
+                     end;
                    else
                      internalerror(2010011102);
                  end;
@@ -1743,6 +1763,7 @@ Implementation
         {$endif}
         ccomp : comp;
         tmp    : word;
+        cpu: tcputype;
       begin
         fillchar(zerobuf,sizeof(zerobuf),0);
         fillchar(objsym,sizeof(objsym),0);
@@ -1943,7 +1964,17 @@ Implementation
                          { TODO: should become a weak definition; for now, do
                              the same as what was done for ait_weak }
                          objsym.bind:=AB_WEAK_EXTERNAL;
-                     end
+                     end;
+                   asd_cpu:
+                     begin
+                       ObjData.CPUType:=cpu_none;
+                       for cpu:=low(tcputype) to high(tcputype) do
+                         if cputypestr[cpu]=tai_directive(hp).name then
+                           begin
+                             ObjData.CPUType:=cpu;
+                             break;
+                           end;
+                     end;
                  end
                end;
              ait_symbolpair:

+ 3 - 3
compiler/cgobj.pas

@@ -1323,7 +1323,7 @@ implementation
                     tmpreg2:=makeregsize(list,register,OS_16);
                     a_load_ref_reg(list,OS_8,OS_16,tmpref,tmpreg2);
                     a_op_reg_reg(list,OP_OR,OS_16,tmpreg,tmpreg2);
-                    a_load_reg_reg(list,OS_16,tosize,tmpreg2,register);
+                    a_load_reg_reg(list,fromsize,tosize,tmpreg2,register);
                   end;
               OS_32,OS_S32:
                 if ref.alignment=2 then
@@ -1340,7 +1340,7 @@ implementation
                     tmpreg2:=makeregsize(list,register,OS_32);
                     a_load_ref_reg(list,OS_16,OS_32,tmpref,tmpreg2);
                     a_op_reg_reg(list,OP_OR,OS_32,tmpreg,tmpreg2);
-                    a_load_reg_reg(list,OS_32,tosize,tmpreg2,register);
+                    a_load_reg_reg(list,fromsize,tosize,tmpreg2,register);
                   end
                 else
                   begin
@@ -1359,7 +1359,7 @@ implementation
                         a_load_ref_reg(list,OS_8,OS_32,tmpref,tmpreg2);
                         a_op_reg_reg(list,OP_OR,OS_32,tmpreg2,tmpreg);
                       end;
-                    a_load_reg_reg(list,OS_32,tosize,tmpreg,register);
+                    a_load_reg_reg(list,fromsize,tosize,tmpreg,register);
                   end
               else
                 a_load_ref_reg(list,fromsize,tosize,tmpref,register);

+ 17 - 0
compiler/cutils.pas

@@ -103,6 +103,7 @@ interface
        exponent value is returned in power.
     }
     function ispowerof2(value : int64;out power : longint) : boolean;
+    function ispowerof2(value : Tconstexprint;out power : longint) : boolean;
     function nextpowerof2(value : int64; out power: longint) : int64;
 {$ifdef VER2_6}  { only 2.7.1+ has a popcnt function in the system unit }
     function PopCnt(AValue : Byte): Byte;
@@ -866,6 +867,22 @@ implementation
       end;
 
 
+    function ispowerof2(value: Tconstexprint; out power: longint): boolean;
+      begin
+        if value.signed or
+           (value.uvalue<=high(int64)) then
+          result:=ispowerof2(value.svalue,power)
+        else if not value.signed and
+            (value.svalue=low(int64)) then
+          begin
+            result:=true;
+            power:=63;
+          end
+        else
+          result:=false;
+      end;
+
+
     function nextpowerof2(value : int64; out power: longint) : int64;
     {
       returns the power of 2 >= value

+ 41 - 1
compiler/dbgdwarf.pas

@@ -2231,6 +2231,11 @@ implementation
 
             append_labelentry(DW_AT_low_pc,current_asmdata.RefAsmSymbol(procentry));
             append_labelentry(DW_AT_high_pc,procendlabel);
+
+            current_asmdata.asmlists[al_dwarf_aranges].Concat(
+              tai_const.create_type_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry)));
+            current_asmdata.asmlists[al_dwarf_aranges].Concat(
+              tai_const.Create_rel_sym(aitconst_ptr_unaligned,current_asmdata.RefAsmSymbol(procentry),procendlabel));
           end;
 
         { Don't write the funcretsym explicitly, it's also in the
@@ -3152,7 +3157,7 @@ implementation
 
       var
         storefilepos  : tfileposinfo;
-        lenstartlabel : tasmlabel;
+        lenstartlabel,arangestartlabel: tasmlabel;
         i : longint;
         def: tdef;
         dbgname: string;
@@ -3192,6 +3197,36 @@ implementation
         { start abbrev section }
         new_section(current_asmdata.asmlists[al_dwarf_abbrev],sec_debug_abbrev,'',0);
 
+        { start aranges section }
+        new_section(current_asmdata.asmlists[al_dwarf_aranges],sec_debug_aranges,'',0);
+
+        current_asmdata.getlabel(arangestartlabel,alt_dbgfile);
+
+        if use_64bit_headers then
+          current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_32bit_unaligned(longint($FFFFFFFF)));
+        current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_rel_sym(offsetreltype,
+          arangestartlabel,current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'earanges0',AB_LOCAL,AT_DATA)));
+
+        current_asmdata.asmlists[al_dwarf_aranges].concat(tai_label.create(arangestartlabel));
+
+        current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_16bit_unaligned(2));
+
+        if not(tf_dwarf_relative_addresses in target_info.flags) then
+          current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_type_sym(offsetabstype,
+            current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_DATA)))
+        else
+          current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_rel_sym(offsetreltype,
+            current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_infosection0',AB_LOCAL,AT_DATA),
+            current_asmdata.DefineAsmSymbol(target_asm.labelprefix+'debug_info0',AB_LOCAL,AT_DATA)));
+
+        current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(sizeof(pint)));
+        current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_8bit(0));
+        { alignment }
+        current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.create_32bit_unaligned(0));
+
+        { start ranges section }
+        new_section(current_asmdata.asmlists[al_dwarf_ranges],sec_debug_ranges,'',0);
+
         { debug info header }
         current_asmdata.getlabel(lenstartlabel,alt_dbgfile);
         { size }
@@ -3286,6 +3321,11 @@ implementation
         { end of abbrev table }
         current_asmdata.asmlists[al_dwarf_abbrev].concat(tai_const.create_8bit(0));
 
+        { end of aranges table }
+        current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_aint(0));
+        current_asmdata.asmlists[al_dwarf_aranges].concat(tai_const.Create_aint(0));
+        current_asmdata.asmlists[al_dwarf_aranges].concat(tai_symbol.createname(target_asm.labelprefix+'earanges0',AT_DATA,0));
+
         { reset all def debug states }
         for i:=0 to defnumberlist.count-1 do
           begin

+ 6 - 1
compiler/entfile.pas

@@ -38,6 +38,10 @@ const
   subentryid          = 2;
   {special}
   iberror             = 0;
+  ibstartrequireds    = 244;
+  ibendrequireds      = 245;
+  ibstartcontained    = 246;
+  ibendcontained      = 247;
   ibstartdefs         = 248;
   ibenddefs           = 249;
   ibstartsyms         = 250;
@@ -117,6 +121,8 @@ const
   ibmainname       = 90;
   ibsymtableoptions = 91;
   ibrecsymtableoptions = 91;
+  ibpackagefiles   = 92;
+  ibpackagename    = 93;
   { target-specific things }
   iblinkotherframeworks = 100;
   ibjvmnamespace = 101;
@@ -409,7 +415,6 @@ end;
 
 function tentryfile.openfile:boolean;
 var
-  i      : integer;
   strm : TCStream;
 begin
   openfile:=false;

+ 394 - 0
compiler/fpcp.pas

@@ -0,0 +1,394 @@
+{
+    Copyright (c) 2013-2016 by Free Pascal development team
+
+    This unit implements the loading and searching of package files
+
+    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 fpcp;
+
+{$i fpcdefs.inc}
+
+interface
+
+  uses
+    cclasses,
+    globtype,
+    pcp,finput,fpkg;
+
+  type
+    tpcppackage=class(tpackage)
+    private
+      loaded : boolean;
+      pcpfile : tpcpfile;
+    private
+      function openpcp:boolean;
+      function search_package(ashortname:boolean):boolean;
+      function search_package_file:boolean;
+      procedure setfilename(const fn:string;allowoutput:boolean);
+      procedure writecontainernames;
+      procedure writecontainedunits;
+      procedure readcontainernames;
+      procedure readcontainedunits;
+    public
+      constructor create(const pn:string);
+      destructor destroy; override;
+      procedure loadpcp;
+      procedure savepcp;
+      procedure initmoduleinfo(module:tmodulebase);
+      procedure addunit(module:tmodulebase);
+    end;
+
+implementation
+
+  uses
+    sysutils,
+    cfileutl,cutils,
+    systems,globals,version,
+    verbose,
+    entfile,fppu;
+
+{ tpcppackage }
+
+  function tpcppackage.openpcp: boolean;
+    var
+      pcpfiletime : longint;
+    begin
+      result:=false;
+      Message1(package_t_pcp_loading,pcpfilename);
+      { Get pcpfile time (also check if the file exists) }
+      pcpfiletime:=getnamedfiletime(pcpfilename);
+      if pcpfiletime=-1 then
+       exit;
+    { Open the pcpfile }
+      Message1(package_u_pcp_name,pcpfilename);
+      pcpfile:=tpcpfile.create(pcpfilename);
+      if not pcpfile.openfile then
+       begin
+         pcpfile.free;
+         pcpfile:=nil;
+         Message(package_u_pcp_file_too_short);
+         exit;
+       end;
+    { check for a valid PPU file }
+      if not pcpfile.checkpcpid then
+       begin
+         pcpfile.free;
+         pcpfile:=nil;
+         Message(package_u_pcp_invalid_header);
+         exit;
+       end;
+    { check for allowed PCP versions }
+      if not (pcpfile.getversion=CurrentPCPVersion) then
+       begin
+         Message1(package_u_pcp_invalid_version,tostr(pcpfile.getversion));
+         pcpfile.free;
+         pcpfile:=nil;
+         exit;
+       end;
+    { check the target processor }
+      if tsystemcpu(pcpfile.header.common.cpu)<>target_cpu then
+       begin
+         pcpfile.free;
+         pcpfile:=nil;
+         Message(package_u_pcp_invalid_processor);
+         exit;
+       end;
+    { check target }
+      if tsystem(pcpfile.header.common.target)<>target_info.system then
+       begin
+         pcpfile.free;
+         pcpfile:=nil;
+         Message(package_u_pcp_invalid_target);
+         exit;
+       end;
+  {$ifdef cpufpemu}
+     { check if floating point emulation is on?
+       fpu emulation isn't unit levelwise because it affects calling convention }
+     if ((pcpfile.header.common.flags and uf_fpu_emulation)<>0) xor
+          (cs_fp_emulation in current_settings.moduleswitches) then
+       begin
+         pcpfile.free;
+         pcpfile:=nil;
+         Message(package_u_pcp_invalid_fpumode);
+         exit;
+       end;
+  {$endif cpufpemu}
+
+    { Load values to be access easier }
+      //flags:=pcpfile.header.common.flags;
+      //crc:=pcpfile.header.checksum;
+    { Show Debug info }
+      Message1(package_u_pcp_time,filetimestring(pcpfiletime));
+      Message1(package_u_pcp_flags,tostr(pcpfile.header.common.flags{flags}));
+      Message1(package_u_pcp_crc,hexstr(pcpfile.header.checksum,8));
+      (*Message1(package_u_pcp_crc,hexstr(ppufile.header.interface_checksum,8)+' (intfc)');
+      Message1(package_u_pcp_crc,hexstr(ppufile.header.indirect_checksum,8)+' (indc)');
+      Comment(V_used,'Number of definitions: '+tostr(ppufile.header.deflistsize));
+      Comment(V_used,'Number of symbols: '+tostr(ppufile.header.symlistsize));
+      do_compile:=false;*)
+      result:=true;
+    end;
+
+  function tpcppackage.search_package(ashortname:boolean):boolean;
+    var
+      singlepathstring,
+      filename : TCmdStr;
+
+    function package_exists(const ext:string;var foundfile:TCmdStr):boolean;
+      begin
+        if CheckVerbosity(V_Tried) then
+          Message1(package_t_packagesearch,Singlepathstring+filename+ext);
+        result:=FindFile(filename+ext,singlepathstring,true,foundfile);
+      end;
+
+    function package_search_path(const s:TCmdStr):boolean;
+      var
+        found : boolean;
+        hs    : TCmdStr;
+      begin
+        found:=false;
+        singlepathstring:=FixPath(s,false);
+        { Check for package file }
+        { TODO }
+        found:=package_exists({target_info.pkginfoext}'.pcp',hs);
+        if found then
+          begin
+            setfilename(hs,false);
+            found:=openpcp;
+          end;
+        result:=found;
+      end;
+
+    function search_path_list(list:TSearchPathList):boolean;
+      var
+        hp : TCmdStrListItem;
+        found : boolean;
+      begin
+        found:=false;
+        hp:=TCmdStrListItem(list.First);
+        while assigned(hp) do
+         begin
+           found:=package_search_path(hp.Str);
+           if found then
+            break;
+           hp:=TCmdStrListItem(hp.next);
+         end;
+        result:=found;
+      end;
+
+    begin
+      filename:=packagename^;
+      result:=search_path_list(packagesearchpath);
+    end;
+
+  function tpcppackage.search_package_file: boolean;
+    var
+      found : boolean;
+    begin
+      found:=false;
+      if search_package(false) then
+        found:=true;
+      if not found and
+          (length(packagename^)>8) and
+         search_package(true) then
+        found:=true;
+      result:=found;
+    end;
+
+  procedure tpcppackage.setfilename(const fn:string;allowoutput:boolean);
+    var
+      p,n : tpathstr;
+    begin
+      p:=FixPath(ExtractFilePath(fn),false);
+      n:=FixFileName(ChangeFileExt(ExtractFileName(fn),''));
+      { pcp name }
+      if allowoutput then
+        if (OutputUnitDir<>'') then
+          p:=OutputUnitDir
+        else
+          if (OutputExeDir<>'') then
+            p:=OutputExeDir;
+      pcpfilename:=p+n+{target_info.pkginfoext}'.pcp';
+    end;
+
+  procedure tpcppackage.writecontainernames;
+    begin
+      pcpfile.putstring(pplfilename);
+      //pcpfile.putstring(ppafilename);
+      pcpfile.writeentry(ibpackagefiles);
+    end;
+
+  procedure tpcppackage.writecontainedunits;
+    var
+      p : pcontainedunit;
+      i : longint;
+    begin
+      pcpfile.putlongint(containedmodules.count);
+      pcpfile.writeentry(ibstartcontained);
+      { for now we write the unit name and the ppu file name }
+      for i:=0 to containedmodules.count-1 do
+        begin
+          p:=pcontainedunit(containedmodules.items[i]);
+          pcpfile.putstring(p^.module.modulename^);
+          pcpfile.putstring(p^.ppufile);
+        end;
+      pcpfile.writeentry(ibendcontained);
+    end;
+
+  procedure tpcppackage.readcontainernames;
+    begin
+      if pcpfile.readentry<>ibpackagefiles then
+        begin
+          message(package_f_pcp_read_error);
+          internalerror(424242);
+        end;
+      pplfilename:=pcpfile.getstring;
+
+      writeln('PPL filename: ',pplfilename);
+    end;
+
+  procedure tpcppackage.readcontainedunits;
+    var
+      cnt,i : longint;
+      name,path : string;
+      p : pcontainedunit;
+    begin
+      if pcpfile.readentry<>ibstartcontained then
+        begin
+          message(package_f_pcp_read_error);
+          internalerror(424242);
+        end;
+      cnt:=pcpfile.getlongint;
+      if pcpfile.readentry<>ibendcontained then
+        begin
+          message(package_f_pcp_read_error);
+          internalerror(424242);
+        end;
+      for i:=0 to cnt-1 do
+        begin
+          name:=pcpfile.getstring;
+          path:=ChangeFileExt(pcpfile.getstring,'.ppl.ppu');
+          new(p);
+          p^.module:=nil;
+          p^.ppufile:=path;
+          containedmodules.add(name,p);
+          message1(package_u_contained_unit,name);
+        end;
+    end;
+
+    constructor tpcppackage.create(const pn: string);
+    begin
+      inherited create(pn);
+      setfilename(pn,true);
+    end;
+
+  destructor tpcppackage.destroy;
+    begin
+      pcpfile.free;
+      inherited destroy;
+    end;
+
+  procedure tpcppackage.loadpcp;
+    var
+      newpackagename : string;
+    begin
+      if loaded then
+        exit;
+
+      if not search_package_file then
+        begin
+          Message1(package_f_cant_find_pcp,realpackagename^);
+          exit;
+        end
+      else
+        Message1(package_u_pcp_found,realpackagename^);
+
+      if not assigned(pcpfile) then
+        internalerror(2013053101);
+
+      if pcpfile.readentry<>ibpackagename then
+        Message1(package_f_cant_read_pcp,realpackagename^);
+      newpackagename:=pcpfile.getstring;
+      if upper(newpackagename)<>packagename^ then
+        Comment(V_Error,'Package was renamed: '+realpackagename^);
+
+      readcontainernames;
+
+      //readrequiredpackages
+
+      readcontainedunits;
+    end;
+
+  procedure tpcppackage.savepcp;
+    begin
+      { create new ppufile }
+      pcpfile:=tpcpfile.create(pcpfilename);
+      if not pcpfile.createfile then
+        Message2(package_f_cant_create_pcp,realpackagename^,pcpfilename);
+
+      pcpfile.putstring(realpackagename^);
+      pcpfile.writeentry(ibpackagename);
+
+      writecontainernames;
+
+      //writerequiredpackages;
+
+      writecontainedunits;
+
+      //writeppus;
+
+      { the last entry ibend is written automatically }
+
+      { flush to be sure }
+      pcpfile.flush;
+      { create and write header }
+      pcpfile.header.common.size:=pcpfile.size;
+      pcpfile.header.checksum:=pcpfile.crc;
+      pcpfile.header.common.compiler:=wordversion;
+      pcpfile.header.common.cpu:=word(target_cpu);
+      pcpfile.header.common.target:=word(target_info.system);
+      //pcpfile.header.flags:=flags;
+      pcpfile.header.ppulistsize:=containedmodules.count;
+      pcpfile.header.requiredlistsize:=requiredpackages.count;
+      pcpfile.writeheader;
+
+      { save crc in current module also }
+      //crc:=pcpfile.crc;
+
+      pcpfile.closefile;
+      pcpfile.free;
+      pcpfile:=nil;
+    end;
+
+  procedure tpcppackage.initmoduleinfo(module: tmodulebase);
+    begin
+      pplfilename:=extractfilename(module.sharedlibfilename);
+    end;
+
+  procedure tpcppackage.addunit(module: tmodulebase);
+    var
+      containedunit : pcontainedunit;
+    begin
+      new(containedunit);
+      containedunit^.module:=module;
+      containedunit^.ppufile:=extractfilename(module.ppufilename);
+      containedmodules.add(module.modulename^,containedunit);
+    end;
+
+end.
+

+ 131 - 0
compiler/fpkg.pas

@@ -0,0 +1,131 @@
+{
+    Copyright (c) 2013-2016 by Free Pascal Development Team
+
+    This unit implements basic parts of the package system
+
+    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 fpkg;
+
+{$i fpcdefs.inc}
+
+interface
+
+  uses
+    cclasses,
+    globtype,
+    finput;
+
+  type
+    tcontainedunit=record
+      module:tmodulebase;
+      ppufile:tpathstr;
+    end;
+    pcontainedunit=^tcontainedunit;
+
+    tpackage=class
+    public
+      realpackagename,
+      packagename : pshortstring;
+      containedmodules : TFPHashList;
+      requiredpackages : TFPHashObjectList;
+      pcpfilename,
+      ppafilename,
+      pplfilename : tpathstr;
+      constructor create(const pn:string);
+      destructor destroy;override;
+    end;
+
+    tpackageentry=record
+      package : tpackage;
+      realpkgname : string;
+    end;
+    ppackageentry=^tpackageentry;
+
+    procedure addpackage(list:tfphashlist;const pn:string);
+
+implementation
+
+  uses
+    cutils,globals;
+
+  procedure addpackage(list: tfphashlist;const pn:string);
+    var
+      pkgentry : ppackageentry;
+    begin
+      new(pkgentry);
+      pkgentry^.realpkgname:=pn;
+      pkgentry^.package:=nil;
+      list.add(upper(pn),pkgentry);
+    end;
+
+  { tpackage }
+
+  constructor tpackage.create(const pn: string);
+    begin
+      realpackagename:=stringdup(pn);
+      packagename:=stringdup(upper(pn));
+      containedmodules:=TFPHashList.Create;
+      requiredpackages:=TFPHashObjectList.Create(false);
+    end;
+
+  destructor tpackage.destroy;
+    var
+      p : pcontainedunit;
+      i : longint;
+    begin
+      if assigned(containedmodules) then
+        for i:=0 to containedmodules.count-1 do
+          begin
+            p:=pcontainedunit(containedmodules[i]);
+            dispose(p);
+          end;
+      containedmodules.free;
+      requiredpackages.free;
+      inherited destroy;
+    end;
+
+
+    procedure packageinit;
+      begin
+        packagelist:=TFPHashList.Create;
+      end;
+
+
+    procedure packagedone;
+      var
+        i : longint;
+        pkgentry : ppackageentry;
+      begin
+        if assigned(packagelist) then
+          begin
+            for i:=0 to packagelist.count-1 do
+              begin
+                pkgentry:=ppackageentry(packagelist[i]);
+                pkgentry^.package.free;
+                dispose(pkgentry);
+              end;
+          end;
+        packagelist.Free;
+        packagelist:=nil;
+      end;
+
+
+initialization
+  register_initdone_proc(@packageinit,@packagedone);
+end.
+

+ 93 - 1
compiler/fppu.pas

@@ -79,6 +79,7 @@ interface
           function  openppu(ppufiletime:longint):boolean;
           function  search_unit_files(onlysource:boolean):boolean;
           function  search_unit(onlysource,shortname:boolean):boolean;
+          function  loadfrompackage:boolean;
           procedure load_interface;
           procedure load_implementation;
           procedure load_usedunits;
@@ -121,7 +122,7 @@ uses
   aasmbase,ogbase,
   parser,
   comphook,
-  entfile;
+  entfile,fpkg;
 
 
 var
@@ -209,6 +210,7 @@ var
 
     function tppumodule.openppustream(strm:TCStream):boolean;
       begin
+        result:=false;
       { Open the ppufile }
         Message1(unit_u_ppu_name,ppufilename);
         ppufile:=tcompilerppufile.create(ppufilename);
@@ -506,6 +508,86 @@ var
          search_unit:=fnd;
       end;
 
+    function tppumodule.loadfrompackage: boolean;
+      var
+        singlepathstring,
+        filename : TCmdStr;
+
+        Function UnitExists(const ext:string;var foundfile:TCmdStr):boolean;
+          begin
+            if CheckVerbosity(V_Tried) then
+              Message1(unit_t_unitsearch,Singlepathstring+filename);
+            UnitExists:=FindFile(FileName,Singlepathstring,true,foundfile);
+          end;
+
+        Function PPUSearchPath(const s:TCmdStr):boolean;
+          var
+            found : boolean;
+            hs    : TCmdStr;
+          begin
+            Found:=false;
+            singlepathstring:=FixPath(s,false);
+          { Check for PPU file }
+            Found:=UnitExists(target_info.unitext,hs);
+            if Found then
+             Begin
+               SetFileName(hs,false);
+               Found:=openppufile;
+             End;
+            PPUSearchPath:=Found;
+          end;
+
+        Function SearchPathList(list:TSearchPathList):boolean;
+          var
+            hp : TCmdStrListItem;
+            found : boolean;
+          begin
+            found:=false;
+            hp:=TCmdStrListItem(list.First);
+            while assigned(hp) do
+             begin
+               found:=PPUSearchPath(hp.Str);
+               if found then
+                break;
+               hp:=TCmdStrListItem(hp.next);
+             end;
+            SearchPathList:=found;
+          end;
+
+      var
+        pkg : ppackageentry;
+        pkgunit : pcontainedunit;
+        i,idx : longint;
+      begin
+        result:=false;
+        for i:=0 to packagelist.count-1 do
+          begin
+            pkg:=ppackageentry(packagelist[i]);
+            if not assigned(pkg^.package) then
+              internalerror(2013053103);
+            idx:=pkg^.package.containedmodules.FindIndexOf(modulename^);
+            if idx>=0 then
+              begin
+                { the unit is part of this package }
+                pkgunit:=pcontainedunit(pkg^.package.containedmodules[idx]);
+                if not assigned(pkgunit^.module) then
+                  pkgunit^.module:=self;
+                filename:=pkgunit^.ppufile;
+                if not SearchPathList(unitsearchpath) then
+                  exit;
+
+                { now load the unit and all used units }
+                load_interface;
+                setdefgeneration;
+                load_usedunits;
+                Message1(unit_u_finished_loading_unit,modulename^);
+
+                result:=true;
+                break;
+              end;
+          end;
+      end;
+
 
 {**********************************
     PPU Reading/Writing Helpers
@@ -1622,6 +1704,16 @@ var
         second_time:=false;
         set_current_module(self);
 
+        { try to load it as a package unit first }
+        if (packagelist.count>0) and loadfrompackage then
+          begin
+            do_load:=false;
+            do_reload:=false;
+            state:=ms_load;
+            { add the unit to the used units list of the program }
+            usedunits.concat(tused_unit.create(self,true,false,nil));
+          end;
+
         { A force reload }
         if do_reload then
          begin

+ 23 - 3
compiler/globals.pas

@@ -151,7 +151,8 @@ interface
          maxfpuregisters : shortint;
 
          cputype,
-         optimizecputype : tcputype;
+         optimizecputype,
+         asmcputype      : tcputype;
          fputype         : tfputype;
          asmmode         : tasmmode;
          interfacetype   : tinterfacetypes;
@@ -276,6 +277,9 @@ interface
        objectsearchpath,
        includesearchpath,
        frameworksearchpath  : TSearchPathList;
+       packagesearchpath     : TSearchPathList;
+       { contains tpackageentry entries }
+       packagelist : TFPHashList;
        autoloadunits      : string;
 
        { linking }
@@ -394,7 +398,7 @@ interface
         globalswitches : [cs_check_unit_name,cs_link_static];
         targetswitches : [];
         moduleswitches : [cs_extsyntax,cs_implicit_exceptions];
-        localswitches : [cs_check_io,cs_typed_const_writable,cs_pointermath{$ifdef i8086},cs_force_far_calls{$endif}];
+        localswitches : [cs_check_io,cs_typed_const_writable,cs_pointermath,cs_imported_data{$ifdef i8086},cs_force_far_calls{$endif}];
         modeswitches : fpcmodeswitches;
         optimizerswitches : [];
         genwpoptimizerswitches : [];
@@ -417,66 +421,79 @@ interface
 {$ifdef GENERIC_CPU}
         cputype : cpu_none;
         optimizecputype : cpu_none;
+        asmcputype : cpu_none;
         fputype : fpu_none;
 {$else not GENERIC_CPU}
   {$ifdef i386}
         cputype : cpu_Pentium;
         optimizecputype : cpu_Pentium3;
+        asmcputype : cpu_none;
         fputype : fpu_x87;
   {$endif i386}
   {$ifdef m68k}
         cputype : cpu_MC68020;
         optimizecputype : cpu_MC68020;
+        asmcputype : cpu_none;
         fputype : fpu_soft;
   {$endif m68k}
   {$ifdef powerpc}
         cputype : cpu_PPC604;
         optimizecputype : cpu_ppc7400;
+        asmcputype : cpu_none;
         fputype : fpu_standard;
   {$endif powerpc}
   {$ifdef POWERPC64}
         cputype : cpu_PPC970;
         optimizecputype : cpu_ppc970;
+        asmcputype : cpu_none;
         fputype : fpu_standard;
   {$endif POWERPC64}
   {$ifdef sparc}
         cputype : cpu_SPARC_V9;
         optimizecputype : cpu_SPARC_V9;
+        asmcputype : cpu_none;
         fputype : fpu_hard;
   {$endif sparc}
   {$ifdef arm}
         cputype : cpu_armv4;
         optimizecputype : cpu_armv4;
+        asmcputype : cpu_none;
         fputype : fpu_fpa;
   {$endif arm}
   {$ifdef x86_64}
         cputype : cpu_athlon64;
         optimizecputype : cpu_athlon64;
+        asmcputype : cpu_none;
         fputype : fpu_sse64;
   {$endif x86_64}
   {$ifdef avr}
         cputype : cpuinfo.cpu_avr5;
         optimizecputype : cpuinfo.cpu_avr5;
+        asmcputype : cpu_none;
         fputype : fpu_none;
   {$endif avr}
   {$ifdef mips}
         cputype : cpu_mips2;
         optimizecputype : cpu_mips2;
+        asmcputype : cpu_none;
         fputype : fpu_mips2;
   {$endif mips}
   {$ifdef jvm}
         cputype : cpu_none;
         optimizecputype : cpu_none;
+        asmcputype : cpu_none;
         fputype : fpu_standard;
   {$endif jvm}
   {$ifdef aarch64}
         cputype : cpu_armv8;
         optimizecputype : cpu_armv8;
+        asmcputype : cpu_none;
         fputype : fpu_vfp;
   {$endif aarch64}
   {$ifdef i8086}
         cputype : cpu_8086;
         optimizecputype : cpu_8086;
+        asmcputype : cpu_8086;
         fputype : fpu_x87;
   {$endif i8086}
 {$endif not GENERIC_CPU}
@@ -1075,7 +1092,8 @@ implementation
          'STDCALL',
          'SOFTFLOAT',
          'MWPASCAL',
-         'INTERRUPT'
+         'INTERRUPT',
+         'HARDFLOAT'
         );
       var
         t  : tproccalloption;
@@ -1421,6 +1439,7 @@ implementation
        frameworksearchpath.Free;
        LinkLibraryAliases.Free;
        LinkLibraryOrder.Free;
+       packagesearchpath.Free;
      end;
 
    procedure InitGlobals;
@@ -1456,6 +1475,7 @@ implementation
         includesearchpath:=TSearchPathList.Create;
         objectsearchpath:=TSearchPathList.Create;
         frameworksearchpath:=TSearchPathList.Create;
+        packagesearchpath:=TSearchPathList.Create;
 
         { Def file }
         usewindowapi:=false;

+ 7 - 3
compiler/globtype.pas

@@ -141,7 +141,7 @@ interface
          cs_generate_stackframes,cs_do_assertion,cs_generate_rtti,
          cs_full_boolean_eval,cs_typed_const_writable,cs_allow_enum_calc,
          cs_do_inline,cs_fpu_fwait,cs_ieee_errors,
-         cs_check_low_addr_load,
+         cs_check_low_addr_load,cs_imported_data,
          { mmx }
          cs_mmx,cs_mmx_saturation,
          { parser }
@@ -523,7 +523,10 @@ interface
          { constant records by reference.                            }
          pocall_mwpascal,
          { Special interrupt handler for embedded systems }
-         pocall_interrupt
+         pocall_interrupt,
+         { Directive for arm: pass floating point values in (v)float registers
+           regardless of the actual calling conventions }
+         pocall_hardfloat
        );
        tproccalloptions = set of tproccalloption;
 
@@ -541,7 +544,8 @@ interface
            'StdCall',
            'SoftFloat',
            'MWPascal',
-           'Interrupt'
+           'Interrupt',
+           'HardFloat'
          );
 
        { Default calling convention }

+ 1 - 1
compiler/htypechk.pas

@@ -2420,7 +2420,7 @@ implementation
             while assigned(pt) do
               begin
                 if (pt.resultdef.typ=recorddef) and
-                    (sto_has_operator in tabstractrecorddef(pt.resultdef).owner.tableoptions) then
+                    (sto_has_operator in tabstractrecorddef(pt.resultdef).symtable.tableoptions) then
                   collect_overloads_in_struct(tabstractrecorddef(pt.resultdef),ProcdefOverloadList,searchhelpers,anoninherited,spezcontext);
                 pt:=tcallparanode(pt.right);
               end;

+ 19 - 9
compiler/i386/cgcpu.pas

@@ -209,7 +209,11 @@ unit cgcpu;
               end
           end
         else
-          inherited a_load_ref_cgpara(list,size,r,cgpara);
+          begin
+            href:=r;
+            make_simple_ref(list,href);
+            inherited a_load_ref_cgpara(list,size,href,cgpara);
+          end;
       end;
 
 
@@ -217,9 +221,15 @@ unit cgcpu;
       var
         tmpreg : tregister;
         opsize : topsize;
-        tmpref : treference;
+        tmpref,dirref : treference;
       begin
-        with r do
+        dirref:=r;
+
+        { this could probably done in a more optimized way, but for now this
+          is sufficent }
+        make_direct_ref(list,dirref);
+
+        with dirref do
           begin
             if use_push(cgpara) then
               begin
@@ -230,11 +240,11 @@ unit cgcpu;
                     if assigned(symbol) then
                       begin
                         if (target_info.system in [system_i386_darwin,system_i386_iphonesim]) and
-                           ((r.symbol.bind in [AB_EXTERNAL,AB_WEAK_EXTERNAL]) or
+                           ((dirref.symbol.bind in [AB_EXTERNAL,AB_WEAK_EXTERNAL]) or
                             (cs_create_pic in current_settings.moduleswitches)) then
                           begin
                             tmpreg:=getaddressregister(list);
-                            a_loadaddr_ref_reg(list,r,tmpreg);
+                            a_loadaddr_ref_reg(list,dirref,tmpreg);
                             list.concat(taicpu.op_reg(A_PUSH,opsize,tmpreg));
                           end
                         else if cs_create_pic in current_settings.moduleswitches then
@@ -242,12 +252,12 @@ unit cgcpu;
                             if offset<>0 then
                               begin
                                 tmpreg:=getaddressregister(list);
-                                a_loadaddr_ref_reg(list,r,tmpreg);
+                                a_loadaddr_ref_reg(list,dirref,tmpreg);
                                 list.concat(taicpu.op_reg(A_PUSH,opsize,tmpreg));
                               end
                             else
                               begin
-                                reference_reset_symbol(tmpref,r.symbol,0,r.alignment);
+                                reference_reset_symbol(tmpref,dirref.symbol,0,dirref.alignment);
                                 tmpref.refaddr:=addr_pic;
                                 tmpref.base:=current_procinfo.got;
 {$ifdef EXTDEBUG}
@@ -273,12 +283,12 @@ unit cgcpu;
                 else
                   begin
                     tmpreg:=getaddressregister(list);
-                    a_loadaddr_ref_reg(list,r,tmpreg);
+                    a_loadaddr_ref_reg(list,dirref,tmpreg);
                     list.concat(taicpu.op_reg(A_PUSH,opsize,tmpreg));
                   end;
               end
             else
-              inherited a_loadaddr_ref_cgpara(list,r,cgpara);
+              inherited a_loadaddr_ref_cgpara(list,dirref,cgpara);
           end;
       end;
 

+ 3 - 0
compiler/i386/cpuinfo.pas

@@ -45,6 +45,7 @@ Type
    tcputype =
       (cpu_none,
        cpu_386,
+       cpu_486,
        cpu_Pentium,
        cpu_Pentium2,
        cpu_Pentium3,
@@ -110,6 +111,7 @@ Const
 
    cputypestr : array[tcputype] of string[10] = ('',
      '80386',
+     '80486',
      'PENTIUM',
      'PENTIUM2',
      'PENTIUM3',
@@ -173,6 +175,7 @@ type
    cpu_capabilities : array[tcputype] of set of tcpuflags = (
      { cpu_none      } [],
      { cpu_386       } [],
+     { cpu_486       } [],
      { cpu_Pentium   } [],
      { cpu_Pentium2  } [CPUX86_HAS_CMOV],
      { cpu_Pentium3  } [CPUX86_HAS_CMOV,CPUX86_HAS_SSEUNIT],

+ 10 - 1
compiler/i386/i386att.inc

@@ -1025,5 +1025,14 @@
 'vfnmsub231sd',
 'vfnmsub132ss',
 'vfnmsub213ss',
-'vfnmsub231ss'
+'vfnmsub231ss',
+'xacquire',
+'xrelease',
+'xbegin',
+'xabort',
+'xend',
+'xtest',
+'rdrand',
+'rdseed',
+'xgetbv'
 );

+ 9 - 0
compiler/i386/i386atts.inc

@@ -1025,5 +1025,14 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufINT,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
 attsufNONE
 );

+ 10 - 1
compiler/i386/i386int.inc

@@ -1025,5 +1025,14 @@
 'vfnmsub231sd',
 'vfnmsub132ss',
 'vfnmsub213ss',
-'vfnmsub231ss'
+'vfnmsub231ss',
+'xacquire',
+'xrelease',
+'xbegin',
+'xabort',
+'xend',
+'xtest',
+'rdrand',
+'rdseed',
+'xgetbv'
 );

+ 1 - 1
compiler/i386/i386nop.inc

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

+ 10 - 1
compiler/i386/i386op.inc

@@ -1025,5 +1025,14 @@ A_VFNMSUB213SD,
 A_VFNMSUB231SD,
 A_VFNMSUB132SS,
 A_VFNMSUB213SS,
-A_VFNMSUB231SS
+A_VFNMSUB231SS,
+A_XACQUIRE,
+A_XRELEASE,
+A_XBEGIN,
+A_XABORT,
+A_XEND,
+A_XTEST,
+A_RDRAND,
+A_RDSEED,
+A_XGETBV
 );

+ 26 - 17
compiler/i386/i386prop.inc

@@ -700,22 +700,22 @@
 (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_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
@@ -1025,5 +1025,14 @@
 (Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1)),
-(Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1))
+(Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_None, Ch_None, Ch_None)),
+(Ch: (Ch_None, Ch_None, Ch_None)),
+(Ch: (Ch_None, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_None, Ch_None, Ch_None)),
+(Ch: (Ch_WFlags, Ch_None, Ch_None)),
+(Ch: (Ch_Wop1, Ch_WFlags, CH_None)),
+(Ch: (Ch_Wop1, Ch_WFlags, CH_None)),
+(Ch: (Ch_WEAX, Ch_WEDX, Ch_RECX))
 );

+ 66 - 3
compiler/i386/i386tab.inc

@@ -7677,21 +7677,21 @@
     ops     : 0;
     optypes : (ot_none,ot_none,ot_none,ot_none);
     code    : #219#3#15#166#192;
-    flags   : if_centaur
+    flags   : if_p6 or if_cyrix
   ),
   (
     opcode  : A_XSHA1;
     ops     : 0;
     optypes : (ot_none,ot_none,ot_none,ot_none);
     code    : #219#3#15#166#200;
-    flags   : if_centaur
+    flags   : if_p6 or if_cyrix
   ),
   (
     opcode  : A_XSHA256;
     ops     : 0;
     optypes : (ot_none,ot_none,ot_none,ot_none);
     code    : #219#3#15#166#208;
-    flags   : if_centaur
+    flags   : if_p6 or if_cyrix
   ),
   (
     opcode  : A_DMINT;
@@ -13600,5 +13600,68 @@
     optypes : (ot_xmmreg,ot_xmmreg,ot_xmmrm,ot_none);
     code    : #241#242#249#1#191#61#80;
     flags   : if_fma
+  ),
+  (
+    opcode  : A_XACQUIRE;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #1#242;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_XRELEASE;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #1#243;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_XBEGIN;
+    ops     : 1;
+    optypes : (ot_memory,ot_none,ot_none,ot_none);
+    code    : #208#2#199#248#52;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_XABORT;
+    ops     : 1;
+    optypes : (ot_immediate,ot_none,ot_none,ot_none);
+    code    : #2#198#248#20;
+    flags   : if_tsx or if_sb
+  ),
+  (
+    opcode  : A_XEND;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #3#15#1#213;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_XTEST;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #3#15#1#214;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_RDRAND;
+    ops     : 1;
+    optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_none,ot_none,ot_none);
+    code    : #208#2#15#199#134;
+    flags   : if_rand
+  ),
+  (
+    opcode  : A_RDSEED;
+    ops     : 1;
+    optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_none,ot_none,ot_none);
+    code    : #208#2#15#199#135;
+    flags   : if_rand
+  ),
+  (
+    opcode  : A_XGETBV;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #3#15#1#208;
+    flags   : if_xsave
   )
 );

+ 5 - 1
compiler/i386/n386cal.pas

@@ -69,7 +69,11 @@ implementation
               // one syscall convention for AROS
               current_asmdata.CurrAsmList.concat(tai_comment.create(strpnew('AROS SysCall')));
               reference_reset(tmpref,sizeof(pint));
-              tmpref.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(tcpuprocdef(procdefinition).libsym).mangledname);
+              { re-read the libbase pushed first on the stack, instead of just trusting the
+                mangledname will work. this is important for example for threadvar libbases.
+                and this way they also don't need to be resolved twice then. (KB) }
+              tmpref.base:=NR_ESP;
+              tmpref.offset:=pushedparasize-sizeof(pint);
               cg.getcpuregister(current_asmdata.CurrAsmList,NR_EAX);
               cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,tmpref,NR_EAX);
               reference_reset_base(tmpref,NR_EAX,-tprocdef(procdefinition).extnumber,sizeof(pint));

+ 2 - 0
compiler/i8086/cpuinfo.pas

@@ -48,6 +48,7 @@ Type
        cpu_186,
        cpu_286,
        cpu_386,
+       cpu_486,
        cpu_Pentium,
        cpu_Pentium2,
        cpu_Pentium3,
@@ -113,6 +114,7 @@ Const
      '80186',
      '80286',
      '80386',
+     '80486',
      'PENTIUM',
      'PENTIUM2',
      'PENTIUM3',

+ 10 - 1
compiler/i8086/i8086att.inc

@@ -1039,5 +1039,14 @@
 'vfnmsub231sd',
 'vfnmsub132ss',
 'vfnmsub213ss',
-'vfnmsub231ss'
+'vfnmsub231ss',
+'xacquire',
+'xrelease',
+'xbegin',
+'xabort',
+'xend',
+'xtest',
+'rdrand',
+'rdseed',
+'xgetbv'
 );

+ 9 - 0
compiler/i8086/i8086atts.inc

@@ -1039,5 +1039,14 @@ attsufNONE,
 attsufNONE,
 attsufNONE,
 attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufINT,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
+attsufNONE,
 attsufNONE
 );

+ 10 - 1
compiler/i8086/i8086int.inc

@@ -1039,5 +1039,14 @@
 'vfnmsub231sd',
 'vfnmsub132ss',
 'vfnmsub213ss',
-'vfnmsub231ss'
+'vfnmsub231ss',
+'xacquire',
+'xrelease',
+'xbegin',
+'xabort',
+'xend',
+'xtest',
+'rdrand',
+'rdseed',
+'xgetbv'
 );

+ 1 - 1
compiler/i8086/i8086nop.inc

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

+ 10 - 1
compiler/i8086/i8086op.inc

@@ -1039,5 +1039,14 @@ A_VFNMSUB213SD,
 A_VFNMSUB231SD,
 A_VFNMSUB132SS,
 A_VFNMSUB213SS,
-A_VFNMSUB231SS
+A_VFNMSUB231SS,
+A_XACQUIRE,
+A_XRELEASE,
+A_XBEGIN,
+A_XABORT,
+A_XEND,
+A_XTEST,
+A_RDRAND,
+A_RDSEED,
+A_XGETBV
 );

+ 26 - 17
compiler/i8086/i8086prop.inc

@@ -700,22 +700,22 @@
 (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_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
+(Ch: (Ch_Wop2, Ch_Rop1, Ch_None)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Wop3, Ch_Rop2, Ch_Rop1)),
@@ -1039,5 +1039,14 @@
 (Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1)),
 (Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1)),
-(Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1))
+(Ch: (Ch_Mop3, Ch_Rop2, Ch_Rop1)),
+(Ch: (Ch_None, Ch_None, Ch_None)),
+(Ch: (Ch_None, Ch_None, Ch_None)),
+(Ch: (Ch_None, Ch_None, Ch_None)),
+(Ch: (Ch_All, Ch_None, Ch_None)),
+(Ch: (Ch_None, Ch_None, Ch_None)),
+(Ch: (Ch_WFlags, Ch_None, Ch_None)),
+(Ch: (Ch_Wop1, Ch_WFlags, CH_None)),
+(Ch: (Ch_Wop1, Ch_WFlags, CH_None)),
+(Ch: (Ch_WEAX, Ch_WEDX, Ch_RECX))
 );

+ 76 - 13
compiler/i8086/i8086tab.inc

@@ -7705,21 +7705,21 @@
     ops     : 0;
     optypes : (ot_none,ot_none,ot_none,ot_none);
     code    : #219#3#15#166#192;
-    flags   : if_centaur
+    flags   : if_p6 or if_cyrix
   ),
   (
     opcode  : A_XSHA1;
     ops     : 0;
     optypes : (ot_none,ot_none,ot_none,ot_none);
     code    : #219#3#15#166#200;
-    flags   : if_centaur
+    flags   : if_p6 or if_cyrix
   ),
   (
     opcode  : A_XSHA256;
     ops     : 0;
     optypes : (ot_none,ot_none,ot_none,ot_none);
     code    : #219#3#15#166#208;
-    flags   : if_centaur
+    flags   : if_p6 or if_cyrix
   ),
   (
     opcode  : A_DMINT;
@@ -12976,14 +12976,14 @@
     ops     : 2;
     optypes : (ot_rm_gpr or ot_bits8,ot_immediate,ot_none,ot_none);
     code    : #2#15#26#128#21;
-    flags   : if_nec or if_sb or if_16bitonly
+    flags   : if_nec or if_sb or if_imm3 or if_16bitonly
   ),
   (
     opcode  : A_CLR1;
     ops     : 2;
     optypes : (ot_rm_gpr or ot_bits16,ot_immediate,ot_none,ot_none);
     code    : #2#15#27#128#21;
-    flags   : if_nec or if_sw or if_16bitonly
+    flags   : if_nec or if_sw or if_imm4 or if_16bitonly
   ),
   (
     opcode  : A_CMP4S;
@@ -13004,7 +13004,7 @@
     ops     : 2;
     optypes : (ot_reg8,ot_immediate,ot_none,ot_none);
     code    : #2#15#59#128#21;
-    flags   : if_nec or if_sb or if_16bitonly
+    flags   : if_nec or if_sb or if_imm4 or if_16bitonly
   ),
   (
     opcode  : A_INS;
@@ -13018,7 +13018,7 @@
     ops     : 2;
     optypes : (ot_reg8,ot_immediate,ot_none,ot_none);
     code    : #2#15#57#128#21;
-    flags   : if_nec or if_sb or if_16bitonly
+    flags   : if_nec or if_sb or if_imm4 or if_16bitonly
   ),
   (
     opcode  : A_NOT1;
@@ -13039,14 +13039,14 @@
     ops     : 2;
     optypes : (ot_rm_gpr or ot_bits8,ot_immediate,ot_none,ot_none);
     code    : #2#15#30#128#21;
-    flags   : if_nec or if_sb or if_16bitonly
+    flags   : if_nec or if_sb or if_imm3 or if_16bitonly
   ),
   (
     opcode  : A_NOT1;
     ops     : 2;
     optypes : (ot_rm_gpr or ot_bits16,ot_immediate,ot_none,ot_none);
     code    : #2#15#31#128#21;
-    flags   : if_nec or if_sw or if_16bitonly
+    flags   : if_nec or if_sw or if_imm4 or if_16bitonly
   ),
   (
     opcode  : A_REPC;
@@ -13095,14 +13095,14 @@
     ops     : 2;
     optypes : (ot_rm_gpr or ot_bits8,ot_immediate,ot_none,ot_none);
     code    : #2#15#28#128#21;
-    flags   : if_nec or if_sb or if_16bitonly
+    flags   : if_nec or if_sb or if_imm3 or if_16bitonly
   ),
   (
     opcode  : A_SET1;
     ops     : 2;
     optypes : (ot_rm_gpr or ot_bits16,ot_immediate,ot_none,ot_none);
     code    : #2#15#29#128#21;
-    flags   : if_nec or if_sw or if_16bitonly
+    flags   : if_nec or if_sw or if_imm4 or if_16bitonly
   ),
   (
     opcode  : A_SUB4S;
@@ -13130,14 +13130,14 @@
     ops     : 2;
     optypes : (ot_rm_gpr or ot_bits8,ot_immediate,ot_none,ot_none);
     code    : #2#15#24#128#21;
-    flags   : if_nec or if_sb or if_16bitonly
+    flags   : if_nec or if_sb or if_imm3 or if_16bitonly
   ),
   (
     opcode  : A_TEST1;
     ops     : 2;
     optypes : (ot_rm_gpr or ot_bits16,ot_immediate,ot_none,ot_none);
     code    : #2#15#25#128#21;
-    flags   : if_nec or if_sw or if_16bitonly
+    flags   : if_nec or if_sw or if_imm4 or if_16bitonly
   ),
   (
     opcode  : A_VFMADD132PD;
@@ -13824,5 +13824,68 @@
     optypes : (ot_xmmreg,ot_xmmreg,ot_xmmrm,ot_none);
     code    : #241#242#249#1#191#61#80;
     flags   : if_fma
+  ),
+  (
+    opcode  : A_XACQUIRE;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #1#242;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_XRELEASE;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #1#243;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_XBEGIN;
+    ops     : 1;
+    optypes : (ot_memory,ot_none,ot_none,ot_none);
+    code    : #208#2#199#248#52;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_XABORT;
+    ops     : 1;
+    optypes : (ot_immediate,ot_none,ot_none,ot_none);
+    code    : #2#198#248#20;
+    flags   : if_tsx or if_sb
+  ),
+  (
+    opcode  : A_XEND;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #3#15#1#213;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_XTEST;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #3#15#1#214;
+    flags   : if_tsx
+  ),
+  (
+    opcode  : A_RDRAND;
+    ops     : 1;
+    optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_none,ot_none,ot_none);
+    code    : #208#2#15#199#134;
+    flags   : if_rand
+  ),
+  (
+    opcode  : A_RDSEED;
+    ops     : 1;
+    optypes : (ot_reg16 or ot_bits32 or ot_bits64,ot_none,ot_none,ot_none);
+    code    : #208#2#15#199#135;
+    flags   : if_rand
+  ),
+  (
+    opcode  : A_XGETBV;
+    ops     : 0;
+    optypes : (ot_none,ot_none,ot_none,ot_none);
+    code    : #3#15#1#208;
+    flags   : if_xsave
   )
 );

+ 4 - 0
compiler/jvm/agjasmin.pas

@@ -502,6 +502,10 @@ implementation
 
              ait_directive :
                begin
+                 { the CPU directive is probably not supported by the JVM assembler,
+                   so it's commented out }
+                 if tai_directive(hp).directive=asd_cpu then
+                   writer.AsmWrite(asminfo^.comment);
                  writer.AsmWrite('.'+directivestr[tai_directive(hp).directive]+' ');
                  if tai_directive(hp).name<>'' then
                    writer.AsmWrite(tai_directive(hp).name);

+ 109 - 35
compiler/jvm/njvmtcon.pas

@@ -42,6 +42,7 @@ interface
       tjvmtypedconstbuilder = class(tnodetreetypedconstbuilder)
        private
         procedure tc_flush_arr_strconst(def: tdef);
+        procedure tc_emit_arr_strconst_ele(val: int64; def: torddef);
        protected
         arrstringdata: tarrstringdata;
         parsingordarray: boolean;
@@ -55,8 +56,9 @@ implementation
 
     uses
       globals,widestr,verbose,constexp,
+      tokens,scanner,pexpr,
       defutil,
-      nbas,ncal,ncon,njvmcon;
+      nbas,ncal,ncon,ncnv,njvmcon;
 
 
     procedure init_arrstringdata(out data: tarrstringdata);
@@ -88,7 +90,9 @@ implementation
             tcompilerwidechar(ord(arrstringdata.arrstring[length(arrstringdata.arrstring)]) shl 8));
 
 
-        if is_signed(def) then
+        if is_char(def) then
+          procvariant:='ansichar'
+        else if is_signed(def) then
           case def.size of
             1: procvariant:='shortint';
             2: procvariant:='smallint';
@@ -121,14 +125,54 @@ implementation
       end;
 
 
+    procedure tjvmtypedconstbuilder.tc_emit_arr_strconst_ele(val: int64; def: torddef);
+      var
+        elesize: longint;
+      begin
+        elesize:=def.size;
+        inc(arrstringdata.arrdatalen);
+        case elesize of
+          1:
+            arrstringdata.arrstring:=arrstringdata.arrstring+char(val);
+          2:
+            arrstringdata.arrstring:=arrstringdata.arrstring+char(val shr 8)+char(val and $ff);
+          4:
+            arrstringdata.arrstring:=arrstringdata.arrstring+char((val shr 24))+
+              char((val shr 16) and $ff)+
+              char((val shr 8) and $ff)+
+              char(val and $ff);
+          8:
+            arrstringdata.arrstring:=arrstringdata.arrstring+char((val shr 56))+
+              char((val shr 48) and $ff)+
+              char((val shr 40) and $ff)+
+              char((val shr 32) and $ff)+
+              char((val shr 24) and $ff)+
+              char((val shr 16) and $ff)+
+              char((val shr 8) and $ff)+
+              char(val and $ff);
+        end;
+        { we can't use the full 64kb, because inside the Java class file the
+          string constant is actually encoded using UTF-8 and it's this UTF-8
+          encoding that has to fit inside 64kb (and utf-8 encoding of random
+          data can easily blow up its size by about a third) }
+        if length(arrstringdata.arrstring)>40000 then
+          tc_flush_arr_strconst(def);
+      end;
+
+
     procedure tjvmtypedconstbuilder.parse_arraydef(def: tarraydef);
       var
+        n: tnode;
+        i, len: longint;
+        ca: pbyte;
+        ch: array[0..1] of char;
         old_arrstringdata: tarrstringdata;
         old_parsingordarray: boolean;
       begin
         if is_dynamic_array(def) or
-           not is_integer(def.elementdef) or
-           not(ts_compact_int_array_init in current_settings.targetswitches) then
+           (not is_char(def.elementdef) and
+            (not is_integer(def.elementdef) or
+             not(ts_compact_int_array_init in current_settings.targetswitches))) then
           begin
             inherited;
             exit;
@@ -138,7 +182,66 @@ implementation
         arrstringdata.arraybase:=basenode.getcopy;
         old_parsingordarray:=parsingordarray;
         parsingordarray:=true;
-        inherited;
+        if (token=_LKLAMMER) or
+           not is_char(def.elementdef) then
+          inherited
+        else
+          begin
+            { array of ansichar -> can be constant char/string; can't use plain
+              assignment in this case, because it will result in a codepage
+              conversion }
+            n:=comp_expr([ef_accept_equal]);
+            if n.nodetype=stringconstn then
+              begin
+                len:=tstringconstnode(n).len;
+                if (tstringconstnode(n).cst_type in [cst_unicodestring,cst_widestring]) then
+                  inserttypeconv(n,getansistringdef);
+                  if n.nodetype<>stringconstn then
+                    internalerror(2010033003);
+                  ca:=pbyte(tstringconstnode(n).value_str);
+                { For tp7 the maximum lentgh can be 255 }
+                if (m_tp7 in current_settings.modeswitches) and
+                   (len>255) then
+                 len:=255;
+              end
+            else if is_constcharnode(n) then
+               begin
+                 ch[0]:=chr(tordconstnode(n).value.uvalue and $ff);
+                 ca:=@ch;
+                 len:=1;
+               end
+            else if is_constwidecharnode(n) and (current_settings.sourcecodepage<>CP_UTF8) then
+               begin
+                 inserttypeconv(n,cansichartype);
+                 if not is_constcharnode(n) then
+                   internalerror(2010033001);
+                 ch[0]:=chr(tordconstnode(n).value.uvalue and $ff);
+                 ca:=@ch;
+                 len:=1;
+               end
+            else
+              begin
+                Message(parser_e_illegal_expression);
+                len:=0;
+                { avoid crash later on }
+                ch[0]:=#0;
+                ca:=@ch;
+              end;
+            if len>(def.highrange-def.lowrange+1) then
+              Message(parser_e_string_larger_array);
+            for i:=0 to def.highrange-def.lowrange do
+              begin
+                if i<len then
+                  begin
+                    tc_emit_arr_strconst_ele(pbyte(ca)^,torddef(cansichartype));
+                    inc(ca);
+                  end
+                else
+                  {Fill the remaining positions with #0.}
+                  tc_emit_arr_strconst_ele(0,torddef(cansichartype));
+              end;
+            n.free;
+          end;
         if length(arrstringdata.arrstring)<>0 then
           tc_flush_arr_strconst(def.elementdef);
         arrstringdata.arraybase.free;
@@ -158,8 +261,6 @@ implementation
 
 
     procedure tjvmtypedconstbuilder.tc_emit_orddef(def: torddef; var node: tnode);
-      var
-        elesize: longint;
       begin
         if not parsingordarray then
           begin
@@ -168,34 +269,7 @@ implementation
           end;
         if node.nodetype<>ordconstn then
           internalerror(2011111101);
-        elesize:=def.size;
-        inc(arrstringdata.arrdatalen);
-        case elesize of
-          1:
-            arrstringdata.arrstring:=arrstringdata.arrstring+char(tordconstnode(node).value.svalue);
-          2:
-            arrstringdata.arrstring:=arrstringdata.arrstring+char(tordconstnode(node).value.svalue shr 8)+char(tordconstnode(node).value.svalue and $ff);
-          4:
-            arrstringdata.arrstring:=arrstringdata.arrstring+char((tordconstnode(node).value.svalue shr 24))+
-              char((tordconstnode(node).value.svalue shr 16) and $ff)+
-              char((tordconstnode(node).value.svalue shr 8) and $ff)+
-              char(tordconstnode(node).value.svalue and $ff);
-          8:
-            arrstringdata.arrstring:=arrstringdata.arrstring+char((tordconstnode(node).value.svalue shr 56))+
-              char((tordconstnode(node).value.svalue shr 48) and $ff)+
-              char((tordconstnode(node).value.svalue shr 40) and $ff)+
-              char((tordconstnode(node).value.svalue shr 32) and $ff)+
-              char((tordconstnode(node).value.svalue shr 24) and $ff)+
-              char((tordconstnode(node).value.svalue shr 16) and $ff)+
-              char((tordconstnode(node).value.svalue shr 8) and $ff)+
-              char(tordconstnode(node).value.svalue and $ff);
-        end;
-        { we can't use the full 64kb, because inside the Java class file the
-          string constant is actually encoded using UTF-8 and it's this UTF-8
-          encoding that has to fit inside 64kb (and utf-8 encoding of random
-          data can easily blow up its size by about a third) }
-        if length(arrstringdata.arrstring)>40000 then
-          tc_flush_arr_strconst(def);
+        tc_emit_arr_strconst_ele(tordconstnode(node).value.svalue,def);
         basenode.free;
         basenode:=nil;
         node.free;

+ 1 - 1
compiler/jvm/symcpu.pas

@@ -677,7 +677,7 @@ implementation
             container:=owner;
             while container.symtabletype=localsymtable do
               begin
-                tmpresult:='$'+tprocdef(owner.defowner).procsym.realname+'$'+tostr(tprocdef(owner.defowner).procsym.symid)+'$'+tmpresult;
+                tmpresult:='$'+tprocdef(owner.defowner).procsym.realname+'$$'+tprocdef(owner.defowner).unique_id_str+'$'+tmpresult;
                 container:=container.defowner.owner;
               end;
           end;

+ 3 - 0
compiler/llvm/agllvm.pas

@@ -1120,6 +1120,9 @@ implementation
 
           ait_directive :
             begin
+              { CPU directive is commented out for the LLVM }
+              if tai_directive(hp).directive=asd_cpu then
+                writer.AsmWrite(asminfo^.comment);
               WriteDirectiveName(tai_directive(hp).directive);
               if tai_directive(hp).name <>'' then
                 writer.AsmWrite(tai_directive(hp).name);

+ 147 - 269
compiler/m68k/cgcpu.pas

@@ -93,7 +93,7 @@ unit cgcpu;
         procedure sign_extend(list: TAsmList;_oldsize : tcgsize; _newsize : tcgsize; reg: tregister);
 
         procedure g_stackpointer_alloc(list : TAsmList;localsize : longint);override;
-        function fixref(list: TAsmList; var ref: treference): boolean;
+        function fixref(list: TAsmList; var ref: treference; fullyresolve: boolean): boolean;
         function force_to_dataregister(list: TAsmList; size: TCGSize; reg: TRegister): TRegister;
         procedure move_if_needed(list: TAsmList; size: TCGSize; src: TRegister; dest: TRegister);
      protected
@@ -350,7 +350,7 @@ unit cgcpu;
           { Push the data starting at ofs }
           href:=r;
           inc(href.offset,ofs);
-          fixref(list,href);
+          fixref(list,href,false);
           if tcgsize2size[paraloc^.size]>cgpara.alignment then
             pushsize:=paraloc^.size
           else
@@ -410,219 +410,134 @@ unit cgcpu;
             //list.concat(tai_comment.create(strpnew('a_loadaddr_ref_cgpara: PEA')));
             cgpara.check_simple_location;
             tmpref:=r;
-            fixref(list,tmpref);
+            fixref(list,tmpref,false);
             list.concat(taicpu.op_ref(A_PEA,S_NO,tmpref));
           end
         else
           inherited a_loadaddr_ref_cgpara(list,r,cgpara);
       end;
 
-    function tcg68k.fixref(list: TAsmList; var ref: treference): boolean;
+
+    function tcg68k.fixref(list: TAsmList; var ref: treference; fullyresolve: boolean): boolean;
        var
-         hreg,idxreg : tregister;
+         hreg : tregister;
          href : treference;
          instr : taicpu;
-         scale : aint;
        begin
          result:=false;
-         { The MC68020+ has extended
-           addressing capabilities with a 32-bit
-           displacement.
-         }
-         { first ensure that base is an address register }
-         if ((ref.base<>NR_NO) and (ref.index<>NR_NO)) and
-            (not isaddressregister(ref.base) and isaddressregister(ref.index)) and
-            (ref.scalefactor < 2) then
+         hreg:=NR_NO;
+
+         { NOTE: we don't have to fixup scaling in this function, because the memnode
+           won't generate scaling on CPUs which don't support it }
+
+         { first, deal with the symbol, if we have an index or base register.
+           in theory, the '020+ could deal with these, but it's better to avoid
+           long displacements on most members of the 68k family anyway }
+         if assigned(ref.symbol) and ((ref.base<>NR_NO) or (ref.index<>NR_NO)) then
            begin
-             { if we have both base and index registers, but base is data and index
-               is address, we can just swap them, as FPC always uses long index.
-               but we can only do this, if the index has no scalefactor }
-             hreg:=ref.base;
-             ref.base:=ref.index;
-             ref.index:=hreg;
-             //list.concat(tai_comment.create(strpnew('fixref: base and index swapped')));
+             //list.concat(tai_comment.create(strpnew('fixref: symbol with base or index')));
+
+             hreg:=getaddressregister(list);
+             reference_reset_symbol(href,ref.symbol,ref.offset,ref.alignment);
+             list.concat(taicpu.op_ref_reg(A_LEA,S_L,href,hreg));
+             ref.offset:=0;
+             ref.symbol:=nil;
+
+             { if we have unused base or index, try to use it, otherwise fold the existing base,
+               also handle the case where the base might be a data register. }
+             if ref.base=NR_NO then
+               ref.base:=hreg
+             else
+               if (ref.index=NR_NO) and not isintregister(ref.base) then
+                 ref.index:=hreg
+               else
+                 begin
+                   list.concat(taicpu.op_reg_reg(A_ADD,S_L,ref.base,hreg));
+                   ref.base:=hreg;
+                 end;
+
+             { at this point we have base + (optional) index * scale }
            end;
 
-         if (not assigned (ref.symbol) and (current_settings.cputype<>cpu_MC68000)) and
-            (ref.base<>NR_NO) and not isaddressregister(ref.base) then
+         { deal with the case if our base is a dataregister }
+         if (ref.base<>NR_NO) and not isaddressregister(ref.base) then
            begin
+
              hreg:=getaddressregister(list);
-             instr:=taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg);
-             add_move_instruction(instr);
-             list.concat(instr);
-             fixref:=true;
-             ref.base:=hreg;
-           end;
-         if (current_settings.cputype=cpu_MC68020) then
-           exit;
-         { ToDo: check which constraints of Coldfire also apply to MC68000 }
-         case current_settings.cputype of
-           cpu_MC68000:
-             begin
-               if (ref.base<>NR_NO) then
-                 begin
-                   if (ref.index<>NR_NO) and assigned(ref.symbol) then
-                     begin
-                       hreg:=getaddressregister(list);
-                       list.concat(taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg));
-                       list.concat(taicpu.op_reg_reg(A_ADD,S_L,ref.index,hreg));
-                       ref.index:=NR_NO;
-                       ref.base:=hreg;
-                     end;
-                   { base + reg }
-                   if ref.index <> NR_NO then
-                      begin
-                         { base + reg + offset }
-                         if (ref.offset < low(shortint)) or (ref.offset > high(shortint)) then
-                           begin
-                             hreg:=getaddressregister(list);
-                             list.concat(taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg));
-                             list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,hreg));
-                             fixref:=true;
-                             ref.offset:=0;
-                             ref.base:=hreg;
-                             exit;
-                           end;
-                      end
-                   else
-                   { base + offset }
-                   if (ref.offset < low(smallint)) or (ref.offset > high(smallint)) then
-                     begin
-                       hreg:=getaddressregister(list);
-                       list.concat(taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg));
-                       list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,hreg));
-                       fixref:=true;
-                       ref.offset:=0;
-                       ref.base:=hreg;
-                       exit;
-                     end;
-                   if assigned(ref.symbol) then
-                     begin
-                       hreg:=getaddressregister(list);
-                       idxreg:=ref.base;
-                       ref.base:=NR_NO;
-                       list.concat(taicpu.op_ref_reg(A_LEA,S_L,ref,hreg));
-                       reference_reset_base(ref,hreg,0,ref.alignment);
-                       fixref:=true;
-                       ref.index:=idxreg;
-                     end
-                   else if not isaddressregister(ref.base) then
-                     begin
-                       hreg:=getaddressregister(list);
-                       instr:=taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg);
-                       //add_move_instruction(instr);
-                       list.concat(instr);
-                       fixref:=true;
-                       ref.base:=hreg;
-                     end;
-                 end
-               else
-                 { Note: symbol -> ref would be supported as long as ref does not
-                         contain a offset or index... (maybe something for the
-                         optimizer) }
-                 if Assigned(ref.symbol) and (ref.index<>NR_NO) then
+             if isaddressregister(ref.index) and (ref.scalefactor < 2) then
+               begin
+                 //list.concat(tai_comment.create(strpnew('fixref: base is dX, resolving with reverse regs')));
+
+                 reference_reset_base(href,ref.index,0,ref.alignment);
+                 href.index:=ref.base;
+                 { we can fold in an 8 bit offset "for free" }
+                 if isvalue8bit(ref.offset) then
                    begin
-                     hreg:=cg.getaddressregister(list);
-                     idxreg:=ref.index;
-                     ref.index:=NR_NO;
-                     list.concat(taicpu.op_ref_reg(A_LEA,S_L,ref,hreg));
-                     reference_reset_base(ref,hreg,0,ref.alignment);
-                     ref.index:=idxreg;
-                     fixref:=true;
+                     href.offset:=ref.offset;
+                     ref.offset:=0;
                    end;
-             end;
-           cpu_isa_a,
-           cpu_isa_a_p,
-           cpu_isa_b,
-           cpu_isa_c:
-             begin
-               if (ref.base<>NR_NO) then
-                 begin
-                   if assigned(ref.symbol) then
-                     begin
-                       //list.concat(tai_comment.create(strpnew('fixref: symbol')));
-                       hreg:=cg.getaddressregister(list);
-                       reference_reset_symbol(href,ref.symbol,ref.offset,ref.alignment);
-                       list.concat(taicpu.op_ref_reg(A_LEA,S_L,href,hreg));
-                       if ref.index<>NR_NO then
-                         begin
-                           { fold the symbol + offset into the base, not the base into the index,
-                             because that might screw up the scalefactor of the reference }
-                           //list.concat(tai_comment.create(strpnew('fixref: symbol + offset (index + base)')));
-                           idxreg:=getaddressregister(list);
-                           reference_reset_base(href,ref.base,0,ref.alignment);
-                           href.index:=hreg;
-                           hreg:=getaddressregister(list);
-                           list.concat(taicpu.op_ref_reg(A_LEA,S_L,href,hreg));
-                           ref.base:=hreg;
-                         end
-                       else
-                         ref.index:=hreg;
-
-                       ref.offset:=0;
-                       ref.symbol:=nil;
-                       fixref:=true;
-                     end
-                   else
-                     { base + reg }
-                     if ref.index <> NR_NO then
-                       begin
-                         { base + reg + offset }
-                         if (ref.offset < low(shortint)) or (ref.offset > high(shortint)) then
-                           begin
-                             hreg:=getaddressregister(list);
-                             if (ref.offset < low(smallint)) or (ref.offset > high(smallint)) then
-                               begin
-                                 instr:=taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg);
-                                 //add_move_instruction(instr);
-                                 list.concat(instr);
-                                 list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,hreg));
-                               end
-                             else
-                               begin
-                                 //list.concat(tai_comment.create(strpnew('fixref: base + reg + offset lea')));
-                                 reference_reset_base(href,ref.base,ref.offset,ref.alignment);
-                                 list.concat(taicpu.op_ref_reg(A_LEA,S_NO,href,hreg));
-                               end;
-                             fixref:=true;
-                             ref.base:=hreg;
-                             ref.offset:=0;
-                             exit;
-                           end;
-                       end
-                     else
-                       { base + offset }
-                       if (ref.offset < low(smallint)) or (ref.offset > high(smallint)) then
-                         begin
-                           hreg:=getaddressregister(list);
-                           instr:=taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg);
-                           //add_move_instruction(instr);
-                           list.concat(instr);
-                           list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,hreg));
-                           fixref:=true;
-                           ref.offset:=0;
-                           ref.base:=hreg;
-                           exit;
-                         end;
-                 end
-               else
-                 { Note: symbol -> ref would be supported as long as ref does not
-                         contain a offset or index... (maybe something for the
-                         optimizer) }
-                 if Assigned(ref.symbol) {and (ref.index<>NR_NO)} then
+                 list.concat(taicpu.op_ref_reg(A_LEA,S_L,href,hreg));
+                 ref.base:=hreg;
+                 ref.index:=NR_NO;
+                 result:=true;
+               end
+             else
+               begin
+                 //list.concat(tai_comment.create(strpnew('fixref: base is dX, can''t resolve with reverse regs')));
+
+                 instr:=taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg);
+                 add_move_instruction(instr);
+                 list.concat(instr);
+                 ref.base:=hreg;
+                 result:=true;
+               end;
+           end;
+
+         { deal with large offsets on non-020+ }
+         if current_settings.cputype<>cpu_MC68020 then
+           begin
+             if ((ref.index<>NR_NO) and not isvalue8bit(ref.offset)) or
+                ((ref.base<>NR_NO) and not isvalue16bit(ref.offset)) then
+               begin
+                 //list.concat(tai_comment.create(strpnew('fixref: handling large offsets')));
+                 { if we have a temp register from above, we can just add to it }
+                 if hreg=NR_NO then
+                   hreg:=getaddressregister(list);
+
+                 if isvalue16bit(ref.offset) then
                    begin
-                     hreg:=cg.getaddressregister(list);
-                     idxreg:=ref.index;
-                     scale:=ref.scalefactor;
-                     ref.index:=NR_NO;
-                     list.concat(taicpu.op_ref_reg(A_LEA,S_L,ref,hreg));
-                     reference_reset_base(ref,hreg,0,ref.alignment);
-                     ref.index:=idxreg;
-                     ref.scalefactor:=scale;
-                     fixref:=true;
+                     reference_reset_base(href,ref.base,ref.offset,ref.alignment);
+                     list.concat(taicpu.op_ref_reg(A_LEA,S_L,href,hreg));
+                   end
+                 else
+                   begin
+                     instr:=taicpu.op_reg_reg(A_MOVE,S_L,ref.base,hreg);
+                     add_move_instruction(instr);
+                     list.concat(instr);
+                     list.concat(taicpu.op_const_reg(A_ADD,S_L,ref.offset,hreg));
                    end;
-             end;
-         end;
+                 ref.offset:=0;
+                 ref.base:=hreg;
+                 result:=true;
+               end;
+           end;
+
+         { fully resolve the reference to an address register, if we're told to do so
+           and there's a reason to do so }
+         if fullyresolve and
+            ((ref.index<>NR_NO) or assigned(ref.symbol) or (ref.offset<>0)) then
+           begin
+             //list.concat(tai_comment.create(strpnew('fixref: fully resolve to register')));
+             if hreg=NR_NO then
+               hreg:=getaddressregister(list);
+             list.concat(taicpu.op_ref_reg(A_LEA,S_L,ref,hreg));
+             ref.base:=hreg;
+             ref.index:=NR_NO;
+             ref.scalefactor:=1;
+             ref.symbol:=nil;
+             ref.offset:=0;
+             result:=true;
+           end;
        end;
 
 
@@ -805,7 +720,7 @@ unit cgcpu;
       begin
         a:=longint(a);
         href:=ref;
-        fixref(list,href);
+        fixref(list,href,false);
         if (a=0) and not (current_settings.cputype = cpu_mc68000) then
           list.concat(taicpu.op_ref(A_CLR,tcgsize2opsize[tosize],href))
         else if (tcgsize2opsize[tosize]=S_L) and
@@ -845,13 +760,18 @@ unit cgcpu;
     procedure tcg68k.a_load_reg_ref(list : TAsmList;fromsize,tosize : tcgsize;register : tregister;const ref : treference);
       var
         href : treference;
+        hreg : tregister;
       begin
         href := ref;
-        fixref(list,href);
+        hreg := register;
+        fixref(list,href,false);
         if tcgsize2size[fromsize]<tcgsize2size[tosize] then
-          a_load_reg_reg(list,fromsize,tosize,register,register);
+          begin
+            hreg:=getintregister(list,tosize);
+            a_load_reg_reg(list,fromsize,tosize,register,hreg);
+          end;
         { move to destination reference }
-        list.concat(taicpu.op_reg_ref(A_MOVE,TCGSize2OpSize[tosize],register,href));
+        list.concat(taicpu.op_reg_ref(A_MOVE,TCGSize2OpSize[tosize],hreg,href));
       end;
 
 
@@ -859,77 +779,31 @@ unit cgcpu;
       var
         aref: treference;
         bref: treference;
-        tmpref : treference;
-        dofix : boolean;
+        usetemp: boolean;
         hreg: TRegister;
       begin
+        usetemp:=TCGSize2OpSize[fromsize]<>TCGSize2OpSize[tosize];
+
         aref := sref;
         bref := dref;
-        fixref(list,aref);
-        fixref(list,bref);
-        if TCGSize2OpSize[fromsize]<>TCGSize2OpSize[tosize] then
+        fixref(list,aref,false);
+
+        if usetemp then
           begin
-            { if we need to change the size then always use a temporary
-              register }
+            { if we will use a temp register, we don't need to fully resolve 
+              the dest ref, not even on coldfire }
+            fixref(list,bref,false); 
+            { if we need to change the size then always use a temporary register }
             hreg:=getintregister(list,fromsize);
             list.concat(taicpu.op_ref_reg(A_MOVE,TCGSize2OpSize[fromsize],aref,hreg));
             sign_extend(list,fromsize,tosize,hreg);
             list.concat(taicpu.op_reg_ref(A_MOVE,TCGSize2OpSize[tosize],hreg,bref));
-            exit;
-          end;
-        { Coldfire dislikes certain move combinations }
-        if current_settings.cputype in cpu_coldfire then
+          end
+        else
           begin
-            { TODO : move.b/w only allowed in newer coldfires... (ISA_B+) }
-
-            dofix:=false;
-            if { (d16,Ax) and (d8,Ax,Xi) }
-                (
-                  (aref.base<>NR_NO) and
-                  (
-                    (aref.index<>NR_NO) or
-                    (aref.offset<>0)
-                  )
-                ) or
-                { (xxx) }
-                assigned(aref.symbol) then
-              begin
-                if aref.index<>NR_NO then
-                  begin
-                    dofix:={ (d16,Ax) and (d8,Ax,Xi) }
-                           (
-                             (bref.base<>NR_NO) and
-                             (
-                               (bref.index<>NR_NO) or
-                               (bref.offset<>0)
-                             )
-                           ) or
-                           { (xxx) }
-                           assigned(bref.symbol);
-                  end
-                else
-                  { offset <> 0, but no index }
-                  begin
-                    dofix:={ (d8,Ax,Xi) }
-                           (
-                             (bref.base<>NR_NO) and
-                             (bref.index<>NR_NO)
-                           ) or
-                           { (xxx) }
-                           assigned(bref.symbol);
-                  end;
-              end;
-
-            if dofix then
-              begin
-                hreg:=getaddressregister(list);
-                reference_reset_base(tmpref,hreg,0,0);
-                list.concat(taicpu.op_ref_reg(A_LEA,S_L,aref,hreg));
-                list.concat(taicpu.op_ref_ref(A_MOVE,TCGSize2OpSize[fromsize],tmpref,bref));
-                exit;
-              end;
+            fixref(list,bref,current_settings.cputype in cpu_coldfire);
+            list.concat(taicpu.op_ref_ref(A_MOVE,TCGSize2OpSize[fromsize],aref,bref));
           end;
-        list.concat(taicpu.op_ref_ref(A_MOVE,TCGSize2OpSize[fromsize],aref,bref));
       end;
 
 
@@ -971,7 +845,7 @@ unit cgcpu;
        opsize: topsize;
       begin
          href:=ref;
-         fixref(list,href);
+         fixref(list,href,false);
          if tcgsize2size[fromsize]<tcgsize2size[tosize] then
            size:=fromsize
          else
@@ -999,7 +873,7 @@ unit cgcpu;
         hreg : tregister;
       begin
         href:=ref;
-        fixref(list, href);
+        fixref(list, href, false);
         if not isaddressregister(r) then
           begin
             hreg:=getaddressregister(list);
@@ -1031,7 +905,7 @@ unit cgcpu;
         if opsize = S_FX then
           internalerror(20020729);
         href := ref;
-        fixref(list,href);
+        fixref(list,href,false);
         list.concat(taicpu.op_ref_reg(A_FMOVE,opsize,href,reg));
       end;
 
@@ -1045,7 +919,7 @@ unit cgcpu;
         if opsize = S_FX then
           internalerror(20020729);
         href := ref;
-        fixref(list,href);
+        fixref(list,href,false);
         list.concat(taicpu.op_reg_ref(A_FMOVE,opsize,reg,href));
       end;
 
@@ -1092,7 +966,7 @@ unit cgcpu;
           if use_push(cgpara) and (current_settings.fputype in [fpu_68881]) then
             begin
               fref:=ref;
-              fixref(list,fref);
+              fixref(list,fref,false);
               { fmove can't do <ea> -> <ea>, so move it to an fpreg first }
               freg:=getfpuregister(list,size);
               a_loadfpu_ref_reg(list,size,size,fref,freg);
@@ -1284,10 +1158,10 @@ unit cgcpu;
           OP_SUB :
             begin
               href:=ref;
-              fixref(list,href);
               { add/sub works the same way, so have it unified here }
               if (a >= 1) and (a <= 8) then
                 begin
+                  fixref(list,href,false);
                   if (op = OP_ADD) then
                     opcode:=A_ADDQ
                   else
@@ -1296,7 +1170,10 @@ unit cgcpu;
                 end
               else
                 if not(current_settings.cputype in cpu_coldfire) then
-                  list.concat(taicpu.op_const_ref(opcode, opsize, a, href))
+                  begin
+                    fixref(list,href,false);
+                    list.concat(taicpu.op_const_ref(opcode, opsize, a, href));
+                  end
                 else
                   { on ColdFire, ADDI/SUBI cannot act on memory
                     so we can only go through a register }
@@ -1437,7 +1314,7 @@ unit cgcpu;
           OP_SUB :
             begin
               href:=ref;
-              fixref(list,href);
+              fixref(list,href,false);
               { areg -> ref arithmetic operations are impossible on 68k }
               hreg:=force_to_dataregister(list,size,reg);
               { add/sub works the same way, so have it unified here }
@@ -1518,7 +1395,7 @@ unit cgcpu;
           begin
             //list.concat(tai_comment.create(strpnew('a_cmp_const_ref_label with TST')));
             tmpref:=ref;
-            fixref(list,tmpref);
+            fixref(list,tmpref,false);
             list.concat(taicpu.op_ref(A_TST,tcgsize2opsize[size],tmpref));
             a_jmp_cond(list,cmp_op,l);
           end
@@ -1738,6 +1615,7 @@ unit cgcpu;
         if not nostackframe then
           begin
             { size can't be negative }
+            localsize:=align(localsize,4);
             if (localsize < 0) then
               internalerror(2006122601);
 
@@ -2273,7 +2151,7 @@ unit cgcpu;
           OP_AND,OP_OR:
             begin
               tempref:=ref;
-              tcg68k(cg).fixref(list,tempref);
+              tcg68k(cg).fixref(list,tempref,false);
               inc(tempref.offset,4);
               list.concat(taicpu.op_ref_reg(topcg2tasmop[op],S_L,tempref,reg.reglo));
               dec(tempref.offset,4);

+ 3 - 2
compiler/m68k/cpuinfo.pas

@@ -120,12 +120,13 @@ Const
                                  genericlevel3optimizerswitches-
                                  { no need to write info about those }
                                  [cs_opt_level1,cs_opt_level2,cs_opt_level3]+
-                                 [cs_opt_regvar,cs_opt_loopunroll,cs_opt_nodecse,
+                                 [cs_opt_regvar,cs_opt_stackframe,cs_opt_loopunroll,
+                                  cs_opt_tailrecursion,cs_opt_nodecse,
                                   cs_opt_reorder_fields,cs_opt_fastmath];
 
    level1optimizerswitches = genericlevel1optimizerswitches;
    level2optimizerswitches = genericlevel2optimizerswitches + level1optimizerswitches +
-     [cs_opt_regvar,cs_opt_stackframe,cs_opt_nodecse];
+     [cs_opt_regvar,cs_opt_stackframe,cs_opt_tailrecursion,cs_opt_nodecse];
    level3optimizerswitches = genericlevel3optimizerswitches + level2optimizerswitches + [{,cs_opt_loopunroll}];
    level4optimizerswitches = genericlevel4optimizerswitches + level3optimizerswitches + [];
 

+ 2 - 2
compiler/m68k/hlcgcpu.pas

@@ -88,7 +88,7 @@ implementation
     begin
       //list.concat(tai_comment.create(strpnew('a_bit_set_reg_ref: called!')));
       sref:=get_bit_reg_ref_sref(list,fromsize,tosize,bitnumber,ref);
-      tcg68k(cg).fixref(list,sref.ref);
+      tcg68k(cg).fixref(list,sref.ref,false);
 
       tmpvalue:=getintregister(list,ptruinttype);
       a_load_const_reg(list,ptruinttype,7,tmpvalue);
@@ -105,7 +105,7 @@ implementation
     begin
       //list.concat(tai_comment.create(strpnew('a_bit_set_const_ref: called!')));
       sref:=get_bit_const_ref_sref(bitnumber,destsize,ref);
-      tcg68k(cg).fixref(list,sref.ref);
+      tcg68k(cg).fixref(list,sref.ref,current_settings.cputype in cpu_coldfire);
 
       { memory accesses of bset/bclr are always byte, so no alignment problem }
       list.concat(taicpu.op_const_ref(bit_set_clr_instr[doset],S_NO,8-sref.startbit-1,sref.ref));

+ 6 - 6
compiler/m68k/n68kadd.pas

@@ -157,7 +157,7 @@ implementation
                 LOC_REFERENCE,LOC_CREFERENCE:
                     begin
                       href:=right.location.reference;
-                      tcg68k(cg).fixref(current_asmdata.CurrAsmList,href);
+                      tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,false);
                       current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,tcgsize2opsize[right.location.size],href,location.register));
                     end
                 else
@@ -194,7 +194,7 @@ implementation
                 LOC_REFERENCE,LOC_CREFERENCE:
                     begin
                       href:=right.location.reference;
-                      tcg68k(cg).fixref(current_asmdata.CurrAsmList,href);
+                      tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,false);
                       current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_FCMP,tcgsize2opsize[right.location.size],href,left.location.register));
                     end
                 else
@@ -307,7 +307,7 @@ implementation
              LOC_CREFERENCE:
                begin
                  href:=left.location.reference;
-                 tcg68k(cg).fixref(current_asmdata.CurrAsmList,href);
+                 tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,false);
                  current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,opsize,href));
                  location_freetemp(current_asmdata.CurrAsmList,left.location);
                end;
@@ -350,7 +350,7 @@ implementation
          LOC_CREFERENCE:
            begin
              href:=right.location.reference;
-             tcg68k(cg).fixref(current_asmdata.CurrAsmList,href);
+             tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,false);
              current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_CMP,opsize,href,
                left.location.register));
            end;
@@ -475,7 +475,7 @@ implementation
               LOC_CREFERENCE:
                 begin
                   href:=left.location.reference;
-                  tcg68k(cg).fixref(current_asmdata.CurrAsmList,href);
+                  tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,false);
                   current_asmdata.CurrAsmList.concat(taicpu.op_ref(A_TST,S_L,href));
                   firstjmp64bitcmp;
                   inc(href.offset,4);
@@ -518,7 +518,7 @@ implementation
           LOC_REFERENCE,LOC_CREFERENCE:
             begin
               href:=right.location.reference;
-              tcg68k(cg).fixref(current_asmdata.CurrAsmList,href);
+              tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,false);
               current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_CMP,S_L,href,left.location.register64.reghi));
               firstjmp64bitcmp;
               inc(href.offset,4);

+ 1 - 1
compiler/m68k/n68kcnv.pas

@@ -148,7 +148,7 @@ implementation
           LOC_REFERENCE,LOC_CREFERENCE:
             begin
               ref:=left.location.reference;
-              tcg68k(cg).fixref(current_asmdata.CurrAsmList,ref);
+              tcg68k(cg).fixref(current_asmdata.CurrAsmList,ref,false);
               current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_FMOVE,TCGSize2OpSize[opsize],ref,location.register));
             end
           else

+ 1 - 1
compiler/m68k/n68kinl.pas

@@ -216,7 +216,7 @@ implementation
                   begin
                     location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
                     href:=left.location.reference;
-                    tcg68k(cg).fixref(current_asmdata.CurrAsmList,href);
+                    tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,false);
                     current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(op,tcgsize2opsize[left.location.size],href,location.register));
                   end;
                 else

+ 2 - 2
compiler/m68k/n68kmat.pas

@@ -89,7 +89,7 @@ implementation
               LOC_REFERENCE,
               LOC_CREFERENCE:
                 begin
-                  tcg68k(cg).fixref(current_asmdata.CurrAsmList,left.location.reference);
+                  tcg68k(cg).fixref(current_asmdata.CurrAsmList,left.location.reference,false);
                   if is_64bit(resultdef) then
                    begin
                      hreg:=cg.GetIntRegister(current_asmdata.CurrAsmList,OS_32);
@@ -194,7 +194,7 @@ implementation
             begin
               location.register:=cg.getfpuregister(current_asmdata.CurrAsmList,location.size);
               href:=left.location.reference;
-              tcg68k(cg).fixref(current_asmdata.CurrAsmList,href);
+              tcg68k(cg).fixref(current_asmdata.CurrAsmList,href,false);
               current_asmdata.CurrAsmList.concat(taicpu.op_ref_reg(A_FNEG,tcgsize2opsize[left.location.size],href,location.register));
             end;
           LOC_FPUREGISTER:

+ 3 - 3
compiler/m68k/rgcpu.pas

@@ -152,12 +152,12 @@ unit rgcpu;
                 end
               else if (instr.oper[1]^.typ=top_reg) and (getregtype(instr.oper[1]^.reg)=regtype) and
                 (get_alias(getsupreg(instr.oper[1]^.reg))=orgreg) and
-                (
+                ((
                   (instr.opcode in [A_MOVE,A_ADD,A_SUB,A_AND,A_OR]) and
                   (instr.oper[0]^.typ=top_reg) and not
-                  (isaddressregister(instr.oper[0]^.reg) and (instr.opcode in [A_ADD,A_SUB,A_AND,A_OR]))
+                  (isaddressregister(instr.oper[0]^.reg))
                 ) or
-                (instr.opcode in [A_ADDQ,A_SUBQ,A_MOV3Q]) then
+                (instr.opcode in [A_ADDQ,A_SUBQ,A_MOV3Q])) then
                 opidx:=1;
             end;
         end;

+ 1 - 0
compiler/macho.pas

@@ -87,6 +87,7 @@ const
   CPU_TYPE_MC98000	= 10;
   CPU_TYPE_HPPA     = 11;
   CPU_TYPE_ARM		  = 12;
+  CPU_TYPE_ARM64          = CPU_TYPE_ARM or CPU_ARCH_ABI64;
   CPU_TYPE_MC88000	= 13;
   CPU_TYPE_SPARC		= 14;
   CPU_TYPE_I860		  = 15;

+ 83 - 7
compiler/mips/cpuelf.pas

@@ -117,8 +117,8 @@ implementation
     R_MIPS_PC16    = 10;
     R_MIPS_CALL16  = 11;
     R_MIPS_GPREL32 = 12;
-    R_MIPS_GOT_HI16 = 21;
-    R_MIPS_GOT_LO16 = 22;
+    R_MIPS_GOT_HI16 = 22;
+    R_MIPS_GOT_LO16 = 23;
     R_MIPS_CALL_HI16 = 30;
     R_MIPS_CALL_LO16 = 31;
     R_MIPS_JALR    = 37;
@@ -175,6 +175,62 @@ implementation
       offset:aword;
     end;
 
+
+  const
+    relocnames: array[0..50] of PChar = (
+      'R_MIPS_NONE',
+      'R_MIPS_16',
+      'R_MIPS_32',
+      'R_MIPS_REL32',
+      'R_MIPS_26',
+      'R_MIPS_HI16',
+      'R_MIPS_LO16',
+      'R_MIPS_GPREL16',
+      'R_MIPS_LITERAL',
+      'R_MIPS_GOT16',
+      'R_MIPS_PC16',
+      'R_MIPS_CALL16',
+      'R_MIPS_GPREL32',
+      nil,  {13}
+      nil,  {14}
+      nil,  {15}
+      nil,  {16}
+      nil,  {17}
+      nil,  {18}
+      nil,  {19}
+      nil,  {20}
+      nil,  {21}
+      'R_MIPS_GOT_HI16',
+      'R_MIPS_GOT_LO16',
+      nil,  {24}
+      nil,  {25}
+      nil,  {26}
+      nil,  {27}
+      nil,  {28}
+      nil,  {29}
+      'R_MIPS_CALL_HI16',
+      'R_MIPS_CALL_LO16',
+      nil,  {32}
+      nil,  {33}
+      nil,  {34}
+      nil,  {35}
+      nil,  {36}
+      'R_MIPS_JALR',
+      'R_MIPS_TLS_DTPMOD32',
+      'R_MIPS_TLS_DTPREL32',
+      'R_MIPS_TLS_DTPMOD64',
+      'R_MIPS_TLS_DTPREL64',
+      'R_MIPS_TLS_GD',
+      'R_MIPS_TLS_LDM',
+      'R_MIPS_TLS_DTPREL_HI16',
+      'R_MIPS_TLS_DTPREL_LO16',
+      'R_MIPS_TLS_GOTTPREL',
+      'R_MIPS_TLS_TPREL32',
+      'R_MIPS_TLS_TPREL64',
+      'R_MIPS_TLS_TPREL_HI16',
+      'R_MIPS_TLS_TPREL_LO16'
+    );
+
   procedure MaybeSwapElfReginfo(var h:TElfReginfo);
     var
       i: longint;
@@ -218,7 +274,11 @@ implementation
 
   function elf_mips_relocname(reltyp:byte):string;
     begin
-      result:='TODO';
+      if (reltyp<=high(relocnames)) and
+        (relocnames[reltyp]<>nil) then
+        result:=relocnames[reltyp]
+      else
+        result:='unknown ('+tostr(reltyp)+')';
     end;
 
 
@@ -863,6 +923,8 @@ implementation
               begin
                 tmp:=(address and $03FFFFFF) shl 2;
                 tmp:=((tmp or (curloc and $F0000000))+relocval) shr 2;
+                { TODO: Report overflow if upper 4 bits change
+                        However JAL to undefined weak symbol is not treated as an overflow }
                 address:=(address and $FC000000) or (tmp and $3FFFFFF);
               end;
 
@@ -955,8 +1017,12 @@ implementation
               end;
 
             R_MIPS_PC16:
-              //TODO: check overflow
-              address:=(address and $FFFF0000) or ((((SmallInt(address) shl 2)+relocval-curloc) shr 2) and $FFFF);
+              begin
+                tmp:=((SmallInt(address) shl 2)+relocval-curloc) shr 2;
+                if (tmp<>SmallInt(tmp)) then
+                  ReportRelocOverflow(reltyp,objsec,objreloc);
+                address:=(address and $FFFF0000) or (tmp and $FFFF);
+              end;
 
             R_MIPS_GPREL32:
               address:=address+relocval+TElfObjData(objsec.objdata).gp_value-gotsymbol.address;
@@ -986,8 +1052,18 @@ implementation
                 address:=(address and $FFFF0000) or (tmp and $FFFF);
               end;
 
-            R_MIPS_JALR: {optimization hint, ignore for now }
-              ;
+            R_MIPS_JALR: {optimization hint}
+              begin
+                { 4 is subtracted because branch is relative to delay slot, not instruction itself }
+                tmp:=(relocval-curloc-4) shr 2;
+                if (tmp=SmallInt(tmp)) then
+                  begin
+                    if (address=$0320f809) then        { JALR $t9 -> BAL addr }
+                      address:=$04110000 or (tmp and $FFFF)
+                    else if (address=$03200008) then   { JR $t9   -> B addr }
+                      address:=$10000000 or (tmp and $FFFF);
+                  end;
+              end;
           else
             begin
               writeln(objsec.fullname,'+',objreloc.dataoffset,' ',objreloc.ftype);

+ 26 - 38
compiler/mips/racpugas.pas

@@ -26,15 +26,16 @@ Unit racpugas;
 Interface
 
   uses
+    cgbase,
     rautils,
     raatt;
 
   type
     tMipsReader = class(tattreader)
+      actrel: trefaddr;
       function is_asmopcode(const s: string):boolean;override;
       procedure BuildOperand(oper : TOperand);
       procedure BuildOpCode(instr : TInstruction);
-      procedure ConvertCalljmp(instr : TInstruction);
       procedure handlepercent;override;
       procedure handledollar;override;
       procedure handleopcode;override;
@@ -59,7 +60,7 @@ Interface
       rabase,
       rgbase,
       itcpugas,
-      cgbase,cgobj
+      cgobj
       ;
 
 
@@ -92,7 +93,6 @@ Interface
         len:=1;
         actasmpattern[len]:='%';
         c:=current_scanner.asmgetchar;
-        { to be a register there must be a letter and not a number }
         while c in ['a'..'z','A'..'Z','0'..'9'] do
           Begin
             inc(len);
@@ -101,12 +101,15 @@ Interface
           end;
          actasmpattern[0]:=chr(len);
          uppervar(actasmpattern);
+         actrel:=addr_no;
          if (actasmpattern='%HI') then
-           actasmtoken:=AS_HI
+           actrel:=addr_high
          else if (actasmpattern='%LO')then
-           actasmtoken:=AS_LO
+           actrel:=addr_low
          else
            Message(asmr_e_invalid_reference_syntax);
+         if actrel<>addr_no then
+           actasmtoken:=AS_RELTYPE;
       end;
 
 
@@ -215,18 +218,28 @@ Interface
                 gotplus:=true;
               end;
 
-            AS_INTNUM,
-            AS_MOD:
+            AS_INTNUM:
               Begin
                 if not gotplus then
                   Message(asmr_e_invalid_reference_syntax);
                 l:=BuildConstExpression(True,False);
                 if negative then
                   l:=-l;
-                { Constant memory offset }
-                oper.InitRef;
-                oper.opr.ref.refaddr:=addr_full;
-                oper.opr.ref.offset:=l;
+                case oper.opr.typ of
+                  OPR_NONE:
+                    begin
+                      oper.opr.typ:=OPR_CONSTANT;
+                      oper.opr.val:=l;
+                    end;
+                  OPR_CONSTANT :
+                    inc(oper.opr.val,l);
+                  OPR_REFERENCE:
+                    inc(oper.opr.ref.offset,l);
+                  OPR_LOCAL:
+                    inc(oper.opr.localsymofs,l);
+                else
+                  InternalError(12345);
+                end;
                 GotPlus:=(prevasmtoken=AS_PLUS) or
                          (prevasmtoken=AS_MINUS);
                 if GotPlus then
@@ -244,16 +257,12 @@ Interface
                 gotplus:=false;
               end;
 
-            AS_HI,
-            AS_LO:
+            AS_RELTYPE:
               begin
                 { Low or High part of a constant (or constant
                   memory location) }
                 oper.InitRef;
-                if actasmtoken=AS_LO then
-                  oper.opr.ref.refaddr:=addr_low
-                else
-                  oper.opr.ref.refaddr:=addr_high;
+                oper.opr.ref.refaddr:=actrel;
                 Consume(actasmtoken);
                 Consume(AS_LPAREN);
                 BuildConstSymbolExpression(false, true,false,l,tempstr,tempsymtyp);
@@ -496,25 +505,6 @@ Interface
       end;
 
 
-    procedure TMipsReader.ConvertCalljmp(instr : TInstruction);
-      var
-        newopr : toprrec;
-      begin
-        if instr.Operands[1].opr.typ=OPR_REFERENCE then
-          with newopr do
-            begin
-              typ:=OPR_SYMBOL;
-              symbol:=instr.Operands[1].opr.ref.symbol;
-              symofs:=instr.Operands[1].opr.ref.offset;
-              if (instr.Operands[1].opr.ref.base<>NR_NO) or
-                (instr.Operands[1].opr.ref.index<>NR_NO) or
-                (instr.Operands[1].opr.ref.refaddr<>addr_full) then
-                Message(asmr_e_syn_operand);
-              instr.Operands[1].opr:=newopr;
-            end;
-      end;
-
-
     procedure TMipsReader.handleopcode;
       var
         instr : TInstruction;
@@ -524,8 +514,6 @@ Interface
         with instr do
           begin
             condition := actcondition;
-            if is_calljmp(opcode) then
-              ConvertCalljmp(instr);
             { Coprocessor-related instructions have operands referring to both coprocessor registers
               and general-purpose ones. The input representation "$<number>" is the same for both,
               but symbolic names must not be used for non-GPRs on output. }

+ 1 - 1
compiler/msg/errorct.msg

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

+ 111 - 61
compiler/msg/errord.msg

@@ -3,10 +3,10 @@
 #   Latest updates contributed by Karl-Michael Schindler aka mischi
 #   <karl-michael.schindler at web.de>
 #
-#   Based on errore.msg of SVN revision 30725
+#   Based on errore.msg of SVN revision 33053
 #
 #   This file is part of the Free Pascal Compiler
-#   Copyright (c) 1998-2015 by the Free Pascal Development team
+#   Copyright (c) 1998-2016 by the Free Pascal Development team
 #
 #   See the file COPYING.v2, included in this distribution,
 #   for details about the copyright.
@@ -28,7 +28,7 @@
 #   parser_   parser
 #   type_     type checking
 #   general_  general info
-#   exec_     calls to assembler, linker, binder
+#   exec_     calls to assembler, external linker, binder
 #   link_     internal linker
 #
 # <type> the type of the message it should normally used for
@@ -53,7 +53,7 @@
 #
 # General
 #
-# 01025 is the last used one
+# 01026 is the last used one
 #
 # BeginOfTeX
 % \section{General compiler messages}
@@ -136,6 +136,9 @@ general_f_ioerror=01024_F_I/O Fehler: $1
 % During compilation an I/O error happened which allows no further compilation.
 general_f_oserror=01025_F_Betriebsystemfehler: $1
 % During compilation an operating system error happened which allows no further compilation.
+general_e_exception_raised=01026_E_Kompilieren verursachte interne Ausnahme (exception)
+% Compilation was aborted, due to an exception generation.
+%
 %
 % \end{description}
 # EndOfTeX
@@ -198,7 +201,7 @@ scan_e_illegal_pack_records=02015_E_Ung
 % with an illegal value for \var{n}. For \$PACKRECORDS valid alignments are 1, 2, 4, 8, 16, 32, C,
 % NORMAL, DEFAULT, and for \$ALIGN valid alignments are 1, 2, 4, 8, 16, 32, ON,
 % OFF. Under mode MacPas \$ALIGN also supports MAC68K, POWER and RESET.
-scan_e_illegal_pack_enum=02016_E_Ung�ltige minimale Gr”sse der Aufz„hlung "$1"
+scan_e_illegal_pack_enum=02016_E_Ung�ltige minimale Gr”áe der Aufz„hlung "$1"
 % You are specifying the \var{\{\$PACKENUM n\}} with an illegal value for
 % \var{n}. Only 1,2,4, NORMAL or DEFAULT is valid here.
 scan_e_endif_expected=02017_E_$ENDIF erwartet f�r $1 $2 definiert in $3 Zeile $4
@@ -337,7 +340,7 @@ scan_e_mode_switch_not_allowed=02067_E_Der Modus Umschalter "$1" ist hier nicht
 % a mode switch occurs after UNIT.
 scan_e_error_macro_undefined=02068_E_Die Compile time Variable oder das Makro "$1" ist nicht definiert.
 % Thus the conditional compile time expression cannot be evaluated. Only in mode MacPas.
-scan_e_utf8_bigger_than_65535=02069_E_Der UTF-8 Code ist gr”sser als 65535
+scan_e_utf8_bigger_than_65535=02069_E_Der UTF-8 Code ist grӇer als 65535
 % \fpc handles UTF-8 strings internally as widestrings, i.e. the char codes are limited to 65535.
 scan_e_utf8_malformed=02070_E_Ung�ltige UTF-8 Zeichenkette
 % The given string isn't a valid UTF-8 string.
@@ -421,7 +424,7 @@ scan_e_illegal_hugepointernormalization=02098_E_Illegales Argument f
 #
 # Parser
 #
-# 03340 is the last used one
+# 03344 is the last used one
 #
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
@@ -512,7 +515,7 @@ parser_n_duplicate_enum=03031_N_Werte in Aufz
 parser_e_no_with_for_variable_in_other_segments=03033_E_WITH kann nicht auf Variablen in anderen Segmenten angewendet werden
 % With stores a variable locally on the stack,
 % but this is not possible if the variable belongs to another segment.
-parser_e_too_much_lexlevel=03034_E_Funktionsverschachtelung gr”sser als 31
+parser_e_too_much_lexlevel=03034_E_Funktionsverschachtelung grӇer als 31
 % You can nest function definitions only 31 levels deep.
 parser_e_range_check_error=03035_E_Bereichspr�fungsfehler bei Konstantenbestimmung
 % The constants are out of their allowed range.
@@ -862,7 +865,7 @@ parser_e_array_lower_less_than_upper_bound=03140_E_Obere Grenze des Bereichs ist
 parser_w_string_too_long=03141_W_String "$1" ist l„nger als $2
 % The size of the constant string is larger than the size you specified in
 % string type definition.
-parser_e_string_larger_array=03142_E_Stringl„nge ist gr”sser als die L„nge des "array of char"
+parser_e_string_larger_array=03142_E_Stringl„nge ist gr”áer als die L„nge des "array of char"
 % The size of the constant string is larger than the size you specified in
 % the \var{Array[x..y] of char} definition.
 parser_e_ill_msg_expr=03143_E_Ung�ltiger Ausdruck nach der 'Message'-Direktive
@@ -1130,7 +1133,7 @@ parser_e_arithmetic_operation_overflow=03213_E_
 % An operation on two integer values produced an overflow.
 parser_e_protected_or_private_expected=03214_E_Protected oder private erwartet
 % \var{strict} can be only used together with \var{protected} or \var{private}.
-parser_e_illegal_slice=03215_E_SLICE kann nicht ausserhalb der Parameterliste benutzt werden
+parser_e_illegal_slice=03215_E_SLICE kann nicht auáerhalb der Parameterliste benutzt werden
 % \var{slice} can be used only for arguments accepting an open array parameter.
 parser_e_dispinterface_cant_have_parent=03216_E_Ein DISPINTERFACE kann keine Elternklasse haben.
 % A DISPINTERFACE is a special type of interface which cannot have a parent class. Dispinterface always derive from IDispatch type.
@@ -1144,7 +1147,7 @@ parser_w_overridden_methods_not_same_ret=03218_W_
 % and the way the methods are called.
 parser_e_dispid_must_be_ord_const=03219_E_Dispatch IDs m�ssen ganzzahlige Konstanten sein
 % The \var{dispid} keyword must be followed by an ordinal constant (the dispid index).
-parser_e_array_range_out_of_bounds=03220_E_Der Bereich des Array ist zu gross
+parser_e_array_range_out_of_bounds=03220_E_Der Bereich des Array ist zu groá
 % Regardless of the size taken up by its elements, an array cannot have more
 % than high(ptrint) elements. Additionally, the range type must be a subrange
 % of ptrint.
@@ -1182,7 +1185,7 @@ parser_e_type_object_constants=03230_E_Konstanten eines Objekts, das ein VMT ent
 % If an object requires a VMT either because it contains a constructor or virtual methods,
 % it's not allowed to create constants of it. In TP and Delphi mode this is allowed
 % for compatibility reasons.
-parser_e_label_outside_proc=03231_E_Die Address von Labels, die ausserhalb des aktuellen Scopes definiert wurden, k”nnen nicht verwendet werden
+parser_e_label_outside_proc=03231_E_Die Address von Labels, die auáerhalb des aktuellen Scopes definiert wurden, k”nnen nicht verwendet werden
 % It isn't allowed to take the address of labels outside the
 % current procedure.
 parser_e_initialized_not_for_external=03233_E_Extern deklarierte Variablen k”nnen nicht intialisiert werden 
@@ -1545,6 +1548,17 @@ parser_e_global_generic_references_static=03339_E_Ein globales, generisches Temp
 parser_u_already_compiled=03340_UL_Die Unit $1 wurde inzwischen bereits kompiliert.
 % This tells you that the recursive reading of the uses clauses triggered already
 % a compilation of the current unit, so the current compilation can be aborted.
+parser_e_explicit_method_implementation_for_specializations_not_allowed=03341_E_Die explizite Implementierung von Methoden ist bei der Spezialisierung von "Generics" nicht erlaubt
+% Methods introduced in a generic must be implemented for the generic. It is not possible to implement them only for specializations.
+parser_e_no_genfuncs_in_interfaces=03342_E_Generische Methoden sind in Interfaces nicht erlaubt
+% Generic methods are not allowed in interfaces, because there is no way to specialize a suitable
+% implementation.
+parser_e_genfuncs_cannot_be_virtual=03343_E_Generische Methoden k”nnen nicht virtuell sein
+% Generic methods can not be declared as virtual as there'd need to be a VMT entry for each
+% specialization. This is however not possible with a static VMT.
+parser_e_packages_not_supported=03344_E_Dynamische Pakete werden f�r das Ziel-OS nicht unterst�tzt
+% Support for dynamic packages is not implemented for the specified target OS
+% or it is at least not tested and thus disabled.
 %
 % \end{description}
 # EndOfTeX
@@ -1715,7 +1729,7 @@ type_w_mixed_signed_unsigned2=04036_W_Mischen von signed Ausdr
 % such a case both operands are converted to longword before the operation is
 % carried out. You can avoid this by typecasting one operand so it
 % matches the result type of the other one.
-type_e_typecast_wrong_size_for_assignment=04037_E_Typecast hat verschiedene Gr”ssen ($1 -> $2) in der Zuweisung
+type_e_typecast_wrong_size_for_assignment=04037_E_Typecast hat verschiedene GrӇen ($1 -> $2) in der Zuweisung
 % Type casting to a type with a different size is not allowed when the variable is
 % used in an assignment.
 type_e_array_index_enums_with_assign_not_possible=04038_E_enums mit Zuweisungen k”nnen nicht als Array-Index verwendet werden
@@ -1753,16 +1767,16 @@ type_w_instance_with_abstract=04046_W_Konstruktion der Klasse "$1" mit der abstr
 % An instance of a class is created which contains non-implemented abstract
 % methods. This will probably lead to a runtime error 211 in the code if that
 % routine is ever called. All abstract methods should be overridden.
-type_h_in_range_check=04047_H_Der linke Operand des IN Operators sollte byte Gr”sse haben
+type_h_in_range_check=04047_H_Der linke Operand des IN Operators sollte byte GrӇe haben
 % The left operand of the \var{in} operator is not an ordinal or enumeration which fits
 % within 8 bits. This may lead to range check errors. The \var{in} operator
 % currently only supports a left operand which fits within a byte. In the case of
 % enumerations, the size of an element of an enumeration can be controlled with
 % the \var{\{\$PACKENUM\}} or \var{\{\$Zn\}} switches.
-type_w_smaller_possible_range_check=04048_W_Unpassende Typgr”ssen, Gefahr des Datenverlusts oder der Bereichs�berschreitung
+type_w_smaller_possible_range_check=04048_W_Unpassende Typgr”áen, Gefahr des Datenverlusts oder der Bereichs�berschreitung
 % There is an assignment to a smaller type than the source type. This means that
 % this may cause a range-check error, or may lead to possible loss of data.
-type_h_smaller_possible_range_check=04049_H_Unpassende Typgr”ssen, Gefahr des Datenverlusts oder der Bereichs�berschreitung
+type_h_smaller_possible_range_check=04049_H_Unpassende Typgr”áen, Gefahr des Datenverlusts oder der Bereichs�berschreitung
 % There is an assignment to a smaller type than the source type. This means that
 % this may cause a range-check error, or may lead to possible loss of data.
 type_e_cant_take_address_of_abstract_method=04050_E_Die Adresse einer abstrakten Methode kann nicht verwendet werden
@@ -2106,7 +2120,7 @@ sym_h_param_list=05039_H_Deklaration gefunden: $1
 % You get this when you use the \var{-vh} switch.In the case of an overloaded procedure
 % not being found. Then all candidate overloaded procedures are
 % listed, with their parameter lists.
-sym_e_segment_too_large=05040_E_Datensegment zu gross (max. 2GB)
+sym_e_segment_too_large=05040_E_Datensegment zu groá (max. 2GB)
 % You get this when you declare a data element whose size exceeds the
 % prescribed limit (2 Gb on 80386+/68020+ processors).
 sym_e_no_matching_implementation_found=05042_E_Keine passende Implementation der Interface Methode "$1" gefunden
@@ -2223,7 +2237,7 @@ sym_w_experimental_unit=05079_W_Unit "$1" ist experimentell
 % declared as \var{experimental} is used. Experimental units
 % might disappear or change semantics in future versions. Usage of this unit
 % should be avoided as much as possible.
-sym_e_formal_class_not_resolved=05080_E_Die vollst„ndige Definition der formal deklarierten ObjC-Klasse "$1" fehlt in diesem Geltungsbereich
+sym_e_formal_class_not_resolved=05080_E_Die vollst„ndige Definition der formal deklarierten ObjC-Klasse "$1" fehlt in diesem Geltungsbereich. Erg„nzen sie die uses-Anweisung um die Unit mit der vollst„ndigen Definition
 % Objecive-C and Java classes can be imported formally, without using the unit in which it is fully declared.
 % This enables making forward references to such classes and breaking circular dependencies amongst units.
 % However, as soon as you wish to actually do something with an entity of this class type (such as
@@ -2314,7 +2328,7 @@ sym_w_duplicate_id=05095_W_Duplikat des Bezeichners "$1"
 % This section lists all messages that can be displayed if the code
 % generator encounters an error condition.
 % \begin{description}
-cg_e_parasize_too_big=06009_E_Gr”sse der Parameterliste �bersteigt 65535 Bytes
+cg_e_parasize_too_big=06009_E_Gr”áe der Parameterliste �bersteigt 65535 Bytes
 % The I386 processor limits the parameter list to 65535 bytes. (The \var{RET}
 % instruction causes this).
 cg_e_file_must_call_by_reference=06012_E_Dateitypen m�ssen VAR Parameter sein
@@ -2406,13 +2420,13 @@ cg_e_control_flow_outside_finally=06040_E_Kontrollfluss-Anweisungen sind in eine
 % If the procedure \var{p} raises an exception the finally block is
 % executed. If the execution reaches the exit, it's unclear what to do:
 % exit the procedure or search for another exception handler.
-cg_w_parasize_too_big=06041_W_Gr”sse der Parameter �berschreitet die Grenze f�r bestimmte CPUs
+cg_w_parasize_too_big=06041_W_Gr”áe der Parameter �berschreitet die Grenze f�r bestimmte CPUs
 % This indicates that you are declaring more than 64K of parameters, which
 % might not be supported on other processor targets.
-cg_w_localsize_too_big=06042_W_Gr”sse der lokalen Variablen �berschreitet die Grenze f�r bestimmte CPUs
+cg_w_localsize_too_big=06042_W_Gr”áe der lokalen Variablen �berschreitet die Grenze f�r bestimmte CPUs
 % This indicates that you are declaring more than 32K of local variables, which
 % might not be supported on other processor targets.
-cg_e_localsize_too_big=06043_E_Gr”sse der lokalen Variablen �berschreitet die unterst�tzte Grenze
+cg_e_localsize_too_big=06043_E_Gr”áe der lokalen Variablen �berschreitet die unterst�tzte Grenze
 % This indicates that you are declaring more than 32K of local variables, which
 % is not supported by this processor.
 cg_e_break_not_allowed=06044_E_BREAK nicht zul„ssig
@@ -2452,7 +2466,7 @@ cg_e_mod_only_defined_for_pos_quotient=06054_E_Im ISO-Modus ist der Operator mod
 % In ISO pascal, only positive values are allowed for the quotient: \var{n mod m} is only valid if \var{m>0}.
 cg_d_autoinlining=06055_DL_Automatisches inlining: $1
 % Due to auto inlining turned on, the compiler auto inlines this subroutine.
-cg_e_function_not_support_by_selected_instruction_set=06056_E_Die verwendete Funktion wird vom ausgew„hlten Instruction-Set nicht unterst�tzt: $1
+cg_e_function_not_support_by_selected_instruction_set=06056_E_Die verwendete Funktion wird vom ausgew„hlten Instruktionen-Satz nicht unterst�tzt: $1
 % Some functions cannot be implemented efficiently for certain instruction sets, one example is fused multiply/add.
 % To avoid very inefficient code, the compiler complains in this case, so either select another instruction set
 % or replace the function call by alternative code
@@ -2466,7 +2480,7 @@ cg_f_max_units_reached=06057_F_Maximale Anzahl an Units ($1) f
 #
 # Assembler reader
 #
-# 07125 is the last used one
+# 07129 is the last used one
 #
 asmr_d_start_reading=07000_DL_Starte $1 Stil Assembler Parsen
 % This informs you that an assembler block is being parsed
@@ -2544,7 +2558,7 @@ asmr_w_calling_overload_func=07032_W_Aufruf einer 
 % There is a call to an overloaded method in the assembler block,
 % this might be the sign there is a problem
 asmr_e_unsupported_symbol_type=07033_E_Nicht unterst�tzter Symboltyp f�r Operand
-asmr_e_constant_out_of_bounds=07034_E_Wert der Konstante ausserhalb des zul„ssigen Bereichs
+asmr_e_constant_out_of_bounds=07034_E_Wert der Konstante auáerhalb des zul„ssigen Bereichs
 asmr_e_error_converting_decimal=07035_E_Fehler beim Umwandeln in Dezimal $1
 % A constant decimal value does not have the correct syntax
 asmr_e_error_converting_octal=07036_E_Fehler beim Umwandeln in Oktal $1
@@ -2555,20 +2569,20 @@ asmr_e_error_converting_hexadecimal=07038_E_Fehler beim Umwandeln in Hexadezimal
 % A constant hexadecimal value does not have the correct syntax
 asmr_h_direct_global_to_mangled=07039_H_$1 �bersetzt nach $2
 asmr_w_direct_global_is_overloaded_func=07040_W_$1 ist einer �berladenen Funktion zugeordnet
-asmr_e_cannot_use_SELF_outside_a_method=07041_E_Kann SELF nicht ausserhalb einer Methode verwenden
+asmr_e_cannot_use_SELF_outside_a_method=07041_E_Kann SELF nicht auáerhalb einer Methode verwenden
 % There is a reference to the \var{self} symbol while it is not
 % allowed. \var{self} can only be referenced inside methods
-asmr_e_cannot_use_OLDEBP_outside_nested_procedure=07042_E_Kann OLDEBP ausserhalb einer verschachtelten Prozedur nicht verwenden
+asmr_e_cannot_use_OLDEBP_outside_nested_procedure=07042_E_Kann OLDEBP auáerhalb einer verschachtelten Prozedur nicht verwenden
 % There is a reference to the \var{oldebp} symbol while it is not
 % allowed. \var{oldebp} can only be referenced inside nested routines
 asmr_e_void_function=07043_W_Prozeduren k”nnen keinen Wert im Assembler-Code zur�ckliefern
 % Trying to return a value while in a procedure. A procedure
 % does not have any return value
 asmr_e_SEG_not_supported=07044_E_SEG nicht unterst�tzt
-asmr_e_size_suffix_and_dest_dont_match=07045_E_Gr”ssensuffix und Ziel- oder Quellgr”sse passen nicht zusammen
+asmr_e_size_suffix_and_dest_dont_match=07045_E_GrӇensuffix und Ziel- oder QuellgrӇe passen nicht zusammen
 % The register size and the opcode size suffix don't match. This is
 % probably an error in the assembler statement
-asmr_w_size_suffix_and_dest_dont_match=07046_W_Gr”ssensuffix und Ziel- oder Quellgr”sse passen nicht zusammen
+asmr_w_size_suffix_and_dest_dont_match=07046_W_GrӇensuffix und Ziel- oder QuellgrӇe passen nicht zusammen
 % The register size and the opcode size suffix don't match. This is
 % probably an error in the assembler statement
 asmr_e_syntax_error=07047_E_Assembler Syntaxfehler
@@ -2642,7 +2656,7 @@ asmr_e_cannot_access_object_field_directly=07082_E_Kann auf Felder von Objekten/
 % You should load the self pointer first into a register and then access the
 % fields using the register as base. By default the self pointer is available
 % in the esi register on i386.
-asmr_e_unable_to_determine_reference_size=07083_E_Gr”sse nicht spezifiziert und auch keine M”glichkeit die Gr”sse der Operanden zu bestimmen
+asmr_e_unable_to_determine_reference_size=07083_E_Gr”áe nicht spezifiziert und auch keine M”glichkeit die Gr”áe der Operanden zu bestimmen
 % You should specify explicitly a size for the reference, because
 % the compiler is unable to determine what size (byte,word,dword,etc.) it
 % should use for the reference.
@@ -2670,7 +2684,7 @@ asmr_e_higher_cpu_mode_required=07097_E_H
 % Trying to use an instruction which is not supported in the current
 % cpu mode. Use a higher cpu generation to be able to use this
 % opcode in your assembler block
-asmr_w_unable_to_determine_reference_size_using_dword=07098_W_Gr”sse nicht spezifiziert und auch keine M”glichkeit die Gr”sse der Operanden zu bestimmen. Es wird DWORD als Voreinstellung verwendet
+asmr_w_unable_to_determine_reference_size_using_dword=07098_W_Gr”áe nicht spezifiziert und auch keine M”glichkeit die Gr”áe der Operanden zu bestimmen. Es wird DWORD als Voreinstellung verwendet
 % You should specify explicitly a size for the reference, because
 % the compiler is unable to determine what size (byte,word,dword,etc.) it
 % should use for the reference. This warning is only used in Delphi mode where
@@ -2690,7 +2704,7 @@ asmr_e_packed_element=07100_E_Die Adresse der packed Komponente ist nicht an ein
 % message when trying to index arrays with elements whose size is not a multiple
 % of 8 bits. The same goes for accessing record fields with such an address.
 % multiple of 8 bits.
-asmr_w_unable_to_determine_reference_size_using_byte=07101_W_Gr”sse nicht angegeben und kann auch nicht aus der Gr”sse der Operanden bestimmt werden. Verwende BYTE als Voreinstellung
+asmr_w_unable_to_determine_reference_size_using_byte=07101_W_GrӇe nicht angegeben und kann auch nicht aus der GrӇe der Operanden bestimmt werden. Verwende BYTE als Voreinstellung
 % You should specify explicitly a size for the reference, because
 % the compiler is unable to determine what size (byte,word,dword,etc.) it
 % should use for the reference. This warning is only used in Delphi mode where
@@ -2767,6 +2781,17 @@ asmr_e_invalid_ref_register=07125_E_Ung
 % FPU, vector and sometimes integer registers cannot be used in memory reference
 % expressions, due to limitations of the cpu architecture or simple because
 % it is not meaningful.
+asmr_e_seg_without_identifier=07126_E_SEG ohne Bezeichner benutzt
+% You can only use SEG with an identifier. Other syntaxes are not
+% supported
+asmr_e_CODE_or_DATA_without_SEG=07127_E_@CODE und @DATA k”nnen nur mit dem SEG-Operator benutzt werden
+% You can only use @CODE and @DATA symbols together with the SEG operator
+asmr_e_const16bit_for_segment=07128_E_Nicht ausreichend Platz (16 Bit ben”tigt) f�r die Segment-Konstante des Symbols $1
+% Specifying a segment constant for a symbol via the SEG operator requires at
+% least 16 bits of space for the segment. This error occurs, if you specify
+% less, for example, if you use 'DB SEG symbol' instead of 'DW SEG symbol'.
+asmr_e_invalid_code_value=07129_E_Ung�ltiger Wert des Arguments f�r die .code-Direktive
+% The ARM assembler only allows the values 16 and 32 to be used as arguments to the .code directive
 %
 % \end{description}
 # EndOfTeX
@@ -2791,7 +2816,7 @@ asmw_e_16bit_not_supported=08008_E_Asm: 16-Bit-Verweise werden nicht unterst
 asmw_e_invalid_effective_address=08009_E_Asm: Ung�ltige effektive Adresse
 asmw_e_immediate_or_reference_expected=08010_E_Asm: Konstanter Ausdruck oder Referenz erwartet
 asmw_e_value_exceeds_bounds=08011_E_Asm: $1 Wert �berschreitet Grenzen $2
-asmw_e_short_jmp_out_of_range=08012_E_Asm: "Short jump" ist ausserhalb des Bereichs $1
+asmw_e_short_jmp_out_of_range=08012_E_Asm: "Short jump" ist auáerhalb des Bereichs $1
 asmw_e_undefined_label=08013_E_Asm: Undefiniertes Label: $1
 asmw_e_comp_not_supported=08014_E_Asm: Comp wird f�r dieses Ziel nicht unterst�tzt
 asmw_e_extended_not_supported=08015_E_Asm: Extended Typ wird f�r dieses Ziel nicht unterst�tzt
@@ -2827,6 +2852,7 @@ asmw_h_changing_bind_type=08028_H_
 asmw_e_32bit_not_supported=08029_E_Asm: 32 Bit Referenzen werden nicht unterst�tzt
 asmw_f_code_segment_too_large=08030_F_Code-Segment zu groá
 asmw_f_data_segment_too_large=08031_F_Data-Segment zu groá
+asmw_e_instruction_not_supported_by_cpu=08032_E_Instruktion wird vom ausgew„hlten Instruktionen-Satz nicht unterst�tzt
 %
 % \end{description}
 # EndOfTeX
@@ -2895,7 +2921,7 @@ exec_e_exe_not_supported=09018_E_Erzeugen von ausf
 exec_e_dll_not_supported=09019_E_Dynamische Bibliotheken nicht unterst�tzt
 % Creating dynamically loadable libraries is not supported for this platform, because it was
 % not yet implemented in the compiler.
-exec_i_closing_script=09020_I_Schliesse Skript $1
+exec_i_closing_script=09020_I_Schlieáe Skript $1
 % Informational message showing when writing of the external assembling and linking script is finished.
 exec_e_res_not_found=09021_E_Resource-Compiler "$1" nicht gefunden, schalte um auf externen Modus
 % An external resource compiler was not found. The compiler will produce a script that
@@ -2950,11 +2976,11 @@ execinfo_f_cant_process_executable=09128_F_Kann ausf
 % Fatal error when the compiler is unable to post-process an executable.
 execinfo_f_cant_open_executable=09129_F_Kann ausf�hrbare Datei nicht ”ffnen: $1
 % Fatal error when the compiler cannot open the file for the executable.
-execinfo_x_codesize=09130_X_Gr”sse des Codes: $1 Bytes
+execinfo_x_codesize=09130_X_GrӇe des Codes: $1 Bytes
 % Informational message showing the size of the produced code section.
-execinfo_x_initdatasize=09131_X_Gr”sse der initialisierten Daten: $1 Bytes
+execinfo_x_initdatasize=09131_X_GrӇe der initialisierten Daten: $1 Bytes
 % Informational message showing the size of the initialized data section.
-execinfo_x_uninitdatasize=09132_X_Gr”sse der nicht initialisierten Daten: $1 Bytes
+execinfo_x_uninitdatasize=09132_X_GrӇe der nicht initialisierten Daten: $1 Bytes
 % Informational message showing the size of the uninitialized data section.
 execinfo_x_stackreserve=09133_X_Stack Bereich "reserved": $1 Bytes
 % Informational message showing the stack size that the compiler reserved for the executable.
@@ -2967,7 +2993,7 @@ execinfo_x_stackcommit=09134_X_Stack Bereich "committed": $1 Bytes
 #
 # Internal linker messages
 #
-# 09201 is the last used one
+# 09207 is the last used one
 #
 # BeginOfTeX
 % \section{Linker messages}
@@ -2979,6 +3005,23 @@ link_w_32bit_absolute_reloc=09201_W_Objektdatei "$1" enth
 % Warning when 64-bit object file contains 32-bit absolute relocations.
 % In such case an executable image can be loaded into lower 4Gb of
 % address space only.
+link_e_program_segment_too_large=09202_E_Program-Segment zu groá (�bersteigt 64k um $1 Byte)
+% Error when a 16-bit program is compiled in the tiny memory model, but its size exceeds 64k
+link_e_code_segment_too_large=09203_E_Code-Segment zu groá (�bersteigt 64k um $1 Byte)
+% Error when a 16-bit program's code segment exceeds 64k bytes
+link_e_data_segment_too_large=09204_E_Data-Segment zu groá (�bersteigt 64k um $1 Byte)
+% Error when a 16-bit program's data segment exceeds 64k bytes
+link_e_segment_too_large=09205_E_Segment "$1" zu groá (�bersteigt 64k um $2 Byte)
+% Error when a 16-bit program contains a segment that exceeds 64k bytes
+link_e_group_too_large=09206_E_Gruppe "$1" zu groá (�bersteigt 64k um $2 Byte)
+% Error when a 16-bit program's object modules define a segment group that
+% exceeds 64k bytes
+link_e_com_program_uses_segment_relocations=09207_E_Eine .COM-Datei kann nicht erzeugt werden, weil das Programm Segement-Relocations enth„lt
+% Error occurs, when creating a tiny model DOS .COM file, but at least one of
+% the program's object modules contains segment relocations. Segment relocations
+% might be caused by the use of the Seg() function or by the SEG assembler
+% directive (either in pascal's built-in inline assembler, or in an externally
+% linked assembly module).
 %
 % \end{description}
 # EndOfTeX
@@ -2986,7 +3029,7 @@ link_w_32bit_absolute_reloc=09201_W_Objektdatei "$1" enth
 #
 # Unit loading
 #
-# 10062 is the last used one
+# 10063 is the last used one
 #
 # BeginOfTeX
 % \section{Unit loading messages.}
@@ -3430,7 +3473,7 @@ wpo_cant_create_feedback_file=12019_E_Die angegebene Feedback-Eingabe-Datei "$1"
 #
 option_logo=11023_[
 Free Pascal Compiler Version $FPCFULLVERSION [$FPCDATE] f�r $FPCTARGET
-Copyright (c) 1993-2015 Florian Kl„mpfl und andere
+Copyright (c) 1993-2016 Florian Kl„mpfl und andere
 ]
 
 #
@@ -3571,24 +3614,24 @@ S*2Aas_Assembliere mit Hilfe von GNU AS
 **2Cc<x>_Setze "default calling convention" zu <x>
 **2CD_Erzeuge auch eine dynamische Bibliothek (nicht unterst�tzt)
 **2Ce_šbersetze mit emulierten Fliesskomma opcodes
-**2Cf<x>_W„hle den Fliesskomma-Instruction-Set aus; fpc -i oder fpc -if geben die m”glichen Werte aus
+**2Cf<x>_W„hle den Fliesskomma-Instruktionen-Satz aus; fpc -i oder fpc -if geben die m”glichen Werte aus
 **2CF<x>_Minimale Pr„zission von Fliesskommakonstanten (default, 32, 64)
 **2Cg_Erzeuge PIC code
 **2Ch<n>_<n> Bytes Heap (zwischen 1023 und 67107840)
 **2Ci_I/O-Pr�fung
-A*2CI<x>_W„hle den Instruction-Set f�r ARM aus: ARM oder THUMB
+A*2CI<x>_W„hle den Instruktionen-Satz f�r ARM aus: ARM oder THUMB
 **2Cn_Lasse die Linkstufe aus
 P*2CN_Erzeuge šberpr�fungen auf Nil-Zeiger (nur AIX)
 **2Co_Pr�fe auf šberlauf von Integer-Operationen
 **2CO_Pr�fe auf m”glichen šberlauf von Integer-Operationen
-**2Cp<x>_W„hle Instruction-Set aus; fpc -i oder fpc -ic geben die m”glichen Werte aus
+**2Cp<x>_W„hle Instruktionen-Satz aus; fpc -i oder fpc -ic geben die m”glichen Werte aus
 **2CP<x>=<y>_ Einstellungen f�r packing
 **3CPPACKSET=<y>_ <y> Belegung von Sets: 0, 1 oder DEFAULT oder NORMAL, 2, 4 und 8
 **3CPPACKENUM=<y>_ <y> Packen von Aufz„hlungen: 0, 1, 2 und 4 oder DEFAULT oder NORMAL
 **3CPPACKRECORD=<y>_ <y> Packen von Records: 0 oder DEFAULT oder NORMAL, 1, 2, 4, 8, 16 und 32
 **2Cr_F�hre Bereichspr�fung durch
 **2CR_Verifiziere die G�ltigkiet des Aufrufs der Objektmethoden
-**2Cs<n>_Setze die Pr�fgr”sse des Stacks auf <n>
+**2Cs<n>_Setze die Pr�fgr”áe des Stacks auf <n>
 **2Ct_F�hre Stackpr�fung durch (nur zum Testen, siehe Handbuch)
 8*2CT<x>_Optionen f�r die ziel-spezifische Code-Erzeugung
 3*2CT<x>_Optionen f�r die ziel-spezifische Code-Erzeugung
@@ -3604,6 +3647,7 @@ J*3CTautosetterprefix=X_  Erzeuge automatisch Setter f
 8*3CTcld_                 Emittiere eine CLD-Instruktion vor der x86-String-Instruktion
 3*3CTcld_                 Emittiere eine CLD-Instruktion vor der x86-String-Instruktion
 4*3CTcld_                 Emittiere eine CLD-Instruktion vor der x86-String-Instruktion
+8*3CTfarprocspushoddbp_ Erh”he BP vor dem Verschieben in den Prolog von "far"-Funktionen
 J*3CTcompactintarrayinit_ Erzeuge kleineren (aber m”glicherweise langsameren) Code f�r die Initialisierung von Integer-Array-Konstanten
 J*3CTenumfieldinit_       Initialisiere Aufz„hlungsfelder in Konstruktoren mit enumtype(0), nach dem Aufruf geerbter Konstruktoren
 J*3CTinitlocals_          Initialisiere lokale Variablen, die einen JVM bytecode Verifikationfehler ausl”sen, wenn uninitialisiert verwendet (verz”gert den Code)
@@ -3648,7 +3692,7 @@ J*2Cv_Var/out Parameter copy-out 
 *g3godwarfsets_Schalte DWARF Debug Informationen f�r Mengen (sets) ein (verhindert debugging mit gdb < 6.5)
 *g3gostabsabsincludes_ Absolute/volle Include-Datei-Pfade in Stabs speichern
 *g3godwarfmethodclassprefix_ Stelle Methodennamen in DWARF den Namen der Klasse voran
-*g2gp_Erhalte Gross/Kleinschreibung in Stabs-Symbolnamen
+*g2gp_Erhalte Groá/Kleinschreibung in Stabs-Symbolnamen
 *g2gs_Erzeuge Stabs-Debug-Informationen
 *g2gt_L”sche lokale Variablen (um eine Verwendung ohne Initialisierung zu finden; mehrere 't' „ndern den Wert, mit dem �berschrieben wird)
 *g2gv_Erzeuge ein mit Valgrind verfolgbares (traceable) Programm
@@ -3665,8 +3709,8 @@ J*2Cv_Var/out Parameter copy-out 
 **2iV_Zeige kurze Compilerversion
 **2iW_Zeige vollst„ndige Compilerversion
 **2ia_Zeige Liste der unterst�tzten ABI-Ziele
-**2ic_Zeige Liste der unterst�tzten CPU-Instruction-Sets
-**2if_Zeige Liste der unterst�tzten Fliesskomma-Instruction-Sets
+**2ic_Zeige Liste der unterst�tzten CPU-Instruktionen-Satz
+**2if_Zeige Liste der unterst�tzten Fliesskomma-Instruktionen-Satz
 **2ii_Zeige Liste der unterst�tzten Inline-Assembler-Modi
 **2io_Zeige Liste der unterst�tzten Optimierungen
 **2ir_Zeige Liste der erkannten Compiler- und RTL-Feature
@@ -3678,10 +3722,13 @@ J*2Cv_Var/out Parameter copy-out 
 **1l_Zeige Logo
 **1M<x>_Setze Sprachmodus zu <x>
 **2Mfpc_Free Pascal Dialekt (Voreinstellung)
-**2Mobjfpc_Schalte einige Delphi 2 Erweiterungen ein
-**2Mdelphi_Versuche zu Delphi kompatibel zu sein
-**2Mtp_Versuche zu TP/BP 7.0 kompatibel zu sein
-**2Mmacpas_Versuche zu den MacIntosh Pascal-Dialekten kompatibel zu sein
+**2Mobjfpc_FPC Modus mit Unterst�tzung von Object-Pascal
+**2Mdelphi_Kompatibilit„ts-Modus f�r Delphi
+**2Mtp_Kompatibilit„ts-Modus f�r TP/BP 7.0
+**2Mmacpas_Kompatibilit„ts-Modus f�r MacIntosh Pascal-Dialekte
+**2Miso_ISO 7185 Modus
+**2Mextendedpascal_ISO 10206 Modus
+**2Mdelphiunicode_Kompatibilit„ts-Modus f�r  Delphi 2009 und sp„ter
 **1n_Standard-Konfigurationsdatei ignorieren
 **1o<x>_Die erzeugte, ausf�hrbare Datei bekommt den Namen <x>
 **1O<x>_Optimierungen:
@@ -3700,7 +3747,7 @@ J*2Cv_Var/out Parameter copy-out 
 F*1P<x>_Ziel CPU / Compiler bezogene Optionen:
 F*2PB_Zeige die voreingestellte Compilerbin„rdatei
 F*2PP_Zeige die voreingestellte Ziel-CPU
-F*2P<x>_Setze die Ziel-CPU (arm, avr, i386, jvm, m68k, mips, mipsel, powerpc, powerpc64, sparc, x86_64)
+F*2P<x>_Setze die Ziel-CPU (arm,avr,i386,i8086,jvm,m68k,mips,mipsel,powerpc,powerpc64,sparc,x86_64)
 **1R<x>_Assembler Code-Format:
 **2Rdefault_Benutze den voreingestellten Assembler
 3*2Ratt_Lese Assembler Code im AT&T-Format
@@ -3740,7 +3787,7 @@ F*2P<x>_Setze die Ziel-CPU (arm, avr, i386, jvm, m68k, mips, mipsel, powerpc, po
 3*2Tbeos_BeOS
 3*2Tdarwin_Darwin/Mac OS X
 3*2Tembedded_Embedded
-3*2Temx_OS/2 via EMX (einschliesslich EMX/RSX extender)
+3*2Temx_OS/2 via EMX (einschlieálich EMX/RSX extender)
 3*2Tfreebsd_FreeBSD
 3*2Tgo32v2_Version 2 des DJ Delorie DOS extender
 3*2Thaiku_Haiku
@@ -3806,7 +3853,7 @@ V*2Tembedded_Embedded
 **2Ur_Erzeuge "release unit"-Dateien
 **2Us_Erzeuge eine Systemunit
 **1v<x>_Meldungen, <x> ist eine Kombination der folgenden Zeichen:
-**2*_e : Fehler (Standard)             0 : Nichts (ausser Fehlern)
+**2*_e : Fehler (Standard)             0 : Nichts (auáer Fehlern)
 **2*_w : Warnungen                     u : Unit Informationen
 **2*_n : Anmerkungen                   t : Angesprochene/benutzte Dateien
 **2*_h : Hinweise                      c : Preprozessordirektiven
@@ -3831,11 +3878,11 @@ a*2Wb_Erzeuge statt einer Bibliothek ein Bundle (Darwin)
 A*2Wb_Erzeuge statt einer Bibliothek ein Bundle (Darwin)
 4*2Wb_Erzeuge statt einer Bibliothek ein Bundle (Darwin)
 3*2WB_Erzeuge ein relozierbares Image (Windows, Symbian)
-3*2WBxxxx_Setze die Imagebasis auf xxxx (Windows, Symbian)
+3*2WB<x>_Setze die Imagebasis auf <x> (Windows, Symbian)
 4*2WB_Erzeuge ein relozierbares Image (Windows)
-4*2WBxxxx_Setze die Imagebasis auf xxxx (Windows, Symbian)
+4*2WB<x>_Setze die Imagebasis auf <x> (Windows, Symbian)
 A*2WB_Erzeuge ein relozierbares Image (Windows, Symbian)
-A*2WBxxxx_Setze die Imagebasis auf xxxx (Windows)
+A*2WB<x>_Setze die Imagebasis auf <x> (Windows)
 3*2WC_Spezifiziere "console type application" (EMX, OS/2, Windows)
 4*2WC_Spezifiziere "console type application" (Windows)
 A*2WC_Spezifiziere "console type application" (Windows)
@@ -3869,6 +3916,7 @@ A*2WI_Die Verwendung der "import"-Abschnitte ein/ausschalten (Windows)
 8*3WmMedium_Mittleres (medium) Speichermodell
 8*3WmCompact_Kompaktes (compact) Speichermodell
 8*3WmLarge_Groáes (large) Speichermodell
+8*3WmHuge_Riesiges (huge) Speichermodell
 3*2WM<x>_Minimale Mac OS X Deployment Version: 10.4, 10.5.1, ... (Darwin)
 4*2WM<x>_Minimale Mac OS X Deployment Version: 10.4, 10.5.1, ... (Darwin)
 p*2WM<x>_Minimale Mac OS X Deployment Version: 10.4, 10.5.1, ... (Darwin)
@@ -3876,9 +3924,9 @@ P*2WM<x>_Minimale Mac OS X Deployment Version: 10.4, 10.5.1, ... (Darwin)
 3*2WN_Erzeuge keinen "relocation code" (notwendig f�r debugging) (Windows)
 4*2WN_Erzeuge keinen "relocation code" (notwendig f�r debugging) (Windows)
 A*2WN_Erzeuge keinen "relocation code" (notwendig f�r debugging) (Windows)
-A*2Wpxxxx_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben m”gliche Werte aus
-m*2Wpxxxx_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben m”gliche Werte aus
-V*2Wpxxxx_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu  geben m”gliche Werte aus
+A*2Wp<x>_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben m”gliche Werte aus
+m*2Wp<x>_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben m”gliche Werte aus
+V*2Wp<x>_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben m”gliche Werte aus
 3*2WP<x>_Minimale iOS Deployment Version: 3.0, 5.0.1, ... (iphonesim)
 4*2WP<x>_Minimale iOS Deployment Version: 8.0, 8.0.2, ... (iphonesim)
 a*2WP<x>_Minimale iOS Deployment Version: 7.0, 7.1.2, ... (Darwin)
@@ -3892,6 +3940,7 @@ A*2WR_Erzeuge "relocation code" (Windows)
 P*2WF_Spezifiziere "MPW tool type application" (Classic Mac OS)
 **2WX_Erm”gliche den executable stack (Linux)
 **1X_Programm-Optionen:
+**2X9_Erzeuge Linkerscript f�r GNU Binutils ld „lter als Version 2.19.1 (Linux)
 **2Xc_šbergebe --shared an den Linker (BeOS, Darwin, FreeBSD, Linux)
 **2Xd_Den Standard Bibliotheks-Suchpfad NICHT nutzen (ben”tigt f�r cross compile, wenn nicht -XR verwendet wird)
 **2Xe_Verwende den externen Linker
@@ -3903,7 +3952,7 @@ P*2WF_Spezifiziere "MPW tool type application" (Classic Mac OS)
 **2XLO_Definiere die Reihenfolge der Bibliotheken f�r das Linken
 **2XLD_Schlieáe die voreingestellte Reihenfolge der Standard-Bibliotheken aus
 **2Xm_Erzeuge die "link map"
-**2XM<x>_Setze den Namen der 'main' Programm-Routine (default ist 'main')
+**2XM<x>_Setze den Namen der 'main' Programm-Routine (Voreinstellung ist 'main')
 **2Xn_Nutze den plattformeigenen Linker des Zielsystem anstelle des GNU ld (Solaris, AIX)
 F*2Xp<x>_Suche nach der Compilerbinary zuerst im Verzeichnis <x>
 **2XP<x>_Stelle dem Namen der Compiler-Hilfsprogramme (binutils) den Prefix <x> voran
@@ -3913,6 +3962,7 @@ F*2Xp<x>_Suche nach der Compilerbinary zuerst im Verzeichnis <x>
 **2XS_Versuche Units statisch zu linken (default)    (definiert FPC_LINK_STATIC)
 **2Xt_Linke mit statischen Bibliotheken              (-static wird an den Linker �bergeben)
 **2Xv_Erzeuge eine Tabelle mit den virtuellen Entry-Aufrufen
+**2XV_Benutze VLink als externen linker              (Voreinstellung f�r Amiga, MorphOS)
 **2XX_Versuche Units smart zu linken                 (definiert FPC_LINK_SMART)
 **1*_
 **1?_Zeigt diese Hilfe an

+ 1 - 1
compiler/msg/errorda.msg

@@ -3532,7 +3532,7 @@ wpo_cant_create_feedback_file=12019_E_Cannot create specified whole program opti
 #
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] til $FPCTARGET
-Copyright (c) 1993-2015 Florian Klaempfl and others
+Copyright (c) 1993-2016 Florian Klaempfl and others
 ]
 
 #

+ 112 - 63
compiler/msg/errordu.msg

@@ -3,10 +3,10 @@
 #   Latest updates contributed by Karl-Michael Schindler aka mischi
 #   <karl-michael.schindler at web.de>
 #
-#   Based on errore.msg of SVN revision 30725
+#   Based on errore.msg of SVN revision 33053
 #
 #   This file is part of the Free Pascal Compiler
-#   Copyright (c) 1998-2015 by the Free Pascal Development team
+#   Copyright (c) 1998-2016 by the Free Pascal Development team
 #
 #   See the file COPYING.v2, included in this distribution,
 #   for details about the copyright.
@@ -28,7 +28,7 @@
 #   parser_   parser
 #   type_     type checking
 #   general_  general info
-#   exec_     calls to assembler, linker, binder
+#   exec_     calls to assembler, external linker, binder
 #   link_     internal linker
 #
 # <type> the type of the message it should normally used for
@@ -53,7 +53,7 @@
 #
 # General
 #
-# 01025 is the last used one
+# 01026 is the last used one
 #
 # BeginOfTeX
 % \section{General compiler messages}
@@ -136,6 +136,8 @@ general_f_ioerror=01024_F_I/O Fehler: $1
 % During compilation an I/O error happened which allows no further compilation.
 general_f_oserror=01025_F_Betriebsystemfehler: $1
 % During compilation an operating system error happened which allows no further compilation.
+general_e_exception_raised=01026_E_Kompilieren verursachte interne Ausnahme (exception)
+% Compilation was aborted, due to an exception generation.
 %
 % \end{description}
 # EndOfTeX
@@ -198,7 +200,7 @@ scan_e_illegal_pack_records=02015_E_Ungültige Record Ausrichtung "$1"
 % with an illegal value for \var{n}. For \$PACKRECORDS valid alignments are 1, 2, 4, 8, 16, 32, C,
 % NORMAL, DEFAULT, and for \$ALIGN valid alignments are 1, 2, 4, 8, 16, 32, ON,
 % OFF. Under mode MacPas \$ALIGN also supports MAC68K, POWER and RESET.
-scan_e_illegal_pack_enum=02016_E_Ungültige minimale Grösse der Aufzählung "$1"
+scan_e_illegal_pack_enum=02016_E_Ungültige minimale Größe der Aufzählung "$1"
 % You are specifying the \var{\{\$PACKENUM n\}} with an illegal value for
 % \var{n}. Only 1,2,4, NORMAL or DEFAULT is valid here.
 scan_e_endif_expected=02017_E_$ENDIF erwartet für $1 $2 definiert in $3 Zeile $4
@@ -337,7 +339,7 @@ scan_e_mode_switch_not_allowed=02067_E_Der Modus Umschalter "$1" ist hier nicht
 % a mode switch occurs after UNIT.
 scan_e_error_macro_undefined=02068_E_Die Compile time Variable oder das Makro "$1" ist nicht definiert.
 % Thus the conditional compile time expression cannot be evaluated. Only in mode MacPas.
-scan_e_utf8_bigger_than_65535=02069_E_Der UTF-8 Code ist grösser als 65535
+scan_e_utf8_bigger_than_65535=02069_E_Der UTF-8 Code ist größer als 65535
 % \fpc handles UTF-8 strings internally as widestrings, i.e. the char codes are limited to 65535.
 scan_e_utf8_malformed=02070_E_Ungültige UTF-8 Zeichenkette
 % The given string isn't a valid UTF-8 string.
@@ -421,7 +423,7 @@ scan_e_illegal_hugepointernormalization=02098_E_Illegales Argument für HUGEPOIN
 #
 # Parser
 #
-# 03340 is the last used one
+# 03344 is the last used one
 #
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
@@ -512,7 +514,7 @@ parser_n_duplicate_enum=03031_N_Werte in Aufzählungen müssen aufsteigend sein
 parser_e_no_with_for_variable_in_other_segments=03033_E_WITH kann nicht auf Variablen in anderen Segmenten angewendet werden
 % With stores a variable locally on the stack,
 % but this is not possible if the variable belongs to another segment.
-parser_e_too_much_lexlevel=03034_E_Funktionsverschachtelung grösser als 31
+parser_e_too_much_lexlevel=03034_E_Funktionsverschachtelung größer als 31
 % You can nest function definitions only 31 levels deep.
 parser_e_range_check_error=03035_E_Bereichsprüfungsfehler bei Konstantenbestimmung
 % The constants are out of their allowed range.
@@ -862,7 +864,7 @@ parser_e_array_lower_less_than_upper_bound=03140_E_Obere Grenze des Bereichs ist
 parser_w_string_too_long=03141_W_String "$1" ist länger als $2
 % The size of the constant string is larger than the size you specified in
 % string type definition.
-parser_e_string_larger_array=03142_E_Stringlänge ist grösser als die Länge des "array of char"
+parser_e_string_larger_array=03142_E_Stringlänge ist größer als die Länge des "array of char"
 % The size of the constant string is larger than the size you specified in
 % the \var{Array[x..y] of char} definition.
 parser_e_ill_msg_expr=03143_E_Ungültiger Ausdruck nach der 'Message'-Direktive
@@ -1130,7 +1132,7 @@ parser_e_arithmetic_operation_overflow=03213_E_Überlauf in arithmetischer Opera
 % An operation on two integer values produced an overflow.
 parser_e_protected_or_private_expected=03214_E_Protected oder private erwartet
 % \var{strict} can be only used together with \var{protected} or \var{private}.
-parser_e_illegal_slice=03215_E_SLICE kann nicht ausserhalb der Parameterliste benutzt werden
+parser_e_illegal_slice=03215_E_SLICE kann nicht außerhalb der Parameterliste benutzt werden
 % \var{slice} can be used only for arguments accepting an open array parameter.
 parser_e_dispinterface_cant_have_parent=03216_E_Ein DISPINTERFACE kann keine Elternklasse haben.
 % A DISPINTERFACE is a special type of interface which cannot have a parent class. Dispinterface always derive from IDispatch type.
@@ -1144,7 +1146,7 @@ parser_w_overridden_methods_not_same_ret=03218_W_Überschriebene Methoden müsse
 % and the way the methods are called.
 parser_e_dispid_must_be_ord_const=03219_E_Dispatch IDs müssen ganzzahlige Konstanten sein
 % The \var{dispid} keyword must be followed by an ordinal constant (the dispid index).
-parser_e_array_range_out_of_bounds=03220_E_Der Bereich des Array ist zu gross
+parser_e_array_range_out_of_bounds=03220_E_Der Bereich des Array ist zu groß
 % Regardless of the size taken up by its elements, an array cannot have more
 % than high(ptrint) elements. Additionally, the range type must be a subrange
 % of ptrint.
@@ -1182,7 +1184,7 @@ parser_e_type_object_constants=03230_E_Konstanten eines Objekts, das ein VMT ent
 % If an object requires a VMT either because it contains a constructor or virtual methods,
 % it's not allowed to create constants of it. In TP and Delphi mode this is allowed
 % for compatibility reasons.
-parser_e_label_outside_proc=03231_E_Die Address von Labels, die ausserhalb des aktuellen Scopes definiert wurden, können nicht verwendet werden
+parser_e_label_outside_proc=03231_E_Die Address von Labels, die außerhalb des aktuellen Scopes definiert wurden, können nicht verwendet werden
 % It isn't allowed to take the address of labels outside the
 % current procedure.
 parser_e_initialized_not_for_external=03233_E_Extern deklarierte Variablen können nicht intialisiert werden 
@@ -1545,6 +1547,17 @@ parser_e_global_generic_references_static=03339_E_Ein globales, generisches Temp
 parser_u_already_compiled=03340_UL_Die Unit $1 wurde inzwischen bereits kompiliert.
 % This tells you that the recursive reading of the uses clauses triggered already
 % a compilation of the current unit, so the current compilation can be aborted.
+parser_e_explicit_method_implementation_for_specializations_not_allowed=03341_E_Die explizite Implementierung von Methoden ist bei der Spezialisierung von "Generics" nicht erlaubt
+% Methods introduced in a generic must be implemented for the generic. It is not possible to implement them only for specializations.
+parser_e_no_genfuncs_in_interfaces=03342_E_Generische Methoden sind in Interfaces nicht erlaubt
+% Generic methods are not allowed in interfaces, because there is no way to specialize a suitable
+% implementation.
+parser_e_genfuncs_cannot_be_virtual=03343_E_Generische Methoden können nicht virtuell sein
+% Generic methods can not be declared as virtual as there'd need to be a VMT entry for each
+% specialization. This is however not possible with a static VMT.
+parser_e_packages_not_supported=03344_E_Dynamische Pakete werden für das Ziel-OS nicht unterstützt
+% Support for dynamic packages is not implemented for the specified target OS
+% or it is at least not tested and thus disabled.
 %
 % \end{description}
 # EndOfTeX
@@ -1715,7 +1728,7 @@ type_w_mixed_signed_unsigned2=04036_W_Mischen von signed Ausdrücken und kardina
 % such a case both operands are converted to longword before the operation is
 % carried out. You can avoid this by typecasting one operand so it
 % matches the result type of the other one.
-type_e_typecast_wrong_size_for_assignment=04037_E_Typecast hat verschiedene Grössen ($1 -> $2) in der Zuweisung
+type_e_typecast_wrong_size_for_assignment=04037_E_Typecast hat verschiedene Größen ($1 -> $2) in der Zuweisung
 % Type casting to a type with a different size is not allowed when the variable is
 % used in an assignment.
 type_e_array_index_enums_with_assign_not_possible=04038_E_enums mit Zuweisungen können nicht als Array-Index verwendet werden
@@ -1753,16 +1766,16 @@ type_w_instance_with_abstract=04046_W_Konstruktion der Klasse "$1" mit der abstr
 % An instance of a class is created which contains non-implemented abstract
 % methods. This will probably lead to a runtime error 211 in the code if that
 % routine is ever called. All abstract methods should be overridden.
-type_h_in_range_check=04047_H_Der linke Operand des IN Operators sollte byte Grösse haben
+type_h_in_range_check=04047_H_Der linke Operand des IN Operators sollte byte Größe haben
 % The left operand of the \var{in} operator is not an ordinal or enumeration which fits
 % within 8 bits. This may lead to range check errors. The \var{in} operator
 % currently only supports a left operand which fits within a byte. In the case of
 % enumerations, the size of an element of an enumeration can be controlled with
 % the \var{\{\$PACKENUM\}} or \var{\{\$Zn\}} switches.
-type_w_smaller_possible_range_check=04048_W_Unpassende Typgrössen, Gefahr des Datenverlusts oder der Bereichsüberschreitung
+type_w_smaller_possible_range_check=04048_W_Unpassende Typgrößen, Gefahr des Datenverlusts oder der Bereichsüberschreitung
 % There is an assignment to a smaller type than the source type. This means that
 % this may cause a range-check error, or may lead to possible loss of data.
-type_h_smaller_possible_range_check=04049_H_Unpassende Typgrössen, Gefahr des Datenverlusts oder der Bereichsüberschreitung
+type_h_smaller_possible_range_check=04049_H_Unpassende Typgrößen, Gefahr des Datenverlusts oder der Bereichsüberschreitung
 % There is an assignment to a smaller type than the source type. This means that
 % this may cause a range-check error, or may lead to possible loss of data.
 type_e_cant_take_address_of_abstract_method=04050_E_Die Adresse einer abstrakten Methode kann nicht verwendet werden
@@ -2106,7 +2119,7 @@ sym_h_param_list=05039_H_Deklaration gefunden: $1
 % You get this when you use the \var{-vh} switch.In the case of an overloaded procedure
 % not being found. Then all candidate overloaded procedures are
 % listed, with their parameter lists.
-sym_e_segment_too_large=05040_E_Datensegment zu gross (max. 2GB)
+sym_e_segment_too_large=05040_E_Datensegment zu groß (max. 2GB)
 % You get this when you declare a data element whose size exceeds the
 % prescribed limit (2 Gb on 80386+/68020+ processors).
 sym_e_no_matching_implementation_found=05042_E_Keine passende Implementation der Interface Methode "$1" gefunden
@@ -2223,7 +2236,7 @@ sym_w_experimental_unit=05079_W_Unit "$1" ist experimentell
 % declared as \var{experimental} is used. Experimental units
 % might disappear or change semantics in future versions. Usage of this unit
 % should be avoided as much as possible.
-sym_e_formal_class_not_resolved=05080_E_Die vollständige Definition der formal deklarierten ObjC-Klasse "$1" fehlt in diesem Geltungsbereich
+sym_e_formal_class_not_resolved=05080_E_Die vollständige Definition der formal deklarierten ObjC-Klasse "$1" fehlt in diesem Geltungsbereich. Ergänzen sie die uses-Anweisung um die Unit mit der vollständigen Definition
 % Objecive-C and Java classes can be imported formally, without using the unit in which it is fully declared.
 % This enables making forward references to such classes and breaking circular dependencies amongst units.
 % However, as soon as you wish to actually do something with an entity of this class type (such as
@@ -2314,7 +2327,7 @@ sym_w_duplicate_id=05095_W_Duplikat des Bezeichners "$1"
 % This section lists all messages that can be displayed if the code
 % generator encounters an error condition.
 % \begin{description}
-cg_e_parasize_too_big=06009_E_Grösse der Parameterliste übersteigt 65535 Bytes
+cg_e_parasize_too_big=06009_E_Größe der Parameterliste übersteigt 65535 Bytes
 % The I386 processor limits the parameter list to 65535 bytes. (The \var{RET}
 % instruction causes this).
 cg_e_file_must_call_by_reference=06012_E_Dateitypen müssen VAR Parameter sein
@@ -2406,13 +2419,13 @@ cg_e_control_flow_outside_finally=06040_E_Kontrollfluss-Anweisungen sind in eine
 % If the procedure \var{p} raises an exception the finally block is
 % executed. If the execution reaches the exit, it's unclear what to do:
 % exit the procedure or search for another exception handler.
-cg_w_parasize_too_big=06041_W_Grösse der Parameter überschreitet die Grenze für bestimmte CPUs
+cg_w_parasize_too_big=06041_W_Größe der Parameter überschreitet die Grenze für bestimmte CPUs
 % This indicates that you are declaring more than 64K of parameters, which
 % might not be supported on other processor targets.
-cg_w_localsize_too_big=06042_W_Grösse der lokalen Variablen überschreitet die Grenze für bestimmte CPUs
+cg_w_localsize_too_big=06042_W_Größe der lokalen Variablen überschreitet die Grenze für bestimmte CPUs
 % This indicates that you are declaring more than 32K of local variables, which
 % might not be supported on other processor targets.
-cg_e_localsize_too_big=06043_E_Grösse der lokalen Variablen überschreitet die unterstützte Grenze
+cg_e_localsize_too_big=06043_E_Größe der lokalen Variablen überschreitet die unterstützte Grenze
 % This indicates that you are declaring more than 32K of local variables, which
 % is not supported by this processor.
 cg_e_break_not_allowed=06044_E_BREAK nicht zulässig
@@ -2452,7 +2465,7 @@ cg_e_mod_only_defined_for_pos_quotient=06054_E_Im ISO-Modus ist der Operator mod
 % In ISO pascal, only positive values are allowed for the quotient: \var{n mod m} is only valid if \var{m>0}.
 cg_d_autoinlining=06055_DL_Automatisches inlining: $1
 % Due to auto inlining turned on, the compiler auto inlines this subroutine.
-cg_e_function_not_support_by_selected_instruction_set=06056_E_Die verwendete Funktion wird vom ausgewählten Instruction-Set nicht unterstützt: $1
+cg_e_function_not_support_by_selected_instruction_set=06056_E_Die verwendete Funktion wird vom ausgewählten Instruktionen-Satz nicht unterstützt: $1
 % Some functions cannot be implemented efficiently for certain instruction sets, one example is fused multiply/add.
 % To avoid very inefficient code, the compiler complains in this case, so either select another instruction set
 % or replace the function call by alternative code
@@ -2466,7 +2479,7 @@ cg_f_max_units_reached=06057_F_Maximale Anzahl an Units ($1) für das aktuelle Z
 #
 # Assembler reader
 #
-# 07125 is the last used one
+# 07129 is the last used one
 #
 asmr_d_start_reading=07000_DL_Starte $1 Stil Assembler Parsen
 % This informs you that an assembler block is being parsed
@@ -2544,7 +2557,7 @@ asmr_w_calling_overload_func=07032_W_Aufruf einer überladenen Funktion in Assem
 % There is a call to an overloaded method in the assembler block,
 % this might be the sign there is a problem
 asmr_e_unsupported_symbol_type=07033_E_Nicht unterstützter Symboltyp für Operand
-asmr_e_constant_out_of_bounds=07034_E_Wert der Konstante ausserhalb des zulässigen Bereichs
+asmr_e_constant_out_of_bounds=07034_E_Wert der Konstante außerhalb des zulässigen Bereichs
 asmr_e_error_converting_decimal=07035_E_Fehler beim Umwandeln in Dezimal $1
 % A constant decimal value does not have the correct syntax
 asmr_e_error_converting_octal=07036_E_Fehler beim Umwandeln in Oktal $1
@@ -2555,20 +2568,20 @@ asmr_e_error_converting_hexadecimal=07038_E_Fehler beim Umwandeln in Hexadezimal
 % A constant hexadecimal value does not have the correct syntax
 asmr_h_direct_global_to_mangled=07039_H_$1 übersetzt nach $2
 asmr_w_direct_global_is_overloaded_func=07040_W_$1 ist einer überladenen Funktion zugeordnet
-asmr_e_cannot_use_SELF_outside_a_method=07041_E_Kann SELF nicht ausserhalb einer Methode verwenden
+asmr_e_cannot_use_SELF_outside_a_method=07041_E_Kann SELF nicht außerhalb einer Methode verwenden
 % There is a reference to the \var{self} symbol while it is not
 % allowed. \var{self} can only be referenced inside methods
-asmr_e_cannot_use_OLDEBP_outside_nested_procedure=07042_E_Kann OLDEBP ausserhalb einer verschachtelten Prozedur nicht verwenden
+asmr_e_cannot_use_OLDEBP_outside_nested_procedure=07042_E_Kann OLDEBP außerhalb einer verschachtelten Prozedur nicht verwenden
 % There is a reference to the \var{oldebp} symbol while it is not
 % allowed. \var{oldebp} can only be referenced inside nested routines
 asmr_e_void_function=07043_W_Prozeduren können keinen Wert im Assembler-Code zurückliefern
 % Trying to return a value while in a procedure. A procedure
 % does not have any return value
 asmr_e_SEG_not_supported=07044_E_SEG nicht unterstützt
-asmr_e_size_suffix_and_dest_dont_match=07045_E_Grössensuffix und Ziel- oder Quellgrösse passen nicht zusammen
+asmr_e_size_suffix_and_dest_dont_match=07045_E_Größensuffix und Ziel- oder Quellgröße passen nicht zusammen
 % The register size and the opcode size suffix don't match. This is
 % probably an error in the assembler statement
-asmr_w_size_suffix_and_dest_dont_match=07046_W_Grössensuffix und Ziel- oder Quellgrösse passen nicht zusammen
+asmr_w_size_suffix_and_dest_dont_match=07046_W_Größensuffix und Ziel- oder Quellgröße passen nicht zusammen
 % The register size and the opcode size suffix don't match. This is
 % probably an error in the assembler statement
 asmr_e_syntax_error=07047_E_Assembler Syntaxfehler
@@ -2642,7 +2655,7 @@ asmr_e_cannot_access_object_field_directly=07082_E_Kann auf Felder von Objekten/
 % You should load the self pointer first into a register and then access the
 % fields using the register as base. By default the self pointer is available
 % in the esi register on i386.
-asmr_e_unable_to_determine_reference_size=07083_E_Grösse nicht spezifiziert und auch keine Möglichkeit die Grösse der Operanden zu bestimmen
+asmr_e_unable_to_determine_reference_size=07083_E_Größe nicht spezifiziert und auch keine Möglichkeit die Größe der Operanden zu bestimmen
 % You should specify explicitly a size for the reference, because
 % the compiler is unable to determine what size (byte,word,dword,etc.) it
 % should use for the reference.
@@ -2670,7 +2683,7 @@ asmr_e_higher_cpu_mode_required=07097_E_Höherer cpu Modus notwendig ($1)
 % Trying to use an instruction which is not supported in the current
 % cpu mode. Use a higher cpu generation to be able to use this
 % opcode in your assembler block
-asmr_w_unable_to_determine_reference_size_using_dword=07098_W_Grösse nicht spezifiziert und auch keine Möglichkeit die Grösse der Operanden zu bestimmen. Es wird DWORD als Voreinstellung verwendet
+asmr_w_unable_to_determine_reference_size_using_dword=07098_W_Größe nicht spezifiziert und auch keine Möglichkeit die Größe der Operanden zu bestimmen. Es wird DWORD als Voreinstellung verwendet
 % You should specify explicitly a size for the reference, because
 % the compiler is unable to determine what size (byte,word,dword,etc.) it
 % should use for the reference. This warning is only used in Delphi mode where
@@ -2690,7 +2703,7 @@ asmr_e_packed_element=07100_E_Die Adresse der packed Komponente ist nicht an ein
 % message when trying to index arrays with elements whose size is not a multiple
 % of 8 bits. The same goes for accessing record fields with such an address.
 % multiple of 8 bits.
-asmr_w_unable_to_determine_reference_size_using_byte=07101_W_Grösse nicht angegeben und kann auch nicht aus der Grösse der Operanden bestimmt werden. Verwende BYTE als Voreinstellung
+asmr_w_unable_to_determine_reference_size_using_byte=07101_W_Größe nicht angegeben und kann auch nicht aus der Größe der Operanden bestimmt werden. Verwende BYTE als Voreinstellung
 % You should specify explicitly a size for the reference, because
 % the compiler is unable to determine what size (byte,word,dword,etc.) it
 % should use for the reference. This warning is only used in Delphi mode where
@@ -2767,6 +2780,17 @@ asmr_e_invalid_ref_register=07125_E_Ungültiges Register in Speicherreferenzausd
 % FPU, vector and sometimes integer registers cannot be used in memory reference
 % expressions, due to limitations of the cpu architecture or simple because
 % it is not meaningful.
+asmr_e_seg_without_identifier=07126_E_SEG ohne Bezeichner benutzt
+% You can only use SEG with an identifier. Other syntaxes are not
+% supported
+asmr_e_CODE_or_DATA_without_SEG=07127_E_@CODE und @DATA können nur mit dem SEG-Operator benutzt werden
+% You can only use @CODE and @DATA symbols together with the SEG operator
+asmr_e_const16bit_for_segment=07128_E_Nicht ausreichend Platz (16 Bit benötigt) für die Segment-Konstante des Symbols $1
+% Specifying a segment constant for a symbol via the SEG operator requires at
+% least 16 bits of space for the segment. This error occurs, if you specify
+% less, for example, if you use 'DB SEG symbol' instead of 'DW SEG symbol'.
+asmr_e_invalid_code_value=07129_E_Ungültiger Wert des Arguments für die .code-Direktive
+% The ARM assembler only allows the values 16 and 32 to be used as arguments to the .code directive
 %
 % \end{description}
 # EndOfTeX
@@ -2791,7 +2815,7 @@ asmw_e_16bit_not_supported=08008_E_Asm: 16-Bit-Verweise werden nicht unterstütz
 asmw_e_invalid_effective_address=08009_E_Asm: Ungültige effektive Adresse
 asmw_e_immediate_or_reference_expected=08010_E_Asm: Konstanter Ausdruck oder Referenz erwartet
 asmw_e_value_exceeds_bounds=08011_E_Asm: $1 Wert überschreitet Grenzen $2
-asmw_e_short_jmp_out_of_range=08012_E_Asm: "Short jump" ist ausserhalb des Bereichs $1
+asmw_e_short_jmp_out_of_range=08012_E_Asm: "Short jump" ist außerhalb des Bereichs $1
 asmw_e_undefined_label=08013_E_Asm: Undefiniertes Label: $1
 asmw_e_comp_not_supported=08014_E_Asm: Comp wird für dieses Ziel nicht unterstützt
 asmw_e_extended_not_supported=08015_E_Asm: Extended Typ wird für dieses Ziel nicht unterstützt
@@ -2825,8 +2849,9 @@ asmw_h_changing_bind_type=08028_H_Änderung des Bind-Typs des Symbols $1 von $2
 % of wrong code generation, but currently set to Note level as it appears inside
 % the compiler compilation.
 asmw_e_32bit_not_supported=08029_E_Asm: 32 Bit Referenzen werden nicht unterstützt
-asmw_f_code_segment_too_large=08030_F_Code-Segment zu gro????
-asmw_f_data_segment_too_large=08031_F_Data-Segment zu gro????
+asmw_f_code_segment_too_large=08030_F_Code-Segment zu groß
+asmw_f_data_segment_too_large=08031_F_Data-Segment zu groß
+asmw_e_instruction_not_supported_by_cpu=08032_E_Instruktion wird vom ausgewählten Instruktionen-Satz nicht unterstützt
 %
 % \end{description}
 # EndOfTeX
@@ -2895,7 +2920,7 @@ exec_e_exe_not_supported=09018_E_Erzeugen von ausführbaren Dateien nicht unters
 exec_e_dll_not_supported=09019_E_Dynamische Bibliotheken nicht unterstützt
 % Creating dynamically loadable libraries is not supported for this platform, because it was
 % not yet implemented in the compiler.
-exec_i_closing_script=09020_I_Schliesse Skript $1
+exec_i_closing_script=09020_I_Schließe Skript $1
 % Informational message showing when writing of the external assembling and linking script is finished.
 exec_e_res_not_found=09021_E_Resource-Compiler "$1" nicht gefunden, schalte um auf externen Modus
 % An external resource compiler was not found. The compiler will produce a script that
@@ -2950,11 +2975,11 @@ execinfo_f_cant_process_executable=09128_F_Kann ausführbare Datei nicht nachbea
 % Fatal error when the compiler is unable to post-process an executable.
 execinfo_f_cant_open_executable=09129_F_Kann ausführbare Datei nicht öffnen: $1
 % Fatal error when the compiler cannot open the file for the executable.
-execinfo_x_codesize=09130_X_Grösse des Codes: $1 Bytes
+execinfo_x_codesize=09130_X_Größe des Codes: $1 Bytes
 % Informational message showing the size of the produced code section.
-execinfo_x_initdatasize=09131_X_Grösse der initialisierten Daten: $1 Bytes
+execinfo_x_initdatasize=09131_X_Größe der initialisierten Daten: $1 Bytes
 % Informational message showing the size of the initialized data section.
-execinfo_x_uninitdatasize=09132_X_Grösse der nicht initialisierten Daten: $1 Bytes
+execinfo_x_uninitdatasize=09132_X_Größe der nicht initialisierten Daten: $1 Bytes
 % Informational message showing the size of the uninitialized data section.
 execinfo_x_stackreserve=09133_X_Stack Bereich "reserved": $1 Bytes
 % Informational message showing the stack size that the compiler reserved for the executable.
@@ -2967,7 +2992,7 @@ execinfo_x_stackcommit=09134_X_Stack Bereich "committed": $1 Bytes
 #
 # Internal linker messages
 #
-# 09201 is the last used one
+# 09207 is the last used one
 #
 # BeginOfTeX
 % \section{Linker messages}
@@ -2979,6 +3004,23 @@ link_w_32bit_absolute_reloc=09201_W_Objektdatei "$1" enthält eine 32-bit absolu
 % Warning when 64-bit object file contains 32-bit absolute relocations.
 % In such case an executable image can be loaded into lower 4Gb of
 % address space only.
+link_e_program_segment_too_large=09202_E_Program-Segment zu groß (übersteigt 64k um $1 Byte)
+% Error when a 16-bit program is compiled in the tiny memory model, but its size exceeds 64k
+link_e_code_segment_too_large=09203_E_Code-Segment zu groß (übersteigt 64k um $1 Byte)
+% Error when a 16-bit program's code segment exceeds 64k bytes
+link_e_data_segment_too_large=09204_E_Data-Segment zu groß (übersteigt 64k um $1 Byte)
+% Error when a 16-bit program's data segment exceeds 64k bytes
+link_e_segment_too_large=09205_E_Segment "$1" zu groß (übersteigt 64k um $2 Byte)
+% Error when a 16-bit program contains a segment that exceeds 64k bytes
+link_e_group_too_large=09206_E_Gruppe "$1" zu groß (übersteigt 64k um $2 Byte)
+% Error when a 16-bit program's object modules define a segment group that
+% exceeds 64k bytes
+link_e_com_program_uses_segment_relocations=09207_E_Eine .COM-Datei kann nicht erzeugt werden, weil das Programm Segement-Relocations enthält
+% Error occurs, when creating a tiny model DOS .COM file, but at least one of
+% the program's object modules contains segment relocations. Segment relocations
+% might be caused by the use of the Seg() function or by the SEG assembler
+% directive (either in pascal's built-in inline assembler, or in an externally
+% linked assembly module).
 %
 % \end{description}
 # EndOfTeX
@@ -2986,7 +3028,7 @@ link_w_32bit_absolute_reloc=09201_W_Objektdatei "$1" enthält eine 32-bit absolu
 #
 # Unit loading
 #
-# 10062 is the last used one
+# 10063 is the last used one
 #
 # BeginOfTeX
 % \section{Unit loading messages.}
@@ -3430,7 +3472,7 @@ wpo_cant_create_feedback_file=12019_E_Die angegebene Feedback-Eingabe-Datei "$1"
 #
 option_logo=11023_[
 Free Pascal Compiler Version $FPCFULLVERSION [$FPCDATE] für $FPCTARGET
-Copyright (c) 1993-2015 Florian Klämpfl und andere
+Copyright (c) 1993-2016 Florian Klämpfl und andere
 ]
 
 #
@@ -3571,24 +3613,24 @@ S*2Aas_Assembliere mit Hilfe von GNU AS
 **2Cc<x>_Setze "default calling convention" zu <x>
 **2CD_Erzeuge auch eine dynamische Bibliothek (nicht unterstützt)
 **2Ce_Übersetze mit emulierten Fliesskomma opcodes
-**2Cf<x>_Wähle den Fliesskomma-Instruction-Set aus; fpc -i oder fpc -if geben die möglichen Werte aus
+**2Cf<x>_Wähle den Fliesskomma-Instruktionen-Satz aus; fpc -i oder fpc -if geben die möglichen Werte aus
 **2CF<x>_Minimale Präzission von Fliesskommakonstanten (default, 32, 64)
 **2Cg_Erzeuge PIC code
 **2Ch<n>_<n> Bytes Heap (zwischen 1023 und 67107840)
 **2Ci_I/O-Prüfung
-A*2CI<x>_Wähle den Instruction-Set für ARM aus: ARM oder THUMB
+A*2CI<x>_Wähle den Instruktionen-Satz für ARM aus: ARM oder THUMB
 **2Cn_Lasse die Linkstufe aus
 P*2CN_Erzeuge Überprüfungen auf Nil-Zeiger (nur AIX)
 **2Co_Prüfe auf Überlauf von Integer-Operationen
 **2CO_Prüfe auf möglichen Überlauf von Integer-Operationen
-**2Cp<x>_Wähle Instruction-Set aus; fpc -i oder fpc -ic geben die möglichen Werte aus
+**2Cp<x>_Wähle Instruktionen-Satz aus; fpc -i oder fpc -ic geben die möglichen Werte aus
 **2CP<x>=<y>_ Einstellungen für packing
 **3CPPACKSET=<y>_ <y> Belegung von Sets: 0, 1 oder DEFAULT oder NORMAL, 2, 4 und 8
 **3CPPACKENUM=<y>_ <y> Packen von Aufzählungen: 0, 1, 2 und 4 oder DEFAULT oder NORMAL
 **3CPPACKRECORD=<y>_ <y> Packen von Records: 0 oder DEFAULT oder NORMAL, 1, 2, 4, 8, 16 und 32
 **2Cr_Führe Bereichsprüfung durch
 **2CR_Verifiziere die Gültigkiet des Aufrufs der Objektmethoden
-**2Cs<n>_Setze die Prüfgrösse des Stacks auf <n>
+**2Cs<n>_Setze die Prüfgröße des Stacks auf <n>
 **2Ct_Führe Stackprüfung durch (nur zum Testen, siehe Handbuch)
 8*2CT<x>_Optionen für die ziel-spezifische Code-Erzeugung
 3*2CT<x>_Optionen für die ziel-spezifische Code-Erzeugung
@@ -3604,6 +3646,7 @@ J*3CTautosetterprefix=X_  Erzeuge automatisch Setter für Eigenschaften mit dem
 8*3CTcld_                 Emittiere eine CLD-Instruktion vor der x86-String-Instruktion
 3*3CTcld_                 Emittiere eine CLD-Instruktion vor der x86-String-Instruktion
 4*3CTcld_                 Emittiere eine CLD-Instruktion vor der x86-String-Instruktion
+8*3CTfarprocspushoddbp_ Erhöhe BP vor dem Verschieben in den Prolog von "far"-Funktionen
 J*3CTcompactintarrayinit_ Erzeuge kleineren (aber möglicherweise langsameren) Code für die Initialisierung von Integer-Array-Konstanten
 J*3CTenumfieldinit_       Initialisiere Aufzählungsfelder in Konstruktoren mit enumtype(0), nach dem Aufruf geerbter Konstruktoren
 J*3CTinitlocals_          Initialisiere lokale Variablen, die einen JVM bytecode Verifikationfehler auslösen, wenn uninitialisiert verwendet (verzögert den Code)
@@ -3648,7 +3691,7 @@ J*2Cv_Var/out Parameter copy-out Überprüfung
 *g3godwarfsets_Schalte DWARF Debug Informationen für Mengen (sets) ein (verhindert debugging mit gdb < 6.5)
 *g3gostabsabsincludes_ Absolute/volle Include-Datei-Pfade in Stabs speichern
 *g3godwarfmethodclassprefix_ Stelle Methodennamen in DWARF den Namen der Klasse voran
-*g2gp_Erhalte Gross/Kleinschreibung in Stabs-Symbolnamen
+*g2gp_Erhalte Groß/Kleinschreibung in Stabs-Symbolnamen
 *g2gs_Erzeuge Stabs-Debug-Informationen
 *g2gt_Lösche lokale Variablen (um eine Verwendung ohne Initialisierung zu finden; mehrere 't' ändern den Wert, mit dem überschrieben wird)
 *g2gv_Erzeuge ein mit Valgrind verfolgbares (traceable) Programm
@@ -3665,8 +3708,8 @@ J*2Cv_Var/out Parameter copy-out Überprüfung
 **2iV_Zeige kurze Compilerversion
 **2iW_Zeige vollständige Compilerversion
 **2ia_Zeige Liste der unterstützten ABI-Ziele
-**2ic_Zeige Liste der unterstützten CPU-Instruction-Sets
-**2if_Zeige Liste der unterstützten Fliesskomma-Instruction-Sets
+**2ic_Zeige Liste der unterstützten CPU-Instruktionen-Satz
+**2if_Zeige Liste der unterstützten Fliesskomma-Instruktionen-Satz
 **2ii_Zeige Liste der unterstützten Inline-Assembler-Modi
 **2io_Zeige Liste der unterstützten Optimierungen
 **2ir_Zeige Liste der erkannten Compiler- und RTL-Feature
@@ -3678,10 +3721,13 @@ J*2Cv_Var/out Parameter copy-out Überprüfung
 **1l_Zeige Logo
 **1M<x>_Setze Sprachmodus zu <x>
 **2Mfpc_Free Pascal Dialekt (Voreinstellung)
-**2Mobjfpc_Schalte einige Delphi 2 Erweiterungen ein
-**2Mdelphi_Versuche zu Delphi kompatibel zu sein
-**2Mtp_Versuche zu TP/BP 7.0 kompatibel zu sein
-**2Mmacpas_Versuche zu den MacIntosh Pascal-Dialekten kompatibel zu sein
+**2Mobjfpc_FPC Modus mit Unterstützung von Object-Pascal
+**2Mdelphi_Kompatibilitäts-Modus für Delphi
+**2Mtp_Kompatibilitäts-Modus für TP/BP 7.0
+**2Mmacpas_Kompatibilitäts-Modus für MacIntosh Pascal-Dialekte
+**2Miso_ISO 7185 Modus
+**2Mextendedpascal_ISO 10206 Modus
+**2Mdelphiunicode_Kompatibilitäts-Modus für Delphi 2009 und später
 **1n_Standard-Konfigurationsdatei ignorieren
 **1o<x>_Die erzeugte, ausführbare Datei bekommt den Namen <x>
 **1O<x>_Optimierungen:
@@ -3700,7 +3746,7 @@ J*2Cv_Var/out Parameter copy-out Überprüfung
 F*1P<x>_Ziel CPU / Compiler bezogene Optionen:
 F*2PB_Zeige die voreingestellte Compilerbinärdatei
 F*2PP_Zeige die voreingestellte Ziel-CPU
-F*2P<x>_Setze die Ziel-CPU (arm, avr, i386, jvm, m68k, mips, mipsel, powerpc, powerpc64, sparc, x86_64)
+F*2P<x>_Setze die Ziel-CPU (arm,avr,i386,i8086,jvm,m68k,mips,mipsel,powerpc,powerpc64,sparc,x86_64)
 **1R<x>_Assembler Code-Format:
 **2Rdefault_Benutze den voreingestellten Assembler
 3*2Ratt_Lese Assembler Code im AT&T-Format
@@ -3740,7 +3786,7 @@ F*2P<x>_Setze die Ziel-CPU (arm, avr, i386, jvm, m68k, mips, mipsel, powerpc, po
 3*2Tbeos_BeOS
 3*2Tdarwin_Darwin/Mac OS X
 3*2Tembedded_Embedded
-3*2Temx_OS/2 via EMX (einschliesslich EMX/RSX extender)
+3*2Temx_OS/2 via EMX (einschließlich EMX/RSX extender)
 3*2Tfreebsd_FreeBSD
 3*2Tgo32v2_Version 2 des DJ Delorie DOS extender
 3*2Thaiku_Haiku
@@ -3806,7 +3852,7 @@ V*2Tembedded_Embedded
 **2Ur_Erzeuge "release unit"-Dateien
 **2Us_Erzeuge eine Systemunit
 **1v<x>_Meldungen, <x> ist eine Kombination der folgenden Zeichen:
-**2*_e : Fehler (Standard)             0 : Nichts (ausser Fehlern)
+**2*_e : Fehler (Standard)             0 : Nichts (außer Fehlern)
 **2*_w : Warnungen                     u : Unit Informationen
 **2*_n : Anmerkungen                   t : Angesprochene/benutzte Dateien
 **2*_h : Hinweise                      c : Preprozessordirektiven
@@ -3831,11 +3877,11 @@ a*2Wb_Erzeuge statt einer Bibliothek ein Bundle (Darwin)
 A*2Wb_Erzeuge statt einer Bibliothek ein Bundle (Darwin)
 4*2Wb_Erzeuge statt einer Bibliothek ein Bundle (Darwin)
 3*2WB_Erzeuge ein relozierbares Image (Windows, Symbian)
-3*2WBxxxx_Setze die Imagebasis auf xxxx (Windows, Symbian)
+3*2WB<x>_Setze die Imagebasis auf <x> (Windows, Symbian)
 4*2WB_Erzeuge ein relozierbares Image (Windows)
-4*2WBxxxx_Setze die Imagebasis auf xxxx (Windows, Symbian)
+4*2WB<x>_Setze die Imagebasis auf <x> (Windows, Symbian)
 A*2WB_Erzeuge ein relozierbares Image (Windows, Symbian)
-A*2WBxxxx_Setze die Imagebasis auf xxxx (Windows)
+A*2WB<x>_Setze die Imagebasis auf <x> (Windows)
 3*2WC_Spezifiziere "console type application" (EMX, OS/2, Windows)
 4*2WC_Spezifiziere "console type application" (Windows)
 A*2WC_Spezifiziere "console type application" (Windows)
@@ -3869,6 +3915,7 @@ A*2WI_Die Verwendung der "import"-Abschnitte ein/ausschalten (Windows)
 8*3WmMedium_Mittleres (medium) Speichermodell
 8*3WmCompact_Kompaktes (compact) Speichermodell
 8*3WmLarge_Großes (large) Speichermodell
+8*3WmHuge_Riesiges (huge) Speichermodell
 3*2WM<x>_Minimale Mac OS X Deployment Version: 10.4, 10.5.1, ... (Darwin)
 4*2WM<x>_Minimale Mac OS X Deployment Version: 10.4, 10.5.1, ... (Darwin)
 p*2WM<x>_Minimale Mac OS X Deployment Version: 10.4, 10.5.1, ... (Darwin)
@@ -3876,9 +3923,9 @@ P*2WM<x>_Minimale Mac OS X Deployment Version: 10.4, 10.5.1, ... (Darwin)
 3*2WN_Erzeuge keinen "relocation code" (notwendig für debugging) (Windows)
 4*2WN_Erzeuge keinen "relocation code" (notwendig für debugging) (Windows)
 A*2WN_Erzeuge keinen "relocation code" (notwendig für debugging) (Windows)
-A*2Wpxxxx_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben mögliche Werte aus
-m*2Wpxxxx_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben mögliche Werte aus
-V*2Wpxxxx_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu  geben mögliche Werte aus
+A*2Wp<x>_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben mögliche Werte aus
+m*2Wp<x>_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben mögliche Werte aus
+V*2Wp<x>_Spezifiziere den Kontrollertyp; fpc -i oder fpc -iu geben mögliche Werte aus
 3*2WP<x>_Minimale iOS Deployment Version: 3.0, 5.0.1, ... (iphonesim)
 4*2WP<x>_Minimale iOS Deployment Version: 8.0, 8.0.2, ... (iphonesim)
 a*2WP<x>_Minimale iOS Deployment Version: 7.0, 7.1.2, ... (Darwin)
@@ -3892,6 +3939,7 @@ A*2WR_Erzeuge "relocation code" (Windows)
 P*2WF_Spezifiziere "MPW tool type application" (Classic Mac OS)
 **2WX_Ermögliche den executable stack (Linux)
 **1X_Programm-Optionen:
+**2X9_Erzeuge Linkerscript für GNU Binutils ld älter als Version 2.19.1 (Linux)
 **2Xc_Übergebe --shared an den Linker (BeOS, Darwin, FreeBSD, Linux)
 **2Xd_Den Standard Bibliotheks-Suchpfad NICHT nutzen (benötigt für cross compile, wenn nicht -XR verwendet wird)
 **2Xe_Verwende den externen Linker
@@ -3903,7 +3951,7 @@ P*2WF_Spezifiziere "MPW tool type application" (Classic Mac OS)
 **2XLO_Definiere die Reihenfolge der Bibliotheken für das Linken
 **2XLD_Schließe die voreingestellte Reihenfolge der Standard-Bibliotheken aus
 **2Xm_Erzeuge die "link map"
-**2XM<x>_Setze den Namen der 'main' Programm-Routine (default ist 'main')
+**2XM<x>_Setze den Namen der 'main' Programm-Routine (Voreinstellung ist 'main')
 **2Xn_Nutze den plattformeigenen Linker des Zielsystem anstelle des GNU ld (Solaris, AIX)
 F*2Xp<x>_Suche nach der Compilerbinary zuerst im Verzeichnis <x>
 **2XP<x>_Stelle dem Namen der Compiler-Hilfsprogramme (binutils) den Prefix <x> voran
@@ -3913,6 +3961,7 @@ F*2Xp<x>_Suche nach der Compilerbinary zuerst im Verzeichnis <x>
 **2XS_Versuche Units statisch zu linken (default)    (definiert FPC_LINK_STATIC)
 **2Xt_Linke mit statischen Bibliotheken              (-static wird an den Linker übergeben)
 **2Xv_Erzeuge eine Tabelle mit den virtuellen Entry-Aufrufen
+**2XV_Benutze VLink als externen linker              (Voreinstellung für Amiga, MorphOS)
 **2XX_Versuche Units smart zu linken                 (definiert FPC_LINK_SMART)
 **1*_
 **1?_Zeigt diese Hilfe an

+ 102 - 4
compiler/msg/errore.msg

@@ -26,6 +26,7 @@
 #   general_  general info
 #   exec_     calls to assembler, external linker, binder
 #   link_     internal linker
+#   package_  package handling
 #
 # <type> the type of the message it should normally used for
 #   f_   fatal error
@@ -138,7 +139,7 @@ general_e_exception_raised=01026_E_Compilation raised exception internally
 #
 # Scanner
 #
-# 02098 is the last used one
+# 02099 is the last used one
 #
 % \section{Scanner messages.}
 % This section lists the messages that the scanner emits. The scanner takes
@@ -409,11 +410,14 @@ scan_w_heapmax_lessthan_heapmin=02097_W_The specified HeapMax value is smaller t
 scan_e_illegal_hugepointernormalization=02098_E_Illegal argument for HUGEPOINTERNORMALIZATION
 % The only allowed values for HUGEPOINTERNORMALIZATION are BORLANDC, MICROSOFTC
 % and WATCOMC.
+scan_e_illegal_asmcpu_specifier=02099_E_Illegal assembler CPU instruction set specified "$1"
+% When you specify an assembler CPU with the \var{\{\$ASMCPU xxx\}} directive,
+% the compiler didn't recognize the CPU you specified.
 % \end{description}
 #
 # Parser
 #
-# 03344 is the last used one
+# 03345 is the last used one
 #
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
@@ -1547,6 +1551,8 @@ parser_e_genfuncs_cannot_be_virtual=03343_E_Generic methods can not be virtual
 parser_e_packages_not_supported=03344_E_Dynamic packages not supported for target OS
 % Support for dynamic packages is not implemented for the specified target OS
 % or it is at least not tested and thus disabled.
+parser_e_cannot_use_hardfloat_in_a_softfloat_environment=03345_E_The HardFloat directive cannot be used if soft float code is generated or fpu emulation is turned on
+% The \var{HardFloat} directive can only be used if an instruction set is used which supports floating point operations.
 %
 %
 % \end{description}
@@ -2999,7 +3005,7 @@ link_e_com_program_uses_segment_relocations=09207_E_Cannot create a .COM file, b
 #
 # Unit loading
 #
-# 10062 is the last used one
+# 10064 is the last used one
 #
 # BeginOfTeX
 % \section{Unit loading messages.}
@@ -3204,6 +3210,8 @@ unit_u_indirect_crc_changed=10062_U_Indirect interface (objects/classes) CRC cha
 unit_u_ppu_invalid_memory_model=10063_U_PPU is compiled for another i8086 memory model
 % This unit file was compiled for a different i8086 memory model and
 % cannot be read.
+unit_u_loading_from_package=10064_U_Loading unit $1 from package $2
+% The unit is loaded from a package.
 % \end{description}
 # EndOfTeX
 
@@ -3438,12 +3446,102 @@ wpo_cant_create_feedback_file=12019_E_Cannot create specified whole program opti
 # EndOfTeX
 
 
+#
+# Package loading and handling
+#
+# 13028 is the last used one
+#
+# BeginOfTeX
+% \section{Package loading messages.}
+% This section lists all messages that can occur when the compiler is
+% loading a package from disk into memory, saving a package from memory
+% to disk or when parsing packages in general. Many of these messages are
+% informational messages.
+% \begin{description}
+package_f_cant_find_pcp=13001_F_Can't find package $1
+% You tried to use a package of which the PCP file isn't found by the
+% compiler. Check your configuration file for the package paths.
+package_u_pcp_found=13002_U_PCP file for package $1 found
+% The PCP file for the specified package was found.
+package_e_duplicate_package=13003_E_Duplicate package $1
+% The package was already specified as required package and may not be specified
+% a second time.
+package_e_unit_deny_package=13004_E_Unit $1 can not be part of a package
+% The unit can not be part of a package because the DenyPackageUnit directive is enabled for the unit.
+package_n_implicit_unit_import=13005_N_Unit $1 is implicitely imported into package $2
+% The unit was not specified as part of the \var{contains} section and is also not included in one of the
+% required packages. Add the unit to the \var{contains} section to increase compatibility with other packages.
+package_f_cant_create_pcp=13006_F_Failed to create PCP file $2 for package $1
+% The PCP file for the package could not be created.
+package_f_cant_read_pcp=13007_F_Failed to read PCP file for package $1
+% The PCP file for the package could not be read.
+package_t_pcp_loading=13008_T_PCP loading $1
+% When the \var{-vt} switch is used, the compiler tells you
+% what packages it loads.
+package_u_pcp_name=13009_U_PCP Name: $1
+% When you use the \var{-vu} flag, the package name is shown.
+package_u_pcp_flags=13010_U_PCP Flags: $1
+% When you use the \var{-vu} flag, the package flags are shown.
+package_u_pcp_crc=13011_U_PCP Crc: $1
+% When you use the \var{-vu} flag, the package CRC check is shown.
+package_u_pcp_time=13012_U_PCP Time: $1
+% When you use the \var{-vu} flag, the time the package was compiled is shown.
+package_u_pcp_file_too_short=13013_U_PCP File too short
+% The PCP file is too short, not all declarations are present.
+package_u_pcp_invalid_header=13014_U_PCP Invalid Header (no PCP at the begin)
+% A package file contains as the first three bytes the ASCII codes of the characters \var{PCP}.
+package_u_pcp_invalid_version=13015_U_PCP Invalid Version $1
+% This package file was compiled with a different version of the compiler, and
+% cannot be read.
+package_u_pcp_invalid_processor=13016_U_PCP is compiled for another processor
+% This package file was compiled for a different processor type, and
+% cannot be read.
+package_u_pcp_invalid_target=13017_U_PCP is compiled for another target
+% This package file was compiled for a different target, and
+% cannot be read.
+package_u_pcp_write=13018_U_Writing $1
+% When you specify the \var{-vu} switch, the compiler will tell you where it
+% writes the package file.
+package_f_pcp_cannot_write=13019_F_Can't Write PCP-File
+% An error occurred when writing the package file.
+package_f_pcp_read_error=13020_F_Error reading PCP-File
+% This means that the package file was corrupted, and contains invalid
+% information. Recompilation will be necessary.
+package_f_pcp_read_unexpected_end=13021_F_unexpected end of PCP-File
+% Unexpected end of file. This may mean that the PCP file is
+% corrupted.
+package_f_pcp_invalid_entry=13022_F_Invalid PCP-File entry: $1
+% The unit the compiler is trying to read is corrupted, or generated with a
+% newer version of the compiler.
+package_u_pcp_invalid_fpumode=13023_U_Trying to use a unit which was compiled with a different FPU mode
+% Trying to compile code while using units which were not compiled with
+% the same floating point format mode. Either all code should be compiled
+% with FPU emulation on, or with FPU emulation off.
+package_t_packagesearch=13024_T_Packagesearch: $1
+% When you use the \var{-vt} option, the compiler tells you where it tries to find
+% package files.
+package_u_required_package=13025_U_Required package $1
+% When you specify the \var{-vu} switch, the compiler will tell you which
+% packages a package requires.
+package_u_contained_unit=13026_U_Contained unit $1
+% When you specify the \var{-vu} switch, the compiler will tell you which
+% units a package contains.
+package_e_unit_already_contained_in_package=13027_E_Unit $1 is already contained in package $2
+% A unit specified in a contains sections must not be part of a required package. Note that
+% a unit might have become part of another package by indirectly including it.
+package_w_unit_from_indirect_package=13028_W_Unit $1 is imported from indirectly required package $2
+% If a unit from a package that is not part of the \var{requires} section is used then the package
+% should require this unit directly to avoid confusion.
+% \end{description}
+# EndOfTeX
+
+
 #
 # Logo (option -l)
 #
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2015 by Florian Klaempfl and others
+Copyright (c) 1993-2016 by Florian Klaempfl and others
 ]
 
 #

+ 1 - 1
compiler/msg/errores.msg

@@ -3474,7 +3474,7 @@ wpo_cant_create_feedback_file=12019_E_Cannot create specified whole program opti
 #
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2015 by Florian Klaempfl and others
+Copyright (c) 1993-2016 by Florian Klaempfl and others
 ]
 
 #

+ 1 - 1
compiler/msg/errorf.msg

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

+ 1 - 1
compiler/msg/errorfi.msg

@@ -3496,7 +3496,7 @@ wpo_cant_create_feedback_file=12019_E_Cannot create specified whole program opti
 # Logo (option -l)
 #
 option_logo=11023_[ Compilateur Free Pascal version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2015, Florian Klaempfl and others]
+Copyright (c) 1993-2016, Florian Klaempfl and others]
 #
 # Info (option -i)
 #

+ 1 - 1
compiler/msg/errorhe.msg

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

+ 1 - 1
compiler/msg/errorheu.msg

@@ -3493,7 +3493,7 @@ wpo_cant_create_feedback_file=12019_E_Cannot create specified whole program opti
 #
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2015 by Florian Klaempfl and others
+Copyright (c) 1993-2016 by Florian Klaempfl and others
 ]
 
 #

+ 1 - 1
compiler/msg/errorid.msg

@@ -3501,7 +3501,7 @@ wpo_cant_create_feedback_file=12019_E_Cannot create specified whole program opti
 #
 option_logo=11023_[
 Free Pascal Compiler versi $FPCFULLVERSION [$FPCDATE] untuk $FPCCPU
-Hak Cipta (c) 1993-2015 oleh Florian Klaempfl and others
+Hak Cipta (c) 1993-2016 oleh Florian Klaempfl and others
 ]
 
 #

+ 1 - 1
compiler/msg/erroriu.msg

@@ -2690,7 +2690,7 @@ wpo_cant_create_feedback_file=12019_E_Impossibile creare il file di feedback "$1
 #
 option_logo=11023_[
 Compilatore Free Pascal, versione $FPCFULLVERSION [$FPCDATE] per $FPCCPU
-Copyright (c) 1993-2015 di Florian Klaempfl and others
+Copyright (c) 1993-2016 di Florian Klaempfl and others
 ]
 
 #

+ 1 - 1
compiler/msg/errorn.msg

@@ -3482,7 +3482,7 @@ wpo_cant_create_feedback_file=12019_E_Cannot create specified whole program opti
 #
 option_logo=11023_[
 Free Pascal Compiler versie $FPCFULLVERSION [$FPCDATE] voor $FPCTARGET
-Copyright (c) 1993-2015 door Florian Klaempfl en anderen
+Copyright (c) 1993-2016 door Florian Klaempfl en anderen
 ]
 #
 # Info (option -i)

+ 1 - 1
compiler/msg/errorpli.msg

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

+ 1 - 1
compiler/msg/errorpt.msg

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

+ 1 - 1
compiler/msg/errorptu.msg

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

+ 1 - 1
compiler/msg/errorr.msg

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

+ 1 - 1
compiler/msg/errorru.msg

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

+ 1 - 1
compiler/msg/errorues.msg

@@ -3468,7 +3468,7 @@ wpo_cant_create_feedback_file=12019_E_Cannot create specified whole program opti
 #
 option_logo=11023_[
 Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPCCPU
-Copyright (c) 1993-2015 by Florian Klaempfl and others
+Copyright (c) 1993-2016 by Florian Klaempfl and others
 ]
 
 #

+ 34 - 3
compiler/msgidx.inc

@@ -121,6 +121,7 @@ const
   scan_w_invalid_stacksize=02096;
   scan_w_heapmax_lessthan_heapmin=02097;
   scan_e_illegal_hugepointernormalization=02098;
+  scan_e_illegal_asmcpu_specifier=02099;
   parser_e_syntax_error=03000;
   parser_e_dont_nest_interrupt=03004;
   parser_w_proc_directive_ignored=03005;
@@ -447,6 +448,7 @@ const
   parser_e_no_genfuncs_in_interfaces=03342;
   parser_e_genfuncs_cannot_be_virtual=03343;
   parser_e_packages_not_supported=03344;
+  parser_e_cannot_use_hardfloat_in_a_softfloat_environment=03345;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
@@ -949,6 +951,7 @@ const
   unit_e_different_wpo_file=10061;
   unit_u_indirect_crc_changed=10062;
   unit_u_ppu_invalid_memory_model=10063;
+  unit_u_loading_from_package=10064;
   option_usage=11000;
   option_only_one_source_support=11001;
   option_def_only_for_os2=11002;
@@ -1022,13 +1025,41 @@ const
   wpo_error_executing_symbol_prog=12017;
   wpo_symbol_live_info_needs_smart_linking=12018;
   wpo_cant_create_feedback_file=12019;
+  package_f_cant_find_pcp=13001;
+  package_u_pcp_found=13002;
+  package_e_duplicate_package=13003;
+  package_e_unit_deny_package=13004;
+  package_n_implicit_unit_import=13005;
+  package_f_cant_create_pcp=13006;
+  package_f_cant_read_pcp=13007;
+  package_t_pcp_loading=13008;
+  package_u_pcp_name=13009;
+  package_u_pcp_flags=13010;
+  package_u_pcp_crc=13011;
+  package_u_pcp_time=13012;
+  package_u_pcp_file_too_short=13013;
+  package_u_pcp_invalid_header=13014;
+  package_u_pcp_invalid_version=13015;
+  package_u_pcp_invalid_processor=13016;
+  package_u_pcp_invalid_target=13017;
+  package_u_pcp_write=13018;
+  package_f_pcp_cannot_write=13019;
+  package_f_pcp_read_error=13020;
+  package_f_pcp_read_unexpected_end=13021;
+  package_f_pcp_invalid_entry=13022;
+  package_u_pcp_invalid_fpumode=13023;
+  package_t_packagesearch=13024;
+  package_u_required_package=13025;
+  package_u_contained_unit=13026;
+  package_e_unit_already_contained_in_package=13027;
+  package_w_unit_from_indirect_package=13028;
   option_logo=11023;
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 76752;
+  MsgTxtSize = 78039;
 
   MsgIdxMax : array[1..20] of longint=(
-    27,99,345,124,96,58,130,33,208,64,
-    58,20,1,1,1,1,1,1,1,1
+    27,100,346,124,96,58,130,33,208,65,
+    58,20,29,1,1,1,1,1,1,1
   );

File diff suppressed because it is too large
+ 539 - 506
compiler/msgtxt.inc


+ 4 - 0
compiler/nadd.pas

@@ -437,6 +437,10 @@ implementation
              (lt in [pointerconstn,niln]) and
              (rt in [pointerconstn,niln]) and
              (nodetype in [ltn,lten,gtn,gten,equaln,unequaln,subn])
+            ) or
+            (
+             (lt = ordconstn) and (ld.typ = orddef) and is_currency(ld) and
+             (rt = ordconstn) and (rd.typ = orddef) and is_currency(rd)
             ) then
           begin
              t:=nil;

+ 6 - 0
compiler/ncgbas.pas

@@ -73,6 +73,7 @@ interface
       nflw,pass_2,ncgutil,
       cgbase,cgobj,hlcgobj,
       procinfo,
+      cpuinfo,
       tgobj
       ;
 
@@ -253,6 +254,8 @@ interface
              currenttai:=tai(current_asmdata.CurrAsmList.last);
              exit;
            end;
+         { Switch to the CPU instruction set, specified by the $ASMCPU directive }
+         current_asmdata.CurrAsmList.Concat(tai_directive.create(asd_cpu,cputypestr[current_settings.asmcputype]));
 
          { Allocate registers used in the assembler block }
          { has_registerlist=true means that registers are specified and already allocated }
@@ -348,6 +351,9 @@ interface
          { Release register used in the assembler block }
          if (not has_registerlist) then
            cg.deallocallcpuregisters(current_asmdata.CurrAsmList);
+
+         { Switch back to the CPU instruction set of the target CPU }
+         current_asmdata.CurrAsmList.Concat(tai_directive.create(asd_cpu,cputypestr[current_settings.cputype]));
        end;
 
 

+ 2 - 2
compiler/ncgcnv.pas

@@ -295,7 +295,7 @@ interface
                 begin
                   { FPC_EMPTYCHAR is a widechar -> 2 bytes }
                   reference_reset(hr,2);
-                  hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
+                  hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR',AT_DATA);
                   location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,resultdef);
                   hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,cwidechartype,resultdef,hr,location.register);
                 end
@@ -680,7 +680,7 @@ interface
          hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,resultdef,OC_NE,0,location.register,l1);
          { FPC_EMPTYCHAR is a widechar -> 2 bytes }
          reference_reset(hr,2);
-         hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
+         hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR',AT_DATA);
          hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,cwidechartype,resultdef,hr,location.register);
          hlcg.a_label(current_asmdata.CurrAsmList,l1);
       end;

+ 38 - 15
compiler/ncgld.pas

@@ -38,6 +38,7 @@ interface
           procedure generate_nested_access(vs: tsym);virtual;
           procedure generate_absaddr_access(vs: tabsolutevarsym); virtual;
           procedure generate_threadvar_access(gvs: tstaticvarsym); virtual;
+          function use_indirect_symbol(gvs: tstaticvarsym): boolean;
          public
           procedure pass_generate_code;override;
           procedure changereflocation(const ref: treference);
@@ -68,7 +69,7 @@ implementation
     uses
       cutils,
       systems,
-      verbose,globals,constexp,
+      verbose,globals,constexp,fmodule,
       nutils,
       symtable,symconst,symdef,defutil,paramgr,ncon,nbas,ncgrtti,
       aasmbase,
@@ -273,9 +274,9 @@ implementation
            begin
              if gvs.localloc.loc=LOC_INVALID then
                if not(vo_is_weak_external in gvs.varoptions) then
-                 reference_reset_symbol(location.reference,current_asmdata.RefAsmSymbol(gvs.mangledname),0,location.reference.alignment)
+                 reference_reset_symbol(location.reference,current_asmdata.RefAsmSymbol(gvs.mangledname,AT_DATA,use_indirect_symbol(gvs)),0,location.reference.alignment)
                else
-                 reference_reset_symbol(location.reference,current_asmdata.WeakRefAsmSymbol(gvs.mangledname),0,location.reference.alignment)
+                 reference_reset_symbol(location.reference,current_asmdata.WeakRefAsmSymbol(gvs.mangledname,AT_DATA),0,location.reference.alignment)
              else
                location:=gvs.localloc;
            end
@@ -305,9 +306,9 @@ implementation
              hlcg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,pvd,OC_EQ,0,hregister,norelocatelab);
              { no, call it with the index of the threadvar as parameter }
              if not(vo_is_weak_external in gvs.varoptions) then
-               reference_reset_symbol(tvref,current_asmdata.RefAsmSymbol(gvs.mangledname),0,sizeof(pint))
+               reference_reset_symbol(tvref,current_asmdata.RefAsmSymbol(gvs.mangledname,AT_DATA,use_indirect_symbol(gvs)),0,sizeof(pint))
              else
-               reference_reset_symbol(tvref,current_asmdata.WeakRefAsmSymbol(gvs.mangledname),0,sizeof(pint));
+               reference_reset_symbol(tvref,current_asmdata.WeakRefAsmSymbol(gvs.mangledname,AT_DATA),0,sizeof(pint));
              href:=tvref;
              hlcg.g_set_addr_nonbitpacked_field_ref(current_asmdata.CurrAsmList,
                tv_rec,
@@ -347,6 +348,26 @@ implementation
        end;
 
 
+    function tcgloadnode.use_indirect_symbol(gvs:tstaticvarsym):boolean;
+      begin
+        { we are using a direct reference if any of the following is true:
+          - the target does not support packages
+          - the target does not use indirect references
+          - the variable is declared as (weak) external
+          - G- is set
+          - the variable is located inside the same unit }
+        result:=(tf_supports_packages in target_info.flags) and
+                (target_info.system in systems_indirect_var_imports) and
+                (gvs.varoptions*[vo_is_external,vo_is_weak_external]=[]) and
+                (gvs.owner.symtabletype in [globalsymtable,staticsymtable]) and
+                (cs_imported_data in current_settings.localswitches) and
+                not sym_is_owned_by(gvs,current_module.globalsymtable) and
+                (
+                  (current_module.globalsymtable=current_module.localsymtable) or
+                  not sym_is_owned_by(gvs,current_module.localsymtable)
+                );
+      end;
+
     procedure tcgloadnode.pass_generate_code;
       var
         hregister : tregister;
@@ -371,7 +392,7 @@ implementation
                    toaddr :
                      generate_absaddr_access(tabsolutevarsym(symtableentry));
                    toasm :
-                     location.reference.symbol:=current_asmdata.RefAsmSymbol(tabsolutevarsym(symtableentry).mangledname);
+                     location.reference.symbol:=current_asmdata.RefAsmSymbol(tabsolutevarsym(symtableentry).mangledname,AT_DATA);
                    else
                      internalerror(200310283);
                  end;
@@ -401,9 +422,9 @@ implementation
                  begin
                    hregister:=cg.getaddressregister(current_asmdata.CurrAsmList);
                    if not(vo_is_weak_external in gvs.varoptions) then
-                     location.reference.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(symtableentry).mangledname)
+                     location.reference.symbol:=current_asmdata.RefAsmSymbol(tstaticvarsym(symtableentry).mangledname,AT_DATA)
                    else
-                     location.reference.symbol:=current_asmdata.WeakRefAsmSymbol(tstaticvarsym(symtableentry).mangledname);
+                     location.reference.symbol:=current_asmdata.WeakRefAsmSymbol(tstaticvarsym(symtableentry).mangledname,AT_DATA);
                    cg.a_load_ref_reg(current_asmdata.CurrAsmList,OS_ADDR,OS_ADDR,location.reference,hregister);
                    reference_reset_base(location.reference,hregister,0,location.reference.alignment);
                  end
@@ -414,10 +435,12 @@ implementation
                else
                  begin
                    if gvs.localloc.loc=LOC_INVALID then
-                     if not(vo_is_weak_external in gvs.varoptions) then
-                       reference_reset_symbol(location.reference,current_asmdata.RefAsmSymbol(gvs.mangledname),0,location.reference.alignment)
-                     else
-                       reference_reset_symbol(location.reference,current_asmdata.WeakRefAsmSymbol(gvs.mangledname),0,location.reference.alignment)
+                     begin
+                       if not(vo_is_weak_external in gvs.varoptions) then
+                         reference_reset_symbol(location.reference,current_asmdata.RefAsmSymbol(gvs.mangledname,AT_DATA,use_indirect_symbol(gvs)),0,location.reference.alignment)
+                       else
+                         reference_reset_symbol(location.reference,current_asmdata.WeakRefAsmSymbol(gvs.mangledname,AT_DATA),0,location.reference.alignment)
+                     end
                    else
                      location:=gvs.localloc;
                  end;
@@ -567,7 +590,7 @@ implementation
                      else
                        begin
                          { load address of the function }
-                         reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname),0,procdef.address_type.alignment);
+                         reference_reset_symbol(href,current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION),0,procdef.address_type.alignment);
                          location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,cprocvardef.getreusableprocaddr(procdef));
                          hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,procdef,cprocvardef.getreusableprocaddr(procdef),href,location.register);
                        end;
@@ -587,9 +610,9 @@ implementation
                       { def_cgsize does not work for tprocdef, so we use pd.address_type }
                       location.size:=def_cgsize(pd.address_type);
                       if not(po_weakexternal in pd.procoptions) then
-                        location.reference.symbol:=current_asmdata.RefAsmSymbol(procdef.mangledname)
+                        location.reference.symbol:=current_asmdata.RefAsmSymbol(procdef.mangledname,AT_FUNCTION)
                       else
-                        location.reference.symbol:=current_asmdata.WeakRefAsmSymbol(procdef.mangledname);
+                        location.reference.symbol:=current_asmdata.WeakRefAsmSymbol(procdef.mangledname,AT_FUNCTION);
                    end;
               end;
            labelsym :

+ 23 - 6
compiler/ncgmem.pas

@@ -86,7 +86,7 @@ implementation
 
     uses
       systems,
-      cutils,cclasses,verbose,globals,constexp,
+      cutils,cclasses,verbose,globals,constexp,fmodule,
       symconst,symbase,symdef,symsym,symcpu,symtable,defutil,paramgr,
       aasmbase,aasmtai,aasmdata,
       procinfo,pass_2,parabase,
@@ -106,7 +106,7 @@ implementation
         href    : treference;
         pool    : THashSet;
         entry   : PHashSetItem;
-
+        indirect : boolean;
       begin
          location_reset(location,LOC_REGISTER,def_cgsize(voidpointertype));
          if (left.nodetype=typen) then
@@ -114,8 +114,19 @@ implementation
              location.register:=hlcg.getaddressregister(current_asmdata.CurrAsmList,voidpointertype);
              if not is_objcclass(left.resultdef) then
                begin
+                 { we are using a direct reference if any of the following is true:
+                   - the target does not support packages
+                   - the target does not use indirect references
+                   - the class is located inside the same unit }
+                 indirect:=(tf_supports_packages in target_info.flags) and
+                           (target_info.system in systems_indirect_var_imports) and
+                           not sym_is_owned_by(left.resultdef.typesym,current_module.globalsymtable) and
+                           (
+                             (current_module.globalsymtable=current_module.localsymtable) or
+                             not sym_is_owned_by(left.resultdef.typesym,current_module.localsymtable)
+                           );
                  reference_reset_symbol(href,
-                   current_asmdata.RefAsmSymbol(tobjectdef(tclassrefdef(resultdef).pointeddef).vmt_mangledname,AT_DATA),0,
+                   current_asmdata.RefAsmSymbol(tobjectdef(tclassrefdef(resultdef).pointeddef).vmt_mangledname,AT_DATA,indirect),0,
                    voidpointertype.size);
                  hlcg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,resultdef,resultdef,href,location.register);
                end
@@ -325,6 +336,7 @@ implementation
         paraloc1 : tcgpara;
         tmpref: treference;
         sref: tsubsetreference;
+        awordoffset,
         offsetcorrection : aint;
         pd : tprocdef;
         sym : tsym;
@@ -451,13 +463,18 @@ implementation
                        offsetcorrection:=0;
                        if (left.location.size in [OS_PAIR,OS_SPAIR]) then
                          begin
-                           if (vs.fieldoffset>=sizeof(aword)) xor (target_info.endian=endian_big) then
+                           if not is_packed_record_or_object(left.resultdef) then
+                             awordoffset:=sizeof(aword)
+                           else
+                             awordoffset:=sizeof(aword)*8;
+
+                           if (vs.fieldoffset>=awordoffset) xor (target_info.endian=endian_big) then
                              location.sreg.subsetreg := left.location.registerhi
                            else
                              location.sreg.subsetreg := left.location.register;
 
-                           if (vs.fieldoffset>=sizeof(aword)) then
-                             offsetcorrection:=sizeof(aword)*8;
+                           if vs.fieldoffset>=awordoffset then
+                             offsetcorrection := sizeof(aword)*8;
 
                            location.sreg.subsetregsize := OS_INT;
                          end

+ 31 - 5
compiler/ncgrtti.pas

@@ -940,7 +940,8 @@ implementation
               { pocall_stdcall    } 3,
               { pocall_softfloat  } 10,
               { pocall_mwpascal   } 11,
-              { pocall_interrupt  } 12
+              { pocall_interrupt  } 12,
+              { pocall_hardfloat  } 13
              );
 
            procedure write_param_flag(parasym:tparavarsym);
@@ -1341,7 +1342,7 @@ implementation
           in sstrings.inc. }
         procedure enumdef_rtti_ord2stringindex(rttidef: trecorddef; const syms: tfplist);
 
-        var rttilab:Tasmsymbol;
+        var rttilab,rttilabind:Tasmsymbol;
             h,i,o,prev_value:longint;
             mode:(lookup,search); {Modify with care, ordinal value of enum is written.}
             r:single;             {Must be real type because of integer overflow risk.}
@@ -1442,6 +1443,14 @@ implementation
               rttilab,tcb.end_anonymous_record,sec_rodata,
               rttilab.name,const_align(sizeof(pint))));
             tcb.free;
+
+            { write indirect symbol }
+            tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
+            rttilabind:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_o2s',AB_INDIRECT,AT_DATA);
+            tcb.emit_tai(Tai_const.Createname(rttilab.name,AT_DATA,0),voidpointertype);
+            current_asmdata.AsmLists[al_rtti].concatList(
+              tcb.get_final_asmlist(rttilabind,voidpointertype,sec_rodata,rttilabind.name,const_align(sizeof(pint))));
+            tcb.free;
         end;
 
 
@@ -1452,7 +1461,8 @@ implementation
 
         var
           tcb: ttai_typedconstbuilder;
-          rttilab:Tasmsymbol;
+          rttilab,
+          rttilabind : Tasmsymbol;
           i:longint;
         begin
           { write rtti data }
@@ -1485,6 +1495,13 @@ implementation
             rttilab,tcb.end_anonymous_record,sec_rodata,
             rttilab.name,const_align(sizeof(pint))));
           tcb.free;
+          { write indirect symbol }
+          tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
+          rttilabind:=current_asmdata.DefineAsmSymbol(Tstoreddef(def).rtti_mangledname(rt)+'_s2o',AB_INDIRECT,AT_DATA);
+          tcb.emit_tai(Tai_const.Createname(rttilab.name,AT_DATA,0),voidpointertype);
+          current_asmdata.AsmLists[al_rtti].concatList(
+            tcb.get_final_asmlist(rttilabind,voidpointertype,sec_rodata,rttilabind.name,const_align(sizeof(pint))));
+          tcb.free;
         end;
 
         procedure enumdef_rtti_extrasyms(def:Tenumdef);
@@ -1598,7 +1615,8 @@ implementation
     procedure TRTTIWriter.write_rtti(def:tdef;rt:trttitype);
       var
         tcb: ttai_typedconstbuilder;
-        rttilab: tasmsymbol;
+        rttilab,
+        rttilabind : tasmsymbol;
         rttidef: tdef;
       begin
         { only write rtti of definitions from the current module }
@@ -1626,8 +1644,16 @@ implementation
         rttidef:=tcb.end_anonymous_record;
         current_asmdata.AsmLists[al_rtti].concatList(
           tcb.get_final_asmlist(rttilab,rttidef,sec_rodata,rttilab.name,const_align(sizeof(pint))));
-        write_rtti_extrasyms(def,rt,rttilab);
         tcb.free;
+        { write indirect symbol }
+        tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
+        rttilabind:=current_asmdata.DefineAsmSymbol(tstoreddef(def).rtti_mangledname(rt),AB_INDIRECT,AT_DATA);
+        tcb.emit_tai(Tai_const.Createname(rttilab.name,AT_DATA,0),voidpointertype);
+        current_asmdata.AsmLists[al_rtti].concatList(
+          tcb.get_final_asmlist(rttilabind,voidpointertype,sec_rodata,rttilabind.name,const_align(sizeof(pint))));
+        tcb.free;
+        { write additional data }
+        write_rtti_extrasyms(def,rt,rttilab);
       end;
 
 

+ 10 - 2
compiler/ncgvmt.pas

@@ -1032,9 +1032,7 @@ implementation
          methodnametable,intmessagetable,
          strmessagetable,classnamelabel,
          fieldtablelabel : tasmlabel;
-{$ifdef vtentry}
          hs: string;
-{$endif vtentry}
 {$ifdef WITHDMT}
          dmtlabel : tasmlabel;
 {$endif WITHDMT}
@@ -1228,6 +1226,16 @@ implementation
          current_asmdata.asmlists[al_globals].concat(tai_symbol.CreateName(hs,AT_DATA,0));
 {$endif vtentry}
         symtablestack.pop(current_module.localsymtable);
+
+        { write indirect symbol }
+        tcb:=ctai_typedconstbuilder.create([tcalo_make_dead_strippable]);
+        hs:=_class.vmt_mangledname;
+        tcb.emit_tai(Tai_const.Createname(hs,AT_DATA,0),voidpointertype);
+        current_asmdata.AsmLists[al_globals].concatList(
+          tcb.get_final_asmlist(
+            current_asmdata.DefineAsmSymbol(hs,AB_INDIRECT,AT_DATA),
+            voidpointertype,sec_rodata,hs,const_align(sizeof(pint))));
+        tcb.free;
       end;
 
 

+ 5 - 2
compiler/ncnv.pas

@@ -2563,8 +2563,11 @@ implementation
                 result:=
                   (docheckremoveinttypeconvs(tbinarynode(n).left) and
                    docheckremoveinttypeconvs(tbinarynode(n).right)) or
-                  ((n.nodetype=andn) and wasoriginallysmallerint(tbinarynode(n).left)) or
-                  ((n.nodetype=andn) and wasoriginallysmallerint(tbinarynode(n).right));
+                  { in case of div/mod, the result of that division/modulo can
+                    usually be different in 32 and 64 bit }
+                  (not gotdivmod and
+                   (((n.nodetype=andn) and wasoriginallysmallerint(tbinarynode(n).left)) or
+                    ((n.nodetype=andn) and wasoriginallysmallerint(tbinarynode(n).right))));
               end;
           end;
         end;

+ 27 - 2
compiler/ngenutil.pas

@@ -443,7 +443,11 @@ implementation
           ((vo_is_funcret in tabstractnormalvarsym(p).varoptions) or
            (tabstractnormalvarsym(p).varspez=vs_out)))) and
          not (vo_is_default_var in tabstractnormalvarsym(p).varoptions) and
-         not is_managed_type(tabstractnormalvarsym(p).vardef) and
+         (not is_managed_type(tabstractnormalvarsym(p).vardef) or
+          (is_string(tabstractnormalvarsym(p).vardef) and
+           (vo_is_funcret in tabstractnormalvarsym(p).varoptions)
+          )
+         ) and
          not assigned(tabstractnormalvarsym(p).defaultconstsym);
     end;
 
@@ -468,7 +472,19 @@ implementation
                   the procedure address -> cast to tmethod instead }
                 trashn:=ctypeconvnode.create_explicit(trashn,methodpointertype);
             end;
-          if ((p.typ=localvarsym) and
+          if is_managed_type(p.vardef) then
+            begin
+              if is_string(p.vardef) then
+                trash_small(stat,trashn,
+                  cstringconstnode.createstr(
+                    'uninitialized function result in '+
+                    tprocdef(p.owner.defowner).customprocname([pno_proctypeoption, pno_paranames,pno_ownername, pno_noclassmarker])
+                  )
+                )
+              else
+                internalerror(2016030601);
+            end
+          else if ((p.typ=localvarsym) and
               (not(vo_is_funcret in p.varoptions) or
                not is_shortstring(p.vardef))) or
              ((p.typ=paravarsym) and
@@ -546,6 +562,8 @@ implementation
 
 
   class procedure tnodeutils.insertbsssym(list: tasmlist; sym: tstaticvarsym; size: asizeint; varalign: shortint);
+    var
+      symind : tasmsymbol;
     begin
       if sym.globalasmsym then
         begin
@@ -565,6 +583,13 @@ implementation
         end
       else
         list.concat(Tai_datablock.create(sym.mangledname,size));
+
+      { add the indirect symbol if needed }
+      new_section(list,sec_rodata,lower(sym.mangledname),const_align(sym.vardef.alignment));
+      symind:=current_asmdata.DefineAsmSymbol(sym.mangledname,AB_INDIRECT,AT_DATA);
+      list.concat(Tai_symbol.Create_Global(symind,0));
+      list.concat(Tai_const.Createname(sym.mangledname,AT_DATA,0));
+      list.concat(tai_symbol_end.Create(symind));
     end;
 
 

+ 3 - 0
compiler/nmem.pas

@@ -1109,6 +1109,9 @@ implementation
     procedure Tvecnode.mark_write;
       begin
         include(flags,nf_write);
+        { see comment in tsubscriptnode.mark_write }
+        if not(is_implicit_pointer_object_type(left.resultdef)) then
+          left.mark_write;
       end;
 
 

+ 1 - 1
compiler/node.pas

@@ -882,7 +882,7 @@ implementation
                 first:=false;
               write(t, i);
             end;
-        write(t,']');
+        write(t,'], cmplx = ',node_complexity(self));
       end;
 
 

+ 3 - 2
compiler/nutils.pas

@@ -742,7 +742,8 @@ implementation
               callparan:
                 begin
                   { call to decr? }
-                  if is_managed_type(tunarynode(p).left.resultdef) and (tcallparanode(p).parasym.varspez=vs_out) then
+                  if is_managed_type(tunarynode(p).left.resultdef) and
+                     assigned(tcallparanode(p).parasym) and (tcallparanode(p).parasym.varspez=vs_out) then
                     begin
                       result:=NODE_COMPLEXITY_INF;
                       exit;
@@ -813,7 +814,7 @@ implementation
               ordconstn:
                 begin
 {$ifdef ARM}
-                  if not(is_shifter_const(tordconstnode(p).value.svalue,dummy)) then
+                  if not(is_shifter_const(aint(tordconstnode(p).value.svalue),dummy)) then
                     result:=2;
 {$endif ARM}
                   exit;

Some files were not shown because too many files changed in this diff