Selaa lähdekoodia

* new tf_smartlink_library flag
* use create_smartlink[_sections|_library] to check what to
do for smartlinking

git-svn-id: trunk@8715 -

peter 18 vuotta sitten
vanhempi
commit
9f0ca44c94

+ 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

@@ -639,8 +639,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;
 
 
@@ -659,7 +658,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

@@ -321,7 +321,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
@@ -1070,7 +1070,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');
 
 

+ 1 - 1
compiler/arm/cgcpu.pas

@@ -1882,7 +1882,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;
 
 

+ 1 - 1
compiler/i386/ag386nsm.pas

@@ -478,7 +478,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;
 
 

+ 1 - 1
compiler/ncgutil.pas

@@ -2172,7 +2172,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 :

+ 0 - 5
compiler/options.pas

@@ -2453,11 +2453,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

+ 1 - 1
compiler/powerpc/itcpugas.pas

@@ -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

+ 2 - 2
compiler/powerpc64/itcpugas.pas

@@ -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]

+ 7 - 7
compiler/ppcgen/cgppc.pas

@@ -85,7 +85,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
@@ -106,7 +106,7 @@ unit cgppc;
       begin
       begin
         result:=
         result:=
           ((pi_do_call in current_procinfo.flags) or
           ((pi_do_call in current_procinfo.flags) or
-           ([cs_lineinfo,cs_debuginfo,cs_profile] * current_settings.moduleswitches <> []));   
+           ([cs_lineinfo,cs_debuginfo,cs_profile] * current_settings.moduleswitches <> []));
       end;
       end;
 
 
 
 
@@ -370,7 +370,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?}
@@ -390,7 +390,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
@@ -507,12 +507,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;
 
 
@@ -653,7 +653,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

@@ -1535,7 +1535,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

@@ -1373,7 +1373,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';
@@ -83,6 +84,7 @@ unit i_beos;
               );
               );
             first_parm_offset : 8;
             first_parm_offset : 8;
             stacksize    : 8192;
             stacksize    : 8192;
+            abi : abi_default
           );
           );
 
 
   implementation
   implementation

+ 6 - 6
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';

+ 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';

+ 2 - 2
compiler/systems/t_linux.pas

@@ -296,7 +296,7 @@ begin
          DynamicLinker:='/lib/ld-linux.so.2';
          DynamicLinker:='/lib/ld-linux.so.2';
          libctype:=glibc21;
          libctype:=glibc21;
        end
        end
-     else 
+     else
 {$endif i386}
 {$endif i386}
      if fileexists(sysrootpath+'/lib/ld-uClibc.so.0',false) then
      if fileexists(sysrootpath+'/lib/ld-uClibc.so.0',false) then
        begin
        begin
@@ -812,7 +812,7 @@ 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

+ 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