Browse Source

--- Merging r13526 into '.':
U tests/tbs/tb0524.pp
--- Merging r13529 into '.':
G tests/tbs/tb0524.pp
Skipped missing target: 'utils/simulator'
--- Merging r13554 into '.':
U rtl/x86_64/x86_64.inc
--- Merging r13563 into '.':
U rtl/unix/ipc.pp
U rtl/unix/sockets.pp
U rtl/linux/arm/sysnr.inc
U rtl/linux/osdefs.inc
U rtl/linux/unixsock.inc
U rtl/linux/bunxsysc.inc
U rtl/linux/ossysc.inc
U rtl/linux/system.pp
--- Merging r13565 into '.':
U tests/Makefile.fpc
U tests/Makefile
--- Merging r13574 through r13580 into '.':
U rtl/inc/real2str.inc
A tests/webtbs/tw14230.pp
U compiler/dbgdwarf.pas
U compiler/nmem.pas
U compiler/pexpr.pas
U compiler/finput.pas
U compiler/ncal.pas
U compiler/scanner.pas
U compiler/ncnv.pas
U compiler/pass_1.pas
--- Merging r13584 into '.':
A tests/test/packages/webtbs/tw14265.pp
U compiler/systems/t_linux.pas
--- Merging r13587 through r13589 into '.':
U utils/fppkg/Makefile.fpc
A utils/fppkg/buildfppkg.pp
U utils/fppkg/Makefile
G compiler/systems/t_linux.pas
--- Merging r13600 into '.':
U compiler/systems/t_bsd.pas
--- Merging r13640 into '.':
U compiler/options.pas
--- Merging r13643 into '.':
U packages/Makefile
U packages/fcl-image/Makefile.fpc
U packages/fcl-image/Makefile
U packages/Makefile.fpc
U packages/cairo/Makefile.fpc
U packages/cairo/Makefile
--- Merging r13645 into '.':
G compiler/systems/t_bsd.pas
--- Merging r13647 into '.':
U compiler/pdecsub.pas
--- Merging r13650 into '.':
U compiler/cresstr.pas
--- Merging r13653 into '.':
G compiler/systems/t_bsd.pas
--- Merging r13657 through r13658 into '.':
G compiler/systems/t_bsd.pas
--- Merging r13665 through r13666 into '.':
U rtl/unix/bunxovl.inc
A tests/webtbs/tw14514.pp
U compiler/msgtxt.inc
U compiler/msgidx.inc
U compiler/msg/errore.msg
G compiler/options.pas
--- Merging r13674 through r13680 into '.':
G compiler/dbgdwarf.pas
U packages/cairo/src/cairo.pp
U packages/gtk2/src/gtk+/gtk/gtk2.pas
--- Merging r13687 into '.':
U rtl/objpas/cvarutil.inc
A tests/webtbs/tw14536.pp

git-svn-id: branches/fixes_2_4@13717 -

Jonas Maebe 16 years ago
parent
commit
0698121f36
47 changed files with 1246 additions and 680 deletions
  1. 5 0
      .gitattributes
  2. 7 3
      compiler/cresstr.pas
  3. 12 15
      compiler/dbgdwarf.pas
  4. 2 1
      compiler/finput.pas
  5. 3 1
      compiler/msg/errore.msg
  6. 3 2
      compiler/msgidx.inc
  7. 139 141
      compiler/msgtxt.inc
  8. 1 2
      compiler/ncal.pas
  9. 5 0
      compiler/ncnv.pas
  10. 2 2
      compiler/nmem.pas
  11. 19 3
      compiler/options.pas
  12. 23 4
      compiler/pass_1.pas
  13. 4 2
      compiler/pdecsub.pas
  14. 392 370
      compiler/pexpr.pas
  15. 74 25
      compiler/scanner.pas
  16. 21 6
      compiler/systems/t_bsd.pas
  17. 48 26
      compiler/systems/t_linux.pas
  18. 5 3
      packages/Makefile
  19. 2 2
      packages/Makefile.fpc
  20. 5 3
      packages/cairo/Makefile
  21. 4 0
      packages/cairo/Makefile.fpc
  22. 8 3
      packages/cairo/src/cairo.pp
  23. 3 3
      packages/fcl-image/Makefile
  24. 2 0
      packages/fcl-image/Makefile.fpc
  25. 1 0
      packages/gtk2/src/gtk+/gtk/gtk2.pas
  26. 6 5
      rtl/inc/real2str.inc
  27. 22 3
      rtl/linux/arm/sysnr.inc
  28. 18 1
      rtl/linux/bunxsysc.inc
  29. 15 1
      rtl/linux/osdefs.inc
  30. 2 1
      rtl/linux/ossysc.inc
  31. 2 0
      rtl/linux/system.pp
  32. 1 1
      rtl/linux/unixsock.inc
  33. 14 21
      rtl/objpas/cvarutil.inc
  34. 0 11
      rtl/unix/bunxovl.inc
  35. 3 1
      rtl/unix/ipc.pp
  36. 2 0
      rtl/unix/sockets.pp
  37. 1 1
      rtl/x86_64/x86_64.inc
  38. 2 2
      tests/Makefile
  39. 1 1
      tests/Makefile.fpc
  40. 13 13
      tests/tbs/tb0524.pp
  41. 48 0
      tests/test/packages/webtbs/tw14265.pp
  42. 44 0
      tests/webtbs/tw14230.pp
  43. 38 0
      tests/webtbs/tw14514.pp
  44. 36 0
      tests/webtbs/tw14536.pp
  45. 175 1
      utils/fppkg/Makefile
  46. 1 0
      utils/fppkg/Makefile.fpc
  47. 12 0
      utils/fppkg/buildfppkg.pp

+ 5 - 0
.gitattributes

@@ -8048,6 +8048,7 @@ tests/test/packages/webtbs/tw10045.pp svneol=native#text/plain
 tests/test/packages/webtbs/tw11142.pp svneol=native#text/plain
 tests/test/packages/webtbs/tw11570.pp svneol=native#text/plain
 tests/test/packages/webtbs/tw12830.pp svneol=native#text/plain
+tests/test/packages/webtbs/tw14265.pp svneol=native#text/plain
 tests/test/packages/webtbs/tw1808.pp svneol=native#text/plain
 tests/test/packages/webtbs/tw3820.pp svneol=native#text/plain
 tests/test/packages/win-base/tdispvar1.pp svneol=native#text/plain
@@ -9214,6 +9215,7 @@ tests/webtbs/tw14149.pp svneol=native#text/plain
 tests/webtbs/tw14155.pp svneol=native#text/plain
 tests/webtbs/tw1416.pp svneol=native#text/plain
 tests/webtbs/tw14174.pp svneol=native#text/plain
+tests/webtbs/tw14230.pp svneol=native#text/plain
 tests/webtbs/tw14236.pp svneol=native#text/plain
 tests/webtbs/tw1430.pp svneol=native#text/plain
 tests/webtbs/tw14307.pp svneol=native#text/plain
@@ -9223,6 +9225,8 @@ tests/webtbs/tw14403.pp svneol=native#text/plain
 tests/webtbs/tw1445.pp svneol=native#text/plain
 tests/webtbs/tw1450.pp svneol=native#text/plain
 tests/webtbs/tw1451.pp svneol=native#text/plain
+tests/webtbs/tw14514.pp svneol=native#text/plain
+tests/webtbs/tw14536.pp svneol=native#text/plain
 tests/webtbs/tw1470.pp svneol=native#text/plain
 tests/webtbs/tw1472.pp svneol=native#text/plain
 tests/webtbs/tw1477.pp svneol=native#text/plain
@@ -10290,6 +10294,7 @@ utils/fpmc/test.mc -text
 utils/fppkg/Makefile svneol=native#text/plain
 utils/fppkg/Makefile.fpc svneol=native#text/plain
 utils/fppkg/README.txt svneol=native#text/plain
+utils/fppkg/buildfppkg.pp svneol=native#text/plain
 utils/fppkg/examples/pkglibcurl.pp svneol=native#text/plain
 utils/fppkg/examples/pkgocurl.pp svneol=native#text/plain
 utils/fppkg/examples/pkgsynapse.pp svneol=native#text/plain

+ 7 - 3
compiler/cresstr.pas

@@ -156,6 +156,7 @@ uses
         namelab,
         valuelab : tasmlabel;
         resstrlab : tasmsymbol;
+        endsymlab : tasmsymbol;
         R : TResourceStringItem;
       begin
         { Put resourcestrings in a new objectfile. Putting it in multiple files
@@ -213,16 +214,19 @@ uses
             R:=TResourceStringItem(R.Next);
           end;
         new_section(current_asmdata.asmlists[al_resourcestrings],sec_data,make_mangledname('RESSTR',current_module.localsymtable,'3_END'),sizeof(pint));
-        current_asmdata.AsmLists[al_resourcestrings].concat(tai_symbol.createname_global(
-          make_mangledname('RESSTR',current_module.localsymtable,'END'),AT_DATA,0));
+        endsymlab:=current_asmdata.DefineAsmSymbol(make_mangledname('RESSTR',current_module.localsymtable,'END'),AB_GLOBAL,AT_DATA);
+        current_asmdata.AsmLists[al_resourcestrings].concat(tai_symbol.create_global(endsymlab,0));
         { The darwin/ppc64 assembler or linker seems to have trouble       }
         { if a section ends with a global label without any data after it. }
         { So for safety, just put a dummy value here.                      }
         { Further, the regular linker also kills this symbol when turning  }
         { on smart linking in case no value appears after it, so put the   }
         { dummy byte there always                                          }
+        { Update: the Mac OS X 10.6 linker orders data that needs to be    }
+        { relocated before all other data, so make this data relocatable,  }
+        { otherwise the end label won't be moved with the rest             }
         if (target_info.system in systems_darwin) then   
-          current_asmdata.asmlists[al_resourcestrings].concat(Tai_const.create_8bit(0));
+          current_asmdata.asmlists[al_resourcestrings].concat(Tai_const.create_sym(endsymlab));
       end;
 
 

+ 12 - 15
compiler/dbgdwarf.pas

@@ -1344,13 +1344,13 @@ implementation
 
         if not is_packed_array(def) then
           begin
-          elestrideattr := DW_AT_byte_stride;
-          elesize := def.elesize;
+            elestrideattr := DW_AT_byte_stride;
+            elesize := def.elesize;
           end
         else
           begin
-          elestrideattr := DW_AT_stride_size;
-          elesize := def.elepackedbitsize;
+            elestrideattr := DW_AT_stride_size;
+            elesize := def.elepackedbitsize;
           end;
 
         if is_special_array(def) then
@@ -1358,18 +1358,16 @@ implementation
             { no known size, no known upper bound }
             if assigned(def.typesym) then
               append_entry(DW_TAG_array_type,true,[
-                DW_AT_name,DW_FORM_string,symname(def.typesym)+#0,
-                elestrideattr,DW_FORM_udata,elesize
+                DW_AT_name,DW_FORM_string,symname(def.typesym)+#0
                 ])
             else
-              append_entry(DW_TAG_array_type,true,[
-                elestrideattr,DW_FORM_udata,elesize
-                ]);
+              append_entry(DW_TAG_array_type,true,[]);
             append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.elementdef));
             finish_entry;
             { a missing upper bound means "unknown"/default }
             append_entry(DW_TAG_subrange_type,false,[
-              DW_AT_lower_bound,DW_FORM_sdata,def.lowrange
+              DW_AT_lower_bound,DW_FORM_sdata,def.lowrange,
+              elestrideattr,DW_FORM_udata,elesize
               ]);
           end
         else
@@ -1378,20 +1376,19 @@ implementation
             if assigned(def.typesym) then
               append_entry(DW_TAG_array_type,true,[
                 DW_AT_name,DW_FORM_string,symname(def.typesym)+#0,
-                DW_AT_byte_size,DW_FORM_udata,size,
-                elestrideattr,DW_FORM_udata,elesize
+                DW_AT_byte_size,DW_FORM_udata,size
                 ])
             else
               append_entry(DW_TAG_array_type,true,[
-                DW_AT_byte_size,DW_FORM_udata,size,
-                elestrideattr,DW_FORM_udata,elesize
+                DW_AT_byte_size,DW_FORM_udata,size
                 ]);
             append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.elementdef));
             finish_entry;
             { to simplify things, we don't write a multidimensional array here }
             append_entry(DW_TAG_subrange_type,false,[
               DW_AT_lower_bound,DW_FORM_sdata,def.lowrange,
-              DW_AT_upper_bound,DW_FORM_sdata,def.highrange
+              DW_AT_upper_bound,DW_FORM_sdata,def.highrange,
+              elestrideattr,DW_FORM_udata,elesize
               ]);
           end;
         append_labelentry_ref(DW_AT_type,def_dwarf_lab(def.rangedef));

+ 2 - 1
compiler/finput.pas

@@ -29,7 +29,7 @@ interface
       cutils,cclasses;
 
     const
-       InputFileBufSize=32*1024;
+       InputFileBufSize=32*1024+1;
        linebufincrease=512;
 
     type
@@ -268,6 +268,7 @@ uses
         endoffile:=false;
         closed:=false;
         Getmem(buf,MaxBufsize);
+        buf[0]:=#0;
         bufstart:=0;
         bufsize:=0;
         open:=true;

+ 3 - 1
compiler/msg/errore.msg

@@ -2547,7 +2547,9 @@ option_unsupported_target_for_feature=11045_F_The feature "$1" is not, or not ye
 option_dwarf_smart_linking=11046_N_DWARF debug information cannot be used with smart linking on this target, switching to static linking
 % Smart linking is currently incompatble with DWARF debug information on most
 % platforms, so smart linking is disabled in such cases.
-
+option_ignored_target=11047_W_Option "$1" is ignored for the current target platform.
+% Not all options are supported or implemented for all target platforms. This message informs you that a chosen
+% option is ignored for the currently selected target platform.
 %\end{description}
 # EndOfTeX
 

+ 3 - 2
compiler/msgidx.inc

@@ -765,6 +765,7 @@ const
   option_unsupported_target=11044;
   option_unsupported_target_for_feature=11045;
   option_dwarf_smart_linking=11046;
+  option_ignored_target=11047;
   wpo_cant_find_file=12000;
   wpo_begin_processing=12001;
   wpo_end_processing=12002;
@@ -789,9 +790,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 51588;
+  MsgTxtSize = 51652;
 
   MsgIdxMax : array[1..20] of longint=(
     24,87,253,88,65,50,108,22,202,62,
-    47,20,1,1,1,1,1,1,1,1
+    48,20,1,1,1,1,1,1,1,1
   );

+ 139 - 141
compiler/msgtxt.inc

@@ -1,7 +1,7 @@
 {$ifdef Delphi}
-const msgtxt : array[0..000214] of string[240]=(
+const msgtxt : array[0..000215] of string[240]=(
 {$else Delphi}
-const msgtxt : array[0..000214,1..240] of char=(
+const msgtxt : array[0..000215,1..240] of char=(
 {$endif Delphi}
   '01000_T_Compiler: $1'#000+
   '01001_D_Compiler OS: $1'#000+
@@ -864,49 +864,50 @@ const msgtxt : array[0..000214,1..240] of char=(
   ' target platform'#000+
   '11046_','N_DWARF debug information cannot be used with smart linking on'+
   ' this target, switching to static linking'#000+
+  '11047_W_Option "$1" is ignored for the current target platform.'#000+
   '12000_F_Cannot open whole program optimization feedback file "$1"'#000+
-  '12001_D_Processing whole program optimization information in wpo feedb',
-  'ack file "$1"'#000+
+  '12001_','D_Processing whole program optimization information in wpo fee'+
+  'dback file "$1"'#000+
   '12002_D_Finished processing the whole program optimization information'+
   ' in wpo feedback file "$1"'#000+
-  '12003_E_Expected section header, but got "$2" at line $1 of wpo feedba'+
-  'ck file'#000+
-  '12004_W_No handler registered for whole program opt','imization section'+
-  ' "$2" at line $1 of wpo feedback file, ignoring'#000+
+  '12003_E_Expected section header, but got "$2" at line $1 of wpo f','eed'+
+  'back file'#000+
+  '12004_W_No handler registered for whole program optimization section "'+
+  '$2" at line $1 of wpo feedback file, ignoring'#000+
   '12005_D_Found whole program optimization section "$1" with information'+
   ' about "$2"'#000+
-  '12006_F_The selected whole program optimizations require a previously '+
-  'generated feedback file',' (use -Fw to specify)'#000+
+  '12006_F_The selected whole pr','ogram optimizations require a previousl'+
+  'y generated feedback file (use -Fw to specify)'#000+
   '12007_E_No collected information necessary to perform "$1" whole progr'+
   'am optimization found'#000+
-  '12008_F_Specify a whole program optimization feedback file to store th'+
-  'e generated info in (using -FW)'#000+
-  '12009_E_Not generating a','ny whole program optimization information, y'+
-  'et a feedback file was specified (using -FW)'#000+
+  '12008_F_Specify a whole program optimization feedback file to ','store '+
+  'the generated info in (using -FW)'#000+
+  '12009_E_Not generating any whole program optimization information, yet'+
+  ' a feedback file was specified (using -FW)'#000+
   '12010_E_Not performing any whole program optimizations, yet an input f'+
-  'eedback file was specified (using -Fw)'#000+
-  '12011_D_Skipping whole program optimizatio','n section "$1", because no'+
-  't needed by the requested optimizations'#000+
+  'eedback file was ','specified (using -Fw)'#000+
+  '12011_D_Skipping whole program optimization section "$1", because not '+
+  'needed by the requested optimizations'#000+
   '12012_W_Overriding previously read information for "$1" from feedback '+
-  'input file using information in section "$2"'#000+
-  '12013_E_Cannot extract symbol liveness information from pro','gram when'+
-  ' stripping symbols, use -Xs-'#000+
+  'input file using information in section ','"$2"'#000+
+  '12013_E_Cannot extract symbol liveness information from program when s'+
+  'tripping symbols, use -Xs-'#000+
   '12014_E_Cannot extract symbol liveness information from program when w'+
   'hen not linking'#000+
-  '12015_F_Cannot find "$1" or "$2" to extract symbol liveness informatio'+
-  'n from linked program'#000+
-  '12016_E_Error during rea','ding symbol liveness information produced by'+
-  ' "$1"'#000+
+  '12015_F_Cannot find "$1" or "$2" to extract symbol l','iveness informat'+
+  'ion from linked program'#000+
+  '12016_E_Error during reading symbol liveness information produced by "'+
+  '$1"'#000+
   '12017_F_Error executing "$1" (exitcode: $2) to extract symbol informat'+
   'ion from linked program'#000+
-  '12018_E_Collection of symbol liveness information can only help when u'+
-  'sing smart linking, use -C','X -XX'#000+
+  '12018_E_Collection of symbol liv','eness information can only help when'+
+  ' using smart linking, use -CX -XX'#000+
   '12019_E_Cannot create specified whole program optimisation feedback fi'+
   'le "$1"'#000+
   '11023_Free Pascal Compiler version $FPCFULLVERSION [$FPCDATE] for $FPC'+
   'CPU'#010+
-  'Copyright (c) 1993-2009 by Florian Klaempfl'#000+
-  '11024_Free Pascal Compiler version $FP','CVERSION'#010+
+  'Copyright (c) 1993','-2009 by Florian Klaempfl'#000+
+  '11024_Free Pascal Compiler version $FPCVERSION'#010+
   #010+
   'Compiler Date      : $FPCDATE'#010+
   'Compiler CPU Target: $FPCCPU'#010+
@@ -917,11 +918,11 @@ const msgtxt : array[0..000214,1..240] of char=(
   'Supported CPU instruction sets:'#010+
   '  $INSTRUCTIONSETS'#010+
   #010+
-  'Supported FPU instruction sets:'#010+
+  'Supported FPU instruc','tion sets:'#010+
   '  $FPUINSTRUCTIONSETS'#010+
   #010+
   'Supported ABI targets:'#010+
-  '  $ABIT','ARGETS'#010+
+  '  $ABITARGETS'#010+
   #010+
   'Supported Optimizations:'#010+
   '  $OPTIMIZATIONS'#010+
@@ -933,293 +934,290 @@ const msgtxt : array[0..000214,1..240] of char=(
   'Supported Microcontroller types:'#010+
   '  $CONTROLLERTYPES'#010+
   #010+
-  'This program comes under the GNU General Public Licence'#010+
-  'For more inform','ation read COPYING.FPC'#010+
+  'This pr','ogram comes under the GNU General Public Licence'#010+
+  'For more information read COPYING.FPC'#010+
   #010+
   'Report bugs, suggestions, etc. to:'#010+
   '                 http://bugs.freepascal.org'#010+
   'or'#010+
   '                 [email protected]'#000+
-  '11025_**0*_Put + after a boolean switch option to enable it, - to disa'+
-  'ble it'#010+
-  '**1a_The compiler do','esn'#039't delete the generated assembler file'#010+
+  '11025_**0*_Put + after a boolean ','switch option to enable it, - to di'+
+  'sable it'#010+
+  '**1a_The compiler doesn'#039't delete the generated assembler file'#010+
   '**2al_List sourcecode lines in assembler file'#010+
   '**2an_List node info in assembler file'#010+
-  '*L2ap_Use pipes instead of creating temporary assembler files'#010+
-  '**2ar_List register allocation/release info in asse','mbler file'#010+
+  '*L2ap_Use pipes instead of creating temporary ass','embler files'#010+
+  '**2ar_List register allocation/release info in assembler file'#010+
   '**2at_List temp allocation/release info in assembler file'#010+
   '**1A<x>_Output format:'#010+
   '**2Adefault_Use default assembler'#010+
   '3*2Aas_Assemble using GNU AS'#010+
-  '3*2Anasmcoff_COFF (Go32v2) file using Nasm'#010+
-  '3*2Anasmelf_ELF32 (Linux) file using Nasm'#010,
+  '3*2Anasmcoff_COFF (Go','32v2) file using Nasm'#010+
+  '3*2Anasmelf_ELF32 (Linux) file using Nasm'#010+
   '3*2Anasmwin32_Win32 object file using Nasm'#010+
   '3*2Anasmwdosx_Win32/WDOSX object file using Nasm'#010+
   '3*2Awasm_Obj file using Wasm (Watcom)'#010+
   '3*2Anasmobj_Obj file using Nasm'#010+
-  '3*2Amasm_Obj file using Masm (Microsoft)'#010+
-  '3*2Atasm_Obj file using Tasm (Borland',')'#010+
+  '3*2Amasm_Obj f','ile using Masm (Microsoft)'#010+
+  '3*2Atasm_Obj file using Tasm (Borland)'#010+
   '3*2Aelf_ELF (Linux) using internal writer'#010+
   '3*2Acoff_COFF (Go32v2) using internal writer'#010+
   '3*2Apecoff_PE-COFF (Win32) using internal writer'#010+
   '4*2Aas_Assemble using GNU AS'#010+
-  '6*2Aas_Unix o-file using GNU AS'#010+
+  '6*2Aas_Un','ix o-file using GNU AS'#010+
   '6*2Agas_GNU Motorola assembler'#010+
-  '6*2Amit_MI','T Syntax (old GAS)'#010+
+  '6*2Amit_MIT Syntax (old GAS)'#010+
   '6*2Amot_Standard Motorola assembler'#010+
   'A*2Aas_Assemble using GNU AS'#010+
   'P*2Aas_Assemble using GNU AS'#010+
   'S*2Aas_Assemble using GNU AS'#010+
   '**1b_Generate browser info'#010+
-  '**2bl_Generate local symbol info'#010+
+  '**2bl_G','enerate local symbol info'#010+
   '**1B_Build all modules'#010+
-  '**1C<x>_Code ge','neration options:'#010+
+  '**1C<x>_Code generation options:'#010+
   '**2Ca<x>_Select ABI, see fpc -i for possible values'#010+
   '**2Cb_Generate big-endian code'#010+
   '**2Cc<x>_Set default calling convention to <x>'#010+
-  '**2CD_Create also dynamic library (not supported)'#010+
-  '**2Ce_Compilation with emulated floating p','oint opcodes'#010+
+  '**2CD_Create also dynamic li','brary (not supported)'#010+
+  '**2Ce_Compilation with emulated floating point opcodes'#010+
   '**2Cf<x>_Select fpu instruction set to use, see fpc -i for possible va'+
   'lues'#010+
   '**2CF<x>_Minimal floating point constant precision (default, 32, 64)'#010+
-  '**2Cg_Generate PIC code'#010+
+  '**2Cg_Generate PIC ','code'#010+
   '**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#010+
-  '**2Ci_I','O-checking'#010+
+  '**2Ci_IO-checking'#010+
   '**2Cn_Omit linking stage'#010+
   '**2Co_Check overflow of integer operations'#010+
   '**2CO_Check for possible overflow of integer operations'#010+
-  '**2Cp<x>_Select instruction set, see fpc -i for possible values'#010+
+  '**2Cp<x>_Select instruction set, see fpc ','-i for possible values'#010+
   '**2CP<x>=<y>_ packing settings'#010+
-  '**3CPPACKS','ET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, '+
-  '4 and 8'#010+
+  '**3CPPACKSET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 '+
+  'and 8'#010+
   '**2Cr_Range checking'#010+
   '**2CR_Verify object method call validity'#010+
   '**2Cs<n>_Set stack checking size to <n>'#010+
-  '**2Ct_Stack checking (for testing only, see manual)'#010+
-  '**2CX_Create also sm','artlinked library'#010+
+  '**2Ct_St','ack checking (for testing only, see manual)'#010+
+  '**2CX_Create also smartlinked library'#010+
   '**1d<x>_Defines the symbol <x>'#010+
   '**1D_Generate a DEF file'#010+
   '**2Dd<x>_Set description to <x>'#010+
   '**2Dv<x>_Set DLL version to <x>'#010+
   '*O2Dw_PM application'#010+
-  '**1e<x>_Set path to executable'#010+
+  '**1e<x>_Set path ','to executable'#010+
   '**1E_Same as -Cn'#010+
   '**1fPIC_Same as -Cg'#010+
-  '**1F<x>_Set f','ile names and paths:'#010+
+  '**1F<x>_Set file names and paths:'#010+
   '**2Fa<x>[,y]_(for a program) load units <x> and [y] before uses is par'+
   'sed'#010+
   '**2Fc<x>_Set input codepage to <x>'#010+
   '**2FC<x>_Set RC compiler binary name to <x>'#010+
-  '**2Fd_Disable the compiler'#039's internal directory cache'#010+
-  '**2FD<x>_Set',' the directory where to search for compiler utilities'#010+
+  '**','2Fd_Disable the compiler'#039's internal directory cache'#010+
+  '**2FD<x>_Set the directory where to search for compiler utilities'#010+
   '**2Fe<x>_Redirect error output to <x>'#010+
   '**2Ff<x>_Add <x> to framework path (Darwin only)'#010+
-  '**2FE<x>_Set exe/unit output path to <x>'#010+
+  '**2FE<x>_Set exe/unit output path t','o <x>'#010+
   '**2Fi<x>_Add <x> to include path'#010+
-  '**2Fl<x>_Add <x> to libra','ry path'#010+
+  '**2Fl<x>_Add <x> to library path'#010+
   '**2FL<x>_Use <x> as dynamic linker'#010+
   '**2Fm<x>_Load unicode conversion table from <x>.txt in the compiler di'+
   'r'#010+
   '**2Fo<x>_Add <x> to object path'#010+
-  '**2Fr<x>_Load error message file <x>'#010+
+  '**2Fr<x>_Load error message f','ile <x>'#010+
   '**2FR<x>_Set resource (.res) linker to <x>'#010+
-  '**2Fu<x>_Add ','<x> to unit path'#010+
+  '**2Fu<x>_Add <x> to unit path'#010+
   '**2FU<x>_Set unit output path to <x>, overrides -FE'#010+
   '**2FW<x>_Store generated whole-program optimization feedback in <x>'#010+
-  '**2Fw<x>_Load previously stored whole-program optimization feedback fr'+
-  'om <x>'#010+
-  '*g1g_Generate debug inform','ation (default format for target)'#010+
+  '**2Fw<x>_Load previously stored whole-p','rogram optimization feedback '+
+  'from <x>'#010+
+  '*g1g_Generate debug information (default format for target)'#010+
   '*g2gc_Generate checks for pointers'#010+
   '*g2gh_Use heaptrace unit (for memory leak/corruption debugging)'#010+
-  '*g2gl_Use line info unit (show more info with backtraces)'#010+
+  '*g2gl_Use line info unit (show more info wi','th backtraces)'#010+
   '*g2go<x>_Set debug information options'#010+
-  '*g3godwarf','sets_ Enable DWARF set debug information (breaks gdb < 6.5'+
-  ')'#010+
+  '*g3godwarfsets_ Enable DWARF set debug information (breaks gdb < 6.5)'#010+
   '*g3gostabsabsincludes_ Store absolute/full include file paths in Stabs'+
   #010+
   '*g2gp_Preserve case in stabs symbol names'#010+
-  '*g2gs_Generate Stabs debug information'#010+
-  '*g2gt_Trash local variables ','(to detect uninitialized uses)'#010+
+  '*g2','gs_Generate Stabs debug information'#010+
+  '*g2gt_Trash local variables (to detect uninitialized uses)'#010+
   '*g2gv_Generates programs traceable with Valgrind'#010+
   '*g2gw_Generate DWARFv2 debug information (same as -gw2)'#010+
-  '*g2gw2_Generate DWARFv2 debug information'#010+
+  '*g2gw2_Generate DWARFv2 debug informatio','n'#010+
   '*g2gw3_Generate DWARFv3 debug information'#010+
   '**1i_Information'#010+
-  '**2','iD_Return compiler date'#010+
+  '**2iD_Return compiler date'#010+
   '**2iV_Return short compiler version'#010+
   '**2iW_Return full compiler version'#010+
   '**2iSO_Return compiler OS'#010+
   '**2iSP_Return compiler host processor'#010+
-  '**2iTO_Return target OS'#010+
+  '**2iTO_Return tar','get OS'#010+
   '**2iTP_Return target processor'#010+
-  '**1I<x>_Add <x> to include',' path'#010+
+  '**1I<x>_Add <x> to include path'#010+
   '**1k<x>_Pass <x> to the linker'#010+
   '**1l_Write logo'#010+
   '**1M<x>_Set language mode to <x>'#010+
   '**2Mfpc_Free Pascal dialect (default)'#010+
   '**2Mobjfpc_FPC mode with Object Pascal support'#010+
-  '**2Mdelphi_Delphi 7 compatibility mode'#010+
-  '**2Mtp_TP/BP 7.0 compatibility',' mode'#010+
+  '**2Md','elphi_Delphi 7 compatibility mode'#010+
+  '**2Mtp_TP/BP 7.0 compatibility mode'#010+
   '**2Mmacpas_Macintosh Pascal dialects compatibility mode'#010+
   '**1n_Do not read the default config files'#010+
   '**1N<x>_Node tree optimizations'#010+
   '**2Nu_Unroll loops'#010+
-  '**1o<x>_Change the name of the executable produced to <x>'#010+
+  '**1o<x>_Change the na','me of the executable produced to <x>'#010+
   '**1O<x>_Optimizations:'#010+
-  '**2O','-_Disable optimizations'#010+
+  '**2O-_Disable optimizations'#010+
   '**2O1_Level 1 optimizations (quick and debugger friendly)'#010+
   '**2O2_Level 2 optimizations (-O1 + quick optimizations)'#010+
-  '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+
+  '**2O3_Level 3 optimizations (-O2 + slo','w optimizations)'#010+
   '**2Oa<x>=<y>_Set alignment'#010+
-  '**2Oo[NO]<x>_Enable ','or disable optimizations, see fpc -i for possibl'+
-  'e values'#010+
+  '**2Oo[NO]<x>_Enable or disable optimizations, see fpc -i for possible '+
+  'values'#010+
   '**2Op<x>_Set target cpu for optimizing, see fpc -i for possible values'+
   #010+
-  '**2OW<x>_Generate whole-program optimization feedback for optimization'+
-  ' <x>, see fpc -i for possible values'#010+
-  '**2Ow','<x>_Perform whole-program optimization <x>, see fpc -i for poss'+
-  'ible values'#010+
+  '**2OW<x>_Generate whole-program optimization fee','dback for optimizati'+
+  'on <x>, see fpc -i for possible values'#010+
+  '**2Ow<x>_Perform whole-program optimization <x>, see fpc -i for possib'+
+  'le values'#010+
   '**2Os_Optimize for size rather than speed'#010+
-  '**1pg_Generate profile code for gprof (defines FPC_PROFILE)'#010+
+  '**1pg_Generate profile code for gprof (defines FPC_PROFILE)',#010+
   '**1R<x>_Assembler reading style:'#010+
-  '**2Rdefault_Use default assemb','ler for target'#010+
+  '**2Rdefault_Use default assembler for target'#010+
   '3*2Ratt_Read AT&T style assembler'#010+
   '3*2Rintel_Read Intel style assembler'#010+
   '6*2RMOT_Read motorola style assembler'#010+
   '**1S<x>_Syntax options:'#010+
   '**2S2_Same as -Mobjfpc'#010+
-  '**2Sc_Support operators like C (*=,+=,/= and -=)'#010+
-  '**2Sa_Turn on assert','ions'#010+
+  '**2Sc','_Support operators like C (*=,+=,/= and -=)'#010+
+  '**2Sa_Turn on assertions'#010+
   '**2Sd_Same as -Mdelphi'#010+
   '**2Se<x>_Error options. <x> is a combination of the following:'#010+
   '**3*_<n> : Compiler halts after the <n> errors (default is 1)'#010+
-  '**3*_w : Compiler also halts after warnings'#010+
+  '**3*_w : Compiler also ','halts after warnings'#010+
   '**3*_n : Compiler also halts after notes'#010+
-  '**','3*_h : Compiler also halts after hints'#010+
+  '**3*_h : Compiler also halts after hints'#010+
   '**2Sg_Enable LABEL and GOTO (default in -Mtp and -Mdelphi)'#010+
   '**2Sh_Use ansistrings by default instead of shortstrings'#010+
-  '**2Si_Turn on inlining of procedures/functions declared as "inline"'#010+
-  '**2Sk_Load fpcyli','x unit'#010+
+  '**2Si_Turn on inlinin','g of procedures/functions declared as "inline"'#010+
+  '**2Sk_Load fpcylix unit'#010+
   '**2SI<x>_Set interface style to <x>'#010+
   '**3SIcom_COM compatible interface (default)'#010+
   '**3SIcorba_CORBA compatible interface'#010+
   '**2Sm_Support macros like C (global)'#010+
-  '**2So_Same as -Mtp'#010+
-  '**2Ss_Constructor name must be init (destructor must be don','e)'#010+
+  '**2So_Same as ','-Mtp'#010+
+  '**2Ss_Constructor name must be init (destructor must be done)'#010+
   '**2St_Allow static keyword in objects'#010+
   '**2Sx_Enable exception keywords (default in Delphi/ObjFPC modes)'#010+
   '**1s_Do not call assembler and linker'#010+
-  '**2sh_Generate script to link on host'#010+
+  '**2sh_Generate script to link on',' host'#010+
   '**2st_Generate script to link on target'#010+
-  '**2sr_Skip registe','r allocation phase (use with -alr)'#010+
+  '**2sr_Skip register allocation phase (use with -alr)'#010+
   '**1T<x>_Target operating system:'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
   '3*2Tfreebsd_FreeBSD'#010+
-  '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
+  '3*2Tgo32v2_Version 2 of DJ Delorie DOS',' extender'#010+
   '3*2Tlinux_Linux'#010+
   '3*2Tnetbsd_NetBSD'#010+
-  '3*2Tnetware_Novell N','etware Module (clib)'#010+
+  '3*2Tnetware_Novell Netware Module (clib)'#010+
   '3*2Tnetwlibc_Novell Netware Module (libc)'#010+
   '3*2Topenbsd_OpenBSD'#010+
   '3*2Tos2_OS/2 / eComStation'#010+
   '3*2Tsunos_SunOS/Solaris'#010+
   '3*2Tsymbian_Symbian OS'#010+
-  '3*2Twatcom_Watcom compatible DOS extender'#010+
+  '3*2Twatcom_Watcom c','ompatible DOS extender'#010+
   '3*2Twdosx_WDOSX DOS extender'#010+
-  '3*2Twin32_Wi','ndows 32 Bit'#010+
+  '3*2Twin32_Windows 32 Bit'#010+
   '3*2Twince_Windows CE'#010+
   '4*2Tlinux_Linux'#010+
   '6*2Tamiga_Commodore Amiga'#010+
   '6*2Tatari_Atari ST/STe/TT'#010+
   '6*2Tlinux_Linux/m68k'#010+
   '6*2Tmacos_Macintosh m68k (not supported)'#010+
-  '6*2Tpalmos_PalmOS'#010+
+  '6*2Tpalmos_P','almOS'#010+
   'A*2Tlinux_Linux'#010+
   'A*2Twince_Windows CE'#010+
-  'P*2Tamiga_AmigaOS on ','PowerPC'#010+
+  'P*2Tamiga_AmigaOS on PowerPC'#010+
   'P*2Tdarwin_Darwin and Mac OS X on PowerPC'#010+
   'P*2Tlinux_Linux on PowerPC'#010+
   'P*2Tmacos_Mac OS (classic) on PowerPC'#010+
   'P*2Tmorphos_MorphOS'#010+
   'S*2Tlinux_Linux'#010+
-  '**1u<x>_Undefines the symbol <x>'#010+
+  '**1u<x>_Undefines the sym','bol <x>'#010+
   '**1U_Unit options:'#010+
-  '**2Un_Do not check where the unit nam','e matches the file name'#010+
+  '**2Un_Do not check where the unit name matches the file name'#010+
   '**2Ur_Generate release unit files (never automatically recompiled)'#010+
   '**2Us_Compile a system unit'#010+
-  '**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+
-  '**2*_e : Show errors (default)       0 : Show nothing ','(except errors'+
-  ')'#010+
+  '**1v<x>_Be verbose. <x> is a combination of the following',' letters:'#010+
+  '**2*_e : Show errors (default)       0 : Show nothing (except errors)'#010+
   '**2*_w : Show warnings               u : Show unit info'#010+
   '**2*_n : Show notes                  t : Show tried/used files'#010+
-  '**2*_h : Show hints                  c : Show conditionals'#010+
-  '**2*_i : Show general info           d : Show ','debug info'#010+
+  '**2*_h : Show hints                  c : ','Show conditionals'#010+
+  '**2*_i : Show general info           d : Show debug info'#010+
   '**2*_l : Show linenumbers            r : Rhide/GCC compatibility mode'#010+
   '**2*_s : Show time stamps            q : Show message numbers'#010+
-  '**2*_a : Show everything             x : Executable info (Win32 only)'#010+
-  '**2*_b : Write file names m','essages   p : Write tree.log with parse t'+
-  'ree'#010+
+  '**2*_a : Show everything         ','    x : Executable info (Win32 only'+
+  ')'#010+
+  '**2*_b : Write file names messages   p : Write tree.log with parse tre'+
+  'e'#010+
   '**2*_    with full path              v : Write fpcdebug.txt with'#010+
   '**2*_                                    lots of debugging info'#010+
-  '**2*_m<x>,<y> : Don'#039't show messages numbered <x> and <y>'#010+
-  '3*1W<x>_T','arget-specific options (targets)'#010+
+  '**','2*_m<x>,<y> : Don'#039't show messages numbered <x> and <y>'#010+
+  '3*1W<x>_Target-specific options (targets)'#010+
   'A*1W<x>_Target-specific options (targets)'#010+
   'P*1W<x>_Target-specific options (targets)'#010+
   'p*1W<x>_Target-specific options (targets)'#010+
-  '3*2Wb_Create a bundle instead of a library (Darwin)'#010+
-  'P*2Wb_Create a bundle instead',' of a library (Darwin)'#010+
+  '3*2Wb_Create a bu','ndle instead of a library (Darwin)'#010+
+  'P*2Wb_Create a bundle instead of a library (Darwin)'#010+
   'p*2Wb_Create a bundle instead of a library (Darwin)'#010+
   '3*2WB_Create a relocatable image (Windows)'#010+
   'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
-  '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
-  'A*2WC_Spec','ify console type application (Windows)'#010+
+  '3*2WC_','Specify console type application (EMX, OS/2, Windows)'#010+
+  'A*2WC_Specify console type application (Windows)'#010+
   'P*2WC_Specify console type application (Classic Mac OS)'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
-  'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
-  '3*2We_Use external re','sources (Darwin)'#010+
+  'A*2WD_Use DEFFILE t','o export functions of DLL or EXE (Windows)'#010+
+  '3*2We_Use external resources (Darwin)'#010+
   'P*2We_Use external resources (Darwin)'#010+
   'p*2We_Use external resources (Darwin)'#010+
   '3*2WF_Specify full-screen type application (EMX, OS/2)'#010+
-  '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
-  'A*2WG_Specify graphic type appli','cation (Windows)'#010+
+  '3*2WG_Specify graphic type a','pplication (EMX, OS/2, Windows)'#010+
+  'A*2WG_Specify graphic type application (Windows)'#010+
   'P*2WG_Specify graphic type application (Classic Mac OS)'#010+
   '3*2Wi_Use internal resources (Darwin)'#010+
   'P*2Wi_Use internal resources (Darwin)'#010+
-  'p*2Wi_Use internal resources (Darwin)'#010+
-  '3*2WN_Do not generate relocation code, needed for deb','ugging (Windows'+
-  ')'#010+
+  'p*2Wi_Use internal resource','s (Darwin)'#010+
+  '3*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   '3*2WR_Generate relocation code (Windows)'#010+
   'A*2WR_Generate relocation code (Windows)'#010+
-  'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
-  '3*2WX_Enable e','xecutable stack (Linux)'#010+
+  'P*2WT_S','pecify MPW tool type application (Classic Mac OS)'#010+
+  '3*2WX_Enable executable stack (Linux)'#010+
   'A*2WX_Enable executable stack (Linux)'#010+
   'p*2WX_Enable executable stack (Linux)'#010+
   'P*2WX_Enable executable stack (Linux)'#010+
   '**1X_Executable options:'#010+
-  '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
-  'ux)'#010+
-  '**2','Xd_Do not use standard library search path (needed for cross comp'+
-  'ile)'#010+
+  '**2Xc_Pass --','shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, L'+
+  'inux)'#010+
+  '**2Xd_Do not use standard library search path (needed for cross compil'+
+  'e)'#010+
   '**2Xe_Use external linker'#010+
   '**2Xg_Create debuginfo in a separate file and add a debuglink section '+
-  'to executable'#010+
-  '**2XD_Try to link units dynamically      (defines FPC_LINK_D','YNAMIC)'#010+
+  'to executa','ble'#010+
+  '**2XD_Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
   '**2Xi_Use internal linker'#010+
   '**2Xm_Generate link map'#010+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   's '#039'main'#039')'#010+
-  '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
-  '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed fo','r cross co'+
-  'mpile, see the ld manual for more information) (BeOS, Linux)'#010+
+  '**2XP<x>_Prepend the binutils names with the p','refix <x>'#010+
+  '**2Xr<x>_Set the linker'#039's rlink-path to <x> (needed for cross comp'+
+  'ile, see the ld manual for more information) (BeOS, Linux)'#010+
   '**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD'+
   ', Linux, Mac OS, Solaris)'#010+
-  '**2Xs_Strip all symbols from executable'#010+
-  '**2XS_Try to link units staticall','y (default, defines FPC_LINK_STATIC'+
-  ')'#010+
+  '**2Xs_Str','ip all symbols from executable'#010+
+  '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
   '**2Xt_Link with static libraries (-static is passed to linker)'#010+
   '**2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
-  '**1?_Show this help'#010+
+  '**1?','_Show this help'#010+
   '**1h_Shows this help without waiting'
 );

+ 1 - 2
compiler/ncal.pas

@@ -750,8 +750,7 @@ implementation
                     not(is_open_string(parasym.vardef)) and
                     not(equal_defs(left.resultdef,parasym.vardef)) then
                    begin
-                     current_filepos:=left.fileinfo;
-                     CGMessage(type_e_strict_var_string_violation);
+                     CGMessagePos(left.fileinfo,type_e_strict_var_string_violation);
                    end;
 
                  { Handle formal parameters separate }

+ 5 - 0
compiler/ncnv.pas

@@ -249,6 +249,7 @@ implementation
         else
          begin
            p:=ctypeconvnode.create(p,def);
+           p.fileinfo:=ttypeconvnode(p).left.fileinfo;
            typecheckpass(p);
          end;
       end;
@@ -270,6 +271,7 @@ implementation
         else
          begin
            p:=ctypeconvnode.create_internal(p,def);
+           p.fileinfo:=ttypeconvnode(p).left.fileinfo;
            typecheckpass(p);
          end;
       end;
@@ -363,6 +365,7 @@ implementation
         l : Longint;
         lr,hr : TConstExprInt;
         hp : tarrayconstructornode;
+        oldfilepos: tfileposinfo;
       begin
         if p.nodetype<>arrayconstructorn then
           internalerror(200205105);
@@ -407,6 +410,7 @@ implementation
                 end;
               if codegenerror then
                break;
+              oldfilepos:=current_filepos;
               current_filepos:=p2.fileinfo;
               case p2.resultdef.typ of
                  enumdef,
@@ -535,6 +539,7 @@ implementation
               hp:=tarrayconstructornode(tarrayconstructornode(p2).right);
               tarrayconstructornode(p2).right:=nil;
               p2.free;
+              current_filepos:=oldfilepos;
             end;
            if (hdef=nil) then
             hdef:=u8inttype;

+ 2 - 2
compiler/nmem.pas

@@ -384,8 +384,7 @@ implementation
                (left.nodetype in [stringconstn])
               ) then
          begin
-           current_filepos:=left.fileinfo;
-           CGMessage(type_e_no_addr_of_constant);
+           CGMessagePos(left.fileinfo,type_e_no_addr_of_constant);
            exit;
          end;
 
@@ -403,6 +402,7 @@ implementation
             if not isprocvar then
               begin
                 left:=ctypeconvnode.create_proc_to_procvar(left);
+                left.fileinfo:=fileinfo;
                 typecheckpass(left);
               end;
 

+ 19 - 3
compiler/options.pas

@@ -51,6 +51,7 @@ Type
     procedure WriteQuickInfo;
     procedure IllegalPara(const opt:string);
     procedure UnsupportedPara(const opt:string);
+    procedure IgnoredPara(const opt:string);
     function  Unsetbool(var Opts:TCmdStr; Pos: Longint):boolean;
     procedure interpret_option(const opt :string;ispara:boolean);
     procedure Interpret_envvar(const envname : string);
@@ -120,6 +121,10 @@ const
                         + [system_i386_freebsd]
                         + [system_i386_netbsd]
                         + [system_i386_wdosx];
+                        
+  suppported_targets_x_smallr = system_linux
+                             + [system_i386_haiku]
+                             + [system_i386_beos];
 
 {****************************************************************************
                                  Defines
@@ -447,6 +452,12 @@ begin
 end;
 
 
+procedure toption.IgnoredPara(const opt: string);
+begin
+  Message1(option_ignored_target,opt);
+end;
+
+
 procedure toption.ForceStaticLinking;
 begin
   def_system_macro('FPC_LINK_STATIC');
@@ -1617,9 +1628,14 @@ begin
                     'p' : ; { Ignore used by fpc.pp }
                     'r' :
                       begin
-                        rlinkpath:=Copy(more,2,length(More)-1);
-                        DefaultReplacements(rlinkpath);
-                        More:='';
+                        if (target_info.system in suppported_targets_x_smallr) then
+                          begin
+                            rlinkpath:=Copy(more,2,length(More)-1);
+                            DefaultReplacements(rlinkpath);
+                          end
+                        else
+                          IgnoredPara('-Xr');
+                        more:='';
                       end;
                     'R' :
                       begin

+ 23 - 4
compiler/pass_1.pas

@@ -30,6 +30,7 @@ interface
 
     procedure typecheckpass(var p : tnode);
     function  do_typecheckpass(var p : tnode) : boolean;
+    function  do_typecheckpass_changed(var p : tnode; out nodechanged: boolean) : boolean;
 
     procedure firstpass(var p : tnode);
     function  do_firstpass(var p : tnode) : boolean;
@@ -57,7 +58,7 @@ implementation
                             Global procedures
 *****************************************************************************}
 
-    procedure typecheckpass(var p : tnode);
+    procedure typecheckpass_internal(var p : tnode; out node_changed: boolean);
       var
          oldcodegenerror  : boolean;
          oldlocalswitches : tlocalswitches;
@@ -65,6 +66,7 @@ implementation
          oldpos    : tfileposinfo;
          hp        : tnode;
       begin
+        node_changed:=false;
         if (p.resultdef=nil) then
          begin
            oldcodegenerror:=codegenerror;
@@ -79,6 +81,7 @@ implementation
            { should the node be replaced? }
            if assigned(hp) then
             begin
+               node_changed:=true;
                p.free;
                { run typecheckpass }
                typecheckpass(hp);
@@ -106,11 +109,27 @@ implementation
       end;
 
 
-    function do_typecheckpass(var p : tnode) : boolean;
+    procedure typecheckpass(var p : tnode);
+      var
+        node_changed: boolean;
+      begin
+        typecheckpass_internal(p,node_changed);
+      end;
+
+
+    function do_typecheckpass_changed(var p : tnode; out nodechanged: boolean) : boolean;
       begin
          codegenerror:=false;
-         typecheckpass(p);
-         do_typecheckpass:=codegenerror;
+         typecheckpass_internal(p,nodechanged);
+         do_typecheckpass_changed:=codegenerror;
+      end;
+
+
+    function do_typecheckpass(var p : tnode) : boolean;
+      var
+        nodechanged: boolean;
+      begin
+         result:=do_typecheckpass_changed(p,nodechanged);
       end;
 
 

+ 4 - 2
compiler/pdecsub.pas

@@ -103,14 +103,16 @@ implementation
 
 {$if defined(i386)}
            { For left to right add it at the end to be delphi compatible }
-           if pd.proccalloption in (pushleftright_pocalls+[pocall_safecall])  then
+           if (target_info.system in system_all_windows) and
+              (pd.proccalloption in (pushleftright_pocalls+[pocall_safecall])) then
              paranr:=paranr_result_leftright
            else
 {$elseif defined(x86) or defined(arm)}
            { other platforms don't have a "safecall" convention,
              and never reverse the parameter pushing order
            }
-           if (pd.proccalloption = pocall_safecall)  then
+           if (target_info.system in system_all_windows) and
+              (pd.proccalloption = pocall_safecall)  then
              paranr:=paranr_result_leftright
            else
 {$endif}

+ 392 - 370
compiler/pexpr.pas

@@ -1283,7 +1283,7 @@ implementation
                          Factor_read_id
          ---------------------------------------------}
 
-       procedure factor_read_id(var p1:tnode;var again:boolean);
+       procedure factor_read_id(out p1:tnode;var again:boolean);
          var
            pc    : pchar;
            srsym : tsym;
@@ -1702,7 +1702,8 @@ implementation
                         PostFixOperators
          ---------------------------------------------}
 
-      procedure postfixoperators(var p1:tnode;var again:boolean);
+      { returns whether or not p1 has been changed }
+      function postfixoperators(var p1:tnode;var again:boolean): boolean;
 
         { tries to avoid syntax errors after invalid qualifiers }
         procedure recoverconsume_postfixops;
@@ -1819,14 +1820,17 @@ implementation
           { shouldn't be used that often, so the extra overhead is ok to save
             stack space }
           dispatchstring : ansistring;
+          nodechanged    : boolean;
         label
           skipreckklammercheck;
         begin
+          result:=false;
           again:=true;
           while again do
            begin
              { we need the resultdef }
-             do_typecheckpass(p1);
+             do_typecheckpass_changed(p1,nodechanged);
+             result:=result or nodechanged;
 
              if codegenerror then
               begin
@@ -1887,6 +1891,7 @@ implementation
                       begin
                         consume(_LECKKLAMMER);
                         repeat
+                          { in all of the cases below, p1 is changed }
                           case p1.resultdef.typ of
                             pointerdef:
                               begin
@@ -2152,6 +2157,11 @@ implementation
                      again:=false;
                   end;
              end;
+
+             { we only try again if p1 was changed }
+             if again or
+                (p1.nodetype=errorn) then
+               result:=true;
            end; { while again }
         end;
 
@@ -2164,21 +2174,24 @@ implementation
          l          : longint;
          ic         : int64;
          qc         : qword;
-         oldp1,
          p1         : tnode;
          code       : integer;
-         again      : boolean;
          srsym      : tsym;
          srsymtable : TSymtable;
          pd         : tprocdef;
-         hclassdef     : tobjectdef;
+         hclassdef  : tobjectdef;
          d          : bestreal;
          cur        : currency;
          hs,hsorg   : string;
          hdef       : tdef;
          filepos    : tfileposinfo;
+         again,
+         updatefpos,
+         nodechanged  : boolean;
       begin
-        oldp1:=nil;
+        { can't keep a copy of p1 and compare pointers afterwards, because
+          p1 may be freed and reallocated in the same place!  }
+        updatefpos:=false;
         p1:=nil;
         filepos:=current_tokenpos;
         again:=false;
@@ -2197,398 +2210,401 @@ implementation
            else
              factor_read_id(p1,again);
 
-           if again then
+           if assigned(p1) then
             begin
-              if (p1<>oldp1) then
-               begin
-                 if assigned(p1) then
-                   p1.fileinfo:=filepos;
-                 oldp1:=p1;
-                 filepos:=current_tokenpos;
-               end;
-              { handle post fix operators }
-              postfixoperators(p1,again);
+              { factor_read_id will set the filepos to after the id,
+                and in case of _SELF the filepos will already be the
+                same as filepos (so setting it again doesn't hurt).  }
+              p1.fileinfo:=filepos;
+              filepos:=current_tokenpos;
             end;
+           { handle post fix operators }
+           updatefpos:=postfixoperators(p1,again);
          end
         else
-         case token of
-           _RETURN :
-              begin
-                consume(_RETURN);
-                if not(token in [_SEMICOLON,_ELSE,_END]) then
-                  p1 := cexitnode.create(comp_expr(true))
-                else
-                  p1 := cexitnode.create(nil);
-              end;
-           _INHERITED :
-             begin
-               again:=true;
-               consume(_INHERITED);
-               if assigned(current_procinfo) and
-                  assigned(current_objectdef) then
+         begin
+           updatefpos:=true;
+           case token of
+             _RETURN :
                 begin
-                  hclassdef:=current_objectdef.childof;
-                  { if inherited; only then we need the method with
-                    the same name }
-                  if token in endtokens then
-                   begin
-                     hs:=current_procinfo.procdef.procsym.name;
-                     hsorg:=current_procinfo.procdef.procsym.realname;
-                     anon_inherited:=true;
-                     { For message methods we need to search using the message
-                       number or string }
-                     pd:=tprocdef(tprocsym(current_procinfo.procdef.procsym).ProcdefList[0]);
-                     srdef:=nil;
-                     if (po_msgint in pd.procoptions) then
-                       searchsym_in_class_by_msgint(hclassdef,pd.messageinf.i,srdef,srsym,srsymtable)
-                     else
-                      if (po_msgstr in pd.procoptions) then
-                        searchsym_in_class_by_msgstr(hclassdef,pd.messageinf.str^,srsym,srsymtable)
-                     else
-                       searchsym_in_class(hclassdef,current_objectdef,hs,srsym,srsymtable);
-                   end
+                  consume(_RETURN);
+                  if not(token in [_SEMICOLON,_ELSE,_END]) then
+                    p1 := cexitnode.create(comp_expr(true))
                   else
-                   begin
-                     hs:=pattern;
-                     hsorg:=orgpattern;
-                     consume(_ID);
-                     anon_inherited:=false;
-                     searchsym_in_class(hclassdef,current_objectdef,hs,srsym,srsymtable);
-                   end;
-                  if assigned(srsym) then
-                   begin
-                     check_hints(srsym,srsym.symoptions);
-                     { load the procdef from the inherited class and
-                       not from self }
-                     case srsym.typ of
-                       procsym:
-                         begin
-                           hdef:=hclassdef;
-                           if (po_classmethod in current_procinfo.procdef.procoptions) or
-                              (po_staticmethod in current_procinfo.procdef.procoptions) then
-                             hdef:=tclassrefdef.create(hdef);
-                           p1:=ctypenode.create(hdef);
-                         end;
-                       propertysym:
-                         ;
+                    p1 := cexitnode.create(nil);
+                end;
+             _INHERITED :
+               begin
+                 again:=true;
+                 consume(_INHERITED);
+                 if assigned(current_procinfo) and
+                    assigned(current_objectdef) then
+                  begin
+                    hclassdef:=current_objectdef.childof;
+                    { if inherited; only then we need the method with
+                      the same name }
+                    if token in endtokens then
+                     begin
+                       hs:=current_procinfo.procdef.procsym.name;
+                       hsorg:=current_procinfo.procdef.procsym.realname;
+                       anon_inherited:=true;
+                       { For message methods we need to search using the message
+                         number or string }
+                       pd:=tprocdef(tprocsym(current_procinfo.procdef.procsym).ProcdefList[0]);
+                       srdef:=nil;
+                       if (po_msgint in pd.procoptions) then
+                         searchsym_in_class_by_msgint(hclassdef,pd.messageinf.i,srdef,srsym,srsymtable)
                        else
-                         begin
-                           Message(parser_e_methode_id_expected);
-                           p1:=cerrornode.create;
-                         end;
-                     end;
-                     do_member_read(hclassdef,getaddr,srsym,p1,again,[cnf_inherited,cnf_anon_inherited]);
-                   end
-                  else
-                   begin
-                     if anon_inherited then
-                      begin
-                        { For message methods we need to call DefaultHandler }
-                        if (po_msgint in pd.procoptions) or
-                           (po_msgstr in pd.procoptions) then
-                          begin
-                            searchsym_in_class(hclassdef,hclassdef,'DEFAULTHANDLER',srsym,srsymtable);
-                            if not assigned(srsym) or
-                               (srsym.typ<>procsym) then
-                              internalerror(200303171);
-                            p1:=nil;
-                            do_proc_call(srsym,srsym.owner,hclassdef,false,again,p1,[]);
-                          end
-                        else
-                          begin
-                            { we need to ignore the inherited; }
-                            p1:=cnothingnode.create;
-                          end;
-                      end
-                     else
-                      begin
-                        Message1(sym_e_id_no_member,hsorg);
-                        p1:=cerrornode.create;
-                      end;
-                     again:=false;
-                   end;
-                  { turn auto inheriting off }
-                  anon_inherited:=false;
-                end
-               else
-                 begin
-                    Message(parser_e_generic_methods_only_in_methods);
-                    again:=false;
-                    p1:=cerrornode.create;
-                 end;
-               postfixoperators(p1,again);
-             end;
-
-           _INTCONST :
-             begin
-               {Try first wether the value fits in an int64.}
-               val(pattern,ic,code);
-               if code=0 then
-                 begin
-                    consume(_INTCONST);
-                    int_to_type(ic,hdef);
-                    p1:=cordconstnode.create(ic,hdef,true);
-                 end
-               else
-                 begin
-                   { try qword next }
-                   val(pattern,qc,code);
-                   if code=0 then
+                        if (po_msgstr in pd.procoptions) then
+                          searchsym_in_class_by_msgstr(hclassdef,pd.messageinf.str^,srsym,srsymtable)
+                       else
+                         searchsym_in_class(hclassdef,current_objectdef,hs,srsym,srsymtable);
+                     end
+                    else
                      begin
-                        consume(_INTCONST);
-                        int_to_type(qc,hdef);
-                        p1:=cordconstnode.create(qc,hdef,true);
+                       hs:=pattern;
+                       hsorg:=orgpattern;
+                       consume(_ID);
+                       anon_inherited:=false;
+                       searchsym_in_class(hclassdef,current_objectdef,hs,srsym,srsymtable);
                      end;
-                 end;
-               if code<>0 then
-                 begin
-                   { finally float }
-                   val(pattern,d,code);
-                   if code<>0 then
+                    if assigned(srsym) then
                      begin
-                        Message(parser_e_invalid_integer);
-                        consume(_INTCONST);
-                        l:=1;
-                        p1:=cordconstnode.create(l,sinttype,true);
+                       check_hints(srsym,srsym.symoptions);
+                       { load the procdef from the inherited class and
+                         not from self }
+                       case srsym.typ of
+                         procsym:
+                           begin
+                             hdef:=hclassdef;
+                             if (po_classmethod in current_procinfo.procdef.procoptions) or
+                                (po_staticmethod in current_procinfo.procdef.procoptions) then
+                               hdef:=tclassrefdef.create(hdef);
+                             p1:=ctypenode.create(hdef);
+                           end;
+                         propertysym:
+                           ;
+                         else
+                           begin
+                             Message(parser_e_methode_id_expected);
+                             p1:=cerrornode.create;
+                           end;
+                       end;
+                       do_member_read(hclassdef,getaddr,srsym,p1,again,[cnf_inherited,cnf_anon_inherited]);
                      end
-                   else
+                    else
                      begin
-                        consume(_INTCONST);
-                        p1:=crealconstnode.create(d,pbestrealtype^);
+                       if anon_inherited then
+                        begin
+                          { For message methods we need to call DefaultHandler }
+                          if (po_msgint in pd.procoptions) or
+                             (po_msgstr in pd.procoptions) then
+                            begin
+                              searchsym_in_class(hclassdef,hclassdef,'DEFAULTHANDLER',srsym,srsymtable);
+                              if not assigned(srsym) or
+                                 (srsym.typ<>procsym) then
+                                internalerror(200303171);
+                              p1:=nil;
+                              do_proc_call(srsym,srsym.owner,hclassdef,false,again,p1,[]);
+                            end
+                          else
+                            begin
+                              { we need to ignore the inherited; }
+                              p1:=cnothingnode.create;
+                            end;
+                        end
+                       else
+                        begin
+                          Message1(sym_e_id_no_member,hsorg);
+                          p1:=cerrornode.create;
+                        end;
+                       again:=false;
                      end;
-                 end
-               else
-                 { the necessary range checking has already been done by val }
-                 tordconstnode(p1).rangecheck:=false;
-             end;
+                    { turn auto inheriting off }
+                    anon_inherited:=false;
+                  end
+                 else
+                   begin
+                      Message(parser_e_generic_methods_only_in_methods);
+                      again:=false;
+                      p1:=cerrornode.create;
+                   end;
+                 postfixoperators(p1,again);
+               end;
 
-           _REALNUMBER :
-             begin
-               val(pattern,d,code);
-               if code<>0 then
-                begin
-                  Message(parser_e_error_in_real);
-                  d:=1.0;
-                end;
-               consume(_REALNUMBER);
+             _INTCONST :
+               begin
+                 {Try first wether the value fits in an int64.}
+                 val(pattern,ic,code);
+                 if code=0 then
+                   begin
+                      consume(_INTCONST);
+                      int_to_type(ic,hdef);
+                      p1:=cordconstnode.create(ic,hdef,true);
+                   end
+                 else
+                   begin
+                     { try qword next }
+                     val(pattern,qc,code);
+                     if code=0 then
+                       begin
+                          consume(_INTCONST);
+                          int_to_type(qc,hdef);
+                          p1:=cordconstnode.create(qc,hdef,true);
+                       end;
+                   end;
+                 if code<>0 then
+                   begin
+                     { finally float }
+                     val(pattern,d,code);
+                     if code<>0 then
+                       begin
+                          Message(parser_e_invalid_integer);
+                          consume(_INTCONST);
+                          l:=1;
+                          p1:=cordconstnode.create(l,sinttype,true);
+                       end
+                     else
+                       begin
+                          consume(_INTCONST);
+                          p1:=crealconstnode.create(d,pbestrealtype^);
+                       end;
+                   end
+                 else
+                   { the necessary range checking has already been done by val }
+                   tordconstnode(p1).rangecheck:=false;
+               end;
+
+             _REALNUMBER :
+               begin
+                 val(pattern,d,code);
+                 if code<>0 then
+                  begin
+                    Message(parser_e_error_in_real);
+                    d:=1.0;
+                  end;
+                 consume(_REALNUMBER);
 {$ifdef FPC_REAL2REAL_FIXED}
-               if current_settings.fputype=fpu_none then
-                 Message(parser_e_unsupported_real);
-               if (current_settings.minfpconstprec=s32real) and
-                  (d = single(d)) then
-                 p1:=crealconstnode.create(d,s32floattype)
-               else if (current_settings.minfpconstprec=s64real) and
-                       (d = double(d)) then
-                 p1:=crealconstnode.create(d,s64floattype)
-               else
+                 if current_settings.fputype=fpu_none then
+                   Message(parser_e_unsupported_real);
+                 if (current_settings.minfpconstprec=s32real) and
+                    (d = single(d)) then
+                   p1:=crealconstnode.create(d,s32floattype)
+                 else if (current_settings.minfpconstprec=s64real) and
+                         (d = double(d)) then
+                   p1:=crealconstnode.create(d,s64floattype)
+                 else
 {$endif FPC_REAL2REAL_FIXED}
-                 p1:=crealconstnode.create(d,pbestrealtype^);
+                   p1:=crealconstnode.create(d,pbestrealtype^);
 {$ifdef FPC_HAS_STR_CURRENCY}
-               val(pattern,cur,code);
-               if code=0 then
-                 trealconstnode(p1).value_currency:=cur;
+                 val(pattern,cur,code);
+                 if code=0 then
+                   trealconstnode(p1).value_currency:=cur;
 {$endif FPC_HAS_STR_CURRENCY}
-             end;
-
-           _STRING :
-             begin
-               string_dec(hdef,true);
-               { STRING can be also a type cast }
-               if try_to_consume(_LKLAMMER) then
-                begin
-                  p1:=comp_expr(true);
-                  consume(_RKLAMMER);
-                  p1:=ctypeconvnode.create_explicit(p1,hdef);
-                  { handle postfix operators here e.g. string(a)[10] }
-                  again:=true;
-                  postfixoperators(p1,again);
-                end
-               else
-                p1:=ctypenode.create(hdef);
-             end;
+               end;
 
-           _FILE :
-             begin
-               hdef:=cfiletype;
-               consume(_FILE);
-               { FILE can be also a type cast }
-               if try_to_consume(_LKLAMMER) then
-                begin
-                  p1:=comp_expr(true);
-                  consume(_RKLAMMER);
-                  p1:=ctypeconvnode.create_explicit(p1,hdef);
-                  { handle postfix operators here e.g. string(a)[10] }
-                  again:=true;
-                  postfixoperators(p1,again);
-                end
-               else
-                begin
+             _STRING :
+               begin
+                 string_dec(hdef,true);
+                 { STRING can be also a type cast }
+                 if try_to_consume(_LKLAMMER) then
+                  begin
+                    p1:=comp_expr(true);
+                    consume(_RKLAMMER);
+                    p1:=ctypeconvnode.create_explicit(p1,hdef);
+                    { handle postfix operators here e.g. string(a)[10] }
+                    again:=true;
+                    postfixoperators(p1,again);
+                  end
+                 else
                   p1:=ctypenode.create(hdef);
-                end;
-             end;
+               end;
 
-           _CSTRING :
-             begin
-               p1:=cstringconstnode.createstr(pattern);
-               consume(_CSTRING);
-             end;
+             _FILE :
+               begin
+                 hdef:=cfiletype;
+                 consume(_FILE);
+                 { FILE can be also a type cast }
+                 if try_to_consume(_LKLAMMER) then
+                  begin
+                    p1:=comp_expr(true);
+                    consume(_RKLAMMER);
+                    p1:=ctypeconvnode.create_explicit(p1,hdef);
+                    { handle postfix operators here e.g. string(a)[10] }
+                    again:=true;
+                    postfixoperators(p1,again);
+                  end
+                 else
+                  begin
+                    p1:=ctypenode.create(hdef);
+                  end;
+               end;
 
-           _CCHAR :
-             begin
-               p1:=cordconstnode.create(ord(pattern[1]),cchartype,true);
-               consume(_CCHAR);
-             end;
+             _CSTRING :
+               begin
+                 p1:=cstringconstnode.createstr(pattern);
+                 consume(_CSTRING);
+               end;
 
-           _CWSTRING:
-             begin
-               p1:=cstringconstnode.createwstr(patternw);
-               consume(_CWSTRING);
-             end;
+             _CCHAR :
+               begin
+                 p1:=cordconstnode.create(ord(pattern[1]),cchartype,true);
+                 consume(_CCHAR);
+               end;
 
-           _CWCHAR:
-             begin
-               p1:=cordconstnode.create(ord(getcharwidestring(patternw,0)),cwidechartype,true);
-               consume(_CWCHAR);
-             end;
+             _CWSTRING:
+               begin
+                 p1:=cstringconstnode.createwstr(patternw);
+                 consume(_CWSTRING);
+               end;
 
-           _KLAMMERAFFE :
-             begin
-               consume(_KLAMMERAFFE);
-               got_addrn:=true;
-               { support both @<x> and @(<x>) }
-               if try_to_consume(_LKLAMMER) then
-                begin
+             _CWCHAR:
+               begin
+                 p1:=cordconstnode.create(ord(getcharwidestring(patternw,0)),cwidechartype,true);
+                 consume(_CWCHAR);
+               end;
+
+             _KLAMMERAFFE :
+               begin
+                 consume(_KLAMMERAFFE);
+                 got_addrn:=true;
+                 { support both @<x> and @(<x>) }
+                 if try_to_consume(_LKLAMMER) then
+                  begin
+                    p1:=factor(true);
+                    if token in [_CARET,_POINT,_LECKKLAMMER] then
+                     begin
+                       again:=true;
+                       postfixoperators(p1,again);
+                     end
+                    else
+                    consume(_RKLAMMER);
+                  end
+                 else
                   p1:=factor(true);
-                  if token in [_CARET,_POINT,_LECKKLAMMER] then
-                   begin
-                     again:=true;
-                     postfixoperators(p1,again);
-                   end;
-                  consume(_RKLAMMER);
-                end
-               else
-                p1:=factor(true);
-               if token in [_CARET,_POINT,_LECKKLAMMER] then
-                begin
-                  again:=true;
-                  postfixoperators(p1,again);
-                end;
-               got_addrn:=false;
-               p1:=caddrnode.create(p1);
-               if cs_typed_addresses in current_settings.localswitches then
-                 include(p1.flags,nf_typedaddr);
-               { Store the procvar that we are expecting, the
-                 addrn will use the information to find the correct
-                 procdef or it will return an error }
-               if assigned(getprocvardef) and
-                  (taddrnode(p1).left.nodetype = loadn) then
-                 taddrnode(p1).getprocvardef:=getprocvardef;
-             end;
+                 if token in [_CARET,_POINT,_LECKKLAMMER] then
+                  begin
+                    again:=true;
+                    postfixoperators(p1,again);
+                  end;
+                 got_addrn:=false;
+                 p1:=caddrnode.create(p1);
+                 p1.fileinfo:=filepos;
+                 if cs_typed_addresses in current_settings.localswitches then
+                   include(p1.flags,nf_typedaddr);
+                 { Store the procvar that we are expecting, the
+                   addrn will use the information to find the correct
+                   procdef or it will return an error }
+                 if assigned(getprocvardef) and
+                    (taddrnode(p1).left.nodetype = loadn) then
+                   taddrnode(p1).getprocvardef:=getprocvardef;
+               end;
 
-           _LKLAMMER :
-             begin
-               consume(_LKLAMMER);
-               p1:=comp_expr(true);
-               consume(_RKLAMMER);
-               { it's not a good solution     }
-               { but (a+b)^ makes some problems  }
-               if token in [_CARET,_POINT,_LECKKLAMMER] then
-                begin
-                  again:=true;
-                  postfixoperators(p1,again);
-                end;
-             end;
+             _LKLAMMER :
+               begin
+                 consume(_LKLAMMER);
+                 p1:=comp_expr(true);
+                 consume(_RKLAMMER);
+                 { it's not a good solution     }
+                 { but (a+b)^ makes some problems  }
+                 if token in [_CARET,_POINT,_LECKKLAMMER] then
+                  begin
+                    again:=true;
+                    postfixoperators(p1,again);
+                  end;
+               end;
 
-           _LECKKLAMMER :
-             begin
-               consume(_LECKKLAMMER);
-               p1:=factor_read_set;
-               consume(_RECKKLAMMER);
-             end;
+             _LECKKLAMMER :
+               begin
+                 consume(_LECKKLAMMER);
+                 p1:=factor_read_set;
+                 consume(_RECKKLAMMER);
+               end;
 
-           _PLUS :
-             begin
-               consume(_PLUS);
-               p1:=factor(false);
-               { we must generate a new node to do 0+<p1> otherwise the + will
-                 not be checked }
-               p1:=caddnode.create(addn,genintconstnode(0),p1);
-             end;
+             _PLUS :
+               begin
+                 consume(_PLUS);
+                 p1:=factor(false);
+                 { we must generate a new node to do 0+<p1> otherwise the + will
+                   not be checked }
+                 p1:=caddnode.create(addn,genintconstnode(0),p1);
+               end;
 
-           _MINUS :
-             begin
-               consume(_MINUS);
-               if (token = _INTCONST) then
-                  begin
-                    { ugly hack, but necessary to be able to parse }
-                    { -9223372036854775808 as int64 (JM)           }
-                    pattern := '-'+pattern;
-                    p1:=sub_expr(oppower,false);
-                    {  -1 ** 4 should be - (1 ** 4) and not
-                       (-1) ** 4
-                       This was the reason of tw0869.pp test failure PM }
-                    if p1.nodetype=starstarn then
-                      begin
-                        if tbinarynode(p1).left.nodetype=ordconstn then
-                          begin
-                            tordconstnode(tbinarynode(p1).left).value:=-tordconstnode(tbinarynode(p1).left).value;
-                            p1:=cunaryminusnode.create(p1);
-                          end
-                        else if tbinarynode(p1).left.nodetype=realconstn then
-                          begin
-                            trealconstnode(tbinarynode(p1).left).value_real:=-trealconstnode(tbinarynode(p1).left).value_real;
-                            trealconstnode(tbinarynode(p1).left).value_currency:=-trealconstnode(tbinarynode(p1).left).value_currency;
-                            p1:=cunaryminusnode.create(p1);
-                          end
-                        else
-                          internalerror(20021029);
-                      end;
-                  end
-               else
-                 begin
-                   p1:=sub_expr(oppower,false);
-                   p1:=cunaryminusnode.create(p1);
-                 end;
-             end;
+             _MINUS :
+               begin
+                 consume(_MINUS);
+                 if (token = _INTCONST) then
+                    begin
+                      { ugly hack, but necessary to be able to parse }
+                      { -9223372036854775808 as int64 (JM)           }
+                      pattern := '-'+pattern;
+                      p1:=sub_expr(oppower,false);
+                      {  -1 ** 4 should be - (1 ** 4) and not
+                         (-1) ** 4
+                         This was the reason of tw0869.pp test failure PM }
+                      if p1.nodetype=starstarn then
+                        begin
+                          if tbinarynode(p1).left.nodetype=ordconstn then
+                            begin
+                              tordconstnode(tbinarynode(p1).left).value:=-tordconstnode(tbinarynode(p1).left).value;
+                              p1:=cunaryminusnode.create(p1);
+                            end
+                          else if tbinarynode(p1).left.nodetype=realconstn then
+                            begin
+                              trealconstnode(tbinarynode(p1).left).value_real:=-trealconstnode(tbinarynode(p1).left).value_real;
+                              trealconstnode(tbinarynode(p1).left).value_currency:=-trealconstnode(tbinarynode(p1).left).value_currency;
+                              p1:=cunaryminusnode.create(p1);
+                            end
+                          else
+                            internalerror(20021029);
+                        end;
+                    end
+                 else
+                   begin
+                     p1:=sub_expr(oppower,false);
+                     p1:=cunaryminusnode.create(p1);
+                   end;
+               end;
 
-           _OP_NOT :
-             begin
-               consume(_OP_NOT);
-               p1:=factor(false);
-               p1:=cnotnode.create(p1);
-             end;
+             _OP_NOT :
+               begin
+                 consume(_OP_NOT);
+                 p1:=factor(false);
+                 p1:=cnotnode.create(p1);
+               end;
 
-           _TRUE :
-             begin
-               consume(_TRUE);
-               p1:=cordconstnode.create(1,booltype,false);
-             end;
+             _TRUE :
+               begin
+                 consume(_TRUE);
+                 p1:=cordconstnode.create(1,booltype,false);
+               end;
 
-           _FALSE :
-             begin
-               consume(_FALSE);
-               p1:=cordconstnode.create(0,booltype,false);
-             end;
+             _FALSE :
+               begin
+                 consume(_FALSE);
+                 p1:=cordconstnode.create(0,booltype,false);
+               end;
 
-           _NIL :
-             begin
-               consume(_NIL);
-               p1:=cnilnode.create;
-               { It's really ugly code nil^, but delphi allows it }
-               if token in [_CARET] then
-                begin
-                  again:=true;
-                  postfixoperators(p1,again);
-                end;
-             end;
+             _NIL :
+               begin
+                 consume(_NIL);
+                 p1:=cnilnode.create;
+                 { It's really ugly code nil^, but delphi allows it }
+                 if token in [_CARET] then
+                  begin
+                    again:=true;
+                    postfixoperators(p1,again);
+                  end;
+               end;
 
-           else
-             begin
-               Message(parser_e_illegal_expression);
-               p1:=cerrornode.create;
-               { recover }
-               consume(token);
-             end;
+             else
+               begin
+                 Message(parser_e_illegal_expression);
+                 p1:=cerrornode.create;
+                 { recover }
+                 consume(token);
+               end;
+           end;
         end;
 
         { generate error node if no node is created }
@@ -2598,14 +2614,18 @@ implementation
            Comment(V_Warning,'factor: p1=nil');
 {$endif}
            p1:=cerrornode.create;
+           updatefpos:=true;
          end;
 
         { get the resultdef for the node }
         if (not assigned(p1.resultdef)) then
-         do_typecheckpass(p1);
+          begin
+            do_typecheckpass_changed(p1,nodechanged);
+            updatefpos:=updatefpos or nodechanged;
+          end;
 
         if assigned(p1) and
-           (p1<>oldp1) then
+           updatefpos then
           p1.fileinfo:=filepos;
         factor:=p1;
       end;
@@ -2736,9 +2756,9 @@ implementation
 
       var
          p1,p2 : tnode;
-         oldafterassignment : boolean;
-         oldp1 : tnode;
          filepos : tfileposinfo;
+         oldafterassignment,
+         updatefpos          : boolean;
 
       begin
          oldafterassignment:=afterassignment;
@@ -2749,7 +2769,7 @@ implementation
          filepos:=current_tokenpos;
          if token in [_ASSIGNMENT,_PLUSASN,_MINUSASN,_STARASN,_SLASHASN] then
            afterassignment:=true;
-         oldp1:=p1;
+         updatefpos:=true;
          case token of
            _POINTPOINT :
              begin
@@ -2792,12 +2812,14 @@ implementation
                p2:=sub_expr(opcompare,true);
                p1:=gen_c_style_operator(slashn,p1,p2);
             end;
+          else
+            updatefpos:=false;
          end;
          { get the resultdef for this expression }
          if not assigned(p1.resultdef) then
           do_typecheckpass(p1);
          afterassignment:=oldafterassignment;
-         if p1<>oldp1 then
+         if updatefpos then
            p1.fileinfo:=filepos;
          expr:=p1;
       end;

+ 74 - 25
compiler/scanner.pas

@@ -70,6 +70,12 @@ interface
        tspecialgenerictoken = (ST_LOADSETTINGS,ST_LINE,ST_COLUMN,ST_FILEINDEX);
 
        tscannerfile = class
+       private
+         procedure do_gettokenpos(out tokenpos: longint; out filepos: tfileposinfo);
+         procedure cachenexttokenpos;
+         procedure setnexttoken;
+         procedure savetokenpos;
+         procedure restoretokenpos;
        public
           inputfile    : tinputfile;  { current inputfile list }
           inputfilecount : longint;
@@ -81,10 +87,16 @@ interface
           line_no,                    { line }
           lastlinepos  : longint;
 
-          lasttokenpos : longint;     { token }
+          lasttokenpos,
+          nexttokenpos : longint;     { token }
           lasttoken,
           nexttoken    : ttoken;
 
+          oldlasttokenpos     : longint; { temporary saving/restoring tokenpos }
+          oldcurrent_filepos,
+          oldcurrent_tokenpos : tfileposinfo;
+
+
           replaysavetoken : ttoken;
           replaytokenbuf,
           recordtokenbuf : tdynamicarray;
@@ -95,7 +107,9 @@ interface
           last_settings : tsettings;
 
           { last filepos we stored }
-          last_filepos : tfileposinfo;
+          last_filepos,
+          { if nexttoken<>NOTOKEN, then nexttokenpos holds its filepos }
+          next_filepos   : tfileposinfo;
 
           comment_level,
           yylexcount     : longint;
@@ -1828,6 +1842,7 @@ In case not, the value returned can be arbitrary.
         line_no:=0;
         lastlinepos:=0;
         lasttokenpos:=0;
+        nexttokenpos:=0;
         lasttoken:=NOTOKEN;
         nexttoken:=NOTOKEN;
         lastasmgetchar:=#0;
@@ -1873,6 +1888,7 @@ In case not, the value returned can be arbitrary.
         line_no:=0;
         lastlinepos:=0;
         lasttokenpos:=0;
+        nexttokenpos:=0;
       end;
 
 
@@ -1887,6 +1903,7 @@ In case not, the value returned can be arbitrary.
         line_no:=0;
         lastlinepos:=0;
         lasttokenpos:=0;
+        nexttokenpos:=0;
       end;
 
 
@@ -2212,7 +2229,7 @@ In case not, the value returned can be arbitrary.
 
                    line_no:=1;
                    if cs_asm_source in current_settings.globalswitches then
-                     inputfile.setline(line_no,bufstart);
+                     inputfile.setline(line_no,inputstart+inputpointer-inputbuffer);
                  end;
               end
              else
@@ -2265,27 +2282,65 @@ In case not, the value returned can be arbitrary.
         line_no:=line;
         lastlinepos:=0;
         lasttokenpos:=0;
+        nexttokenpos:=0;
       { load new c }
         c:=inputpointer^;
         inc(inputpointer);
       end;
 
 
+    procedure tscannerfile.do_gettokenpos(out tokenpos: longint; out filepos: tfileposinfo);
+      begin
+        tokenpos:=inputstart+(inputpointer-inputbuffer);
+        filepos.line:=line_no;
+        filepos.column:=tokenpos-lastlinepos;
+        filepos.fileindex:=inputfile.ref_index;
+        filepos.moduleindex:=current_module.unit_index;
+      end;
+
+
     procedure tscannerfile.gettokenpos;
     { load the values of tokenpos and lasttokenpos }
       begin
-        lasttokenpos:=inputstart+(inputpointer-inputbuffer);
-        current_tokenpos.line:=line_no;
-        current_tokenpos.column:=lasttokenpos-lastlinepos;
-        current_tokenpos.fileindex:=inputfile.ref_index;
-        current_tokenpos.moduleindex:=current_module.unit_index;
+        do_gettokenpos(lasttokenpos,current_tokenpos);
+        current_filepos:=current_tokenpos;
+      end;
+
+
+    procedure tscannerfile.cachenexttokenpos;
+      begin
+        do_gettokenpos(nexttokenpos,next_filepos);
+      end;
+
+
+    procedure tscannerfile.setnexttoken;
+      begin
+        token:=nexttoken;
+        nexttoken:=NOTOKEN;
+        lasttokenpos:=nexttokenpos;
+        current_tokenpos:=next_filepos;
         current_filepos:=current_tokenpos;
+        nexttokenpos:=0;
+      end;
+
+
+    procedure tscannerfile.savetokenpos;
+      begin
+        oldlasttokenpos:=lasttokenpos;
+        oldcurrent_filepos:=current_filepos;
+        oldcurrent_tokenpos:=current_tokenpos;
+      end;
+
+
+    procedure tscannerfile.restoretokenpos;
+      begin
+        lasttokenpos:=oldlasttokenpos;
+        current_filepos:=oldcurrent_filepos;
+        current_tokenpos:=oldcurrent_tokenpos;
       end;
 
 
     procedure tscannerfile.inc_comment_level;
-      var
-         oldcurrent_filepos : tfileposinfo;
       begin
          if (m_nested_comment in current_settings.modeswitches) then
            inc(comment_level)
@@ -2293,10 +2348,10 @@ In case not, the value returned can be arbitrary.
            comment_level:=1;
          if (comment_level>1) then
           begin
-             oldcurrent_filepos:=current_filepos;
+             savetokenpos;
              gettokenpos; { update for warning }
              Message1(scan_w_comment_level,tostr(comment_level));
-             current_filepos:=oldcurrent_filepos;
+             restoretokenpos;
           end;
       end;
 
@@ -2313,8 +2368,6 @@ In case not, the value returned can be arbitrary.
     procedure tscannerfile.linebreak;
       var
          cur : char;
-         oldtokenpos,
-         oldcurrent_filepos : tfileposinfo;
       begin
         with inputfile do
          begin
@@ -2334,20 +2387,18 @@ In case not, the value returned can be arbitrary.
            { Always return #10 as line break }
            c:=#10;
            { increase line counters }
-           lastlinepos:=bufstart+(inputpointer-inputbuffer);
+           lastlinepos:=inputstart+(inputpointer-inputbuffer);
            inc(line_no);
            { update linebuffer }
            if cs_asm_source in current_settings.globalswitches then
              inputfile.setline(line_no,lastlinepos);
            { update for status and call the show status routine,
              but don't touch current_filepos ! }
-           oldcurrent_filepos:=current_filepos;
-           oldtokenpos:=current_tokenpos;
+           savetokenpos;
            gettokenpos; { update for v_status }
            inc(status.compiledlines);
            ShowStatus;
-           current_filepos:=oldcurrent_filepos;
-           current_tokenpos:=oldtokenpos;
+           restoretokenpos;
          end;
       end;
 
@@ -2482,10 +2533,8 @@ In case not, the value returned can be arbitrary.
 
 
     procedure tscannerfile.handleconditional(p:tdirectiveitem);
-      var
-        oldcurrent_filepos : tfileposinfo;
       begin
-        oldcurrent_filepos:=current_filepos;
+        savetokenpos;
         repeat
           current_scanner.gettokenpos;
           p.proc();
@@ -2507,7 +2556,7 @@ In case not, the value returned can be arbitrary.
              Message1(scan_d_handling_switch,'$'+p.name);
            end;
         until false;
-        current_filepos:=oldcurrent_filepos;
+        restoretokenpos;
       end;
 
 
@@ -3226,8 +3275,7 @@ In case not, the value returned can be arbitrary.
       { was there already a token read, then return that token }
         if nexttoken<>NOTOKEN then
          begin
-           token:=nexttoken;
-           nexttoken:=NOTOKEN;
+           setnexttoken;
            goto exit_label;
          end;
 
@@ -3376,6 +3424,7 @@ In case not, the value returned can be arbitrary.
                   { first check for a . }
                     if c='.' then
                      begin
+                       cachenexttokenpos;
                        readchar;
                        { is it a .. from a range? }
                        case c of

+ 21 - 6
compiler/systems/t_bsd.pas

@@ -152,11 +152,23 @@ begin
            end
          else
            begin
-             ExeCmd[1]:='ld $PRTOBJ $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -no_dead_strip_inits_and_terms -multiply_defined suppress -L. -o $EXE `cat $RES`';
+{$ifndef cpu64bitaddr}
+             { Set the size of the page at address zero to 64kb, so nothing
+               is loaded below that address. This avoids problems with the
+               strange Windows-compatible resource handling that assumes
+               that addresses below 64kb do not exist.
+               
+               On 64bit systems, page zero is 4GB by default, so no problems
+               there.
+             }
+             ExeCmd[1]:='ld $PRTOBJ $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -pagezero_size 0x10000 -multiply_defined suppress -L. -o $EXE `cat $RES`';
+{$else ndef cpu64bitaddr}
+             ExeCmd[1]:='ld $PRTOBJ $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE `cat $RES`';
+{$endif ndef cpu64bitaddr}
              if (apptype<>app_bundle) then
-               DllCmd[1]:='libtool $PRTOBJ $OPT -no_dead_strip_inits_and_terms -dynamic -multiply_defined suppress -L. -o $EXE `cat $RES`'
+               DllCmd[1]:='ld $PRTOBJ $OPT -dynamic -dylib -multiply_defined suppress -L. -o $EXE `cat $RES`'
              else
-               DllCmd[1]:='ld $PRTOBJ $OPT -no_dead_strip_inits_and_terms -dynamic -bundle -multiply_defined suppress -L. -o $EXE `cat $RES`'
+               DllCmd[1]:='ld $PRTOBJ $OPT -dynamic -bundle -multiply_defined suppress -L. -o $EXE `cat $RES`'
            end
        end
      else
@@ -220,7 +232,10 @@ begin
             result:='/usr/lib/bundle1.o'
         end
       else
-        result:=''
+        begin
+          if not librarysearchpath.FindFile('dylib1.o',false,result) then
+            result:='/usr/lib/dylib1.o'
+        end;
     end;
 end;    
 
@@ -485,7 +500,7 @@ var
   DynLinkStr : string[60];
   GCSectionsStr,
   StaticStr,
-  StripStr   : string[40];
+  StripStr   : string[63];
   success : boolean;
 begin
   if not(cs_link_nolink in current_settings.globalswitches) then
@@ -516,7 +531,7 @@ begin
     if not(target_info.system in systems_darwin) then
       GCSectionsStr:='--gc-sections'
     else
-      GCSectionsStr:='-dead_strip';
+      GCSectionsStr:='-dead_strip -no_dead_strip_inits_and_terms';
 
    if(not(target_info.system in systems_darwin) and
       (cs_profile in current_settings.moduleswitches)) or

+ 48 - 26
compiler/systems/t_linux.pas

@@ -380,6 +380,10 @@ begin
       { try to add crti and crtbegin if linking to C }
       if linklibc and (libctype<>uclibc) then
        begin
+         { crti.o must come first }
+         if librarysearchpath.FindFile('crti.o',false,s) then
+           AddFileName(s);
+         { then the crtbegin* }
          { x86_64 requires this to use entry/exit code with pic,
            see also issue #8210 regarding a discussion
            no idea about the other non i386 CPUs (FK)
@@ -392,10 +396,11 @@ begin
            end
          else
 {$endif x86_64}
-           if librarysearchpath.FindFile('crtbegin.o',false,s) then
+           if (cs_link_staticflag in current_settings.globalswitches) and
+              librarysearchpath.FindFile('crtbeginT.o',false,s) then
+             AddFileName(s)
+           else if librarysearchpath.FindFile('crtbegin.o',false,s) then
              AddFileName(s);
-         if librarysearchpath.FindFile('crti.o',false,s) then
-           AddFileName(s);
        end;
       { main objectfiles }
       while not ObjectFiles.Empty do
@@ -429,29 +434,46 @@ begin
       if not SharedLibFiles.Empty then
        begin
 
-         Add('INPUT(');
-         While not SharedLibFiles.Empty do
-          begin
-            S:=SharedLibFiles.GetFirst;
-            if (s<>'c') or reorder then
-             begin
-               i:=Pos(target_info.sharedlibext,S);
-               if i>0 then
-                Delete(S,i,255);
-               Add('-l'+s);
-             end
-            else
-             begin
-               linklibc:=true;
-             end;
-          end;
-         { be sure that libc is the last lib }
-         if linklibc and not reorder then
-          Add('-lc');
-         { when we have -static for the linker the we also need libgcc }
-         if (cs_link_staticflag in current_settings.globalswitches) then
-          Add('-lgcc');
-         Add(')');
+         if (SharedLibFiles.Count<>1) or
+            (TCmdStrListItem(SharedLibFiles.First).Str<>'c') or
+            reorder then
+           begin
+             Add('INPUT(');
+             While not SharedLibFiles.Empty do
+              begin
+                S:=SharedLibFiles.GetFirst;
+                if (s<>'c') or reorder then
+                 begin
+                   i:=Pos(target_info.sharedlibext,S);
+                   if i>0 then
+                    Delete(S,i,255);
+                   Add('-l'+s);
+                 end
+                else
+                 begin
+                   linklibc:=true;
+                 end;
+              end;
+             Add(')');
+           end
+         else
+           linklibc:=true;
+         if (cs_link_staticflag in current_settings.globalswitches) or
+            (linklibc and not reorder) then
+           begin
+             Add('GROUP(');
+             { when we have -static for the linker the we also need libgcc }
+             if (cs_link_staticflag in current_settings.globalswitches) then
+               begin
+                 Add('-lgcc');
+                 if librarysearchpath.FindFile('libgcc_eh.a',false,s1) then
+                   Add('-lgcc_eh');
+               end;
+             { be sure that libc is the last lib }
+             if linklibc and not reorder then
+               Add('-lc');
+             Add(')');
+           end;
        end;
 
       { objects which must be at the end }

+ 5 - 3
packages/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/02]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/20]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -280,10 +280,10 @@ ifeq ($(FULL_TARGET),i386-freebsd)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json  fcl-process unzip regexpr chm fcl-res libgd symbolic  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib users iconvenc
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json  fcl-process unzip regexpr chm fcl-res libgd symbolic  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib iconvenc
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json  fcl-process unzip regexpr chm fcl-res libgd symbolic  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib iconvenc
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json  fcl-process unzip regexpr chm fcl-res libgd symbolic  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib iconvenc
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json  fcl-process unzip regexpr chm fcl-res libgd symbolic  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib iconvenc
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json  fcl-process unzip regexpr chm fcl-res libgd symbolic  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
@@ -1856,6 +1856,7 @@ TARGET_DIRS_TCL=1
 TARGET_DIRS_SYSLOG=1
 TARGET_DIRS_LIBCURL=1
 TARGET_DIRS_OPENGL=1
+TARGET_DIRS_CAIRO=1
 TARGET_DIRS_BFD=1
 TARGET_DIRS_ASPELL=1
 TARGET_DIRS_SVGALIB=1
@@ -1923,6 +1924,7 @@ TARGET_DIRS_TCL=1
 TARGET_DIRS_SYSLOG=1
 TARGET_DIRS_LIBCURL=1
 TARGET_DIRS_OPENGL=1
+TARGET_DIRS_CAIRO=1
 TARGET_DIRS_BFD=1
 TARGET_DIRS_ASPELL=1
 TARGET_DIRS_SVGALIB=1

+ 2 - 2
packages/Makefile.fpc

@@ -14,11 +14,11 @@ dirs_sparc_linux=graph
 dirs_arm_linux=graph
 dirs_m68k_linux=graph
 dirs_beos=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
-               gdbint libpng x11 gdbm tcl syslog libcurl opengl bfd aspell svgalib \
+               gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib \
                imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib \
                iconvenc
 dirs_haiku=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \
-               gdbint libpng x11 gdbm tcl syslog libcurl opengl bfd aspell svgalib \
+               gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib \
                imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib \
                iconvenc
 dirs_freebsd=fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick \

+ 5 - 3
packages/cairo/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/02]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/20]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -282,10 +282,10 @@ ifeq ($(FULL_TARGET),i386-freebsd)
 override TARGET_UNITS+=cairo cairoft  cairoxlib
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=cairo cairoft
+override TARGET_UNITS+=cairo cairoft  cairoxlib
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=cairo cairoft
+override TARGET_UNITS+=cairo cairoft  cairoxlib
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_UNITS+=cairo cairoft  cairoxlib
@@ -1638,6 +1638,7 @@ REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-IMAGE=1
+REQUIRE_PACKAGES_X11=1
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
 REQUIRE_PACKAGES_RTL=1
@@ -1646,6 +1647,7 @@ REQUIRE_PACKAGES_HASH=1
 REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-IMAGE=1
+REQUIRE_PACKAGES_X11=1
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 REQUIRE_PACKAGES_RTL=1

+ 4 - 0
packages/cairo/Makefile.fpc

@@ -4,6 +4,8 @@
 [require]
 packages=fcl-image
 #packages_win32=
+packages_beos=x11
+packages_haiku=x11
 packages_linux=x11
 packages_freebsd=x11
 packages_netbsd=x11
@@ -18,6 +20,8 @@ version=2.2.2
 [target]
 units=cairo cairoft
 units_win32=cairowin32
+units_beos=cairoxlib
+units_haiku=cairoxlib
 units_linux=cairoxlib
 units_freebsd=cairoxlib
 units_netbsd=cairoxlib

+ 8 - 3
packages/cairo/src/cairo.pp

@@ -63,10 +63,15 @@ const
     {$endif}
   {$ENDIF}
 {$else}
-  {$ifdef UseCustomLibs}
-  LIB_CAIRO = '';
+  {$ifdef darwin}
+    LIB_CAIRO = 'cairo';
+    {$linklib cairo}
   {$else}
-  LIB_CAIRO = 'libcairo.so.2';
+    {$ifdef UseCustomLibs}
+    LIB_CAIRO = '';
+    {$else}
+    LIB_CAIRO = 'libcairo.so.2';
+    {$endif}
   {$endif}
 {$endif}
 

+ 3 - 3
packages/fcl-image/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/02]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/20]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -282,10 +282,10 @@ ifeq ($(FULL_TARGET),i386-freebsd)
 override TARGET_UNITS+=fpimgcmn fpimage pngcomn fpreadpng fpwritepng fpreadxpm fpwritexpm clipping fpcanvas pixtools fppixlcanv fpimgcanv pscanvas fpwritebmp fpreadbmp bmpcomn fpreadpnm fpwritepnm fpreadjpeg fpwritejpeg pcxcomn fpreadpcx fpwritepcx fptiffcmn fpreadtiff fpwritetiff targacmn fpreadtga fpwritetga ellipses fpcolhash fpditherer fpquantizer extinterpolation fpreadgif fpreadpsd xwdfile fpreadxwd  freetypeh freetype ftfont
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_UNITS+=fpimgcmn fpimage pngcomn fpreadpng fpwritepng fpreadxpm fpwritexpm clipping fpcanvas pixtools fppixlcanv fpimgcanv pscanvas fpwritebmp fpreadbmp bmpcomn fpreadpnm fpwritepnm fpreadjpeg fpwritejpeg pcxcomn fpreadpcx fpwritepcx fptiffcmn fpreadtiff fpwritetiff targacmn fpreadtga fpwritetga ellipses fpcolhash fpditherer fpquantizer extinterpolation fpreadgif fpreadpsd xwdfile fpreadxwd
+override TARGET_UNITS+=fpimgcmn fpimage pngcomn fpreadpng fpwritepng fpreadxpm fpwritexpm clipping fpcanvas pixtools fppixlcanv fpimgcanv pscanvas fpwritebmp fpreadbmp bmpcomn fpreadpnm fpwritepnm fpreadjpeg fpwritejpeg pcxcomn fpreadpcx fpwritepcx fptiffcmn fpreadtiff fpwritetiff targacmn fpreadtga fpwritetga ellipses fpcolhash fpditherer fpquantizer extinterpolation fpreadgif fpreadpsd xwdfile fpreadxwd  freetypeh freetype ftfont
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_UNITS+=fpimgcmn fpimage pngcomn fpreadpng fpwritepng fpreadxpm fpwritexpm clipping fpcanvas pixtools fppixlcanv fpimgcanv pscanvas fpwritebmp fpreadbmp bmpcomn fpreadpnm fpwritepnm fpreadjpeg fpwritejpeg pcxcomn fpreadpcx fpwritepcx fptiffcmn fpreadtiff fpwritetiff targacmn fpreadtga fpwritetga ellipses fpcolhash fpditherer fpquantizer extinterpolation fpreadgif fpreadpsd xwdfile fpreadxwd
+override TARGET_UNITS+=fpimgcmn fpimage pngcomn fpreadpng fpwritepng fpreadxpm fpwritexpm clipping fpcanvas pixtools fppixlcanv fpimgcanv pscanvas fpwritebmp fpreadbmp bmpcomn fpreadpnm fpwritepnm fpreadjpeg fpwritejpeg pcxcomn fpreadpcx fpwritepcx fptiffcmn fpreadtiff fpwritetiff targacmn fpreadtga fpwritetga ellipses fpcolhash fpditherer fpquantizer extinterpolation fpreadgif fpreadpsd xwdfile fpreadxwd  freetypeh freetype ftfont
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 override TARGET_UNITS+=fpimgcmn fpimage pngcomn fpreadpng fpwritepng fpreadxpm fpwritexpm clipping fpcanvas pixtools fppixlcanv fpimgcanv pscanvas fpwritebmp fpreadbmp bmpcomn fpreadpnm fpwritepnm fpreadjpeg fpwritejpeg pcxcomn fpreadpcx fpwritepcx fptiffcmn fpreadtiff fpwritetiff targacmn fpreadtga fpwritetga ellipses fpcolhash fpditherer fpquantizer extinterpolation fpreadgif fpreadpsd xwdfile fpreadxwd

+ 2 - 0
packages/fcl-image/Makefile.fpc

@@ -14,6 +14,8 @@ units=fpimgcmn fpimage pngcomn fpreadpng fpwritepng fpreadxpm fpwritexpm \
       targacmn fpreadtga fpwritetga ellipses fpcolhash fpditherer fpquantizer \ 
       extinterpolation fpreadgif fpreadpsd xwdfile fpreadxwd
 units_win32=freetypeh freetype ftfont
+units_beos=freetypeh freetype ftfont
+units_haiku=freetypeh freetype ftfont
 units_linux=freetypeh freetype ftfont
 units_freebsd=freetypeh freetype ftfont
 units_darwin=freetypeh freetype ftfont

+ 1 - 0
packages/gtk2/src/gtk+/gtk/gtk2.pas

@@ -93,6 +93,7 @@ const
       {$linklib gobject-2.0.0}
       {$linklib gdk_pixbuf-2.0.0}
       {$linklib atk-1.0.0}
+      {$linklib gthread-2.0}
     {$else}
       {$ifdef UseCustomLibs}
       gtklib = '';

+ 6 - 5
rtl/inc/real2str.inc

@@ -173,7 +173,7 @@ const
         { the fractional part is not used for rounding later                }
         currprec := -1;
         { instead, round based on the next whole digit }
-        if (int(intPartStack[stackPtr]-corrVal+roundcorr) >= 5.0) then
+        if (int(intPartStack[stackPtr]-corrVal) >= 5.0) then
            roundStr(temp,spos);
         end;
 {$ifdef DEBUG_NASM}
@@ -367,10 +367,11 @@ begin
           for fracCount := 1 to currPrec do
             factor := factor * 10.0;
           corrval := corrval / factor;
-          { d is currently in [0.0,1.0[ and roundcorr has been chosen so that
-            1.0+roundcorr <> 1.0 -> add d*roundcorr to d to scale the correction
-            to the actual value of d }
-          if (d<>0.0) then
+          { for single, we may write more significant digits than are available,
+            so the rounding correction itself can show up -> don't round in that
+            case
+          }
+          if real_type<>rt_s32real then
             d:=d+d*roundCorr;
           if d >= corrVal then
             d := d + corrVal;

+ 22 - 3
rtl/linux/arm/sysnr.inc

@@ -39,7 +39,9 @@ Const
   syscall_nr_unlink                     =  syscall_nr_base+10;
   syscall_nr_execve                     =  syscall_nr_base+11;
   syscall_nr_chdir                      =  syscall_nr_base+12;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_time                       =  syscall_nr_base+13;
+{$endif}
   syscall_nr_mknod                      =  syscall_nr_base+14;
   syscall_nr_chmod                      =  syscall_nr_base+15;
   syscall_nr_lchown                     =  syscall_nr_base+16;
@@ -48,15 +50,23 @@ Const
   syscall_nr_lseek                      =  syscall_nr_base+19;
   syscall_nr_getpid                     =  syscall_nr_base+20;
   syscall_nr_mount                      =  syscall_nr_base+21;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_umount                     =  syscall_nr_base+22;
+{$endif}
   syscall_nr_setuid                     =  syscall_nr_base+23;
   syscall_nr_getuid                     =  syscall_nr_base+24;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_stime                      =  syscall_nr_base+25;
+{$endif}
   syscall_nr_ptrace                     =  syscall_nr_base+26;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_alarm                      =  syscall_nr_base+27;
+{$endif}
 
   syscall_nr_pause                      =  syscall_nr_base+29;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_utime                      =  syscall_nr_base+30;
+{$endif}
   syscall_nr_stty                       =  syscall_nr_base+31;
   syscall_nr_gtty                       =  syscall_nr_base+32;
   syscall_nr_access                     =  syscall_nr_base+33;
@@ -102,21 +112,27 @@ Const
   syscall_nr_sigpending                 =  syscall_nr_base+73;
   syscall_nr_sethostname                =  syscall_nr_base+74;
   syscall_nr_setrlimit                  =  syscall_nr_base+75;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_getrlimit                  =  syscall_nr_base+76;
+{$endif}
   syscall_nr_getrusage                  =  syscall_nr_base+77;
   syscall_nr_gettimeofday               =  syscall_nr_base+78;
   syscall_nr_settimeofday               =  syscall_nr_base+79;
   syscall_nr_getgroups                  =  syscall_nr_base+80;
   syscall_nr_setgroups                  =  syscall_nr_base+81;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_select                     =  syscall_nr_base+82;
+{$endif}
   syscall_nr_symlink                    =  syscall_nr_base+83;
 
   syscall_nr_readlink                   =  syscall_nr_base+85;
   syscall_nr_uselib                     =  syscall_nr_base+86;
   syscall_nr_swapon                     =  syscall_nr_base+87;
   syscall_nr_reboot                     =  syscall_nr_base+88;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_readdir                    =  syscall_nr_base+89;
   syscall_nr_mmap                       =  syscall_nr_base+90;
+{$endif}
   syscall_nr_munmap                     =  syscall_nr_base+91;
   syscall_nr_truncate                   =  syscall_nr_base+92;
   syscall_nr_ftruncate                  =  syscall_nr_base+93;
@@ -128,7 +144,9 @@ Const
   syscall_nr_statfs                     =  syscall_nr_base+99;
   syscall_nr_fstatfs                    = syscall_nr_base+100;
   syscall_nr_ioperm                     = syscall_nr_base+101;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_socketcall                 = syscall_nr_base+102;
+{$endif}
   syscall_nr_syslog                     = syscall_nr_base+103;
   syscall_nr_setitimer                  = syscall_nr_base+104;
   syscall_nr_getitimer                  = syscall_nr_base+105;
@@ -137,11 +155,15 @@ Const
   syscall_nr_fstat                      = syscall_nr_base+108;
   syscall_nr_vhangup                    = syscall_nr_base+111;
   syscall_nr_idle                       = syscall_nr_base+112;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_syscall                    = syscall_nr_base+113;
+{$endif}
   syscall_nr_wait4                      = syscall_nr_base+114;
   syscall_nr_swapoff                    = syscall_nr_base+115;
   syscall_nr_sysinfo                    = syscall_nr_base+116;
+{$ifndef FPC_ABI_EABI}
   syscall_nr_ipc                        = syscall_nr_base+117;
+{$endif}
   syscall_nr_fsync                      = syscall_nr_base+118;
   syscall_nr_sigreturn                  = syscall_nr_base+119;
   syscall_nr_clone                      = syscall_nr_base+120;
@@ -394,6 +416,3 @@ Const
   __ARM_NR_usr32			= __ARM_NR_BASE+4;
   __ARM_NR_set_tls		        = __ARM_NR_BASE+5;
 
-
-
-

+ 18 - 1
rtl/linux/bunxsysc.inc

@@ -330,12 +330,29 @@ begin
   fpChOwn:=do_syscall(syscall_nr_chown,TSysParam(path),TSysParam(owner),TSysParam(group));
 end;
 
+{$ifndef NO_SYSCALL_UTIME}
+
 Function fpUtime(path:pchar;times:putimbuf):cint;
 
 begin
- fputime:=do_syscall(syscall_nr_utime,TSysParam(path),TSysParam(times));
+  fputime:=do_syscall(syscall_nr_utime,TSysParam(path),TSysParam(times));
+end;
+
+{$else}
+
+Function fpUtime(path:pchar;times:putimbuf):cint;
+var
+  tva: Array[0..1] of timeval;
+begin
+  tva[0].tv_sec := times^.actime;
+  tva[0].tv_usec := 0;
+  tva[1].tv_sec := times^.modtime;
+  tva[1].tv_usec := 0;
+  fputime:=do_syscall(syscall_nr_utimes,TSysParam(path),TSysParam(@tva));
 end;
 
+{$endif}
+
 
 {$ifndef FPC_BASEUNIX_HAS_FPPIPE}
 Function fppipe(var fildes : tfildes):cint;

+ 15 - 1
rtl/linux/osdefs.inc

@@ -39,7 +39,21 @@
 {$endif}
 
 {$if (defined(cpuarm) and defined(FPC_ABI_EABI))}
-{$define FPC_USEGETTIMEOFDAY}
+  {$define FPC_USEGETTIMEOFDAY}
+  {$undef usestime}
+
+  {$define NO_SYSCALL_TIME}
+  {$define NO_SYSCALL_UMOUNT}
+  {$define NO_SYSCALL_STIME}
+  {$define NO_SYSCALL_ALARM}
+  {$define NO_SYSCALL_UTIME}
+  {$define NO_SYSCALL_GETRLIMIT}
+  {$define NO_SYSCALL_SELECT}
+  {$define NO_SYSCALL_READDIR}
+  {$define NO_SYSCALL_MMAP}
+  {$define NO_SYSCALL_SOCKETCALL}
+  {$define NO_SYSCALL_SYSCALL}
+  {$define NO_SYSCALL_IPC}
 {$endif}
 
  {$ifdef CPUARM}

+ 2 - 1
rtl/linux/ossysc.inc

@@ -568,12 +568,13 @@ begin
  fpgettimeofday:=do_syscall(syscall_nr_gettimeofday,TSysParam(tp),TSysParam(tzp));
 end;
 
-
+{$ifndef NO_SYSCALL_GETRLIMIT}
 function FpGetRLimit(resource : cInt; rlim : PRLimit) : cInt;
 begin
   FpGetRLimit := do_syscall(syscall_nr_getrlimit,
     TSysParam(resource), TSysParam(rlim));
 end;
+{$endif}
 
 {$ifdef HAS_UGETRLIMIT}
 function fpugetrlimit(resource : cInt; rlim : PRLimit) : cInt;

+ 2 - 0
rtl/linux/system.pp

@@ -312,8 +312,10 @@ begin
   {$ifdef has_ugetrlimit}
   success := fpugetrlimit(RLIMIT_STACK, @limits)=0;
   {$endif}
+  {$ifndef NO_SYSCALL_GETRLIMIT}
   if (not success) then
     success := fpgetrlimit(RLIMIT_STACK, @limits)=0;
+  {$endif}
   if (success) and (limits.rlim_cur < stklen) then
     result := limits.rlim_cur
   else

+ 1 - 1
rtl/linux/unixsock.inc

@@ -13,7 +13,7 @@
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 }
 
-{$ifndef cpux86_64}
+{$if not defined(cpux86_64) and not defined(NO_SYSCALL_SOCKETCALL)}
   {$define NEED_SOCKETCALL}
 {$endif}
 

+ 14 - 21
rtl/objpas/cvarutil.inc

@@ -15,15 +15,8 @@
 
 Resourcestring
 
-  SNoWidestrings = 'No widestrings supported';
   SNoInterfaces  = 'No interfaces supported';
 
-Procedure NoWidestrings;
-
-begin
-  Raise Exception.Create(SNoWideStrings);
-end;
-
 Procedure NoInterfaces;
 
 begin
@@ -106,7 +99,7 @@ begin
       else
         VariantTypeMismatch(vType, varSmallInt);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := PSmallInt(vPointer)^;
         varShortInt : Result := PShortInt(vPointer)^;
         varInteger  : Result := smallint(PInteger(vPointer)^);
@@ -189,7 +182,7 @@ begin
       else
         VariantTypeMismatch(vType, varShortInt);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := shortint(PSmallInt(vPointer)^);
         varShortInt : Result := PShortInt(vPointer)^;
         varInteger  : Result := shortint(PInteger(vPointer)^);
@@ -272,7 +265,7 @@ begin
       else
         VariantTypeMismatch(vType, varInteger);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := PSmallInt(vPointer)^;
         varShortInt : Result := PShortInt(vPointer)^;
         varInteger  : Result := PInteger(vPointer)^;
@@ -355,7 +348,7 @@ begin
       else
         VariantTypeMismatch(vType, varLongWord);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := cardinal(PSmallInt(vPointer)^);
         varShortInt : Result := cardinal(PShortInt(vPointer)^);
         varInteger  : Result := cardinal(PInteger(vPointer)^);
@@ -468,7 +461,7 @@ begin
       else
         VariantTypeMismatch(vType, varSingle);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := PSmallInt(vPointer)^;
         varShortInt : Result := PShortInt(vPointer)^;
         varInteger  : Result := PInteger(vPointer)^;
@@ -561,7 +554,7 @@ begin
       else
         VariantTypeMismatch(vType, varDouble);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := PSmallInt(vPointer)^;
         varShortInt : Result := PShortInt(vPointer)^;
         varInteger  : Result := PInteger(vPointer)^;
@@ -688,7 +681,7 @@ begin
       else
         VariantTypeMismatch(vType, varCurrency);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := PSmallInt(vPointer)^;
         varShortInt : Result := PShortInt(vPointer)^;
         varInteger  : Result := PInteger(vPointer)^;
@@ -785,7 +778,7 @@ begin
       else
         VariantTypeMismatch(vType, varDate);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := PSmallInt(vPointer)^;
         varShortInt : Result := PShortInt(vPointer)^;
         varInteger  : Result := PInteger(vPointer)^;
@@ -864,7 +857,7 @@ begin
       else
         VariantTypeMismatch(vType, varBoolean);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := PSmallInt(vPointer)^ <> 0;
         varShortInt : Result := PShortInt(vPointer)^ <> 0;
         varInteger  : Result := PInteger(vPointer)^ <> 0;
@@ -947,7 +940,7 @@ begin
       else
         VariantTypeMismatch(vType, varByte);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := byte(PSmallInt(vPointer)^);
         varShortInt : Result := byte(PShortInt(vPointer)^);
         varInteger  : Result := byte(PInteger(vPointer)^);
@@ -1030,7 +1023,7 @@ begin
       else
         VariantTypeMismatch(vType, varInt64);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := PSmallInt(vPointer)^;
         varShortInt : Result := PShortInt(vPointer)^;
         varInteger  : Result := PInteger(vPointer)^;
@@ -1113,7 +1106,7 @@ begin
       else
         VariantTypeMismatch(vType, varQWord);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := qword(PSmallInt(vPointer)^);
         varShortInt : Result := qword(PShortInt(vPointer)^);
         varInteger  : Result := qword(PInteger(vPointer)^);
@@ -1178,7 +1171,7 @@ begin
       else
         VariantTypeMismatch(vType, varOleStr);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := IntToStr(PSmallInt(vPointer)^);
         varShortInt : Result := IntToStr(PShortInt(vPointer)^);
         varInteger  : Result := IntToStr(PInteger(vPointer)^);
@@ -1243,7 +1236,7 @@ begin
       else
         VariantTypeMismatch(vType, varString);
       end;
-      varByRef: if Assigned(vPointer) then case vType of
+      varByRef: if Assigned(vPointer) then case vType and varTypeMask of
         varSmallInt : Result := IntToStr(PSmallInt(vPointer)^);
         varShortInt : Result := IntToStr(PShortInt(vPointer)^);
         varInteger  : Result := IntToStr(PInteger(vPointer)^);

+ 0 - 11
rtl/unix/bunxovl.inc

@@ -13,10 +13,6 @@
 
  **********************************************************************}
 
-{$if defined(CPUARM) or defined(CPUX86_64) or defined(CPUSPARC)}
-  {$define RTSIGACTION}
-{$endif}
-
 {$I textrec.inc}
 {$I filerec.inc}
 
@@ -161,13 +157,6 @@ begin
  {restart behaviour needs libc}
       sa.sa_flags :=sa.sa_flags or SA_RESTART;
 }
-{$ifdef RTSIGACTION}
-      sa.sa_flags:=SA_SIGINFO
-{$ifdef cpux86_64}
-         or $4000000
-{$endif cpux86_64}
-      ;
-{$endif RTSIGACTION}
      FPSigaction(signum,@sa,@osa);
      if fpgetErrNo<>0 then
        fpsignal:=NIL

+ 3 - 1
rtl/unix/ipc.pp

@@ -23,6 +23,8 @@ Uses
 {$endif}
   BaseUnix,UnixType;
 
+{$i osdefs.inc}       { Compile time defines }
+
 { ----------------------------------------------------------------------
   General IPC stuff
   ----------------------------------------------------------------------}
@@ -517,7 +519,7 @@ uses Syscall;
 
 {$ifndef FPC_USE_LIBC}
  {$ifdef Linux}
-  {$ifdef cpux86_64}
+  {$if defined(cpux86_64) or defined(NO_SYSCALL_IPC)}
     {$i ipcsys.inc}
   {$else}
     {$i ipccall.inc}

+ 2 - 0
rtl/unix/sockets.pp

@@ -17,6 +17,8 @@ Interface
 Uses baseunix,UnixType;
 {$endif}
 
+{$i osdefs.inc}       { Compile time defines }
+
 {$ifdef FreeBSD}
 {$DEFINE SOCK_HAS_SINLEN}               // BSD definition of socketaddr
 {$endif}

+ 1 - 1
rtl/x86_64/x86_64.inc

@@ -654,7 +654,7 @@ end;
 
 procedure WriteBarrier;assembler;nostackframe;{$ifdef SYSTEMINLINE}inline;{$endif}
 asm
-  { no write reordering on intel CPUs (yet) }
+  sfence
 end;
 
 {$endif}

+ 2 - 2
tests/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/06]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/20]
 #
 default: allexectests
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -1578,7 +1578,7 @@ vpath %.elg $(TEST_OUTPUTDIR)
 	$(call QECHO,"  EXECUTE $<")
 ifdef SINGLEDOTESTRUNS
 	$(Q)$(DOTEST) $(DOTESTOPT) -e $<
-endif SINGLEDOTESTRUNS
+endif
 .PHONY: alltbs alltbf allwebtbs allwebtbf alltest alltests
 alltbs : testprep $(patsubst %.pp,%.log,$(wildcard tbs/t*.pp))
 alltbf : testprep $(patsubst %.pp,%.log,$(wildcard tbf/t*.pp))

+ 1 - 1
tests/Makefile.fpc

@@ -296,7 +296,7 @@ vpath %.elg $(TEST_OUTPUTDIR)
 	$(call QECHO,"  EXECUTE $<")
 ifdef SINGLEDOTESTRUNS
 	$(Q)$(DOTEST) $(DOTESTOPT) -e $<
-endif SINGLEDOTESTRUNS
+endif
 
 ################################
 # Compile tests

+ 13 - 13
tests/tbs/tb0524.pp

@@ -15,10 +15,10 @@ var s,t:string;
     i:byte;
 
 begin
-   lsock:=socket(af_inet,sock_stream,0);
+   lsock:=fpsocket(af_inet,sock_stream,0);
    if lsock=-1 then
      begin
-       writeln(socketerror);
+       writeln('socket:',socketerror);
        halt(1);
      end;
 
@@ -29,23 +29,23 @@ begin
       addr:=0;
    end;
 
-  if not bind(lsock,saddr,sizeof(saddr)) then
+  if  fpbind(lsock,@saddr,sizeof(saddr))<>0 then
     begin
-      writeln(socketerror);
+      writeln('bind:',socketerror);
       halt(1);
     end;
 
-  if not listen(lsock,1) then
+  if  fplisten(lsock,1)<>0 then
     begin
-      writeln(socketerror);
+      writeln('listen:',socketerror);
       halt(1);
     end;
 
   len:=sizeof(saddr);
-  usock:=accept(lsock,saddr,len);
+  usock:=fpaccept(lsock,@saddr,@len);
   if usock=-1 then
     begin
-      writeln(SocketError);
+      writeln('accept:',SocketError);
       halt(1);
     end;
   sock2text(usock,sin,sout);
@@ -61,7 +61,7 @@ begin
   until eof(sin);
   close(sin);
   close(sout);
-  shutdown(usock,2);
+  fpshutdown(usock,2);
 end;
 
 procedure do_client;
@@ -72,13 +72,13 @@ var s:sizeint;
     str:ansistring;
 
 begin
-   s:=socket(af_inet,sock_stream,0);
+   s:=fpsocket(af_inet,sock_stream,0);
    saddr.sin_family:=af_inet;
    saddr.sin_port:=htons(port);
    saddr.sin_addr.s_addr:=hosttonet($7f000001); {127.0.0.1}
-   if connect(s,saddr,sin,sout)=false then
+   if not connect(s,saddr,sin,sout) then
      begin
-       writeln(socketerror);
+       writeln('connect:',socketerror);
        halt(1);
      end;
    writeln(sout,'abcd');
@@ -91,7 +91,7 @@ begin
      halt(1);
    close(sin);
    close(sout);
-   shutdown(s,2);
+   fpshutdown(s,2);
 end;
 
 begin

+ 48 - 0
tests/test/packages/webtbs/tw14265.pp

@@ -0,0 +1,48 @@
+{ %target=linux }
+{ %opt=-Xt }
+
+program phello;
+{$linklib c}
+
+{$packrecords c}
+
+uses
+  ctypes, unixtype, pthreads;
+
+const N = 2;
+var
+  res:array[1..N] of Integer;
+
+function Hello(arg: pointer): longint; cdecl;
+begin
+//  writeln('Hello from thread #', PInteger(arg)^);
+  res[PInteger(arg)^] := PInteger(arg)^;
+  Hello := 0;
+  pthread_exit(pointer(Hello));
+end;
+
+var
+  i: Integer;
+  ret: Pointer;
+  arg: array[1..N] of Integer;
+  threads: array[1..N] of TThreadID;
+  attr: TThreadAttr;
+begin
+  Writeln('Testing simple thread creation');
+  pthread_attr_init(attr);
+  for i := 1 to N do
+  begin
+    Writeln('Creating thread #',i);
+    arg[i] := i;
+    if pthread_create(threads[i], attr, @Hello, @arg[i]) <> 0 then
+      Writeln('Failed to create thread');
+  end;
+  for i := 1 to N do
+  begin
+    Write('Waiting for thread #',i, ' ... ');
+    pthread_join(threads[i], ret);
+    Writeln('result: ', res[i]);
+  end;
+end.
+
+

+ 44 - 0
tests/webtbs/tw14230.pp

@@ -0,0 +1,44 @@
+program test2;
+//The i's are used to have a better understanding of what is actually happening...
+type
+  tsrec = record i: single; end;
+var i,new_i:longword;
+    j,new_j:single;
+    k:double;
+    s:string;
+    Err:integer;
+    count:int64;
+begin
+   randomize;
+   count:=0;
+   repeat
+      //As k is set to be a single-precision number, there should not be 
+      //any rounding off or truncation problem...
+      k:=2*random-1;
+      j:=k;
+      i:=longword(tsrec(j));
+      Str(j,s);
+      Val(s,new_j,Err);
+      if (err<>0) then
+        break;
+      new_i:=longword(tsrec(new_j));
+      count:=count+1;
+   until count=50000;
+   if (new_i<>i) then
+     begin
+       writeln;
+       writeln('Error occurs');
+       writeln;
+       writeln(' err=',err);
+       writeln(' i=',i);
+       writeln(' j=',j);
+       writeln(' k=',k);
+       writeln;
+       writeln(' s=',s);
+       writeln;
+       writeln('new_i=',new_i);
+       writeln('new_j=',new_j);
+       writeln(' k=',k);
+       halt(1);
+     end;
+end.

+ 38 - 0
tests/webtbs/tw14514.pp

@@ -0,0 +1,38 @@
+{ %target=linux,darwin,solaris,freebsd,haiku,beos }
+
+program TestSignal;
+
+{$MODE objfpc}
+
+uses
+  BaseUnix,
+  sysutils;
+
+var
+  Ok: Boolean;
+
+procedure signal_handler(sig: LongInt); cdecl;
+begin
+  Writeln('4');
+  Ok := True;
+end;
+
+var
+  Pid: pid_t;
+begin
+  Ok := False;
+  Writeln('1');
+  fpsignal(SIGUSR1, @signal_handler);
+  Writeln('2');
+  Pid := fpgetpid;
+  Writeln('3');
+  fpkill(Pid, SIGUSR1);
+
+  sleep(500);
+  if not ok then
+    halt(1);
+
+  Writeln('5');
+  Writeln('done');
+end.
+

+ 36 - 0
tests/webtbs/tw14536.pp

@@ -0,0 +1,36 @@
+program test_varbyref;
+
+{$mode objfpc}{$H+}
+{$apptype console}
+
+uses
+  Variants, VarUtils;
+
+var
+  V: Variant;
+  P: Integer;
+begin
+  P := 1;
+  TVarData(V).vtype := varbyref or varinteger;
+  TVarData(V).vpointer := @P;
+  WriteLn(VariantToAnsiString(TVarData(V)));
+  WriteLn(VariantToSmallInt(TVarData(V)));
+  WriteLn(VariantToLongint(TVarData(V)));
+  WriteLn(VariantToShortint(TVarData(V)));
+  WriteLn(VariantToCardinal(TVarData(V)));
+  WriteLn(VariantToSingle(TVarData(V)));
+  WriteLn(VariantToDouble(TVarData(V)));
+  WriteLn(VariantToDate(TVarData(V)));
+  WriteLn(VariantToCurrency(TVarData(V)));
+  WriteLn(VariantToBoolean(TVarData(V)));
+  WriteLn(VariantToByte(TVarData(V)));
+  WriteLn(VariantToInt64(TVarData(V)));
+  WriteLn(VariantToQWord(TVarData(V)));
+  WriteLn(VariantToWideString(TVarData(V)));
+  WriteLn(VariantToAnsiString(TVarData(V)));
+  WriteLn(VariantToShortString(TVarData(V)));
+  WriteLn(V);
+  TVarData(V).vtype := varEmpty;
+  TVarData(V).vpointer := nil;
+end.
+

+ 175 - 1
utils/fppkg/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/02]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2009/08/17]
 #
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded
@@ -441,6 +441,180 @@ ifeq ($(FULL_TARGET),armeb-embedded)
 override TARGET_PROGRAMS+=fppkg
 endif
 ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override TARGET_UNITS+=buildfppkg
+endif
+ifeq ($(FULL_TARGET),i386-linux)
 override TARGET_IMPLICITUNITS+=fprepos fpxmlrep pkgoptions pkgglobals pkgmessages pkghandler pkgmkconv pkgdownload pkgfpmake pkgcommands pkgrepos  pkgwget  pkglnet
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)

+ 1 - 0
utils/fppkg/Makefile.fpc

@@ -8,6 +8,7 @@ version=2.2.2
 
 [target]
 programs=fppkg
+units=buildfppkg
 implicitunits=fprepos fpxmlrep pkgoptions pkgglobals pkgmessages pkghandler pkgmkconv pkgdownload pkgfpmake pkgcommands pkgrepos
 implicitunits_linux=pkgwget  pkglnet
 implicitunits_beos=pkgwget pkglnet

+ 12 - 0
utils/fppkg/buildfppkg.pp

@@ -0,0 +1,12 @@
+unit buildfppkg;
+
+  interface
+
+    uses
+      fprepos,fpxmlrep,pkgoptions,pkgglobals,pkgmessages,pkghandler,pkgmkconv,pkgdownload,pkgfpmake,pkgcommands,pkgrepos,pkgwget,pkglnet;
+
+  implementation
+
+end.
+
+