Browse Source

Merged revisions 8695,8698,8702,8705,8707,8710-8715,8717-8723,8727,8730-8731,8737,8743,8747-8751,8766-8769,8771,8797,8822,8828,8831,8833-8834,8842,8848-8849,8851-8853,8869,8879,8885-8889,8891-8893,8895,8897,8912,8917,8938,8942,8946 via svnmerge from
http://svn.freepascal.org/svn/fpc/trunk

........
r8695 | micha | 2007-09-30 17:00:54 +0200 (Sun, 30 Sep 2007) | 1 line

+ add -XR switch for target root file system with libs (also used for C lib type detection)
........
r8698 | florian | 2007-09-30 17:30:00 +0200 (Sun, 30 Sep 2007) | 2 lines

* fixed compilation for x86-64
........
r8707 | micha | 2007-09-30 23:20:04 +0200 (Sun, 30 Sep 2007) | 1 line

* fix default dynamic linker location for 64 bit targets in linux
........
r8715 | peter | 2007-10-01 18:55:08 +0200 (Mon, 01 Oct 2007) | 4 lines

* new tf_smartlink_library flag
* use create_smartlink[_sections|_library] to check what to
do for smartlinking
........
r8717 | jonas | 2007-10-01 22:01:41 +0200 (Mon, 01 Oct 2007) | 2 lines

* fixed compilation after r8715 (+ aasmbase to uses clause)
........
r8718 | micha | 2007-10-01 23:10:51 +0200 (Mon, 01 Oct 2007) | 1 line

* only use ld -T in case of cross-link (-XR), because not all platforms have complete link script yet
........
r8720 | jonas | 2007-10-02 10:31:04 +0200 (Tue, 02 Oct 2007) | 2 lines

* r8717 for ppc64 (fixed compilation after r8715)
........
r8737 | hajny | 2007-10-07 15:47:30 +0200 (Sun, 07 Oct 2007) | 1 line

+ fcl-json added to install.dat
........
r8771 | florian | 2007-10-12 18:14:49 +0200 (Fri, 12 Oct 2007) | 2 lines

* fixed compilation on arm in extdebug mode
........
r8828 | peter | 2007-10-16 22:55:24 +0200 (Tue, 16 Oct 2007) | 4 lines

* look in main source dir instead of loaded_from unit dirs. The loaded_from dir is normally
already searched by the unit search path. And it prevented overriding the path where to
look first for a unit. See bug #9664
........
r8833 | jonas | 2007-10-17 21:25:06 +0200 (Wed, 17 Oct 2007) | 3 lines

* pass "-syslibroot sysrootpath" to the darwin linker if -XRsysrootpath
is used (mantis #9953)
........
r8834 | jonas | 2007-10-17 21:37:32 +0200 (Wed, 17 Oct 2007) | 3 lines

+ documented -XR in the help pages
* specified OSes to which -Xr applies
........
r8842 | peter | 2007-10-18 21:55:22 +0200 (Thu, 18 Oct 2007) | 2 lines

* -CO option to check for possible integer overflows
........
r8852 | florian | 2007-10-19 20:41:26 +0200 (Fri, 19 Oct 2007) | 2 lines

* fixed Makefile to build writeidx on win32 and linux
........
r8853 | florian | 2007-10-19 22:27:45 +0200 (Fri, 19 Oct 2007) | 2 lines

* made rtti for dyn. arrays more delphi compatible, resolves #9464
........
r8869 | micha | 2007-10-21 10:45:31 +0200 (Sun, 21 Oct 2007) | 1 line

* make testsuite quieter
........
r8938 | jonas | 2007-10-25 22:30:04 +0200 (Thu, 25 Oct 2007) | 7 lines

* Only start caching a directory once more than 20 lookups have been
done in it, to avoid caching very large current directories (such as
those of the testsuite) without reason. It would be better if that
decision were based on a fraction of the total number of entries in
each directory, but that information doesn not appear to be available
in a cross-platform way
........
r8946 | jonas | 2007-10-26 15:01:01 +0200 (Fri, 26 Oct 2007) | 4 lines

* mark darwin as case sensitive, because the dircache isn't always used
anymore (the dircache masks the effects of case-sensitive file
systems on targets marked as case-aware)
........

git-svn-id: branches/fixes_2_2@9086 -

peter 18 years ago
parent
commit
aa3e7d0288
47 changed files with 490 additions and 337 deletions
  1. 21 6
      compiler/aasmbase.pas
  2. 2 3
      compiler/aasmtai.pas
  3. 2 2
      compiler/aggas.pas
  4. 5 2
      compiler/arm/aasmcpu.pas
  5. 1 1
      compiler/arm/cgcpu.pas
  6. 78 34
      compiler/cfileutils.pas
  7. 13 14
      compiler/fppu.pas
  8. 3 1
      compiler/globals.pas
  9. 1 1
      compiler/globtype.pas
  10. 2 5
      compiler/htypechk.pas
  11. 1 1
      compiler/i386/ag386nsm.pas
  12. 1 2
      compiler/i386/cgcpu.pas
  13. 1 1
      compiler/m68k/cgcpu.pas
  14. 3 1
      compiler/msg/errore.msg
  15. 1 1
      compiler/msgidx.inc
  16. 76 72
      compiler/msgtxt.inc
  17. 27 3
      compiler/ncgrtti.pas
  18. 1 1
      compiler/ncgutil.pas
  19. 1 1
      compiler/ogcoff.pas
  20. 1 1
      compiler/ogelf.pas
  21. 13 7
      compiler/options.pas
  22. 3 6
      compiler/pmodules.pas
  23. 2 2
      compiler/powerpc/itcpugas.pas
  24. 3 3
      compiler/powerpc64/itcpugas.pas
  25. 6 6
      compiler/ppcgen/cgppc.pas
  26. 1 1
      compiler/psub.pas
  27. 1 1
      compiler/ptconst.pas
  28. 1 0
      compiler/systems.pas
  29. 3 1
      compiler/systems/i_beos.pas
  30. 9 9
      compiler/systems/i_bsd.pas
  31. 16 9
      compiler/systems/i_linux.pas
  32. 2 1
      compiler/systems/i_nwl.pas
  33. 2 1
      compiler/systems/i_nwm.pas
  34. 3 2
      compiler/systems/i_sunos.pas
  35. 1 1
      compiler/systems/i_symbian.pas
  36. 2 2
      compiler/systems/i_win.pas
  37. 1 1
      compiler/systems/t_beos.pas
  38. 9 2
      compiler/systems/t_bsd.pas
  39. 46 42
      compiler/systems/t_linux.pas
  40. 1 1
      compiler/systems/t_macos.pas
  41. 1 1
      compiler/systems/t_sunos.pas
  42. 2 2
      compiler/systems/t_win.pas
  43. 83 64
      installer/Makefile
  44. 7 5
      installer/Makefile.fpc
  45. 21 13
      installer/install.dat
  46. 9 0
      rtl/objpas/typinfo.pp
  47. 1 1
      tests/webtbf/tw4737.pp

+ 21 - 6
compiler/aasmbase.pas

@@ -130,8 +130,9 @@ interface
          function getaltcopy(AList:TFPHashObjectList;altnr: longint): TAsmSymbol; override;
          function getaltcopy(AList:TFPHashObjectList;altnr: longint): TAsmSymbol; override;
        end;
        end;
 
 
-    function  use_smartlink_section:boolean;
-    function  maybe_smartlink_symbol:boolean;
+    function create_smartlink_sections:boolean;inline;
+    function create_smartlink_library:boolean;inline;
+    function create_smartlink:boolean;inline;
 
 
     function LengthUleb128(a: qword) : byte;
     function LengthUleb128(a: qword) : byte;
     function LengthSleb128(a: int64) : byte;
     function LengthSleb128(a: int64) : byte;
@@ -146,17 +147,31 @@ implementation
       verbose;
       verbose;
 
 
 
 
-    function use_smartlink_section:boolean;
+    function create_smartlink_sections:boolean;inline;
       begin
       begin
         result:=(af_smartlink_sections in target_asm.flags) and
         result:=(af_smartlink_sections in target_asm.flags) and
                 (tf_smartlink_sections in target_info.flags);
                 (tf_smartlink_sections in target_info.flags);
       end;
       end;
 
 
 
 
-    function maybe_smartlink_symbol:boolean;
+    function create_smartlink_library:boolean;inline;
       begin
       begin
-        result:=(cs_Create_smart in current_settings.moduleswitches) or
-                use_smartlink_section;
+        result:=(cs_Create_smart in current_settings.moduleswitches) and
+                (tf_smartlink_library in target_info.flags) and
+                not create_smartlink_sections;
+      end;
+
+
+    function create_smartlink:boolean;inline;
+      begin
+        result:=(
+                 (af_smartlink_sections in target_asm.flags) and
+                 (tf_smartlink_sections in target_info.flags)
+                ) or
+                (
+                 (cs_Create_smart in current_settings.moduleswitches) and
+                 (tf_smartlink_library in target_info.flags)
+                );
       end;
       end;
 
 
 
 

+ 2 - 3
compiler/aasmtai.pas

@@ -637,8 +637,7 @@ implementation
 
 
     procedure maybe_new_object_file(list:TAsmList);
     procedure maybe_new_object_file(list:TAsmList);
       begin
       begin
-        if (cs_create_smart in current_settings.moduleswitches) and
-           (not use_smartlink_section) then
+        if create_smartlink_library then
           list.concat(tai_cutobject.create);
           list.concat(tai_cutobject.create);
       end;
       end;
 
 
@@ -657,7 +656,7 @@ implementation
         list.concat(tai_section.create(Asectype,Aname,Aalign));
         list.concat(tai_section.create(Asectype,Aname,Aalign));
         list.concat(cai_align.create(Aalign));
         list.concat(cai_align.create(Aalign));
         if Aglobal or
         if Aglobal or
-           maybe_smartlink_symbol then
+           create_smartlink then
           list.concat(tai_symbol.createname_global(Aname,Asymtyp,0))
           list.concat(tai_symbol.createname_global(Aname,Asymtyp,0))
         else
         else
           list.concat(tai_symbol.createname(Aname,Asymtyp,0));
           list.concat(tai_symbol.createname(Aname,Asymtyp,0));

+ 2 - 2
compiler/aggas.pas

@@ -316,7 +316,7 @@ implementation
           it is easier to disable it for smartlinking. It doesn't take up
           it is easier to disable it for smartlinking. It doesn't take up
           filespace }
           filespace }
         if not(target_info.system in systems_darwin) and
         if not(target_info.system in systems_darwin) and
-           use_smartlink_section and
+           create_smartlink_sections and
            (aname<>'') and
            (aname<>'') and
            (atype <> sec_toc) and
            (atype <> sec_toc) and
            (atype<>sec_bss) then
            (atype<>sec_bss) then
@@ -1065,7 +1065,7 @@ implementation
           AsmWriteLn(target_asm.comment+'End asmlist '+AsmlistTypeStr[hal]);
           AsmWriteLn(target_asm.comment+'End asmlist '+AsmlistTypeStr[hal]);
         end;
         end;
 
 
-      if (cs_create_smart in current_settings.moduleswitches) and
+      if create_smartlink_sections and
          (target_info.system in systems_darwin) then
          (target_info.system in systems_darwin) then
         AsmWriteLn(#9'.subsections_via_symbols');
         AsmWriteLn(#9'.subsections_via_symbols');
 
 

+ 5 - 2
compiler/arm/aasmcpu.pas

@@ -1559,8 +1559,6 @@ implementation
       end;
       end;
 
 
 
 
-end.
-
 {$ifdef dummy}
 {$ifdef dummy}
       (*
       (*
 static void gencode (long segment, long offset, int bits,
 static void gencode (long segment, long offset, int bits,
@@ -2499,3 +2497,8 @@ static char *CC[] =
 *)
 *)
 {$endif dummy
 {$endif dummy
 }
 }
+
+begin
+  cai_align:=tai_align;
+end.
+

+ 1 - 1
compiler/arm/cgcpu.pas

@@ -1883,7 +1883,7 @@ unit cgcpu;
 
 
         make_global:=false;
         make_global:=false;
         if (not current_module.is_unit) or
         if (not current_module.is_unit) or
-           (cs_create_smart in current_settings.moduleswitches) or
+           create_smartlink or
            (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
            (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
           make_global:=true;
           make_global:=true;
 
 

+ 78 - 34
compiler/cfileutils.pas

@@ -46,18 +46,26 @@ interface
       CUtils,CClasses,
       CUtils,CClasses,
       Systems;
       Systems;
 
 
+    const
+      { On case sensitive file systems, you have 9 lookups per used unit, }
+      { including the system unit, in the current directory               }
+      MinSearchesBeforeCache = 20;
+
     type
     type
       TCachedDirectory = class(TFPHashObject)
       TCachedDirectory = class(TFPHashObject)
       private
       private
         FDirectoryEntries : TFPHashList;
         FDirectoryEntries : TFPHashList;
+        FSearchCount: longint;
         procedure FreeDirectoryEntries;
         procedure FreeDirectoryEntries;
         function GetItemAttr(const AName: TCmdStr): byte;
         function GetItemAttr(const AName: TCmdStr): byte;
+        function TryUseCache: boolean;
+        procedure ForceUseCache;
+        procedure Reload;
       public
       public
         constructor Create(AList:TFPHashObjectList;const AName:TCmdStr);
         constructor Create(AList:TFPHashObjectList;const AName:TCmdStr);
         destructor  destroy;override;
         destructor  destroy;override;
-        procedure Reload;
         function FileExists(const AName:TCmdStr):boolean;
         function FileExists(const AName:TCmdStr):boolean;
-        function FileExistsCaseAware(const AName:TCmdStr; out FoundName: TCmdStr):boolean;
+        function FileExistsCaseAware(const path, fn: TCmdStr; out FoundName: TCmdStr):boolean;
         function DirectoryExists(const AName:TCmdStr):boolean;
         function DirectoryExists(const AName:TCmdStr):boolean;
         property DirectoryEntries:TFPHashList read FDirectoryEntries;
         property DirectoryEntries:TFPHashList read FDirectoryEntries;
       end;
       end;
@@ -84,7 +92,7 @@ interface
         constructor Create;
         constructor Create;
         destructor  destroy;override;
         destructor  destroy;override;
         function FileExists(const AName:TCmdStr):boolean;
         function FileExists(const AName:TCmdStr):boolean;
-        function FileExistsCaseAware(const AName:TCmdStr; out FoundName: TCmdStr):boolean;
+        function FileExistsCaseAware(const path, fn: TCmdStr; out FoundName: TCmdStr):boolean;
         function DirectoryExists(const AName:TCmdStr):boolean;
         function DirectoryExists(const AName:TCmdStr):boolean;
         function FindFirst(const APattern:TCmdStr;var Res:TCachedSearchRec):boolean;
         function FindFirst(const APattern:TCmdStr;var Res:TCachedSearchRec):boolean;
         function FindNext(var Res:TCachedSearchRec):boolean;
         function FindNext(var Res:TCachedSearchRec):boolean;
@@ -175,6 +183,32 @@ implementation
       end;
       end;
 
 
 
 
+    function TCachedDirectory.TryUseCache:boolean;
+      begin
+        Result:=true;
+        if (FSearchCount > MinSearchesBeforeCache) then
+          exit;
+        if (FSearchCount = MinSearchesBeforeCache) then
+          begin
+            inc(FSearchCount);
+            Reload;
+            exit;
+          end;
+        inc(FSearchCount);
+        Result:=false;
+      end;
+
+
+    procedure TCachedDirectory.ForceUseCache;
+      begin
+        if (FSearchCount<=MinSearchesBeforeCache) then
+          begin
+            FSearchCount:=MinSearchesBeforeCache+1;
+            Reload;
+          end;
+      end;
+
+
     procedure TCachedDirectory.FreeDirectoryEntries;
     procedure TCachedDirectory.FreeDirectoryEntries;
       var
       var
         i: Integer;
         i: Integer;
@@ -243,6 +277,12 @@ implementation
       var
       var
         Attr : Longint;
         Attr : Longint;
       begin
       begin
+        if not TryUseCache then
+          begin
+            { prepend directory name again }
+            result:=cfileutils.FileExists(Name+AName,false);
+            exit;
+          end;
         Attr:=GetItemAttr(AName);
         Attr:=GetItemAttr(AName);
         if Attr<>0 then
         if Attr<>0 then
           Result:=((Attr and faDirectory)=0)
           Result:=((Attr and faDirectory)=0)
@@ -251,25 +291,28 @@ implementation
       end;
       end;
 
 
 
 
-    function TCachedDirectory.FileExistsCaseAware(const AName:TCmdStr; out FoundName: TCmdStr):boolean;
+    function TCachedDirectory.FileExistsCaseAware(const path, fn: TCmdStr; out FoundName: TCmdStr):boolean;
       var
       var
         entry : PCachedDirectoryEntry;
         entry : PCachedDirectoryEntry;
         Attr  : Longint;
         Attr  : Longint;
       begin
       begin
         if (tf_files_case_aware in source_info.flags) then
         if (tf_files_case_aware in source_info.flags) then
           begin
           begin
-            entry:=PCachedDirectoryEntry(DirectoryEntries.Find(Lower(AName)));
-            if assigned(entry) then
+            if not TryUseCache then
               begin
               begin
-                Attr:=entry^.Attr;
-                FoundName:=entry^.RealName
+                Result:=FileExistsNonCase(path,fn,false,FoundName);
+                exit;
+              end;
+            entry:=PCachedDirectoryEntry(DirectoryEntries.Find(Lower(ExtractFileName(fn))));
+            if assigned(entry) and
+               (entry^.Attr<>0) and
+               ((entry^.Attr and faDirectory) = 0) then
+              begin
+                 FoundName:=ExtractFilePath(path+fn)+entry^.RealName;
+                 Result:=true
               end
               end
             else
             else
-              Attr:=0;
-            if Attr<>0 then
-              Result:=((Attr and faDirectory)=0)
-            else
-              Result:=false
+              Result:=false;
           end
           end
         else
         else
           { should not be called in this case, use plain FileExists }
           { should not be called in this case, use plain FileExists }
@@ -281,6 +324,11 @@ implementation
       var
       var
         Attr : Longint;
         Attr : Longint;
       begin
       begin
+        if not TryUseCache then
+          begin
+            Result:=PathExists(Name+AName,false);
+            exit;
+          end;
         Attr:=GetItemAttr(AName);
         Attr:=GetItemAttr(AName);
         if Attr<>0 then
         if Attr<>0 then
           Result:=((Attr and faDirectory)=faDirectory)
           Result:=((Attr and faDirectory)=faDirectory)
@@ -313,15 +361,12 @@ implementation
         DirName   : TCmdStr;
         DirName   : TCmdStr;
       begin
       begin
         if ADir='' then
         if ADir='' then
-          DirName:='.'
+          DirName:='.'+source_info.DirSep
         else
         else
           DirName:=ADir;
           DirName:=ADir;
         CachedDir:=TCachedDirectory(FDirectories.Find(DirName));
         CachedDir:=TCachedDirectory(FDirectories.Find(DirName));
         if not assigned(CachedDir) then
         if not assigned(CachedDir) then
-          begin
-            CachedDir:=TCachedDirectory.Create(FDirectories,DirName);
-            CachedDir.Reload;
-          end;
+          CachedDir:=TCachedDirectory.Create(FDirectories,DirName);
         Result:=CachedDir;
         Result:=CachedDir;
       end;
       end;
 
 
@@ -331,24 +376,20 @@ implementation
         CachedDir : TCachedDirectory;
         CachedDir : TCachedDirectory;
       begin
       begin
         Result:=false;
         Result:=false;
-        CachedDir:=GetDirectory(ExtractFileDir(AName));
+        CachedDir:=GetDirectory(ExtractFilePath(AName));
         if assigned(CachedDir) then
         if assigned(CachedDir) then
           Result:=CachedDir.FileExists(ExtractFileName(AName));
           Result:=CachedDir.FileExists(ExtractFileName(AName));
       end;
       end;
 
 
 
 
-    function TDirectoryCache.FileExistsCaseAware(const AName:TCmdStr; out FoundName:TCmdStr):boolean;
+    function TDirectoryCache.FileExistsCaseAware(const path, fn: TCmdStr; out FoundName: TCmdStr):boolean;
       var
       var
         CachedDir : TCachedDirectory;
         CachedDir : TCachedDirectory;
       begin
       begin
         Result:=false;
         Result:=false;
-        CachedDir:=GetDirectory(ExtractFileDir(AName));
+        CachedDir:=GetDirectory(ExtractFilePath(path+fn));
         if assigned(CachedDir) then
         if assigned(CachedDir) then
-          begin
-            Result:=CachedDir.FileExistsCaseAware(ExtractFileName(AName),FoundName);
-            if Result then
-              FoundName:=ExtractFilePath(AName)+FoundName;
-          end;
+          Result:=CachedDir.FileExistsCaseAware(path,fn,FoundName);
       end;
       end;
 
 
 
 
@@ -367,6 +408,7 @@ implementation
       begin
       begin
         Res.Pattern:=ExtractFileName(APattern);
         Res.Pattern:=ExtractFileName(APattern);
         Res.CachedDir:=GetDirectory(ExtractFilePath(APattern));
         Res.CachedDir:=GetDirectory(ExtractFilePath(APattern));
+        Res.CachedDir.ForceUseCache;
         Res.EntryIndex:=0;
         Res.EntryIndex:=0;
         if assigned(Res.CachedDir) then
         if assigned(Res.CachedDir) then
           Result:=FindNext(Res)
           Result:=FindNext(Res)
@@ -538,11 +580,10 @@ implementation
                 Search order for case aware systems:
                 Search order for case aware systems:
                  1. NormalCase
                  1. NormalCase
               }
               }
-              FoundFile:=path+fn;
 {$ifdef usedircache}
 {$ifdef usedircache}
               if allowcache then
               if allowcache then
                 begin
                 begin
-                  result:=DirCache.FileExistsCaseAware(FoundFile,fn2);
+                  result:=DirCache.FileExistsCaseAware(path,fn,fn2);
                   if result then
                   if result then
                     begin
                     begin
                       FoundFile:=fn2;
                       FoundFile:=fn2;
@@ -551,12 +592,15 @@ implementation
                 end
                 end
               else
               else
 {$endif usedircache}
 {$endif usedircache}
-                If FileExists(FoundFile,allowcache) then
-                  begin
-                    { don't know the real name in this case }
-                    result:=true;
-                    exit;
-                 end;
+                begin
+                  FoundFile:=path+fn;
+                  If FileExists(FoundFile,allowcache) then
+                    begin
+                      { don't know the real name in this case }
+                      result:=true;
+                      exit;
+                   end;
+                end;
            end
            end
         else
         else
           begin
           begin

+ 13 - 14
compiler/fppu.pas

@@ -363,18 +363,21 @@ uses
          { try to find unit
          { try to find unit
             1. look for ppu in cwd
             1. look for ppu in cwd
             2. look for ppu in outputpath if set, this is tp7 compatible (PFV)
             2. look for ppu in outputpath if set, this is tp7 compatible (PFV)
-            3. look for the specified source file (from the uses line)
-            4. look for source in cwd
-            5. look in same path as local unit
-            6. local unit pathlist
-            7. global unit pathlist }
+            3. look for ppu in maindir
+            4. look for the specified source file (from the uses line)
+            5. look for source in cwd
+            6. look for source in maindir
+            7. local unit pathlist
+            8. global unit pathlist }
          fnd:=false;
          fnd:=false;
          if not onlysource then
          if not onlysource then
           begin
           begin
             fnd:=PPUSearchPath('.');
             fnd:=PPUSearchPath('.');
             if (not fnd) and (outputpath^<>'') then
             if (not fnd) and (outputpath^<>'') then
              fnd:=PPUSearchPath(outputpath^);
              fnd:=PPUSearchPath(outputpath^);
-           end;
+            if (not fnd) and Assigned(main_module) and (main_module.Path^<>'')  then
+             fnd:=PPUSearchPath(main_module.Path^);
+          end;
          if (not fnd) and (sourcefn^<>'') then
          if (not fnd) and (sourcefn^<>'') then
           begin
           begin
             { the full filename is specified so we can't use here the
             { the full filename is specified so we can't use here the
@@ -403,14 +406,10 @@ uses
           end;
           end;
          if not fnd then
          if not fnd then
            fnd:=SourceSearchPath('.');
            fnd:=SourceSearchPath('.');
-         if (not fnd) and Assigned(Loaded_From) then
-           begin
-             fnd:=PPUSearchPath(Loaded_From.Path^);
-             if not fnd then
-               fnd:=SourceSearchPath(Loaded_From.Path^);
-             if not fnd then
-               fnd:=SearchPathList(Loaded_From.LocalUnitSearchPath);
-           end;
+         if (not fnd) and Assigned(main_module) and (main_module.Path^<>'') then
+           fnd:=SourceSearchPath(main_module.Path^);
+         if (not fnd) and Assigned(loaded_from) then
+           fnd:=SearchPathList(loaded_from.LocalUnitSearchPath);
          if not fnd then
          if not fnd then
            fnd:=SearchPathList(UnitSearchPath);
            fnd:=SearchPathList(UnitSearchPath);
 
 

+ 3 - 1
compiler/globals.pas

@@ -199,7 +199,8 @@ interface
        utilsprefix    : TCmdStr;
        utilsprefix    : TCmdStr;
        cshared        : boolean;        { pass --shared to ld to link C libs shared}
        cshared        : boolean;        { pass --shared to ld to link C libs shared}
        Dontlinkstdlibpath: Boolean;     { Don't add std paths to linkpath}
        Dontlinkstdlibpath: Boolean;     { Don't add std paths to linkpath}
-       rlinkpath      : TCmdStr;         { rpath-link linkdir override}
+       rlinkpath      : TCmdStr;        { rpath-link linkdir override}
+       sysrootpath    : TCmdStr;        { target system root to search dyn linker }
 
 
        { some flags for global compiler switches }
        { some flags for global compiler switches }
        do_build,
        do_build,
@@ -1176,6 +1177,7 @@ implementation
         utilsprefix:='';
         utilsprefix:='';
         cshared:=false;
         cshared:=false;
         rlinkpath:='';
         rlinkpath:='';
+        sysrootpath:='';
 
 
         { Search Paths }
         { Search Paths }
         librarysearchpath:=TSearchPathList.Create;
         librarysearchpath:=TSearchPathList.Create;

+ 1 - 1
compiler/globtype.pas

@@ -83,7 +83,7 @@ interface
          { codegen }
          { codegen }
          cs_check_overflow,cs_check_range,cs_check_object,
          cs_check_overflow,cs_check_range,cs_check_object,
          cs_check_io,cs_check_stack,
          cs_check_io,cs_check_stack,
-         cs_checkpointer,
+         cs_checkpointer,cs_check_ordinal_size,
          cs_generate_stackframes,cs_do_assertion,cs_generate_rtti,
          cs_generate_stackframes,cs_do_assertion,cs_generate_rtti,
          cs_full_boolean_eval,cs_typed_const_writable,cs_allow_enum_calc,
          cs_full_boolean_eval,cs_typed_const_writable,cs_allow_enum_calc,
          cs_do_inline,cs_fpu_fwait,
          cs_do_inline,cs_fpu_fwait,

+ 2 - 5
compiler/htypechk.pas

@@ -2592,10 +2592,8 @@ implementation
 
 
     procedure check_ranges(const location: tfileposinfo; source: tnode; destdef: tdef);
     procedure check_ranges(const location: tfileposinfo; source: tnode; destdef: tdef);
       begin
       begin
-      {These checks create too much false positives. They might be usefull if we have
-       TP styled common type arithmetic semantics, but with the current semantics
-       there are not usefull.}
-      {$ifdef check_ranges_warnings}
+        if not(cs_check_ordinal_size in current_settings.localswitches) then
+          exit;
         { check if the assignment may cause a range check error }
         { check if the assignment may cause a range check error }
         { if its not explicit, and only if the values are       }
         { if its not explicit, and only if the values are       }
         { ordinals, enumdef and floatdef                        }
         { ordinals, enumdef and floatdef                        }
@@ -2615,7 +2613,6 @@ implementation
                  MessagePos(location,type_h_smaller_possible_range_check);
                  MessagePos(location,type_h_smaller_possible_range_check);
              end;
              end;
          end;
          end;
-      {$endif}
       end;
       end;
 
 
 
 

+ 1 - 1
compiler/i386/ag386nsm.pas

@@ -422,7 +422,7 @@ interface
         AsmLn;
         AsmLn;
         AsmWrite('SECTION ');
         AsmWrite('SECTION ');
         AsmWrite(secnames[atype]);
         AsmWrite(secnames[atype]);
-        if use_smartlink_section and
+        if create_smartlink_sections and
            (atype<>sec_bss) and
            (atype<>sec_bss) and
            (aname<>'') then
            (aname<>'') then
           begin
           begin

+ 1 - 2
compiler/i386/cgcpu.pas

@@ -629,8 +629,7 @@ unit cgcpu;
 
 
         make_global:=false;
         make_global:=false;
         if (not current_module.is_unit) or
         if (not current_module.is_unit) or
-           (cs_create_smart in current_settings.moduleswitches) or
-           (af_smartlink_sections in target_asm.flags) or
+           create_smartlink or
            (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
            (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
           make_global:=true;
           make_global:=true;
 
 

+ 1 - 1
compiler/m68k/cgcpu.pas

@@ -1551,7 +1551,7 @@ unit cgcpu;
 
 
         make_global:=false;
         make_global:=false;
         if (not current_module.is_unit) or
         if (not current_module.is_unit) or
-           (cs_create_smart in current_settings.moduleswitches) or
+           create_smartlink or
            (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
            (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
           make_global:=true;
           make_global:=true;
 
 

+ 3 - 1
compiler/msg/errore.msg

@@ -2495,6 +2495,7 @@ S*2Aas_Assemble using GNU AS
 **2Ci_IO-checking
 **2Ci_IO-checking
 **2Cn_Omit linking stage
 **2Cn_Omit linking stage
 **2Co_Check overflow of integer operations
 **2Co_Check overflow of integer operations
+**2CO_Check for possible overflow of integer operations
 **2Cp<x>_Select instruction set, see fpc -i for possible values
 **2Cp<x>_Select instruction set, see fpc -i for possible values
 **2CP<x>=<y>_ packing settings
 **2CP<x>=<y>_ packing settings
 **3CPPACKSET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 and 8
 **3CPPACKSET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 and 8
@@ -2679,7 +2680,8 @@ P*2WT_Specify MPW tool type application (Classic Mac OS)
 **2Xm_Generate link map
 **2Xm_Generate link map
 **2XM<x>_Set the name of the 'main' program routine (default is 'main')
 **2XM<x>_Set the name of the 'main' program routine (default is 'main')
 **2XP<x>_Prepend the binutils names with the prefix <x>
 **2XP<x>_Prepend the binutils names with the prefix <x>
-**2Xr<x>_Set library search path to <x> (needed for cross compile)
+**2Xr<x>_Set library search path to <x> (needed for cross compile) (BeOS, Linux)
+**2XR<x>_Prepend <x> to all linker search paths (BeOS, Darwin, FreeBSD, Linux, Mac OS, Solaris)
 **2Xs_Strip all symbols from executable
 **2Xs_Strip all symbols from executable
 **2XS_Try to link units statically (default, defines FPC_LINK_STATIC)
 **2XS_Try to link units statically (default, defines FPC_LINK_STATIC)
 **2Xt_Link with static libraries (-static is passed to linker)
 **2Xt_Link with static libraries (-static is passed to linker)

+ 1 - 1
compiler/msgidx.inc

@@ -732,7 +732,7 @@ const
   option_info=11024;
   option_info=11024;
   option_help_pages=11025;
   option_help_pages=11025;
 
 
-  MsgTxtSize = 45193;
+  MsgTxtSize = 45359;
 
 
   MsgIdxMax : array[1..20] of longint=(
   MsgIdxMax : array[1..20] of longint=(
     24,86,238,83,63,50,107,22,135,60,
     24,86,238,83,63,50,107,22,135,60,

+ 76 - 72
compiler/msgtxt.inc

@@ -879,136 +879,136 @@ const msgtxt : array[0..000188,1..240] of char=(
   '**2Ci_IO-checking'#010+
   '**2Ci_IO-checking'#010+
   '**2Cn_Omit linking stage'#010+
   '**2Cn_Omit linking stage'#010+
   '**2Co_Check overflow of integer operations'#010+
   '**2Co_Check overflow of integer operations'#010+
-  '**2Cp<x>_Select instruction set, see fpc -i for possible values'#010+
+  '**2CO_Check for possible overflow of integer operations'#010+
+  '**2Cp<x>_Select instruction set, see fpc -i for possible va','lues'#010+
   '**2CP<x>=<y>_ packing settings'#010+
   '**2CP<x>=<y>_ packing settings'#010+
-  '**3CPPACKSET=<y>_ <y','> set allocation: 0, 1 or DEFAULT or NORMAL, 2, '+
-  '4 and 8'#010+
+  '**3CPPACKSET=<y>_ <y> set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4 '+
+  'and 8'#010+
   '**2Cr_Range checking'#010+
   '**2Cr_Range checking'#010+
   '**2CR_Verify object method call validity'#010+
   '**2CR_Verify object method call validity'#010+
   '**2Cs<n>_Set stack size to <n>'#010+
   '**2Cs<n>_Set stack size to <n>'#010+
   '**2Ct_Stack checking'#010+
   '**2Ct_Stack checking'#010+
-  '**2CX_Create also smartlinked library'#010+
+  '**2CX_Create a','lso smartlinked library'#010+
   '**1d<x>_Defines the symbol <x>'#010+
   '**1d<x>_Defines the symbol <x>'#010+
-  '*','*1D_Generate a DEF file'#010+
+  '**1D_Generate a DEF file'#010+
   '**2Dd<x>_Set description to <x>'#010+
   '**2Dd<x>_Set description to <x>'#010+
   '**2Dv<x>_Set DLL version to <x>'#010+
   '**2Dv<x>_Set DLL version to <x>'#010+
   '*O2Dw_PM application'#010+
   '*O2Dw_PM application'#010+
   '**1e<x>_Set path to executable'#010+
   '**1e<x>_Set path to executable'#010+
   '**1E_Same as -Cn'#010+
   '**1E_Same as -Cn'#010+
   '**1fPIC_Same as -Cg'#010+
   '**1fPIC_Same as -Cg'#010+
-  '**1F<x>_Set file names and paths:'#010+
-  '**2Fa<x>[,y]_(for a program) ','load units <x> and [y] before uses is p'+
-  'arsed'#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 input codepage to <x>'#010+
   '**2FC<x>_Set RC compiler binary name to <x>'#010+
   '**2FC<x>_Set RC compiler binary name to <x>'#010+
-  '**2FD<x>_Set the directory where to search for compiler utilities'#010+
+  '**2FD<x>_Set the directory where to search for compiler util','ities'#010+
   '**2Fe<x>_Redirect error output to <x>'#010+
   '**2Fe<x>_Redirect error output to <x>'#010+
-  '**2Ff<x>_Add',' <x> to framework path (Darwin only)'#010+
+  '**2Ff<x>_Add <x> to framework path (Darwin only)'#010+
   '**2FE<x>_Set exe/unit output path to <x>'#010+
   '**2FE<x>_Set exe/unit output path to <x>'#010+
   '**2Fi<x>_Add <x> to include path'#010+
   '**2Fi<x>_Add <x> to include path'#010+
   '**2Fl<x>_Add <x> to library path'#010+
   '**2Fl<x>_Add <x> to library path'#010+
   '**2FL<x>_Use <x> as dynamic linker'#010+
   '**2FL<x>_Use <x> as dynamic linker'#010+
-  '**2Fm<x>_Load unicode conversion table from <x>.txt in the co','mpiler '+
+  '**2Fm','<x>_Load unicode conversion table from <x>.txt in the compiler '+
   'dir'#010+
   'dir'#010+
   '**2Fo<x>_Add <x> to object path'#010+
   '**2Fo<x>_Add <x> to object path'#010+
   '**2Fr<x>_Load error message file <x>'#010+
   '**2Fr<x>_Load error message file <x>'#010+
   '**2FR<x>_Set resource (.res) linker to <x>'#010+
   '**2FR<x>_Set resource (.res) linker to <x>'#010+
   '**2Fu<x>_Add <x> to unit path'#010+
   '**2Fu<x>_Add <x> to unit path'#010+
-  '**2FU<x>_Set unit output path to <x>, overrides -FE'#010+
-  '*g1g_Generate debug information (de','fault format for target)'#010+
+  '**2FU<x>_Set unit output path t','o <x>, overrides -FE'#010+
+  '*g1g_Generate debug information (default format for target)'#010+
   '*g2gc_Generate checks for pointers'#010+
   '*g2gc_Generate checks for pointers'#010+
   '*g2gh_Use heaptrace unit (for memory leak/corruption debugging)'#010+
   '*g2gh_Use heaptrace unit (for memory leak/corruption debugging)'#010+
   '*g2gl_Use line info unit (show more info with backtraces)'#010+
   '*g2gl_Use line info unit (show more info with backtraces)'#010+
-  '*g2go<x>_Set debug information options'#010+
-  '*g3godwarfsets_ Ena','ble Dwarf set debug information (breaks gdb < 6.5'+
-  ')'#010+
+  '*g','2go<x>_Set debug information options'#010+
+  '*g3godwarfsets_ Enable Dwarf set debug information (breaks gdb < 6.5)'#010+
   '*g2gp_Preserve case in stabs symbol names'#010+
   '*g2gp_Preserve case in stabs symbol names'#010+
   '*g2gs_Generate stabs debug information'#010+
   '*g2gs_Generate stabs debug information'#010+
-  '*g2gt_Trash local variables (to detect uninitialized uses)'#010+
-  '*g2gv_Generates programs traceable with valgrind'#010,
+  '*g2gt_Trash local variables (to detect uninitialized',' uses)'#010+
+  '*g2gv_Generates programs traceable with valgrind'#010+
   '*g2gw_Generate dwarf-2 debug information (same as -gw2)'#010+
   '*g2gw_Generate dwarf-2 debug information (same as -gw2)'#010+
   '*g2gw2_Generate dwarf-2 debug information'#010+
   '*g2gw2_Generate dwarf-2 debug information'#010+
   '*g2gw3_Generate dwarf-3 debug information'#010+
   '*g2gw3_Generate dwarf-3 debug information'#010+
   '**1i_Information'#010+
   '**1i_Information'#010+
-  '**2iD_Return compiler date'#010+
+  '**2iD_Return compiler date'#010,
   '**2iV_Return short compiler version'#010+
   '**2iV_Return short compiler version'#010+
-  '**2iW_Return full co','mpiler version'#010+
+  '**2iW_Return full compiler version'#010+
   '**2iSO_Return compiler OS'#010+
   '**2iSO_Return compiler OS'#010+
   '**2iSP_Return compiler host processor'#010+
   '**2iSP_Return compiler host processor'#010+
   '**2iTO_Return target OS'#010+
   '**2iTO_Return target OS'#010+
   '**2iTP_Return target processor'#010+
   '**2iTP_Return target processor'#010+
   '**1I<x>_Add <x> to include path'#010+
   '**1I<x>_Add <x> to include path'#010+
-  '**1k<x>_Pass <x> to the linker'#010+
+  '**1k<x>_Pass <x> t','o the linker'#010+
   '**1l_Write logo'#010+
   '**1l_Write logo'#010+
-  '**1M<x>_Set language mode t','o <x>'#010+
+  '**1M<x>_Set language mode to <x>'#010+
   '**2Mfpc_Free Pascal dialect (default)'#010+
   '**2Mfpc_Free Pascal dialect (default)'#010+
   '**2Mobjfpc_FPC mode with Object Pascal support'#010+
   '**2Mobjfpc_FPC mode with Object Pascal support'#010+
   '**2Mdelphi_Delphi 7 compatibility mode'#010+
   '**2Mdelphi_Delphi 7 compatibility mode'#010+
   '**2Mtp_TP/BP 7.0 compatibility mode'#010+
   '**2Mtp_TP/BP 7.0 compatibility mode'#010+
-  '**2Mmacpas_Macintosh Pascal dialects compatibility mode'#010+
-  '**1n_Do not read t','he default config files'#010+
+  '**2Mmacpas_Macinto','sh Pascal dialects compatibility mode'#010+
+  '**1n_Do not read the default config files'#010+
   '**1N<x>_Node tree optimizations'#010+
   '**1N<x>_Node tree optimizations'#010+
   '**2Nu_Unroll loops'#010+
   '**2Nu_Unroll loops'#010+
   '**1o<x>_Change the name of the executable produced to <x>'#010+
   '**1o<x>_Change the name of the executable produced to <x>'#010+
   '**1O<x>_Optimizations:'#010+
   '**1O<x>_Optimizations:'#010+
-  '**2O-_Disable optimizations'#010+
-  '**2O1_Level 1 optimizations (quick and debugger friendly',')'#010+
+  '**2O-_Disable optimizations'#010,
+  '**2O1_Level 1 optimizations (quick and debugger friendly)'#010+
   '**2O2_Level 2 optimizations (-O1 + quick optimizations)'#010+
   '**2O2_Level 2 optimizations (-O1 + quick optimizations)'#010+
   '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+
   '**2O3_Level 3 optimizations (-O2 + slow optimizations)'#010+
   '**2Oa<x>=<y>_Set alignment'#010+
   '**2Oa<x>=<y>_Set alignment'#010+
-  '**2Oo[NO]<x>_Enable or disable optimizations, see fpc -i for possible '+
-  'values'#010+
-  '**2Op<x>_Set target cpu',' for optimizing, see fpc -i for possible valu'+
-  'es'#010+
+  '**2Oo[NO]<x>_Enable or disable optimizations',', see fpc -i for possibl'+
+  'e values'#010+
+  '**2Op<x>_Set target cpu for optimizing, see fpc -i for possible values'+
+  #010+
   '**2Os_Optimize for size rather than speed'#010+
   '**2Os_Optimize for size rather than speed'#010+
   '**1pg_Generate profile code for gprof (defines FPC_PROFILE)'#010+
   '**1pg_Generate profile code for gprof (defines FPC_PROFILE)'#010+
   '**1R<x>_Assembler reading style:'#010+
   '**1R<x>_Assembler reading style:'#010+
-  '**2Rdefault_Use default assembler for target'#010+
-  '3*2Ratt_Read',' AT&T style assembler'#010+
+  '*','*2Rdefault_Use default assembler for target'#010+
+  '3*2Ratt_Read AT&T style assembler'#010+
   '3*2Rintel_Read Intel style assembler'#010+
   '3*2Rintel_Read Intel style assembler'#010+
   '6*2RMOT_Read motorola style assembler'#010+
   '6*2RMOT_Read motorola style assembler'#010+
   '**1S<x>_Syntax options:'#010+
   '**1S<x>_Syntax options:'#010+
   '**2S2_Same as -Mobjfpc'#010+
   '**2S2_Same as -Mobjfpc'#010+
-  '**2Sc_Support operators like C (*=,+=,/= and -=)'#010+
+  '**2Sc_Support operators like C (*=,+=,/=',' and -=)'#010+
   '**2Sa_Turn on assertions'#010+
   '**2Sa_Turn on assertions'#010+
-  '**2Sd_Same as -Mdelphi',#010+
+  '**2Sd_Same as -Mdelphi'#010+
   '**2Se<x>_Error options. <x> is a combination of the following:'#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*_<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*_n : Compi','ler also halts after notes'#010+
+  '**3*_h : Compiler also halts after hints'#010+
   '**2Sg_Enable LABEL and GOTO (default in -Mtp and -Mdelphi)'#010+
   '**2Sg_Enable LABEL and GOTO (default in -Mtp and -Mdelphi)'#010+
   '**2Sh_Use ansistrings by default instead of shortstrings'#010+
   '**2Sh_Use ansistrings by default instead of shortstrings'#010+
-  '**2Si_Turn on inlining of procedures/functions declared as "inline"'#010+
+  '**2Si_Turn on inlining of procedures/functions declared ','as "inline"'#010+
   '**2Sk_Load fpcylix unit'#010+
   '**2Sk_Load fpcylix unit'#010+
-  '**2SI<x>_Set interfa','ce style to <x>'#010+
+  '**2SI<x>_Set interface style to <x>'#010+
   '**3SIcom_COM compatible interface (default)'#010+
   '**3SIcom_COM compatible interface (default)'#010+
   '**3SIcorba_CORBA compatible interface'#010+
   '**3SIcorba_CORBA compatible interface'#010+
   '**2Sm_Support macros like C (global)'#010+
   '**2Sm_Support macros like C (global)'#010+
   '**2So_Same as -Mtp'#010+
   '**2So_Same as -Mtp'#010+
-  '**2Ss_Constructor name must be init (destructor must be done)'#010+
-  '**2St_Allow static keywo','rd in objects'#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+
   '**2Sx_Enable exception keywords (default in Delphi/ObjFPC modes)'#010+
   '**1s_Do not call assembler and linker'#010+
   '**1s_Do not call assembler and linker'#010+
   '**2sh_Generate script to link on host'#010+
   '**2sh_Generate script to link on host'#010+
-  '**2st_Generate script to link on target'#010+
-  '**2sr_Skip register allocation phase (use wit','h -alr)'#010+
+  '**2st_Generate script to link',' on target'#010+
+  '**2sr_Skip register allocation phase (use with -alr)'#010+
   '**1T<x>_Target operating system:'#010+
   '**1T<x>_Target operating system:'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
   '3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
   '3*2Tfreebsd_FreeBSD'#010+
   '3*2Tfreebsd_FreeBSD'#010+
   '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
   '3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
   '3*2Tlinux_Linux'#010+
   '3*2Tlinux_Linux'#010+
-  '3*2Tnetbsd_NetBSD'#010+
+  '3*2Tnetbs','d_NetBSD'#010+
   '3*2Tnetware_Novell Netware Module (clib)'#010+
   '3*2Tnetware_Novell Netware Module (clib)'#010+
-  '3*2Tne','twlibc_Novell Netware Module (libc)'#010+
+  '3*2Tnetwlibc_Novell Netware Module (libc)'#010+
   '3*2Topenbsd_OpenBSD'#010+
   '3*2Topenbsd_OpenBSD'#010+
   '3*2Tos2_OS/2 / eComStation'#010+
   '3*2Tos2_OS/2 / eComStation'#010+
   '3*2Tsunos_SunOS/Solaris'#010+
   '3*2Tsunos_SunOS/Solaris'#010+
   '3*2Twatcom_Watcom compatible DOS extender'#010+
   '3*2Twatcom_Watcom compatible DOS extender'#010+
   '3*2Twdosx_WDOSX DOS extender'#010+
   '3*2Twdosx_WDOSX DOS extender'#010+
-  '3*2Twin32_Windows 32 Bit'#010+
+  '3*2Twi','n32_Windows 32 Bit'#010+
   '3*2Twince_Windows CE'#010+
   '3*2Twince_Windows CE'#010+
-  '4*2Tlinux_Linux'#010,
+  '4*2Tlinux_Linux'#010+
   '6*2Tamiga_Commodore Amiga'#010+
   '6*2Tamiga_Commodore Amiga'#010+
   '6*2Tatari_Atari ST/STe/TT'#010+
   '6*2Tatari_Atari ST/STe/TT'#010+
   '6*2Tlinux_Linux/m68k'#010+
   '6*2Tlinux_Linux/m68k'#010+
@@ -1016,70 +1016,74 @@ const msgtxt : array[0..000188,1..240] of char=(
   '6*2Tpalmos_PalmOS'#010+
   '6*2Tpalmos_PalmOS'#010+
   'A*2Tlinux_Linux'#010+
   'A*2Tlinux_Linux'#010+
   'A*2Twince_Windows CE'#010+
   'A*2Twince_Windows CE'#010+
-  'P*2Tamiga_AmigaOS on PowerPC'#010+
-  'P*2Tdarwin_Darwin and Mac OS X on PowerPC'#010,
+  'P*2Tamiga_Amiga','OS on PowerPC'#010+
+  'P*2Tdarwin_Darwin and Mac OS X on PowerPC'#010+
   'P*2Tlinux_Linux on PowerPC'#010+
   'P*2Tlinux_Linux on PowerPC'#010+
   'P*2Tmacos_Mac OS (classic) on PowerPC'#010+
   'P*2Tmacos_Mac OS (classic) on PowerPC'#010+
   'P*2Tmorphos_MorphOS'#010+
   'P*2Tmorphos_MorphOS'#010+
   'S*2Tlinux_Linux'#010+
   'S*2Tlinux_Linux'#010+
   '**1u<x>_Undefines the symbol <x>'#010+
   '**1u<x>_Undefines the symbol <x>'#010+
   '**1U_Unit options:'#010+
   '**1U_Unit options:'#010+
-  '**2Un_Do not check where the unit name matches the file name'#010+
-  '**2Ur_Generate release uni','t files (never automatically recompiled)'#010+
+  '**2Un_Do not check where the un','it name matches the file name'#010+
+  '**2Ur_Generate release unit files (never automatically recompiled)'#010+
   '**2Us_Compile a system unit'#010+
   '**2Us_Compile a system unit'#010+
   '**1v<x>_Be verbose. <x> is a combination of the following letters:'#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*_e : Show errors (default)       0 : Show no','thing (except errors'+
+  ')'#010+
+  '**2*_w : Show warnings               u : Show unit info'#010+
   '**2*_n : Show notes                  t : Show tried/used files'#010+
   '**2*_n : Show notes                  t : Show tried/used files'#010+
   '**2*_h : Show hints                  c : Show conditionals'#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 mod'+
-  'e'#010+
+  '**2*_i : Show general info           d :',' Show debug info'#010+
+  '**2*_l : Show linenumbers            r : Rhide/GCC compatibility mode'#010+
   '**2*_a : Show everything             x : Executable info (Win32 only)'#010+
   '**2*_a : Show everything             x : Executable info (Win32 only)'#010+
   '**2*_b : Write file names messages with full path'#010+
   '**2*_b : Write file names messages with full path'#010+
-  '**2*_v : Write fpcdebug.txt with     p : Write tree.log with parse tre'+
-  'e'#010+
-  '**2*_    lots of ','debugging info'#010+
+  '**2*_v : Write fpcdebug.txt with ','    p : Write tree.log with parse t'+
+  'ree'#010+
+  '**2*_    lots of debugging info'#010+
   '3*1W<x>_Target-specific options (targets)'#010+
   '3*1W<x>_Target-specific options (targets)'#010+
   'A*1W<x>_Target-specific options (targets)'#010+
   'A*1W<x>_Target-specific options (targets)'#010+
   'P*1W<x>_Target-specific options (targets)'#010+
   'P*1W<x>_Target-specific options (targets)'#010+
-  '3*2Wb_Create a bundle instead of a library (Darwin)'#010+
-  'P*2Wb_Create a bundle instead of a library (Dar','win)'#010+
+  '3*2Wb_Create a bundle 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+
   'p*2Wb_Create a bundle instead of a library (Darwin)'#010+
   '3*2WB_Create a relocatable image (Windows)'#010+
   '3*2WB_Create a relocatable image (Windows)'#010+
   'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
   'A*2WB_Create a relocatable image (Windows, Symbian)'#010+
-  '3*2WC_Specify console type application (EMX, OS/2, Windows)'#010+
-  'A*2WC_Specify console type a','pplication (Windows)'#010+
+  '3*2WC_Specify console type appli','cation (EMX, OS/2, Windows)'#010+
+  'A*2WC_Specify console type application (Windows)'#010+
   'P*2WC_Specify console type application (Classic Mac OS)'#010+
   'P*2WC_Specify console type application (Classic Mac OS)'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
   '3*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
-  'A*2WD_Use DEFFILE to export functions of DLL or EXE (Windows)'#010+
-  '3*2WF_Specify full-screen type applicat','ion (EMX, OS/2)'#010+
+  'A*2WD_Use DEFFILE to export functions of DLL ','or EXE (Windows)'#010+
+  '3*2WF_Specify full-screen type application (EMX, OS/2)'#010+
   '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
   '3*2WG_Specify graphic type application (EMX, OS/2, Windows)'#010+
   'A*2WG_Specify graphic type application (Windows)'#010+
   'A*2WG_Specify graphic type application (Windows)'#010+
   'P*2WG_Specify graphic type application (Classic Mac OS)'#010+
   'P*2WG_Specify graphic type application (Classic Mac OS)'#010+
-  '3*2WN_Do not generate relocation code, needed for debugging',' (Windows'+
+  '3*2','WN_Do not generate relocation code, needed for debugging (Windows'+
   ')'#010+
   ')'#010+
   'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   'A*2WN_Do not generate relocation code, needed for debugging (Windows)'#010+
   '3*2WR_Generate relocation code (Windows)'#010+
   '3*2WR_Generate relocation code (Windows)'#010+
   'A*2WR_Generate relocation code (Windows)'#010+
   'A*2WR_Generate relocation code (Windows)'#010+
-  'P*2WT_Specify MPW tool type application (Classic Mac OS)'#010+
-  '**1X_Executable opti','ons:'#010+
+  'P*2WT_Specify MPW too','l type application (Classic Mac OS)'#010+
+  '**1X_Executable options:'#010+
   '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
   '**2Xc_Pass --shared/-dynamic to the linker (BeOS, Darwin, FreeBSD, Lin'+
   'ux)'#010+
   'ux)'#010+
   '**2Xd_Do not use standard library search path (needed for cross compil'+
   '**2Xd_Do not use standard library search path (needed for cross compil'+
   'e)'#010+
   'e)'#010+
   '**2Xe_Use external linker'#010+
   '**2Xe_Use external linker'#010+
-  '**2XD_Try to link units dynamically      (defines FPC_LINK_DYN','AMIC)'#010+
+  '**2XD_','Try to link units dynamically      (defines FPC_LINK_DYNAMIC)'#010+
   '**2Xi_Use internal linker'#010+
   '**2Xi_Use internal linker'#010+
   '**2Xm_Generate link map'#010+
   '**2Xm_Generate link map'#010+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   '**2XM<x>_Set the name of the '#039'main'#039' program routine (default i'+
   's '#039'main'#039')'#010+
   's '#039'main'#039')'#010+
-  '**2XP<x>_Prepend the binutils names with the prefix <x>'#010+
-  '**2Xr<x>_Set library search path to <x> (needed for cros','s compile)'#010+
+  '**2XP<x>_Prepend the binutils names with the prefix <x>'#010,
+  '**2Xr<x>_Set library search path to <x> (needed for cross compile) (Be'+
+  'OS, 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_Strip all symbols from executable'#010+
-  '**2XS_Try to link units statically (default, defines FPC_LINK_STATIC)'#010+
+  '**2XS_Try to link units',' statically (default, defines FPC_LINK_STATIC'+
+  ')'#010+
   '**2Xt_Link with static libraries (-static is passed to linker)'#010+
   '**2Xt_Link with static libraries (-static is passed to linker)'#010+
-  '**2XX_Try to smartlink units             (defines FPC_LI','NK_SMART)'#010+
+  '**2XX_Try to smartlink units             (defines FPC_LINK_SMART)'#010+
   '**1*_'#010+
   '**1*_'#010+
   '**1?_Show this help'#010+
   '**1?_Show this help'#010+
   '**1h_Shows this help without waiting'#000
   '**1h_Shows this help without waiting'#000

+ 27 - 3
compiler/ncgrtti.pas

@@ -544,12 +544,36 @@ implementation
              current_asmdata.asmlists[al_rtti].concat(cai_align.Create(sizeof(TConstPtrUInt)));
              current_asmdata.asmlists[al_rtti].concat(cai_align.Create(sizeof(TConstPtrUInt)));
            { size of elements }
            { size of elements }
            current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(def.elesize));
            current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(def.elesize));
+
            if not(ado_IsDynamicArray in def.arrayoptions) then
            if not(ado_IsDynamicArray in def.arrayoptions) then
-             current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(aint(def.elecount)));
-           { element type }
-           current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.elementdef,rt)));
+             begin
+               current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(aint(def.elecount)));
+               { element type }
+               current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.elementdef,rt)));
+             end
+           else
+             { write a delphi almost compatible dyn. array entry:
+               there are two types, eltype and eltype2, the latter is nil if the element type needs
+               no finalization, the former is always valid, delphi has this swapped, but for
+               compatibility with older fpc versions we do it different, to be delphi compatible,
+               the names are swapped in typinfo.pp
+             }
+             begin
+               { element type }
+               current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.elementdef,rt)));
+             end;
            { variant type }
            { variant type }
            current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tstoreddef(def.elementdef).getvardef));
            current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_32bit(tstoreddef(def.elementdef).getvardef));
+           if ado_IsDynamicArray in def.arrayoptions then
+             begin
+               { element type }
+               if def.elementdef.needs_inittable then
+                 current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_sym(ref_rtti(def.elementdef,rt)))
+               else
+                 current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_aint(0));
+               { dummy DynUnitName }
+               current_asmdata.asmlists[al_rtti].concat(Tai_const.Create_8bit(0));
+             end;
         end;
         end;
 
 
         procedure recorddef_rtti(def:trecorddef);
         procedure recorddef_rtti(def:trecorddef);

+ 1 - 1
compiler/ncgutil.pas

@@ -2211,7 +2211,7 @@ implementation
         maybe_new_object_file(list);
         maybe_new_object_file(list);
         new_section(list,sectype,lower(sym.mangledname),varalign);
         new_section(list,sectype,lower(sym.mangledname),varalign);
         if (sym.owner.symtabletype=globalsymtable) or
         if (sym.owner.symtabletype=globalsymtable) or
-           maybe_smartlink_symbol or
+           create_smartlink or
            DLLSource or
            DLLSource or
            (assigned(current_procinfo) and
            (assigned(current_procinfo) and
             (po_inline in current_procinfo.procdef.procoptions)) or
             (po_inline in current_procinfo.procdef.procoptions)) or

+ 1 - 1
compiler/ogcoff.pas

@@ -949,7 +949,7 @@ const pemagic : array[0..3] of byte = (
         secname : string;
         secname : string;
       begin
       begin
         secname:=coffsecnames[atype];
         secname:=coffsecnames[atype];
-        if use_smartlink_section and
+        if create_smartlink_sections and
            (aname<>'') then
            (aname<>'') then
           begin
           begin
             case aorder of
             case aorder of

+ 1 - 1
compiler/ogelf.pas

@@ -619,7 +619,7 @@ implementation
             result:=secname+'.'+aname;
             result:=secname+'.'+aname;
             exit;
             exit;
           end;
           end;
-        if use_smartlink_section and (aname<>'') then
+        if create_smartlink_sections and (aname<>'') then
           begin
           begin
             case aorder of
             case aorder of
               secorder_begin :
               secorder_begin :

+ 13 - 7
compiler/options.pas

@@ -534,6 +534,11 @@ begin
                         exclude(init_settings.localswitches,cs_check_overflow)
                         exclude(init_settings.localswitches,cs_check_overflow)
                       Else
                       Else
                         include(init_settings.localswitches,cs_check_overflow);
                         include(init_settings.localswitches,cs_check_overflow);
+                    'O' :
+                      If UnsetBool(More, j) then
+                        exclude(init_settings.localswitches,cs_check_ordinal_size)
+                      Else
+                        include(init_settings.localswitches,cs_check_ordinal_size);
                     'p' :
                     'p' :
                       begin
                       begin
                         s:=upper(copy(more,j+1,length(more)-j));
                         s:=upper(copy(more,j+1,length(more)-j));
@@ -752,9 +757,9 @@ begin
                  'l' :
                  'l' :
                    begin
                    begin
                      if ispara then
                      if ispara then
-                       ParaLibraryPath.AddPath(More,false)
+                       ParaLibraryPath.AddPath(sysrootpath,More,false)
                      else
                      else
-                       LibrarySearchPath.AddPath(More,true);
+                       LibrarySearchPath.AddPath(sysrootpath,More,true);
                    end;
                    end;
                  'L' :
                  'L' :
                    begin
                    begin
@@ -1396,6 +1401,12 @@ begin
                         DefaultReplacements(rlinkpath);
                         DefaultReplacements(rlinkpath);
                         More:='';
                         More:='';
                       end;
                       end;
+                    'R' :
+                      begin
+                        sysrootpath:=copy(more,2,length(more)-1);
+                        defaultreplacements(sysrootpath);
+                        more:='';
+                      end;
                     's' :
                     's' :
                       begin
                       begin
                         If UnsetBool(More, j) then
                         If UnsetBool(More, j) then
@@ -2459,11 +2470,6 @@ begin
      (target_info.system in [system_i386_win32,system_x86_64_win64]) then
      (target_info.system in [system_i386_win32,system_x86_64_win64]) then
     exclude(target_info.flags,tf_smartlink_sections);
     exclude(target_info.flags,tf_smartlink_sections);
 
 
-{$ifdef x86_64}
-  {$warning HACK: turn off smartlinking}
-  exclude(init_settings.moduleswitches,cs_create_smart);
-{$endif}
-
   if not LinkTypeSetExplicitly then
   if not LinkTypeSetExplicitly then
     set_default_link_type;
     set_default_link_type;
 
 

+ 3 - 6
compiler/pmodules.pas

@@ -98,8 +98,7 @@ implementation
         GenerateAsm(false);
         GenerateAsm(false);
 
 
         { Also create a smartlinked version ? }
         { Also create a smartlinked version ? }
-        if (cs_create_smart in current_settings.moduleswitches) and
-           (not use_smartlink_section) then
+        if create_smartlink_library then
          begin
          begin
            GenerateAsm(true);
            GenerateAsm(true);
            if (af_needar in target_asm.flags) then
            if (af_needar in target_asm.flags) then
@@ -117,8 +116,7 @@ implementation
         current_module.linkunitofiles.add(current_module.objfilename^,link_static);
         current_module.linkunitofiles.add(current_module.objfilename^,link_static);
         current_module.flags:=current_module.flags or uf_static_linked;
         current_module.flags:=current_module.flags or uf_static_linked;
 
 
-        if (cs_create_smart in current_settings.moduleswitches) and
-           not use_smartlink_section then
+        if create_smartlink_library then
          begin
          begin
            current_module.linkunitstaticlibs.add(current_module.staticlibfilename^,link_smart);
            current_module.linkunitstaticlibs.add(current_module.staticlibfilename^,link_smart);
            current_module.flags:=current_module.flags or uf_smart_linked;
            current_module.flags:=current_module.flags or uf_smart_linked;
@@ -129,8 +127,7 @@ implementation
     procedure create_dwarf;
     procedure create_dwarf;
       begin
       begin
         { Dwarf conflicts with smartlinking in separate .a files }
         { Dwarf conflicts with smartlinking in separate .a files }
-        if (cs_create_smart in current_settings.moduleswitches) and
-           not use_smartlink_section then
+        if create_smartlink_library then
           exit;
           exit;
         { Call frame information }
         { Call frame information }
         if (tf_needs_dwarf_cfi in target_info.flags) and
         if (tf_needs_dwarf_cfi in target_info.flags) and

+ 2 - 2
compiler/powerpc/itcpugas.pas

@@ -83,7 +83,7 @@ interface
 implementation
 implementation
 
 
     uses
     uses
-      globtype,globals,
+      globtype,globals,aasmbase,
       cutils,verbose, systems;
       cutils,verbose, systems;
 
 
     const
     const
@@ -138,7 +138,7 @@ implementation
            However, we do not do this for smart linked files since that would cause a lot of (mostly useless)
            However, we do not do this for smart linked files since that would cause a lot of (mostly useless)
            overhead. In theory, we could also not do it if "-a" is not used. The Mac OS X assembler (which is
            overhead. In theory, we could also not do it if "-a" is not used. The Mac OS X assembler (which is
            based on GNU as) "natively" supports full register names.}
            based on GNU as) "natively" supports full register names.}
-          if (cs_create_smart in current_settings.moduleswitches) and
+          if create_smartlink_library and
              (target_info.system <> system_powerpc_darwin) then
              (target_info.system <> system_powerpc_darwin) then
             result:=gas_regname_short_table[p]
             result:=gas_regname_short_table[p]
           else
           else

+ 3 - 3
compiler/powerpc64/itcpugas.pas

@@ -102,7 +102,7 @@ function gas_regname(r: Tregister): string;
 implementation
 implementation
 
 
 uses
 uses
-  globtype, globals,
+  globtype, globals,aasmbase,
   cutils, verbose, systems;
   cutils, verbose, systems;
 
 
 const
 const
@@ -147,8 +147,8 @@ var
 begin
 begin
   p := findreg_by_number(r);
   p := findreg_by_number(r);
   if p <> 0 then
   if p <> 0 then
-    if (cs_create_smart in current_settings.moduleswitches) and
-      not(target_info.system = system_powerpc64_darwin) then
+    if create_smartlink_library and
+       not(target_info.system = system_powerpc64_darwin) then
       result := gas_regname_short_table[p]
       result := gas_regname_short_table[p]
     else
     else
       result := gas_regname_table[p]
       result := gas_regname_table[p]

+ 6 - 6
compiler/ppcgen/cgppc.pas

@@ -93,7 +93,7 @@ unit cgppc;
 
 
   const
   const
     TOpCmp2AsmCond: Array[topcmp] of TAsmCondFlag = (C_NONE,C_EQ,C_GT,
     TOpCmp2AsmCond: Array[topcmp] of TAsmCondFlag = (C_NONE,C_EQ,C_GT,
-                         C_LT,C_GE,C_LE,C_NE,C_LE,C_LT,C_GE,C_GT);  
+                         C_LT,C_GE,C_LE,C_NE,C_LE,C_LT,C_GE,C_GT);
 
 
 
 
   implementation
   implementation
@@ -381,7 +381,7 @@ unit cgppc;
 
 
     procedure tcgppcgen.a_load_reg_ref(list: TAsmList; fromsize, tosize: TCGSize;
     procedure tcgppcgen.a_load_reg_ref(list: TAsmList; fromsize, tosize: TCGSize;
       reg: tregister; const ref: treference);
       reg: tregister; const ref: treference);
-    
+
     const
     const
       StoreInstr: array[OS_8..OS_INT, boolean, boolean] of TAsmOp =
       StoreInstr: array[OS_8..OS_INT, boolean, boolean] of TAsmOp =
       { indexed? updating?}
       { indexed? updating?}
@@ -401,7 +401,7 @@ unit cgppc;
         internalerror(2002090903);
         internalerror(2002090903);
       if not (tosize in [OS_8..OS_INT,OS_S8..OS_SINT]) then
       if not (tosize in [OS_8..OS_INT,OS_S8..OS_SINT]) then
         internalerror(2002090905);
         internalerror(2002090905);
-    
+
       ref2 := ref;
       ref2 := ref;
       fixref(list, ref2);
       fixref(list, ref2);
       if tosize in [OS_S8..OS_SINT] then
       if tosize in [OS_S8..OS_SINT] then
@@ -518,12 +518,12 @@ unit cgppc;
       { subsetregs always count bits from right to left }
       { subsetregs always count bits from right to left }
       fromsreg.startbit := loadbitsize-restbits;
       fromsreg.startbit := loadbitsize-restbits;
       fromsreg.bitlen := restbits;
       fromsreg.bitlen := restbits;
-  
+
       tosreg.subsetreg := valuereg;
       tosreg.subsetreg := valuereg;
       tosreg.subsetregsize := OS_INT;
       tosreg.subsetregsize := OS_INT;
       tosreg.startbit := 0;
       tosreg.startbit := 0;
       tosreg.bitlen := restbits;
       tosreg.bitlen := restbits;
-  
+
       a_load_subsetreg_subsetreg(list,subsetsize,subsetsize,fromsreg,tosreg);
       a_load_subsetreg_subsetreg(list,subsetsize,subsetsize,fromsreg,tosreg);
     end;
     end;
 
 
@@ -664,7 +664,7 @@ unit cgppc;
 
 
         make_global:=false;
         make_global:=false;
         if (not current_module.is_unit) or
         if (not current_module.is_unit) or
-           (cs_create_smart in current_settings.moduleswitches) or
+            create_smartlink or
            (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
            (procdef.owner.defowner.owner.symtabletype=globalsymtable) then
           make_global:=true;
           make_global:=true;
 
 

+ 1 - 1
compiler/psub.pas

@@ -1487,7 +1487,7 @@ implementation
             if (not current_module.in_interface) then
             if (not current_module.in_interface) then
               include(pdflags,pd_implemen);
               include(pdflags,pd_implemen);
             if (not current_module.is_unit) or
             if (not current_module.is_unit) or
-              maybe_smartlink_symbol or
+               create_smartlink or
               {
               {
                 taking addresses of static procedures goes wrong
                 taking addresses of static procedures goes wrong
                 if they aren't global when pic is used (FK)
                 if they aren't global when pic is used (FK)

+ 1 - 1
compiler/ptconst.pas

@@ -1363,7 +1363,7 @@ implementation
         { have been modified by the directives parsed above          }
         { have been modified by the directives parsed above          }
         new_section(list,cursectype,lower(sym.mangledname),const_align(sym.vardef.alignment));
         new_section(list,cursectype,lower(sym.mangledname),const_align(sym.vardef.alignment));
         if (sym.owner.symtabletype=globalsymtable) or
         if (sym.owner.symtabletype=globalsymtable) or
-           maybe_smartlink_symbol or
+           create_smartlink or
            (assigned(current_procinfo) and
            (assigned(current_procinfo) and
             (po_inline in current_procinfo.procdef.procoptions)) or
             (po_inline in current_procinfo.procdef.procoptions)) or
            DLLSource then
            DLLSource then

+ 1 - 0
compiler/systems.pas

@@ -295,6 +295,7 @@ interface
             tf_static_reg_based,
             tf_static_reg_based,
             tf_needs_symbol_size,
             tf_needs_symbol_size,
             tf_smartlink_sections,
             tf_smartlink_sections,
+            tf_smartlink_library,
             tf_needs_dwarf_cfi,
             tf_needs_dwarf_cfi,
             tf_use_8_3,
             tf_use_8_3,
             tf_pic_uses_got,
             tf_pic_uses_got,

+ 3 - 1
compiler/systems/i_beos.pas

@@ -32,7 +32,8 @@ unit i_beos;
             system       : system_i386_BeOS;
             system       : system_i386_BeOS;
             name         : 'Beos for i386';
             name         : 'Beos for i386';
             shortname    : 'Beos';
             shortname    : 'Beos';
-            flags        : [tf_under_development,tf_needs_symbol_size,tf_files_case_sensitive,tf_use_function_relative_addresses];
+            flags        : [tf_under_development,tf_needs_symbol_size,tf_files_case_sensitive,tf_use_function_relative_addresses,
+                            tf_smartlink_library];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'BEOSUNITS';
             unit_env     : 'BEOSUNITS';
             extradefines : 'UNIX;HASUNIX';
             extradefines : 'UNIX;HASUNIX';
@@ -93,6 +94,7 @@ unit i_beos;
               so i use this new value.  
               so i use this new value.  
             }
             }
             stacksize    : 16 * 1024 * 1024;
             stacksize    : 16 * 1024 * 1024;
+            abi : abi_default
           );
           );
 
 
   implementation
   implementation

+ 9 - 9
compiler/systems/i_bsd.pas

@@ -39,7 +39,7 @@ unit i_bsd;
             {$ifdef segment_threadvars}
             {$ifdef segment_threadvars}
                                         tf_section_threadvars,
                                         tf_section_threadvars,
             {$endif segment_threadvars}
             {$endif segment_threadvars}
-                           tf_needs_symbol_type,tf_needs_symbol_size {,tf_smartlink_sections}];
+                           tf_needs_symbol_type,tf_needs_symbol_size,tf_smartlink_library {,tf_smartlink_sections}];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -100,7 +100,7 @@ unit i_bsd;
             name         : 'FreeBSD for x86-64';
             name         : 'FreeBSD for x86-64';
             shortname    : 'FreeBSD';
             shortname    : 'FreeBSD';
             flags        : [tf_needs_symbol_size,tf_needs_dwarf_cfi,{Linux: tf_library_needs_pic,}tf_needs_symbol_type,
             flags        : [tf_needs_symbol_size,tf_needs_dwarf_cfi,{Linux: tf_library_needs_pic,}tf_needs_symbol_type,
-                            tf_files_case_sensitive,tf_use_function_relative_addresses
+                            tf_files_case_sensitive,tf_use_function_relative_addresses,tf_smartlink_library
                                 {	tf_pic_uses_got,tf_smartlink_sections}];
                                 {	tf_pic_uses_got,tf_smartlink_sections}];
             cpu          : cpu_x86_64;
             cpu          : cpu_x86_64;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
@@ -161,7 +161,7 @@ unit i_bsd;
             system       : system_i386_NetBSD;
             system       : system_i386_NetBSD;
             name         : 'NetBSD for i386';
             name         : 'NetBSD for i386';
             shortname    : 'NetBSD';
             shortname    : 'NetBSD';
-            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_smartlink_library,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -220,7 +220,7 @@ unit i_bsd;
             system       : system_i386_OpenBSD;
             system       : system_i386_OpenBSD;
             name         : 'OpenBSD for i386';
             name         : 'OpenBSD for i386';
             shortname    : 'OpenBSD';
             shortname    : 'OpenBSD';
-            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_smartlink_library];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -279,7 +279,7 @@ unit i_bsd;
             system       : system_m68k_NetBSD;
             system       : system_m68k_NetBSD;
             name         : 'NetBSD for m68k';
             name         : 'NetBSD for m68k';
             shortname    : 'NetBSD';
             shortname    : 'NetBSD';
-            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_smartlink_library];
             cpu          : cpu_m68k;
             cpu          : cpu_m68k;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -338,7 +338,7 @@ unit i_bsd;
             system       : system_powerpc_netbsd;
             system       : system_powerpc_netbsd;
             name         : 'NetBSD for PowerPC';
             name         : 'NetBSD for PowerPC';
             shortname    : 'NetBSD';
             shortname    : 'NetBSD';
-            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_smartlink_library];
             cpu          : cpu_powerpc;
             cpu          : cpu_powerpc;
             unit_env     : '';
             unit_env     : '';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -399,7 +399,7 @@ unit i_bsd;
             system       : system_powerpc_darwin;
             system       : system_powerpc_darwin;
             name         : 'Darwin for PowerPC';
             name         : 'Darwin for PowerPC';
             shortname    : 'Darwin';
             shortname    : 'Darwin';
-            flags        : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default];
+            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default];
             cpu          : cpu_powerpc;
             cpu          : cpu_powerpc;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -460,7 +460,7 @@ unit i_bsd;
             system       : system_i386_darwin;
             system       : system_i386_darwin;
             name         : 'Darwin for i386';
             name         : 'Darwin for i386';
             shortname    : 'Darwin';
             shortname    : 'Darwin';
-            flags        : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_uses_got,tf_pic_default];
+            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_uses_got,tf_pic_default];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -520,7 +520,7 @@ unit i_bsd;
             system       : system_powerpc64_darwin;
             system       : system_powerpc64_darwin;
             name         : 'Darwin for PowerPC64';
             name         : 'Darwin for PowerPC64';
             shortname    : 'Darwin';
             shortname    : 'Darwin';
-            flags        : [tf_p_ext_support,tf_files_case_aware,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default];
+            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default];
             cpu          : cpu_powerpc64;
             cpu          : cpu_powerpc64;
             unit_env     : 'BSDUNITS';
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
             extradefines : 'UNIX;BSD;HASUNIX';

+ 16 - 9
compiler/systems/i_linux.pas

@@ -35,6 +35,7 @@ unit i_linux;
              { cross compiled windres can be used to compile .rc files on linux }
              { cross compiled windres can be used to compile .rc files on linux }
              rcbin  : 'windres';
              rcbin  : 'windres';
              rccmd  : '--include $INC -O res -o $RES $RC';
              rccmd  : '--include $INC -O res -o $RES $RC';
+             resourcefileclass : nil;
           );
           );
 
 
        res_elf64_info : tresinfo =
        res_elf64_info : tresinfo =
@@ -45,6 +46,7 @@ unit i_linux;
              { cross compiled windres can be used to compile .rc files on linux }
              { cross compiled windres can be used to compile .rc files on linux }
              rcbin  : 'windres';
              rcbin  : 'windres';
              rccmd  : '--include $INC -O res -o $RES $RC';
              rccmd  : '--include $INC -O res -o $RES $RC';
+             resourcefileclass : nil;
           );
           );
 
 
        system_i386_linux_info : tsysteminfo =
        system_i386_linux_info : tsysteminfo =
@@ -57,7 +59,7 @@ unit i_linux;
                             tf_section_threadvars,
                             tf_section_threadvars,
 {$endif segment_threadvars}
 {$endif segment_threadvars}
                             tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,
                             tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,
-                            tf_needs_dwarf_cfi];
+                            tf_smartlink_library,tf_needs_dwarf_cfi];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'LINUXUNITS';
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
             extradefines : 'UNIX;HASUNIX';
@@ -116,7 +118,7 @@ unit i_linux;
             system       : system_x86_6432_LINUX;
             system       : system_x86_6432_LINUX;
             name         : 'Linux for x64_6432';
             name         : 'Linux for x64_6432';
             shortname    : 'Linux6432';
             shortname    : 'Linux6432';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_pic_uses_got{,tf_smartlink_sections}];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_pic_uses_got{,tf_smartlink_sections},tf_smartlink_library];
             cpu          : cpu_x86_64;
             cpu          : cpu_x86_64;
             unit_env     : 'LINUXUNITS';
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
             extradefines : 'UNIX;HASUNIX';
@@ -175,7 +177,8 @@ unit i_linux;
             system       : system_m68k_linux;
             system       : system_m68k_linux;
             name         : 'Linux for m68k';
             name         : 'Linux for m68k';
             shortname    : 'Linux';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,
+                            tf_smartlink_library];
             cpu          : cpu_m68k;
             cpu          : cpu_m68k;
             unit_env     : 'LINUXUNITS';
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
             extradefines : 'UNIX;HASUNIX';
@@ -234,7 +237,8 @@ unit i_linux;
             system       : system_powerpc_LINUX;
             system       : system_powerpc_LINUX;
             name         : 'Linux for PowerPC';
             name         : 'Linux for PowerPC';
             shortname    : 'Linux';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,
+                            tf_smartlink_library];
             cpu          : cpu_powerpc;
             cpu          : cpu_powerpc;
             unit_env     : '';
             unit_env     : '';
             extradefines : 'UNIX;HASUNIX';
             extradefines : 'UNIX;HASUNIX';
@@ -293,7 +297,8 @@ unit i_linux;
             system       : system_powerpc64_LINUX;
             system       : system_powerpc64_LINUX;
             name         : 'Linux for PowerPC64';
             name         : 'Linux for PowerPC64';
             shortname    : 'Linux';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_requires_proper_alignment];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,
+                            tf_requires_proper_alignment,tf_smartlink_library];
             cpu          : cpu_powerpc64;
             cpu          : cpu_powerpc64;
             unit_env     : '';
             unit_env     : '';
             extradefines : 'UNIX;HASUNIX';
             extradefines : 'UNIX;HASUNIX';
@@ -352,7 +357,8 @@ unit i_linux;
             system       : system_alpha_LINUX;
             system       : system_alpha_LINUX;
             name         : 'Linux for Alpha';
             name         : 'Linux for Alpha';
             shortname    : 'Linux';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
+                            tf_use_function_relative_addresses,tf_smartlink_library];
             cpu          : cpu_alpha;
             cpu          : cpu_alpha;
             unit_env     : 'LINUXUNITS';
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
             extradefines : 'UNIX;HASUNIX';
@@ -411,7 +417,7 @@ unit i_linux;
             system       : system_x86_64_LINUX;
             system       : system_x86_64_LINUX;
             name         : 'Linux for x86-64';
             name         : 'Linux for x86-64';
             shortname    : 'Linux';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_dwarf_cfi,
+            flags        : [tf_needs_symbol_size,tf_needs_dwarf_cfi,tf_smartlink_library,
                             tf_library_needs_pic,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
                             tf_library_needs_pic,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_x86_64;
             cpu          : cpu_x86_64;
             unit_env     : 'LINUXUNITS';
             unit_env     : 'LINUXUNITS';
@@ -471,7 +477,8 @@ unit i_linux;
             system       : system_SPARC_Linux;
             system       : system_SPARC_Linux;
             name         : 'Linux for SPARC';
             name         : 'Linux for SPARC';
             shortname    : 'Linux';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_library_needs_pic,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_requires_proper_alignment];
+            flags        : [tf_needs_symbol_size,tf_library_needs_pic,tf_needs_symbol_type,tf_files_case_sensitive,tf_smartlink_library,
+                            tf_use_function_relative_addresses,tf_requires_proper_alignment];
             cpu          : cpu_SPARC;
             cpu          : cpu_SPARC;
             unit_env     : 'LINUXUNITS';
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
             extradefines : 'UNIX;HASUNIX';
@@ -531,7 +538,7 @@ unit i_linux;
             name         : 'Linux for ARM';
             name         : 'Linux for ARM';
             shortname    : 'Linux';
             shortname    : 'Linux';
             flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
             flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,
-                            tf_use_function_relative_addresses,tf_requires_proper_alignment,tf_smartlink_sections];
+                            tf_use_function_relative_addresses,tf_requires_proper_alignment,tf_smartlink_sections,tf_smartlink_library];
             cpu          : cpu_arm;
             cpu          : cpu_arm;
             unit_env     : 'LINUXUNITS';
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
             extradefines : 'UNIX;HASUNIX';

+ 2 - 1
compiler/systems/i_nwl.pas

@@ -32,7 +32,7 @@ unit i_nwl;
             system       : system_i386_netwlibc;
             system       : system_i386_netwlibc;
             name         : 'Netware for i386(libc)';
             name         : 'Netware for i386(libc)';
             shortname    : 'Netwlibc';
             shortname    : 'Netwlibc';
-            flags        : [tf_use_function_relative_addresses];
+            flags        : [tf_use_function_relative_addresses,tf_smartlink_library];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'NETWLIBCUNITS';
             unit_env     : 'NETWLIBCUNITS';
             extradefines : 'NETWARE;NETWARE_LIBC';
             extradefines : 'NETWARE;NETWARE_LIBC';
@@ -83,6 +83,7 @@ unit i_nwl;
               );
               );
             first_parm_offset : 8;
             first_parm_offset : 8;
             stacksize    : 16384;
             stacksize    : 16384;
+            abi : abi_default
           );
           );
 
 
   implementation
   implementation

+ 2 - 1
compiler/systems/i_nwm.pas

@@ -32,7 +32,7 @@ unit i_nwm;
             system       : system_i386_netware;
             system       : system_i386_netware;
             name         : 'Netware for i386(clib)';
             name         : 'Netware for i386(clib)';
             shortname    : 'Netware';
             shortname    : 'Netware';
-            flags        : [tf_use_function_relative_addresses];
+            flags        : [tf_use_function_relative_addresses,tf_smartlink_library];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'NETWAREUNITS';
             unit_env     : 'NETWAREUNITS';
             extradefines : 'NETWARE_CLIB';
             extradefines : 'NETWARE_CLIB';
@@ -83,6 +83,7 @@ unit i_nwm;
               );
               );
             first_parm_offset : 8;
             first_parm_offset : 8;
             stacksize    : 16384;
             stacksize    : 16384;
+            abi : abi_default
           );
           );
 
 
   implementation
   implementation

+ 3 - 2
compiler/systems/i_sunos.pas

@@ -32,7 +32,7 @@ unit i_sunos;
             system       : system_i386_solaris;
             system       : system_i386_solaris;
             name         : 'Solaris for i386';
             name         : 'Solaris for i386';
             shortname    : 'solaris';
             shortname    : 'solaris';
-            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_smartlink_library];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'SOLARISUNITS';
             unit_env     : 'SOLARISUNITS';
             extradefines : 'UNIX;LIBC;SUNOS;HASUNIX';
             extradefines : 'UNIX;LIBC;SUNOS;HASUNIX';
@@ -91,7 +91,8 @@ unit i_sunos;
             system       : system_sparc_solaris;
             system       : system_sparc_solaris;
             name         : 'Solaris for SPARC';
             name         : 'Solaris for SPARC';
             shortname    : 'solaris';
             shortname    : 'solaris';
-            flags        : [tf_needs_symbol_size,tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses,tf_requires_proper_alignment];
+            flags        : [tf_needs_symbol_size,tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses,
+                            tf_requires_proper_alignment,tf_smartlink_library];
             cpu          : cpu_SPARC;
             cpu          : cpu_SPARC;
             unit_env     : 'SOLARISUNITS';
             unit_env     : 'SOLARISUNITS';
             extradefines : 'UNIX;LIBC;SUNOS;HASUNIX';
             extradefines : 'UNIX;LIBC;SUNOS;HASUNIX';

+ 1 - 1
compiler/systems/i_symbian.pas

@@ -34,7 +34,7 @@ unit i_symbian;
             name         : 'Symbian OS for i386';
             name         : 'Symbian OS for i386';
             shortname    : 'Symbian';
             shortname    : 'Symbian';
             flags        : [tf_files_case_aware, tf_has_dllscanner,
             flags        : [tf_files_case_aware, tf_has_dllscanner,
-                            tf_use_function_relative_addresses];
+                            tf_smartlink_library,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'SYMBIANUNITS';
             unit_env     : 'SYMBIANUNITS';
             extradefines : 'SYMBIAN';
             extradefines : 'SYMBIAN';

+ 2 - 2
compiler/systems/i_win.pas

@@ -32,7 +32,7 @@ unit i_win;
             system       : system_i386_WIN32;
             system       : system_i386_WIN32;
             name         : 'Win32 for i386';
             name         : 'Win32 for i386';
             shortname    : 'Win32';
             shortname    : 'Win32';
-            flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses
+            flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses,tf_smartlink_library
                             ,tf_smartlink_sections{,tf_section_threadvars}{,tf_needs_dwarf_cfi},tf_winlikewidestring,tf_no_pic_supported];
                             ,tf_smartlink_sections{,tf_section_threadvars}{,tf_needs_dwarf_cfi},tf_winlikewidestring,tf_no_pic_supported];
             cpu          : cpu_i386;
             cpu          : cpu_i386;
             unit_env     : 'WIN32UNITS';
             unit_env     : 'WIN32UNITS';
@@ -93,7 +93,7 @@ unit i_win;
             name         : 'Win64 for x64';
             name         : 'Win64 for x64';
             shortname    : 'Win64';
             shortname    : 'Win64';
             flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses,
             flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses,
-                            tf_winlikewidestring,tf_no_pic_supported];
+                            tf_smartlink_sections,tf_smartlink_library,tf_winlikewidestring,tf_no_pic_supported];
             cpu          : cpu_x86_64;
             cpu          : cpu_x86_64;
             unit_env     : 'WIN64UNITS';
             unit_env     : 'WIN64UNITS';
             extradefines : 'MSWINDOWS;WINDOWS';
             extradefines : 'MSWINDOWS;WINDOWS';

+ 1 - 1
compiler/systems/t_beos.pas

@@ -183,7 +183,7 @@ begin
   { since that is what the compiler expects.              }
   { since that is what the compiler expects.              }
   if pos(';',s) = 0 then
   if pos(';',s) = 0 then
     s:=s+';';
     s:=s+';';
-  LibrarySearchPath.AddPath(s,true); {format:'path1;path2;...'}
+  LibrarySearchPath.AddPath(sysrootpath,s,true); {format:'path1;path2;...'}
 end;
 end;
 
 
 
 

+ 9 - 2
compiler/systems/t_bsd.pas

@@ -208,10 +208,10 @@ begin
   Inherited Create;
   Inherited Create;
   if not Dontlinkstdlibpath Then
   if not Dontlinkstdlibpath Then
    if not(target_info.system in systems_darwin) then
    if not(target_info.system in systems_darwin) then
-     LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true)
+     LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true)
    else
    else
      { Mac OS X doesn't have a /lib }
      { Mac OS X doesn't have a /lib }
-     LibrarySearchPath.AddPath('/usr/lib',true)
+     LibrarySearchPath.AddPath(sysrootpath,'/usr/lib',true)
 end;
 end;
 
 
 
 
@@ -375,6 +375,13 @@ begin
   { Open link.res file }
   { Open link.res file }
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
 
 
+  if (target_info.system in systems_darwin) and
+     (sysrootpath<>'') then
+    begin
+      LinkRes.Add('-syslibroot');
+      LinkRes.Add(sysrootpath);
+    end;
+
   if (not isdll) or
   if (not isdll) or
      (apptype=app_bundle) then
      (apptype=app_bundle) then
     begin
     begin

+ 46 - 42
compiler/systems/t_linux.pas

@@ -205,12 +205,12 @@ begin
   Inherited Create;
   Inherited Create;
   if not Dontlinkstdlibpath Then
   if not Dontlinkstdlibpath Then
 {$ifdef x86_64}
 {$ifdef x86_64}
-   LibrarySearchPath.AddPath('/lib64;/usr/lib64;/usr/X11R6/lib64',true);
+   LibrarySearchPath.AddPath(sysrootpath,'/lib64;/usr/lib64;/usr/X11R6/lib64',true);
 {$else}
 {$else}
 {$ifdef powerpc64}
 {$ifdef powerpc64}
-   LibrarySearchPath.AddPath('/lib64;/usr/lib64;/usr/X11R6/lib64',true);
+   LibrarySearchPath.AddPath(sysrootpath,'/lib64;/usr/lib64;/usr/X11R6/lib64',true);
 {$else powerpc64}
 {$else powerpc64}
-   LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true);
+   LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true);
 {$endif powerpc64}
 {$endif powerpc64}
 {$endif x86_64}
 {$endif x86_64}
 end;
 end;
@@ -235,7 +235,11 @@ var
 begin
 begin
   with Info do
   with Info do
    begin
    begin
-     ExeCmd[1]:='ld '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE $RES';
+     ExeCmd[1]:='ld '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -L. -o $EXE';
+     { when we want to cross-link we need to override default library paths }
+     if length(sysrootpath) > 0 then
+       ExeCmd[1]:=ExeCmd[1]+' -T';
+     ExeCmd[1]:=ExeCmd[1]+' $RES';
      DllCmd[1]:='ld '+platform_select+' $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES -E';
      DllCmd[1]:='ld '+platform_select+' $OPT $INIT $FINI $SONAME -shared -L. -o $EXE $RES -E';
      DllCmd[2]:='strip --strip-unneeded $EXE';
      DllCmd[2]:='strip --strip-unneeded $EXE';
 
 
@@ -245,6 +249,29 @@ begin
 {$endif m68k}
 {$endif m68k}
 
 
 {$ifdef i386}
 {$ifdef i386}
+     defdynlinker:='/lib/ld-linux.so.1';
+{$endif}
+
+{$ifdef x86_64}
+     defdynlinker:='/lib64/ld-linux-x86-64.so.2';
+{$endif x86_64}
+
+{$ifdef sparc}
+     defdynlinker:='/lib/ld-linux.so.2';
+{$endif sparc}
+
+{$ifdef powerpc}
+     defdynlinker:='/lib/ld.so.1';
+{$endif powerpc}
+
+{$ifdef powerpc64}
+     defdynlinker:='/lib64/ld64.so.1';
+{$endif powerpc64}
+
+{$ifdef arm}
+     defdynlinker:='/lib/ld-linux.so.2';
+{$endif arm}
+
      {
      {
        Search order:
        Search order:
          glibc 2.1+
          glibc 2.1+
@@ -252,19 +279,22 @@ begin
          glibc 2.0
          glibc 2.0
        If none is found (e.g. when cross compiling) glibc21 is assumed
        If none is found (e.g. when cross compiling) glibc21 is assumed
      }
      }
-     if FileExists('/lib/ld-linux.so.2',false) then
+{$ifdef i386}
+     if FileExists(sysrootpath+'/lib/ld-linux.so.2',false) then
        begin
        begin
          DynamicLinker:='/lib/ld-linux.so.2';
          DynamicLinker:='/lib/ld-linux.so.2';
          libctype:=glibc21;
          libctype:=glibc21;
        end
        end
-     else if fileexists('/lib/ld-uClibc.so.0',false) then
+     else
+{$endif i386}
+     if fileexists(sysrootpath+'/lib/ld-uClibc.so.0',false) then
        begin
        begin
          dynamiclinker:='/lib/ld-uClibc.so.0';
          dynamiclinker:='/lib/ld-uClibc.so.0';
          libctype:=uclibc;
          libctype:=uclibc;
        end
        end
-     else if fileexists('/lib/ld-linux.so.1',false) then
+     else if fileexists(sysrootpath+defdynlinker,false) then
        begin
        begin
-         DynamicLinker:='/lib/ld-linux.so.1';
+         DynamicLinker:=defdynlinker;
          libctype:=glibc2;
          libctype:=glibc2;
        end
        end
      else
      else
@@ -273,32 +303,6 @@ begin
          DynamicLinker:='/lib/ld-linux.so.2';
          DynamicLinker:='/lib/ld-linux.so.2';
          libctype:=glibc21;
          libctype:=glibc21;
        end;
        end;
-{$endif i386}
-
-{$ifdef x86_64}
-     DynamicLinker:='/lib64/ld-linux-x86-64.so.2';
-     libctype:=glibc2;
-{$endif x86_64}
-
-{$ifdef sparc}
-     DynamicLinker:='/lib/ld-linux.so.2';
-     libctype:=glibc2;
-{$endif sparc}
-
-{$ifdef powerpc}
-     DynamicLinker:='/lib/ld.so.1';
-     libctype:=glibc2;
-{$endif powerpc}
-
-{$ifdef powerpc64}
-     DynamicLinker:='/lib64/ld64.so.1';
-     libctype:=glibc2;
-{$endif powerpc64}
-
-{$ifdef arm}
-     DynamicLinker:='/lib/ld-linux.so.2';
-     libctype:=glibc2;
-{$endif arm}
    end;
    end;
 end;
 end;
 
 
@@ -424,7 +428,7 @@ begin
       if not (target_info.system in system_internal_sysinit) and (prtobj<>'') then
       if not (target_info.system in system_internal_sysinit) and (prtobj<>'') then
        AddFileName(maybequoted(FindObjectFile(prtobj,'',false)));
        AddFileName(maybequoted(FindObjectFile(prtobj,'',false)));
       { try to add crti and crtbegin if linking to C }
       { try to add crti and crtbegin if linking to C }
-      if linklibc then
+      if linklibc and (libctype<>uclibc) then
        begin
        begin
          { x86_64 requires this to use entry/exit code with pic,
          { x86_64 requires this to use entry/exit code with pic,
            see also issue #8210 regarding a discussion
            see also issue #8210 regarding a discussion
@@ -778,7 +782,7 @@ var
   binstr,
   binstr,
   cmdstr  : TCmdStr;
   cmdstr  : TCmdStr;
   success : boolean;
   success : boolean;
-  DynLinkStr : string[60];
+  DynLinkStr : string;
   GCSectionsStr,
   GCSectionsStr,
   StaticStr,
   StaticStr,
   StripStr   : string[40];
   StripStr   : string[40];
@@ -797,16 +801,16 @@ begin
    StripStr:='-s';
    StripStr:='-s';
   if (cs_link_map in current_settings.globalswitches) then
   if (cs_link_map in current_settings.globalswitches) then
    StripStr:='-Map '+maybequoted(ChangeFileExt(current_module.exefilename^,'.map'));
    StripStr:='-Map '+maybequoted(ChangeFileExt(current_module.exefilename^,'.map'));
-  if use_smartlink_section then
+  if create_smartlink_sections then
    GCSectionsStr:='--gc-sections';
    GCSectionsStr:='--gc-sections';
   If (cs_profile in current_settings.moduleswitches) or
   If (cs_profile in current_settings.moduleswitches) or
      ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
      ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
    begin
    begin
-     DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
-     if cshared Then
-       DynLinkStr:='--shared ' + DynLinkStr;
-     if rlinkpath<>'' Then
-       DynLinkStr:='--rpath-link '+rlinkpath + ' '+ DynLinkStr;
+     DynLinkStr:='--dynamic-linker='+Info.DynamicLinker;
+     if cshared then
+       DynLinkStr:=DynLinkStr+' --shared ';
+     if rlinkpath<>'' then
+       DynLinkStr:=DynLinkStr+' --rpath-link '+rlinkpath;
    End;
    End;
 
 
 { Write used files and libraries }
 { Write used files and libraries }

+ 1 - 1
compiler/systems/t_macos.pas

@@ -74,7 +74,7 @@ implementation
 Constructor TLinkerMPW.Create;
 Constructor TLinkerMPW.Create;
 begin
 begin
   Inherited Create;
   Inherited Create;
-  //LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib',true);
+  //LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib',true);
 end;
 end;
 
 
 
 

+ 1 - 1
compiler/systems/t_sunos.pas

@@ -182,7 +182,7 @@ Constructor TLinkersolaris.Create;
 begin
 begin
   Inherited Create;
   Inherited Create;
   if NOT Dontlinkstdlibpath Then
   if NOT Dontlinkstdlibpath Then
-   LibrarySearchPath.AddPath('/lib;/usr/lib;/usr/X11R6/lib;/opt/sfw/lib',true);
+   LibrarySearchPath.AddPath(sysrootpath,'/lib;/usr/lib;/usr/X11R6/lib;/opt/sfw/lib',true);
 {$ifdef  LinkTest}
 {$ifdef  LinkTest}
      if (cs_link_staticflag in current_settings.globalswitches) then  WriteLN('ForceLinkStaticFlag');
      if (cs_link_staticflag in current_settings.globalswitches) then  WriteLN('ForceLinkStaticFlag');
      if (cs_link_static in current_settings.globalswitches) then  WriteLN('LinkStatic-Flag');
      if (cs_link_static in current_settings.globalswitches) then  WriteLN('LinkStatic-Flag');

+ 2 - 2
compiler/systems/t_win.pas

@@ -1326,7 +1326,7 @@ implementation
         AsBinStr:=FindUtil(utilsprefix+'as');
         AsBinStr:=FindUtil(utilsprefix+'as');
         if RelocSection then
         if RelocSection then
           RelocStr:='--base-file base.$$$';
           RelocStr:='--base-file base.$$$';
-        if use_smartlink_section then
+        if create_smartlink_sections then
           GCSectionsStr:='--gc-sections';
           GCSectionsStr:='--gc-sections';
         if target_info.system in [system_arm_wince,system_i386_wince] then
         if target_info.system in [system_arm_wince,system_i386_wince] then
           AppTypeStr:='--subsystem wince'
           AppTypeStr:='--subsystem wince'
@@ -1432,7 +1432,7 @@ implementation
         AsBinStr:=FindUtil(utilsprefix+'as');
         AsBinStr:=FindUtil(utilsprefix+'as');
         if RelocSection then
         if RelocSection then
          RelocStr:='--base-file base.$$$';
          RelocStr:='--base-file base.$$$';
-        if use_smartlink_section then
+        if create_smartlink_sections then
          GCSectionsStr:='--gc-sections';
          GCSectionsStr:='--gc-sections';
         if apptype=app_gui then
         if apptype=app_gui then
           begin
           begin

+ 83 - 64
installer/Makefile

@@ -1,11 +1,12 @@
 #
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/10/21]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2007/11/02]
 #
 #
 default: all
 default: all
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos 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-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
 MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos 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-win64 x86_64-embedded arm-linux arm-palmos arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded
 BSDs = freebsd netbsd openbsd darwin
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx
 UNIXs = linux $(BSDs) solaris qnx
 LIMIT83fs = go32v2 os2 emx watcom
 LIMIT83fs = go32v2 os2 emx watcom
+OSNeedsComspecToRunBatch = go32v2 watcom
 FORCE:
 FORCE:
 .PHONY: FORCE
 .PHONY: FORCE
 override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
 override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
@@ -56,6 +57,11 @@ else
 SRCBATCHEXT=.bat
 SRCBATCHEXT=.bat
 endif
 endif
 endif
 endif
+ifdef COMSPEC
+ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),)
+RUNBATCH=$(COMSPEC) /C
+endif
+endif
 ifdef inUnix
 ifdef inUnix
 PATHSEP=/
 PATHSEP=/
 else
 else
@@ -102,7 +108,11 @@ ifndef FPC
 FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
 FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
 ifneq ($(FPCPROG),)
 ifneq ($(FPCPROG),)
 FPCPROG:=$(firstword $(FPCPROG))
 FPCPROG:=$(firstword $(FPCPROG))
+ifneq ($(CPU_TARGET),)
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+else
 FPC:=$(shell $(FPCPROG) -PB)
 FPC:=$(shell $(FPCPROG) -PB)
+endif
 ifneq ($(findstring Error,$(FPC)),)
 ifneq ($(findstring Error,$(FPC)),)
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
 override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
 endif
 endif
@@ -233,190 +243,190 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(F
 override PACKAGE_NAME=installer
 override PACKAGE_NAME=installer
 override PACKAGE_VERSION=2.2.1
 override PACKAGE_VERSION=2.2.1
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_PROGRAMS+=installer
+override TARGET_PROGRAMS+=installer writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_PROGRAMS+=install
+override TARGET_PROGRAMS+=install writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_PROGRAMS+=install
+override TARGET_PROGRAMS+=install writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_PROGRAMS+=install
+override TARGET_PROGRAMS+=install writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_PROGRAMS+=installer
+override TARGET_PROGRAMS+=installer writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_PROGRAMS+=installer
+override TARGET_PROGRAMS+=installer writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_PROGRAMS+=installer
+override TARGET_PROGRAMS+=installer writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_PROGRAMS+=installer
+override TARGET_PROGRAMS+=installer writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_PROGRAMS+=installer
+override TARGET_PROGRAMS+=installer writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_PROGRAMS+=installer
+override TARGET_PROGRAMS+=installer writeidx
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 ifeq ($(FULL_TARGET),i386-go32v2)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-win32)
 ifeq ($(FULL_TARGET),i386-win32)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-os2)
 ifeq ($(FULL_TARGET),i386-os2)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
 ifeq ($(FULL_TARGET),i386-freebsd)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-beos)
 ifeq ($(FULL_TARGET),i386-beos)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
 ifeq ($(FULL_TARGET),i386-netbsd)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
 ifeq ($(FULL_TARGET),i386-solaris)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
 ifeq ($(FULL_TARGET),i386-qnx)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 ifeq ($(FULL_TARGET),i386-netware)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
 ifeq ($(FULL_TARGET),i386-openbsd)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
 ifeq ($(FULL_TARGET),i386-wdosx)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 ifeq ($(FULL_TARGET),i386-darwin)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-emx)
 ifeq ($(FULL_TARGET),i386-emx)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
 ifeq ($(FULL_TARGET),i386-watcom)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-wince)
 ifeq ($(FULL_TARGET),i386-wince)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
 ifeq ($(FULL_TARGET),i386-embedded)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 ifeq ($(FULL_TARGET),i386-symbian)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 ifeq ($(FULL_TARGET),m68k-linux)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
 ifeq ($(FULL_TARGET),m68k-amiga)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
 ifeq ($(FULL_TARGET),m68k-atari)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
 ifeq ($(FULL_TARGET),m68k-palmos)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
 ifeq ($(FULL_TARGET),m68k-embedded)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 ifeq ($(FULL_TARGET),powerpc-linux)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
 ifeq ($(FULL_TARGET),powerpc-macos)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 ifeq ($(FULL_TARGET),sparc-linux)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
 ifeq ($(FULL_TARGET),sparc-solaris)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
 ifeq ($(FULL_TARGET),sparc-embedded)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 ifeq ($(FULL_TARGET),x86_64-linux)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
 ifeq ($(FULL_TARGET),x86_64-win64)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 ifeq ($(FULL_TARGET),arm-linux)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
 ifeq ($(FULL_TARGET),arm-palmos)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),arm-wince)
 ifeq ($(FULL_TARGET),arm-wince)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),arm-gba)
 ifeq ($(FULL_TARGET),arm-gba)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 ifeq ($(FULL_TARGET),arm-nds)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 ifeq ($(FULL_TARGET),arm-embedded)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 ifeq ($(FULL_TARGET),arm-symbian)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override CLEAN_UNITS+=scroll
+override CLEAN_UNITS+=scroll insthelp
 endif
 endif
 ifeq ($(FULL_TARGET),i386-linux)
 ifeq ($(FULL_TARGET),i386-linux)
 override CLEAN_FILES+=installer.pas
 override CLEAN_FILES+=installer.pas
@@ -1696,7 +1706,7 @@ override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
 endif
 endif
 ifndef CROSSBOOTSTRAP
 ifndef CROSSBOOTSTRAP
 ifneq ($(BINUTILSPREFIX),)
 ifneq ($(BINUTILSPREFIX),)
-override FPCOPT+=-XP$(BINUTILSPREFIX) 
+override FPCOPT+=-XP$(BINUTILSPREFIX)
 endif
 endif
 ifneq ($(BINUTILSPREFIX),)
 ifneq ($(BINUTILSPREFIX),)
 override FPCOPT+=-Xr$(RLINKPATH)
 override FPCOPT+=-Xr$(RLINKPATH)
@@ -1828,9 +1838,13 @@ ifeq (,$(findstring -s ,$(COMPILER)))
 EXECPPAS=
 EXECPPAS=
 else
 else
 ifeq ($(FULL_SOURCE),$(FULL_TARGET))
 ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+ifdef RUNBATCH
+EXECPPAS:=@$(RUNBATCH) $(PPAS)
+else
 EXECPPAS:=@$(PPAS)
 EXECPPAS:=@$(PPAS)
 endif
 endif
 endif
 endif
+endif
 .PHONY: fpc_exes
 .PHONY: fpc_exes
 ifndef CROSSINSTALL
 ifndef CROSSINSTALL
 ifneq ($(TARGET_PROGRAMS),)
 ifneq ($(TARGET_PROGRAMS),)
@@ -2062,8 +2076,12 @@ else
 endif
 endif
 ifdef inUnix
 ifdef inUnix
 	/bin/sh $(ZIPWRAPPER)
 	/bin/sh $(ZIPWRAPPER)
+else
+ifdef RUNBATCH
+	$(RUNBATCH) (ZIPWRAPPER)
 else
 else
 	$(ZIPWRAPPER)
 	$(ZIPWRAPPER)
+endif
 endif
 endif
 	$(DEL) $(ZIPWRAPPER)
 	$(DEL) $(ZIPWRAPPER)
 else
 else
@@ -2283,3 +2301,4 @@ installer.pas: install.pas
 	$(COPY) install.pas installer.pas
 	$(COPY) install.pas installer.pas
 install$(EXEEXT) : install.pas scroll.pas
 install$(EXEEXT) : install.pas scroll.pas
 installer$(EXEEXT) : installer.pas scroll.pas
 installer$(EXEEXT) : installer.pas scroll.pas
+writeidx$(EXEEXT) : writeidx.pas insthelp.pas

+ 7 - 5
installer/Makefile.fpc

@@ -7,13 +7,13 @@ name=installer
 version=2.2.1
 version=2.2.1
 
 
 [target]
 [target]
-programs_go32v2=install
-programs_win32=install
-programs_os2=install
-programs_linux=installer
+programs_go32v2=install writeidx
+programs_win32=install writeidx
+programs_os2=install writeidx
+programs_linux=installer writeidx
 
 
 [clean]
 [clean]
-units=scroll
+units=scroll insthelp
 files_linux=installer.pas
 files_linux=installer.pas
 
 
 [require]
 [require]
@@ -45,3 +45,5 @@ installer.pas: install.pas
 install$(EXEEXT) : install.pas scroll.pas
 install$(EXEEXT) : install.pas scroll.pas
 
 
 installer$(EXEEXT) : installer.pas scroll.pas
 installer$(EXEEXT) : installer.pas scroll.pas
+
+writeidx$(EXEEXT) : writeidx.pas insthelp.pas

+ 21 - 13
installer/install.dat

@@ -77,8 +77,9 @@ package=ufclxdos.zip,Free Component Libary (FCL)-XML
 package=ufclwdos.zip,Free Component Libary (FCL)-Web
 package=ufclwdos.zip,Free Component Libary (FCL)-Web
 # Dos 25
 # Dos 25
 package=ufpmkunitdos.zip[ufpmkdos.zip],Units required for building fpmake.exe
 package=ufpmkunitdos.zip[ufpmkdos.zip],Units required for building fpmake.exe
-# Dos 25
-package=ufpmkdos.zip,Units required for building fpmake.exe
+# Dos 26
+package=ufcl-jsondos.zip[ufcljdos.zip],Free Component Libary (FCL)-JSON interface
+
 
 
 #
 #
 # Win32 packages
 # Win32 packages
@@ -186,6 +187,9 @@ package=units-fcl-registry.i386-win32.zip,Free Component Libary (FCL)-registry
 package=units-fcl-web.i386-win32.zip,Free Component Libary (FCL)-Web
 package=units-fcl-web.i386-win32.zip,Free Component Libary (FCL)-Web
 # Win32-2 22
 # Win32-2 22
 package=units-fcl-xml.i386-win32.zip,Free Component Libary (FCL)-XML
 package=units-fcl-xml.i386-win32.zip,Free Component Libary (FCL)-XML
+# Win32-2 23
+package=units-fcl-json.i386-win32.zip,Free Component Libary (FCL)-JSON interface
+
 
 
 #
 #
 # OS/2 packages
 # OS/2 packages
@@ -239,7 +243,6 @@ package=ufclxos2.zip,Free Component Library (FCL)-XML
 # OS/2 20
 # OS/2 20
 #package=ufclwos2.zip,Free Component Library (FCL)-Web
 #package=ufclwos2.zip,Free Component Library (FCL)-Web
 
 
-
 #
 #
 # OS/2 packages 2nd part
 # OS/2 packages 2nd part
 #
 #
@@ -279,6 +282,8 @@ package=uzlibos2.zip,ZLib interface units
 package=unetdbos2.zip[undbos2.zip],NetDB units
 package=unetdbos2.zip[undbos2.zip],NetDB units
 # OS/2-2 17
 # OS/2-2 17
 package=ufpmkunitos2.zip[ufpmkos2.zip],Units required for building fpmake.exe
 package=ufpmkunitos2.zip[ufpmkos2.zip],Units required for building fpmake.exe
+# OS/2-2 18
+package=ufcl-jsonos2.zip[ufcljos2.zip],Free Component Libary (FCL)-JSON interface
 
 
 
 
 #
 #
@@ -335,7 +340,6 @@ package=ufclxemx.zip,Free Component Library (FCL)-XML
 # EMX 21
 # EMX 21
 package=ufpmkos2.zip,Units required for building fpmake.exe
 package=ufpmkos2.zip,Units required for building fpmake.exe
 
 
-
 #
 #
 # EMX packages 2nd part
 # EMX packages 2nd part
 #
 #
@@ -375,6 +379,8 @@ package=uzlibemx.zip,ZLib interface units
 package=unetdbemx.zip[undbemx.zip],NetDB units
 package=unetdbemx.zip[undbemx.zip],NetDB units
 # EMX-2 17
 # EMX-2 17
 package=ufpmkunitemx.zip[ufpmkemx.zip],Units required for building fpmake.exe
 package=ufpmkunitemx.zip[ufpmkemx.zip],Units required for building fpmake.exe
+# EMX-2 18
+package=ufcl-jsonemx.zip[ufcljemx.zip],Free Component Libary (FCL)-JSON interface
 
 
 
 
 #
 #
@@ -468,6 +474,8 @@ package=units-fpgtk.source.zip[ufpgtsrc.zip],fpGTK units
 package=units-sqlite.source.zip[usqltsrc.zip],SQLite interface units
 package=units-sqlite.source.zip[usqltsrc.zip],SQLite interface units
 # Source-2 17
 # Source-2 17
 package=units-fpmkunit.source.zip[ufpmksrc.zip],Units required for building fpmake.exe
 package=units-fpmkunit.source.zip[ufpmksrc.zip],Units required for building fpmake.exe
+# Source-2 18
+package=fcl-json.source.zip[ufcljsrc.zip],Free Component Libary (FCL)-JSON interface
 
 
 #
 #
 # Source packages 3rd part
 # Source packages 3rd part
@@ -485,23 +493,23 @@ package=units-hash.source.zip[uhashsrc.zip],Hash calculation units
 # Source-3 5
 # Source-3 5
 package=units-fftw.source.zip[ufftwsrc.zip],FFTW interface unit
 package=units-fftw.source.zip[ufftwsrc.zip],FFTW interface unit
 # Source-3 6
 # Source-3 6
-package=fcl-base.source.zip[ufclbsrc.zip],Free component library (FCL) sources - base part
+package=fcl-base.source.zip[ufclbsrc.zip],Free component library (FCL)-base part
 # Source-3 7
 # Source-3 7
-package=fcl-db.source.zip[ufcldsrc.zip],Free component library (FCL) sources - datasets
+package=fcl-db.source.zip[ufcldsrc.zip],Free component library (FCL)-datasets
 # Source-3 8
 # Source-3 8
-package=fcl-fpcunit.source.zip[ufclusrc.zip],Free component library (FCL) sources - FPCUnit
+package=fcl-fpcunit.source.zip[ufclusrc.zip],Free component library (FCL)-FPCUnit
 # Source-3 9
 # Source-3 9
-package=fcl-image.source.zip[ufclisrc.zip],Free component library (FCL) sources - images
+package=fcl-image.source.zip[ufclisrc.zip],Free component library (FCL)-images
 # Source-3 10
 # Source-3 10
-package=fcl-net.source.zip[ufclnsrc.zip],Free component library (FCL) sources - network
+package=fcl-net.source.zip[ufclnsrc.zip],Free component library (FCL)-network
 # Source-3 11
 # Source-3 11
-package=fcl-passrc.source.zip[ufclpsrc.zip],Free component library (FCL) sources - Pascal source processing
+package=fcl-passrc.source.zip[ufclpsrc.zip],Free component library (FCL)-Pascal source processing
 # Source-3 12
 # Source-3 12
-package=fcl-registry.source.zip[ufclrsrc.zip],Free component library (FCL) sources - registry
+package=fcl-registry.source.zip[ufclrsrc.zip],Free component library (FCL)-registry
 # Source-3 13
 # Source-3 13
-package=fcl-xml.source.zip[ufclxsrc.zip],Free component library (FCL) sources - XML files
+package=fcl-xml.source.zip[ufclxsrc.zip],Free component library (FCL)-XML files
 # Source-3 14
 # Source-3 14
-package=fcl-web.source.zip[ufclwsrc.zip],Free component library (FCL) sources - Web
+package=fcl-web.source.zip[ufclwsrc.zip],Free component library (FCL)-Web
 # Source-3 15
 # Source-3 15
 package=httpd-1.3.source.zip[uhd13src.zip],HTTPD 1.3 interface units
 package=httpd-1.3.source.zip[uhd13src.zip],HTTPD 1.3 interface units
 # Source-3 16
 # Source-3 16

+ 9 - 0
rtl/objpas/typinfo.pp

@@ -63,6 +63,7 @@ unit typinfo;
 
 
    type
    type
       TTypeKinds = set of TTypeKind;
       TTypeKinds = set of TTypeKind;
+		  ShortStringBase = string[255];
 
 
 {$PACKRECORDS 1}
 {$PACKRECORDS 1}
       TTypeInfo = record
       TTypeInfo = record
@@ -141,6 +142,14 @@ unit typinfo;
                RawIntfUnit: ShortString;
                RawIntfUnit: ShortString;
                IIDStr: ShortString;
                IIDStr: ShortString;
               );
               );
+			      tkDynArray: 
+			        (
+			        elSize     : PtrUInt;
+			        elType2    : PPTypeInfo;
+			        varType    : Longint;
+			        elType     : PPTypeInfo;
+			        DynUnitName: ShortStringBase
+			        );
       end;
       end;
 
 
       // unsed, just for completeness
       // unsed, just for completeness

+ 1 - 1
tests/webtbf/tw4737.pp

@@ -1,5 +1,5 @@
 { %fail }
 { %fail }
-{ %OPT=-Sewnh -vh}
+{ %OPT=-CO -Sewnh -vh}
 { changed -Seh to -Sewnh because -Cr option
 { changed -Seh to -Sewnh because -Cr option
   changes the hint into a warning PM }
   changes the hint into a warning PM }