Browse Source

* refactor booleans in systeminfo structure, they are now flags
* support for case aware filesystems (Windows), they do now only
one lookup if a file exists
* add -WI option to generate import section for DLL imports or
let the linker handle it. Default is still import section until
the Makefiles are fixed, then the generation can be left to the
linker

git-svn-id: trunk@2274 -

peter 19 năm trước cách đây
mục cha
commit
66f8276445

+ 1 - 1
compiler/assemble.pas

@@ -865,7 +865,7 @@ Implementation
                 relocsym:=nil;
               end;
             if (nidx=N_Function) and
-               target_info.use_function_relative_addresses then
+               (tf_use_function_relative_addresses in target_info.flags) then
               ofs:=0;
             objectdata.writestab(ofs,relocsym,nidx,nother,nline,pstr);
           end;

+ 3 - 3
compiler/dbgstabs.pas

@@ -989,7 +989,7 @@ implementation
             strpcopy(p,'192,0,0,');
             {$IFDEF POWERPC64}strpcopy(strend(p), '.');{$ENDIF POWERPC64}
             strpcopy(strend(p),pd.mangledname);
-            if (target_info.use_function_relative_addresses) then
+            if (tf_use_function_relative_addresses in target_info.flags) then
               begin
                 strpcopy(strend(p),'-');
                 {$IFDEF POWERPC64}strpcopy(strend(p), '.');{$ENDIF POWERPC64}
@@ -997,7 +997,7 @@ implementation
               end;
             templist.concat(Tai_stab.Create(stab_stabn,strnew(p)));
             strpcopy(p,'224,0,0,'+stabsendlabel.name);
-            if (target_info.use_function_relative_addresses) then
+            if (tf_use_function_relative_addresses in target_info.flags) then
               begin
                 strpcopy(strend(p),'-');
                 {$IFDEF POWERPC64}strpcopy(strend(p), '.');{$ENDIF POWERPC64}
@@ -1491,7 +1491,7 @@ implementation
                 if (lastfileinfo.line<>currfileinfo.line) and (currfileinfo.line<>0) then
                   begin
                      if assigned(currfuncname) and
-                        (target_info.use_function_relative_addresses) then
+                        (tf_use_function_relative_addresses in target_info.flags) then
                       begin
                         objectlibrary.getlabel(hlabel,alt_dbgline);
                         list.insertbefore(Tai_stab.Create_str(stab_stabn,tostr(n_textline)+',0,'+tostr(currfileinfo.line)+','+

+ 5 - 0
compiler/fmodule.pas

@@ -140,6 +140,7 @@ interface
         linkunitofiles,
         linkunitstaticlibs,
         linkunitsharedlibs,
+        linkdlls,
         linkotherofiles,           { objects,libs loaded from the source }
         linkothersharedlibs,       { using $L or $LINKLIB or import lib (for linux) }
         linkotherstaticlibs  : tlinkcontainer;
@@ -418,6 +419,7 @@ implementation
         linkotherofiles:=TLinkContainer.Create;
         linkotherstaticlibs:=TLinkContainer.Create;
         linkothersharedlibs:=TLinkContainer.Create;
+        linkdlls:=TLinkContainer.Create;
         crc:=0;
         interface_crc:=0;
         flags:=0;
@@ -507,6 +509,7 @@ implementation
         linkotherofiles.Free;
         linkotherstaticlibs.Free;
         linkothersharedlibs.Free;
+        linkdlls.Free;
         stringdispose(objfilename);
         stringdispose(newfilename);
         stringdispose(ppufilename);
@@ -641,6 +644,8 @@ implementation
         linkotherstaticlibs:=TLinkContainer.Create;
         linkothersharedlibs.Free;
         linkothersharedlibs:=TLinkContainer.Create;
+        linkdlls.Free;
+        linkdlls:=TLinkContainer.Create;
         uses_imports:=false;
         do_compile:=false;
         do_reload:=false;

+ 4 - 1
compiler/fppu.pas

@@ -356,7 +356,7 @@ uses
                Message1(unit_t_unitsearch,AddExtension(sourcefn^,pasext));
                fnd:=FindFile(AddExtension(sourcefn^,pasext),'',hs);
              end;
-            if not fnd and ((m_mac in aktmodeswitches) or target_info.p_ext_support) then
+            if not fnd and ((m_mac in aktmodeswitches) or (tf_p_ext_support in target_info.flags)) then
              begin
                Message1(unit_t_unitsearch,AddExtension(sourcefn^,pext));
                fnd:=FindFile(AddExtension(sourcefn^,pext),'',hs);
@@ -930,6 +930,8 @@ uses
                readlinkcontainer(LinkotherStaticLibs);
              iblinkothersharedlibs :
                readlinkcontainer(LinkotherSharedLibs);
+             iblinkdlls :
+               readlinkcontainer(LinkDlls);
              ibderefmap :
                readderefmap;
              ibderefdata :
@@ -1038,6 +1040,7 @@ uses
          writelinkcontainer(linkotherofiles,iblinkotherofiles,false);
          writelinkcontainer(linkotherstaticlibs,iblinkotherstaticlibs,true);
          writelinkcontainer(linkothersharedlibs,iblinkothersharedlibs,true);
+         writelinkcontainer(linkdlls,iblinkdlls,true);
          ppufile.do_crc:=true;
 
          { generate implementation deref data, the interface deref data is

+ 27 - 5
compiler/globals.pas

@@ -178,6 +178,7 @@ interface
        dllrevision   : word;  { revision only for netware }
        UseDeffileForExports    : boolean;
        UseDeffileForExportsSetExplicitly : boolean;
+       GenerateImportSection,
        RelocSection : boolean;
        RelocSectionSetExplicitly : boolean;
        LinkTypeSetExplicitly : boolean;
@@ -628,7 +629,7 @@ implementation
         fn2 : string;
       begin
         result:=false;
-        if source_info.files_case_relevent then
+        if tf_files_case_sensitive in source_info.flags then
           begin
             {
               Search order for case sensitive systems:
@@ -663,6 +664,20 @@ implementation
                  end;
               end;
           end
+        else
+          if tf_files_case_aware in source_info.flags then
+            begin
+              {
+                Search order for case aware systems:
+                 1. NormalCase
+              }
+              FoundFile:=path+fn;
+              If FileExists(FoundFile) then
+               begin
+                 result:=true;
+                 exit;
+               end;
+           end
         else
           begin
             { None case sensitive only lowercase }
@@ -841,7 +856,8 @@ implementation
         if (not allowdot) and (s='.'+source_info.DirSep) then
          s:='';
         { return }
-        if source_info.files_case_relevent then
+        if (tf_files_case_aware in source_info.flags) or
+           (tf_files_case_sensitive in source_info.flags) then
          FixPath:=s
         else
          FixPath:=Lower(s);
@@ -979,7 +995,9 @@ implementation
      begin
        if source_info.system = system_powerpc_MACOS then
          FixFileName:= TranslatePathToMac(s, true)
-       else if source_info.files_case_relevent then
+       else
+        if (tf_files_case_aware in source_info.flags) or
+           (tf_files_case_sensitive in source_info.flags) then
         begin
           for i:=1 to length(s) do
            begin
@@ -1026,7 +1044,8 @@ implementation
         if (not allowdot) and (s='.'+target_info.DirSep) then
          s:='';
         { return }
-        if target_info.files_case_relevent then
+        if (tf_files_case_aware in target_info.flags) or
+           (tf_files_case_sensitive in target_info.flags) then
          TargetFixPath:=s
         else
          TargetFixPath:=Lower(s);
@@ -1039,7 +1058,9 @@ implementation
      begin
        if target_info.system = system_powerpc_MACOS then
          TargetFixFileName:= TranslatePathToMac(s, true)
-       else if target_info.files_case_relevent then
+       else
+        if (tf_files_case_aware in target_info.flags) or
+           (tf_files_case_sensitive in target_info.flags) then
          begin
            for i:=1 to length(s) do
            begin
@@ -2177,6 +2198,7 @@ end;
         nwcopyright  := '';
         UseDeffileForExports:=false;
         UseDeffileForExportsSetExplicitly:=false;
+        GenerateImportSection:=true;
         RelocSection:=false;
         RelocSectionSetExplicitly:=false;
         LinkTypeSetExplicitly:=false;

+ 45 - 5
compiler/link.pas

@@ -44,12 +44,14 @@ Type
     TLinker = class(TAbstractLinker)
     public
        ObjectFiles,
+       DLLFiles,
        SharedLibFiles,
        StaticLibFiles  : TStringList;
        Constructor Create;virtual;
        Destructor Destroy;override;
        procedure AddModuleFiles(hp:tmodule);
        Procedure AddObject(const S,unitpath : String;isunit:boolean);
+       Procedure AddDLL(const S : String);
        Procedure AddStaticLibrary(const S : String);
        Procedure AddSharedLibrary(S : String);
        Procedure AddStaticCLibrary(const S : String);
@@ -85,6 +87,7 @@ var
 
 function FindObjectFile(s : string;const unitpath:string;isunit:boolean) : string;
 function FindLibraryFile(s:string;const prefix,ext:string;var foundfile : string) : boolean;
+function FindDLL(const s:string;var founddll:string):boolean;
 
 procedure InitLinker;
 procedure DoneLinker;
@@ -177,6 +180,34 @@ begin
 end;
 
 
+    { searches a (windows) DLL file }
+    function FindDLL(const s:string;var founddll:string):boolean;
+      var
+        sysdir : string;
+        Found : boolean;
+      begin
+        Found:=false;
+        { Look for DLL in:
+          1. Current dir
+          2. Library Path
+          3. windir,windir/system,windir/system32 }
+        Found:=FindFile(s,'.'+source_info.DirSep,founddll);
+        if (not found) then
+         Found:=librarysearchpath.FindFile(s,founddll);
+        if (not found) then
+         begin
+           sysdir:=FixPath(GetEnv('windir'),false);
+           Found:=FindFile(s,sysdir+';'+sysdir+'system'+source_info.DirSep+';'+sysdir+'system32'+source_info.DirSep,founddll);
+         end;
+        if (not found) then
+         begin
+           message1(exec_w_libfile_not_found,s);
+           FoundDll:=s;
+         end;
+        FindDll:=Found;
+      end;
+
+
 { searches an library file }
 function FindLibraryFile(s:string;const prefix,ext:string;var foundfile : string) : boolean;
 var
@@ -231,6 +262,7 @@ Constructor TLinker.Create;
 begin
   Inherited Create;
   ObjectFiles:=TStringList.Create_no_double;
+  DLLFiles:=TStringList.Create_no_double;
   SharedLibFiles:=TStringList.Create_no_double;
   StaticLibFiles:=TStringList.Create_no_double;
 end;
@@ -239,6 +271,7 @@ end;
 Destructor TLinker.Destroy;
 begin
   ObjectFiles.Free;
+  DLLFiles.Free;
   SharedLibFiles.Free;
   StaticLibFiles.Free;
 end;
@@ -308,15 +341,13 @@ begin
          end;
         { unit files }
         while not linkunitofiles.empty do
-        begin
           AddObject(linkunitofiles.getusemask(mask),path^,true);
-        end;
         while not linkunitstaticlibs.empty do
-         AddStaticLibrary(linkunitstaticlibs.getusemask(mask));
+          AddStaticLibrary(linkunitstaticlibs.getusemask(mask));
         while not linkunitsharedlibs.empty do
-         AddSharedLibrary(linkunitsharedlibs.getusemask(mask));
+          AddSharedLibrary(linkunitsharedlibs.getusemask(mask));
       end;
-   { Other needed .o and libs, specified using $L,$LINKLIB,external }
+     { Other needed .o and libs, specified using $L,$LINKLIB,external }
      mask:=link_allways;
      while not linkotherofiles.empty do
       AddObject(linkotherofiles.Getusemask(mask),path^,false);
@@ -324,6 +355,9 @@ begin
       AddStaticCLibrary(linkotherstaticlibs.Getusemask(mask));
      while not linkothersharedlibs.empty do
       AddSharedCLibrary(linkothersharedlibs.Getusemask(mask));
+     { (Windows) DLLs }
+     while not linkdlls.empty do
+      AddDLL(linkdlls.Getusemask(mask));
    end;
 end;
 
@@ -334,6 +368,12 @@ begin
 end;
 
 
+Procedure TLinker.AddDLL(const S : String);
+begin
+  DLLFiles.Concat(s);
+end;
+
+
 Procedure TLinker.AddSharedLibrary(S:String);
 begin
   if s='' then

+ 1 - 1
compiler/ncgutil.pas

@@ -1772,7 +1772,7 @@ implementation
             list.concat(Tai_symbol.createname_global(hs,AT_FUNCTION,0))
           else
             list.concat(Tai_symbol.createname(hs,AT_FUNCTION,0));
-          if target_info.use_function_relative_addresses then
+          if tf_use_function_relative_addresses in target_info.flags then
             list.concat(Tai_function_name.create(hs));
         until false;
 

+ 11 - 6
compiler/options.pas

@@ -1125,12 +1125,9 @@ begin
                         else
                           apptype:=app_gui;
                       end;
-                    'T':
+                    'I':
                       begin
-                        if UnsetBool(More, j) then
-                          apptype:=app_cui
-                        else
-                          apptype:=app_tool;
+                        GenerateImportSection:=UnsetBool(More,j);
                       end;
                     'N':
                       begin
@@ -1143,6 +1140,13 @@ begin
                         RelocSection:=not UnsetBool(More,j);
                         RelocSectionSetExplicitly:=true;
                       end;
+                    'T':
+                      begin
+                        if UnsetBool(More, j) then
+                          apptype:=app_cui
+                        else
+                          apptype:=app_tool;
+                      end;
                     else
                       IllegalPara(opt);
                   end;
@@ -1993,7 +1997,8 @@ begin
       inputextension:=sourceext
      else if FileExists(inputdir+inputfile+pasext) then
        inputextension:=pasext
-     else if ((m_mac in aktmodeswitches) or target_info.p_ext_support)
+     else if ((m_mac in aktmodeswitches) or
+              (tf_p_ext_support in target_info.flags))
              and FileExists(inputdir+inputfile+pext) then
        inputextension:=pext;
    end;

+ 39 - 18
compiler/pdecsub.pas

@@ -1343,7 +1343,7 @@ begin
         end;
       (paramanager as tm68kparamanager).create_funcretloc_info(pd,calleeside);
       (paramanager as tm68kparamanager).create_funcretloc_info(pd,callerside);
-  
+
       tprocdef(pd).extnumber:=get_intconst;
     end;
 {$endif m68k}
@@ -1351,11 +1351,11 @@ begin
    if target_info.system = system_powerpc_amiga then
     begin
       include(pd.procoptions,po_syscall_sysv);
-      
+
       (paramanager as tppcparamanager).create_funcretloc_info(pd,calleeside);
       (paramanager as tppcparamanager).create_funcretloc_info(pd,callerside);
     end else
-    
+
    if target_info.system = system_powerpc_morphos then
     begin
       if idtoken=_LEGACY then
@@ -1376,7 +1376,7 @@ begin
       else if idtoken=_SYSVBASE then
         begin
           consume(_SYSVBASE);
-          include(pd.procoptions,po_syscall_sysvbase);    
+          include(pd.procoptions,po_syscall_sysvbase);
         end
       else if idtoken=_R12BASE then
         begin
@@ -1814,7 +1814,7 @@ const
     ),(
       idtok:_SYSCALL;
       { Different kind of syscalls are valid for AOS68k, AOSPPC and MOS. }
-      { FIX ME!!! MorphOS/AOS68k pd_flags should be: 
+      { FIX ME!!! MorphOS/AOS68k pd_flags should be:
         pd_interface, pd_implemen, pd_notobject, pd_notobjintf (KB) }
       pd_flags : [pd_interface,pd_implemen,pd_procvar];
       handler  : @pd_syscall;
@@ -2023,6 +2023,15 @@ const
 
 
     function proc_get_importname(pd:tprocdef):string;
+
+       function maybe_cprefix(const s:string):string;
+         begin
+           if not(pd.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
+             result:=s
+           else
+             result:=target_info.Cprefix+s;
+         end;
+
       begin
         result:='';
         if not(po_external in pd.procoptions) then
@@ -2036,20 +2045,32 @@ const
         { external name specified }
           if assigned(pd.import_name) then
             begin
-              { Win32 imports need to use the normal name since to functions
-                can refer to the same DLL function. This is also needed for compatability
-                with Delphi and TP7 }
-              if not(
-                     assigned(pd.import_dll) and
-                     (target_info.system in [system_i386_win32,system_i386_wdosx,
-                                             system_i386_emx,system_i386_os2,system_arm_wince,system_i386_wince])
-                    ) then
+              if assigned(pd.import_dll) then
                 begin
-                  if not(pd.proccalloption in [pocall_cdecl,pocall_cppdecl]) then
-                    result:=pd.import_name^
-                  else
-                    result:=target_info.Cprefix+pd.import_name^;
-                end;
+                  { If we are not using direct dll linking under win32 then imports
+                    need to use the normal name since to functions can refer to the
+                    same DLL function. This is also needed for compatability
+                    with Delphi and TP7 }
+                  case target_info.system of
+                    system_i386_win32 :
+                      begin
+                        { We need to use the name with a _ prefix if we let ld.exe do
+                          the importing for us }
+                        if not GenerateImportSection then
+                          result:=target_info.Cprefix+pd.import_name^;
+                      end;
+                    system_i386_wdosx,
+                    system_i386_emx,system_i386_os2,
+                    system_arm_wince,system_i386_wince :
+                      begin
+                        { keep normal mangledname }
+                      end;
+                    else
+                      result:=maybe_cprefix(pd.import_name^);
+                  end;
+                end
+              else
+                result:=maybe_cprefix(pd.import_name^);
             end
         else
           begin

+ 1 - 1
compiler/pdecvar.pas

@@ -1146,7 +1146,7 @@ implementation
                              importlib.importvariable(tglobalvarsym(vs),C_name,dll_name);
                            end
                           else
-                           if target_info.DllScanSupported then
+                           if tf_has_dllscanner in target_info.flags then
                             current_module.Externals.insert(tExternalsItem.create(vs.mangledname));
                         end;
                      end

+ 2 - 2
compiler/pmodules.pas

@@ -52,7 +52,7 @@ implementation
         KeepShared      : TStringList;
       begin
         { try to create import entries from system dlls }
-        if target_info.DllScanSupported and
+        if (tf_has_dllscanner in target_info.flags) and
            (not current_module.linkOtherSharedLibs.Empty) then
          begin
            { Init DLLScanner }
@@ -366,7 +366,7 @@ implementation
         new_section(asmlist[al_globals],sec_data,'__stklen', sizeof(aint));
         asmlist[al_globals].concat(Tai_symbol.Createname_global('__stklen',AT_DATA,sizeof(aint)));
         asmlist[al_globals].concat(Tai_const.Create_aint(stacksize));
-{$IFDEF POWERPC} 
+{$IFDEF POWERPC}
         { AmigaOS4 "stack cookie" support }
         if ( target_info.system = system_powerpc_amiga ) then
          begin

+ 2 - 1
compiler/ppu.pas

@@ -43,7 +43,7 @@ type
 {$endif Test_Double_checksum}
 
 const
-  CurrentPPUVersion=51;
+  CurrentPPUVersion=52;
 
 { buffer sizes }
   maxentrysize = 1024;
@@ -73,6 +73,7 @@ const
   iblinkotherofiles      = 8;
   iblinkotherstaticlibs  = 9;
   iblinkothersharedlibs  = 10;
+  iblinkdlls             = 11;
   ibsymref               = 12;
   ibdefref               = 13;
   ibendsymtablebrowser   = 14;

+ 1 - 1
compiler/psub.pas

@@ -1496,7 +1496,7 @@ implementation
                  else
                    begin
                      { add import name to external list for DLL scanning }
-                     if target_info.DllScanSupported then
+                     if tf_has_dllscanner in target_info.flags then
                        current_module.externals.insert(tExternalsItem.create(proc_get_importname(pd)));
                    end;
                end;

+ 8 - 7
compiler/systems.pas

@@ -259,7 +259,12 @@ interface
             tf_pic_uses_got,
             tf_library_needs_pic,
             tf_needs_symbol_type,
-            tf_section_threadvars
+            tf_section_threadvars,
+            tf_files_case_sensitive,
+            tf_files_case_aware,
+            tf_p_ext_support,
+            tf_has_dllscanner,
+            tf_use_function_relative_addresses
        );
 
        psysteminfo = ^tsysteminfo;
@@ -290,11 +295,9 @@ interface
           staticClibext,
           staticClibprefix : string[4];
           sharedClibprefix : string[4];
-          p_ext_support:Boolean; {Whether extension .p is supported by default}
           Cprefix      : string[2];
           newline      : string[2];
           dirsep       : char;
-          files_case_relevent : boolean;
           assem        : tasm;
           assemextern  : tasm; { external assembler, used by -a }
           link         : tabstractlinkerclass;
@@ -312,10 +315,8 @@ interface
             (see also FIRST_PARM_OFFSET in GCC source)
           }
           first_parm_offset : longint;
-          stacksize       : longint;
-          DllScanSupported : boolean;
-          use_function_relative_addresses : boolean;
-          abi : tabi;
+          stacksize    : longint;
+          abi          : tabi;
        end;
 
     const

+ 4 - 12
compiler/systems/i_amiga.pas

@@ -32,7 +32,7 @@ unit i_amiga;
             system       : system_m68k_Amiga;
             name         : 'Commodore Amiga';
             shortname    : 'amiga';
-            flags        : [];
+            flags        : [tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_m68k;
             unit_env     : '';
             extradefines : '';
@@ -54,11 +54,9 @@ unit i_amiga;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -85,9 +83,7 @@ unit i_amiga;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
-	    abi : abi_default;
+    	    abi : abi_default;
           );
 
        system_powerpc_amiga_info : tsysteminfo =
@@ -95,7 +91,7 @@ unit i_amiga;
             system       : system_powerpc_Amiga;
             name         : 'AmigaOS for PowerPC';
             shortname    : 'amiga';
-            flags        : [];
+            flags        : [tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_powerpc;
             unit_env     : '';
             extradefines : '';
@@ -117,11 +113,9 @@ unit i_amiga;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : '';
-	    p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -148,9 +142,7 @@ unit i_amiga;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
-	    abi : abi_powerpc_sysv;
+	        abi : abi_powerpc_sysv;
           );
 
   implementation

+ 1 - 5
compiler/systems/i_beos.pas

@@ -32,7 +32,7 @@ unit i_beos;
             system       : system_i386_BeOS;
             name         : 'Beos for i386';
             shortname    : 'Beos';
-            flags        : [tf_under_development,tf_needs_symbol_size];
+            flags        : [tf_under_development,tf_needs_symbol_size,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'BEOSUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -54,11 +54,9 @@ unit i_beos;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -85,8 +83,6 @@ unit i_beos;
               );
             first_parm_offset : 8;
             stacksize    : 8192;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
           );
 
   implementation

+ 14 - 40
compiler/systems/i_bsd.pas

@@ -35,7 +35,7 @@ unit i_bsd;
             system       : system_i386_FreeBSD;
             name         : 'FreeBSD/ELF for i386';
             shortname    : 'FreeBSD';
-            flags        : [tf_pic_uses_got];
+            flags        : [tf_pic_uses_got,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -57,11 +57,9 @@ unit i_bsd;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_i386_elf32;
             assemextern  : as_gas;
             link         : nil;
@@ -88,8 +86,7 @@ unit i_bsd;
               );
             first_parm_offset : 8;
             stacksize   : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
+            abi          : abi_default;
           );
 
 
@@ -98,7 +95,7 @@ unit i_bsd;
             system       : system_x86_64_freebsd;
             name         : 'FreeBSD for x86-64';
             shortname    : 'FreeBSD';
-            flags        : [tf_needs_symbol_size,tf_pic_uses_got{,tf_smartlink_sections}];
+            flags        : [tf_needs_symbol_size,tf_pic_uses_got,tf_files_case_sensitive,tf_use_function_relative_addresses{,tf_smartlink_sections}];
             cpu          : cpu_x86_64;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -120,11 +117,9 @@ unit i_bsd;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -151,8 +146,7 @@ unit i_bsd;
               );
             first_parm_offset : 16;
             stacksize    : 256*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
+            abi          : abi_default;
           );
 
 
@@ -161,7 +155,7 @@ unit i_bsd;
             system       : system_i386_NetBSD;
             name         : 'NetBSD for i386';
             shortname    : 'NetBSD';
-            flags        : [tf_under_development];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -183,11 +177,9 @@ unit i_bsd;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -214,8 +206,7 @@ unit i_bsd;
               );
             first_parm_offset : 8;
             stacksize   : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
+            abi          : abi_default;
           );
 
        system_i386_openbsd_info : tsysteminfo =
@@ -223,7 +214,7 @@ unit i_bsd;
             system       : system_i386_OpenBSD;
             name         : 'OpenBSD for i386';
             shortname    : 'OpenBSD';
-            flags        : [tf_under_development];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -245,11 +236,9 @@ unit i_bsd;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -276,8 +265,7 @@ unit i_bsd;
               );
             first_parm_offset : 8;
             stacksize   : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
+            abi          : abi_default;
           );
 
        system_m68k_netbsd_info : tsysteminfo =
@@ -285,7 +273,7 @@ unit i_bsd;
             system       : system_m68k_NetBSD;
             name         : 'NetBSD for m68k';
             shortname    : 'NetBSD';
-            flags        : [tf_under_development];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_m68k;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -307,11 +295,9 @@ unit i_bsd;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -338,8 +324,7 @@ unit i_bsd;
               );
             first_parm_offset : 8;
             stacksize   : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
+            abi          : abi_default;
           );
 
        system_powerpc_netbsd_info : tsysteminfo =
@@ -347,7 +332,7 @@ unit i_bsd;
             system       : system_powerpc_netbsd;
             name         : 'NetBSD for PowerPC';
             shortname    : 'NetBSD';
-            flags        : [tf_under_development];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_powerpc;
             unit_env     : '';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -369,11 +354,9 @@ unit i_bsd;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -400,8 +383,6 @@ unit i_bsd;
               );
             first_parm_offset : 8;
             stacksize    : 32*1024*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             { abi_powerpc_sysv doesn't work yet }
             abi : abi_powerpc_aix;
           );
@@ -412,7 +393,7 @@ unit i_bsd;
             system       : system_powerpc_darwin;
             name         : 'Darwin for PowerPC';
             shortname    : 'Darwin';
-            flags        : [];
+            flags        : [tf_p_ext_support,tf_files_case_sensitive];
             cpu          : cpu_powerpc;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -434,11 +415,9 @@ unit i_bsd;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : true;
             Cprefix      : '_';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_darwin;
             assemextern  : as_darwin;
             link         : nil;
@@ -465,8 +444,6 @@ unit i_bsd;
               );
             first_parm_offset : 24;
             stacksize   : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : false;
             abi : abi_powerpc_aix;
           );
 
@@ -477,7 +454,7 @@ unit i_bsd;
             system       : system_i386_darwin;
             name         : 'Darwin for i386';
             shortname    : 'Darwin';
-            flags        : [];
+            flags        : [tf_p_ext_support,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'BSDUNITS';
             extradefines : 'UNIX;BSD;HASUNIX';
@@ -499,11 +476,9 @@ unit i_bsd;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : true;
             Cprefix      : '_';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_darwin;
             assemextern  : as_darwin;
             link         : nil;
@@ -530,8 +505,7 @@ unit i_bsd;
               );
             first_parm_offset : 8;
             stacksize   : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
+            abi         : abi_default;
           );
 
   implementation

+ 0 - 4
compiler/systems/i_emx.pas

@@ -62,11 +62,9 @@ unit i_emx;
             staticClibext : '.a';
             staticClibprefix : '';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            files_case_relevent : false;
             assem        : as_i386_as_aout;
             assemextern  : as_i386_as_aout;
             link         : nil;
@@ -93,8 +91,6 @@ unit i_emx;
               );
             first_parm_offset : 8;
             stacksize    : 256*1024;
-            DllScanSupported: false;
-            use_function_relative_addresses : false
           );
 
 

+ 1 - 5
compiler/systems/i_gba.pas

@@ -32,7 +32,7 @@ unit i_gba;
             system       : system_arm_gba;
             name         : 'GameBoy Advance';
             shortname    : 'gba';
-            flags        : [tf_needs_symbol_size];
+            flags        : [tf_needs_symbol_size,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_arm;
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -54,11 +54,9 @@ unit i_gba;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -85,8 +83,6 @@ unit i_gba;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_default
           );
 

+ 1 - 5
compiler/systems/i_go32v2.pas

@@ -32,7 +32,7 @@ unit i_go32v2;
             system       : system_i386_GO32V2;
             name         : 'GO32 V2 DOS extender';
             shortname    : 'Go32v2';
-            flags        : [tf_use_8_3];
+            flags        : [tf_use_8_3,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'GO32V2UNITS';
             extradefines : 'DPMI';
@@ -54,11 +54,9 @@ unit i_go32v2;
             staticClibext : '.a';
             staticClibprefix : '';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            files_case_relevent : false;
             assem        : as_i386_coff;
             assemextern  : as_gas;
             link         : nil;
@@ -85,8 +83,6 @@ unit i_go32v2;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported : false;
-            use_function_relative_addresses : true
           );
 
   implementation

+ 9 - 45
compiler/systems/i_linux.pas

@@ -50,7 +50,7 @@ unit i_linux;
 {$ifdef segment_threadvars}
                             tf_section_threadvars,
 {$endif segment_threadvars}
-                            tf_needs_symbol_type];
+                            tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -72,11 +72,9 @@ unit i_linux;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_i386_elf32;
             assemextern  : as_gas;
             link         : nil;
@@ -103,8 +101,6 @@ unit i_linux;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_default
           );
 
@@ -113,7 +109,7 @@ unit i_linux;
             system       : system_x86_6432_LINUX;
             name         : 'Linux for x64_6432';
             shortname    : 'Linux6432';
-            flags        : [tf_needs_symbol_size,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}];
             cpu          : cpu_x86_64;
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -135,11 +131,9 @@ unit i_linux;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_i386_elf32;
             assemextern  : as_gas;
             link         : nil;
@@ -166,8 +160,6 @@ unit i_linux;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_default
           );
 
@@ -176,7 +168,7 @@ unit i_linux;
             system       : system_m68k_linux;
             name         : 'Linux for m68k';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_m68k;
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -198,11 +190,9 @@ unit i_linux;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -229,8 +219,6 @@ unit i_linux;
               );
             first_parm_offset : 8;
             stacksize    : 32*1024*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_default
           );
 
@@ -239,7 +227,7 @@ unit i_linux;
             system       : system_powerpc_LINUX;
             name         : 'Linux for PowerPC';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_powerpc;
             unit_env     : '';
             extradefines : 'UNIX;HASUNIX';
@@ -261,11 +249,9 @@ unit i_linux;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -292,8 +278,6 @@ unit i_linux;
               );
             first_parm_offset : 8;
             stacksize    : 32*1024*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_powerpc_sysv;
           );
 
@@ -302,7 +286,7 @@ unit i_linux;
             system       : system_powerpc64_LINUX;
             name         : 'Linux for PowerPC64';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_powerpc64;
             unit_env     : '';
             extradefines : 'UNIX;HASUNIX';
@@ -324,11 +308,9 @@ unit i_linux;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -355,8 +337,6 @@ unit i_linux;
               );
             first_parm_offset : 8;
             stacksize    : 10*1024*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_default
           );
 
@@ -365,7 +345,7 @@ unit i_linux;
             system       : system_alpha_LINUX;
             name         : 'Linux for Alpha';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_alpha;
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -387,11 +367,9 @@ unit i_linux;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -418,8 +396,6 @@ unit i_linux;
               );
             first_parm_offset : 8;
             stacksize    : 32*1024*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_default
           );
 
@@ -429,7 +405,7 @@ unit i_linux;
             name         : 'Linux for x86-64';
             shortname    : 'Linux';
             flags        : [tf_needs_symbol_size,tf_needs_dwarf_cfi,
-                            tf_library_needs_pic,tf_needs_symbol_type];
+                            tf_library_needs_pic,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_x86_64;
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -451,11 +427,9 @@ unit i_linux;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -482,8 +456,6 @@ unit i_linux;
               );
             first_parm_offset : 16;
             stacksize    : 256*1024;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_default
           );
 
@@ -492,7 +464,7 @@ unit i_linux;
             system       : system_SPARC_Linux;
             name         : 'Linux for SPARC';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_library_needs_pic,tf_needs_symbol_type];
+            flags        : [tf_needs_symbol_size,tf_library_needs_pic,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_SPARC;
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -514,11 +486,9 @@ unit i_linux;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -545,8 +515,6 @@ unit i_linux;
               );
             first_parm_offset : 92;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_default
           );
 
@@ -555,7 +523,7 @@ unit i_linux;
             system       : system_arm_Linux;
             name         : 'Linux for ARM';
             shortname    : 'Linux';
-            flags        : [tf_needs_symbol_size,tf_needs_symbol_type];
+            flags        : [tf_needs_symbol_size,tf_needs_symbol_type,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_arm;
             unit_env     : 'LINUXUNITS';
             extradefines : 'UNIX;HASUNIX';
@@ -577,11 +545,9 @@ unit i_linux;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -608,8 +574,6 @@ unit i_linux;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_default
           );
 

+ 1 - 5
compiler/systems/i_macos.pas

@@ -31,7 +31,7 @@ unit i_macos;
             system       : system_powerpc_MACOS;
             name         : 'Mac OS for PowerPC';
             shortname    : 'MacOS';
-            flags        : [];
+            flags        : [tf_p_ext_support,tf_files_case_aware,tf_use_function_relative_addresses];
             cpu          : cpu_powerpc;
             unit_env     : '';
             extradefines : '';
@@ -53,11 +53,9 @@ unit i_macos;
             staticClibext : 'Lib';
             staticClibprefix : '';
             sharedClibprefix : '';
-            p_ext_support : true;
             Cprefix      : '';
             newline      : #13;
             dirsep       : ':';
-            files_case_relevent : false;
             assem        : as_powerpc_mpw;
             assemextern  : as_powerpc_mpw;
             link         : nil;
@@ -84,8 +82,6 @@ unit i_macos;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_powerpc_aix;
           );
 

+ 1 - 5
compiler/systems/i_morph.pas

@@ -32,7 +32,7 @@ unit i_morph;
             system       : system_powerpc_MorphOS;
             name         : 'MorphOS';
             shortname    : 'MorphOS';
-            flags        : [];
+            flags        : [tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_powerpc;
             unit_env     : '';
             extradefines : '';
@@ -54,11 +54,9 @@ unit i_morph;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -85,8 +83,6 @@ unit i_morph;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true;
             abi : abi_powerpc_sysv;
           );
 

+ 1 - 5
compiler/systems/i_nwl.pas

@@ -32,7 +32,7 @@ unit i_nwl;
             system       : system_i386_netwlibc;
             name         : 'Netware for i386(libc)';
             shortname    : 'Netwlibc';
-            flags        : [];
+            flags        : [tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'NETWLIBCUNITS';
             extradefines : 'NETWARE;NETWARE_LIBC';
@@ -54,11 +54,9 @@ unit i_nwl;
             staticClibext : '.a';
             staticClibprefix : '';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #13#10;
             dirsep       : '/';
-            files_case_relevent : false;
             assem        : as_i386_elf32;
             assemextern  : as_gas;
             link         : nil;
@@ -85,8 +83,6 @@ unit i_nwl;
               );
             first_parm_offset : 8;
             stacksize    : 16384;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
           );
 
   implementation

+ 1 - 5
compiler/systems/i_nwm.pas

@@ -32,7 +32,7 @@ unit i_nwm;
             system       : system_i386_netware;
             name         : 'Netware for i386(clib)';
             shortname    : 'Netware';
-            flags        : [];
+            flags        : [tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'NETWAREUNITS';
             extradefines : 'NETWARE_CLIB';
@@ -54,11 +54,9 @@ unit i_nwm;
             staticClibext : '.a';
             staticClibprefix : '';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #13#10;
             dirsep       : '/';
-            files_case_relevent : false;
             assem        : as_i386_elf32;
             assemextern  : as_gas;
             link         : nil;
@@ -85,8 +83,6 @@ unit i_nwm;
               );
             first_parm_offset : 8;
             stacksize    : 16384;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
           );
 
   implementation

+ 2 - 5
compiler/systems/i_os2.pas

@@ -40,7 +40,7 @@ unit i_os2;
             system       : system_i386_OS2;
             name         : 'OS/2';
             shortname    : 'OS2';
-            flags        : [tf_need_export,tf_use_8_3];
+            flags        : [tf_need_export,tf_files_case_aware,tf_use_8_3];
             cpu          : cpu_i386;
             unit_env     : 'OS2UNITS';
             extradefines : '';
@@ -62,11 +62,9 @@ unit i_os2;
             staticClibext : '.a';
             staticClibprefix : '';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            files_case_relevent : false;
             assem        : as_i386_as_aout;
             assemextern  : as_i386_as_aout;
             link         : nil;
@@ -93,8 +91,7 @@ unit i_os2;
               );
             first_parm_offset : 8;
             stacksize    : 256*1024;
-            DllScanSupported: false;
-            use_function_relative_addresses : false
+            abi          : abi_default;
           );
 
 

+ 2 - 10
compiler/systems/i_sunos.pas

@@ -32,7 +32,7 @@ unit i_sunos;
             system       : system_i386_solaris;
             name         : 'Solaris for i386';
             shortname    : 'solaris';
-            flags        : [tf_under_development];
+            flags        : [tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'SOLARISUNITS';
             extradefines : 'UNIX;LIBC';
@@ -54,11 +54,9 @@ unit i_sunos;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -85,8 +83,6 @@ unit i_sunos;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
           );
 
        system_sparc_solaris_info : tsysteminfo =
@@ -94,7 +90,7 @@ unit i_sunos;
             system       : system_sparc_solaris;
             name         : 'Solaris for SPARC';
             shortname    : 'solaris';
-            flags        : [tf_needs_symbol_size];
+            flags        : [tf_needs_symbol_size,tf_under_development,tf_files_case_sensitive,tf_use_function_relative_addresses];
             cpu          : cpu_SPARC;
             unit_env     : 'SOLARISUNITS';
             extradefines : 'UNIX;LIBC;';
@@ -116,11 +112,9 @@ unit i_sunos;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : 'lib';
-            p_ext_support : false;
             Cprefix      : '';
             newline      : #10;
             dirsep       : '/';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -147,8 +141,6 @@ unit i_sunos;
               );
             first_parm_offset : 92;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
           );
 
   implementation

+ 1 - 5
compiler/systems/i_watcom.pas

@@ -34,7 +34,7 @@ unit i_watcom;
             system       : system_i386_Watcom;
             name         : 'Watcom compatible DOS extenders';
             shortname    : 'WATCOM';
-            flags        : [tf_use_8_3];
+            flags        : [tf_use_8_3,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : 'WATCOMUNITS';
             extradefines : 'DPMI';
@@ -56,11 +56,9 @@ unit i_watcom;
             staticClibext : '.a';
             staticClibprefix : '';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            files_case_relevent : false;
             assem        : as_i386_wasm;
             assemextern  : as_gas;
             link         : nil;
@@ -87,8 +85,6 @@ unit i_watcom;
               );
             first_parm_offset : 8;
             stacksize    : 16384;
-            DllScanSupported : false;
-            use_function_relative_addresses : true
           );
 
   implementation

+ 1 - 5
compiler/systems/i_wdosx.pas

@@ -32,7 +32,7 @@ unit i_wdosx;
             system       : system_i386_wdosx;
             name         : 'WDOSX DOS extender';
             shortname    : 'WDOSX';
-            flags        : [tf_use_8_3];
+            flags        : [tf_use_8_3,tf_use_function_relative_addresses,tf_has_dllscanner];
             cpu          : cpu_i386;
             unit_env     : 'WDOSXUNITS';
             extradefines : 'MSWINDOWS';
@@ -54,11 +54,9 @@ unit i_wdosx;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            files_case_relevent : false;
             assem        : as_i386_pecoffwdosx;
             assemextern  : as_gas;
             link         : nil;
@@ -85,8 +83,6 @@ unit i_wdosx;
               );
             first_parm_offset : 8;
             stacksize    : 32*1024*1024;
-            DllScanSupported:true;
-            use_function_relative_addresses : true
           );
 
   implementation

+ 8 - 20
compiler/systems/i_win.pas

@@ -32,7 +32,7 @@ unit i_win;
             system       : system_i386_WIN32;
             name         : 'Win32 for i386';
             shortname    : 'Win32';
-            flags        : [{tf_section_threadvars}];
+            flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses{,tf_section_threadvars}];
             cpu          : cpu_i386;
             unit_env     : 'WIN32UNITS';
             extradefines : 'MSWINDOWS';
@@ -54,11 +54,9 @@ unit i_win;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            files_case_relevent : true;
             assem        : as_i386_pecoff;
             assemextern  : as_gas;
             link         : nil;
@@ -85,8 +83,7 @@ unit i_win;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:true;
-            use_function_relative_addresses : true
+            abi          : abi_default;
           );
 
        system_x64_win64_info : tsysteminfo =
@@ -94,7 +91,7 @@ unit i_win;
             system       : system_x86_64_win64;
             name         : 'Win64 for x64';
             shortname    : 'Win64';
-            flags        : [];
+            flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses];
             cpu          : cpu_x86_64;
             unit_env     : 'WIN64UNITS';
             extradefines : 'MSWINDOWS';
@@ -116,11 +113,9 @@ unit i_win;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            files_case_relevent : true;
             assem        : as_x86_64_pecoff;
             assemextern  : as_x86_64_masm;
             link         : nil;
@@ -147,8 +142,7 @@ unit i_win;
               );
             first_parm_offset : 16;
             stacksize    : 262144;
-            DllScanSupported:true;
-            use_function_relative_addresses : true
+            abi          : abi_default;
           );
 
        system_arm_wince_info : tsysteminfo =
@@ -156,7 +150,7 @@ unit i_win;
             system       : system_arm_wince;
             name         : 'WinCE for ARM';
             shortname    : 'WinCE';
-            flags        : [];
+            flags        : [tf_files_case_aware,tf_use_function_relative_addresses];
             cpu          : cpu_arm;
             unit_env     : '';
             extradefines : 'UNDER_CE';
@@ -178,11 +172,9 @@ unit i_win;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            files_case_relevent : true;
             assem        : as_gas;
             assemextern  : as_gas;
             link         : nil;
@@ -209,8 +201,7 @@ unit i_win;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:false;
-            use_function_relative_addresses : true
+            abi          : abi_default;
           );
 
        system_i386_wince_info : tsysteminfo =
@@ -218,7 +209,7 @@ unit i_win;
             system       : system_i386_wince;
             name         : 'WinCE for i386';
             shortname    : 'WinCE';
-            flags        : [];
+            flags        : [tf_files_case_aware,tf_has_dllscanner,tf_use_function_relative_addresses];
             cpu          : cpu_i386;
             unit_env     : '';
             extradefines : 'UNDER_CE';
@@ -240,11 +231,9 @@ unit i_win;
             staticClibext : '.a';
             staticClibprefix : 'lib';
             sharedClibprefix : '';
-            p_ext_support : false;
             Cprefix      : '_';
             newline      : #13#10;
             dirsep       : '\';
-            files_case_relevent : true;
             assem        : as_i386_pecoffwince;
             assemextern  : as_gas;
             link         : nil;
@@ -271,8 +260,7 @@ unit i_win;
               );
             first_parm_offset : 8;
             stacksize    : 262144;
-            DllScanSupported:true;
-            use_function_relative_addresses : true
+            abi          : abi_default;
           );
 
 

+ 45 - 39
compiler/systems/t_win.pas

@@ -86,7 +86,6 @@ interface
     private
       cstring : array[0..127]of char;
       function DOSstubOK(var x:cardinal):boolean;
-      function FindDLL(const s:string;var founddll:string):boolean;
       function ExtractDllName(Const Name : string) : string;
     public
       function isSuitableFileType(x:cardinal):longbool;override;
@@ -132,6 +131,15 @@ implementation
          hp2 : twin32imported_item;
          hs  : string;
       begin
+         { If we don't generate imports then we need to only the dll for
+           the linker }
+         if not GenerateImportSection then
+           begin
+             hs:=AddExtension(module,target_info.sharedlibext);
+             current_module.linkdlls.add(hs,link_allways);
+             exit;
+           end;
+
          { procdef or funcname must be give, not both }
          if assigned(aprocdef) and (func<>'') then
            internalerror(200411161);
@@ -205,6 +213,15 @@ implementation
          hp2 : twin32imported_item;
          hs  : string;
       begin
+         { If we don't generate imports then we need to only the dll for
+           the linker }
+         if not GenerateImportSection then
+           begin
+             hs:=AddExtension(module,target_info.sharedlibext);
+             current_module.linkdlls.add(hs,link_allways);
+             exit;
+           end;
+
          hs:=AddExtension(module,target_info.sharedlibext);
          { search for the module }
          hp1:=timportlist(current_module.imports.first);
@@ -225,6 +242,7 @@ implementation
          hp1.imported_items.concat(hp2);
       end;
 
+
     procedure timportlibwin32.generatenasmlib;
       var
          hp1 : timportlist;
@@ -865,7 +883,7 @@ begin
   Inherited Create;
   { allow duplicated libs (PM) }
   SharedLibFiles.doubles:=true;
-  StaticLibFiles.doubles:=true;
+  StaticLibFiles.doubles:=true;  if not Dontlinkstdlibpath Then
 end;
 
 
@@ -905,6 +923,14 @@ begin
   WriteResponseFile:=False;
   linklibcygwin:=(SharedLibFiles.Find('cygwin')<>nil);
 
+  if (cs_profile in aktmoduleswitches) then
+    begin
+      SharedLibFiles.Concat('c');
+      SharedLibFiles.Concat('gcc');
+      SharedLibFiles.Concat('gmon');
+      SharedLibFiles.Concat('kernel32');
+    end;
+
   { Open link.res file }
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName);
 
@@ -946,18 +972,10 @@ begin
    end;
   LinkRes.Add(')');
 
-
   { Write staticlibraries }
-  if (not StaticLibFiles.Empty) or (cs_profile in aktmoduleswitches) then
+  if (not StaticLibFiles.Empty) then
    begin
      LinkRes.Add('GROUP(');
-     if (cs_profile in aktmoduleswitches) then
-       begin
-         LinkRes.Add('-lc');
-         LinkRes.Add('-lgcc');
-         LinkRes.Add('-lgmon');
-         LinkRes.Add('-lkernel32');
-       end;
      While not StaticLibFiles.Empty do
       begin
         S:=StaticLibFiles.GetFirst;
@@ -966,7 +984,7 @@ begin
      LinkRes.Add(')');
    end;
 
-  { Write sharedlibraries }
+  { Write sharedlibraries (=import libraries) }
   if not SharedLibFiles.Empty then
    begin
      LinkRes.Add('INPUT(') ;
@@ -988,6 +1006,21 @@ begin
      LinkRes.Add(')');
    end;
 
+  { Write DLLs (=direct DLL linking) }
+  if not DLLFiles.Empty then
+   begin
+     LinkRes.Add('INPUT(') ;
+     While not DLLFiles.Empty do
+      begin
+        s:=DLLFiles.GetFirst;
+        if FindDLL(s,s2) then
+          LinkRes.Add(MaybeQuoted(s2))
+        else
+          LinkRes.Add('-l'+s);
+      end;
+     LinkRes.Add(')');
+   end;
+
 { Write and Close response }
   linkres.writetodisk;
   LinkRes.Free;
@@ -1402,33 +1435,6 @@ end;
          end;
       end;
 
-    function TDLLScannerWin32.FindDLL(const s:string;var founddll:string):boolean;
-      var
-        sysdir : string;
-        Found : boolean;
-      begin
-        Found:=false;
-        { Look for DLL in:
-          1. Current dir
-          2. Library Path
-          3. windir,windir/system,windir/system32 }
-        Found:=FindFile(s,'.'+source_info.DirSep,founddll);
-        if (not found) then
-         Found:=librarysearchpath.FindFile(s,founddll);
-        if (not found) then
-         begin
-           sysdir:=FixPath(GetEnv('windir'),false);
-           Found:=FindFile(s,sysdir+';'+sysdir+'system'+source_info.DirSep+';'+sysdir+'system32'+source_info.DirSep,founddll);
-         end;
-        if (not found) then
-         begin
-           message1(exec_w_libfile_not_found,s);
-           FoundDll:=s;
-         end;
-        FindDll:=Found;
-      end;
-
-
     function tDLLScannerWin32.ExtractDllName(Const Name : string) : string;
       var n : string;
       begin