|
@@ -169,7 +169,7 @@ implementation
|
|
|
CheckResourcesUsed:=found;
|
|
|
end;
|
|
|
|
|
|
- procedure AddUnit(const s:string);
|
|
|
+ procedure AddUnit(const s:string; autoadded: boolean);
|
|
|
var
|
|
|
hp : tppumodule;
|
|
|
unitsym : tunitsym;
|
|
@@ -189,6 +189,12 @@ implementation
|
|
|
tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym);
|
|
|
{ add to used units }
|
|
|
current_module.addusedunit(hp,false,unitsym);
|
|
|
+ { mark as used if automatically added }
|
|
|
+ if autoadded then
|
|
|
+ begin
|
|
|
+ current_module.updatemaps;
|
|
|
+ inc(current_module.unitmap[hp.moduleid].refs);
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
|
|
@@ -211,7 +217,7 @@ implementation
|
|
|
end;
|
|
|
{ Variants unit is not loaded yet, load it now }
|
|
|
Message(parser_w_implicit_uses_of_variants_unit);
|
|
|
- AddUnit('variants');
|
|
|
+ AddUnit('variants',true);
|
|
|
end;
|
|
|
|
|
|
|
|
@@ -292,7 +298,7 @@ implementation
|
|
|
|
|
|
{ insert the system unit, it is allways the first. Load also the
|
|
|
internal types from the system unit }
|
|
|
- AddUnit('system');
|
|
|
+ AddUnit('system',true);
|
|
|
systemunit:=tglobalsymtable(symtablestack.top);
|
|
|
load_intern_types;
|
|
|
|
|
@@ -306,26 +312,26 @@ implementation
|
|
|
begin
|
|
|
{ Heaptrc unit, load heaptrace before any other units especially objpas }
|
|
|
if (cs_use_heaptrc in current_settings.globalswitches) then
|
|
|
- AddUnit('heaptrc');
|
|
|
+ AddUnit('heaptrc',true);
|
|
|
{ Lineinfo unit }
|
|
|
if (cs_use_lineinfo in current_settings.globalswitches) then begin
|
|
|
case paratargetdbg of
|
|
|
dbg_stabs:
|
|
|
- AddUnit('lineinfo');
|
|
|
+ AddUnit('lineinfo',true);
|
|
|
dbg_stabx:
|
|
|
- AddUnit('lnfogdb');
|
|
|
+ AddUnit('lnfogdb',true);
|
|
|
else
|
|
|
- AddUnit('lnfodwrf');
|
|
|
+ AddUnit('lnfodwrf',true);
|
|
|
end;
|
|
|
end;
|
|
|
{ Valgrind requires c memory manager }
|
|
|
if (cs_gdb_valgrind in current_settings.globalswitches) then
|
|
|
- AddUnit('cmem');
|
|
|
+ AddUnit('cmem',true);
|
|
|
{$ifdef cpufpemu}
|
|
|
{ Floating point emulation unit?
|
|
|
softfpu must be in the system unit anyways (FK)
|
|
|
if (cs_fp_emulation in current_settings.moduleswitches) and not(target_info.system in system_wince) then
|
|
|
- AddUnit('softfpu');
|
|
|
+ AddUnit('softfpu',true);
|
|
|
}
|
|
|
{$endif cpufpemu}
|
|
|
{ Which kind of resource support?
|
|
@@ -333,55 +339,55 @@ implementation
|
|
|
otherwise we need it here since it must be loaded quite early }
|
|
|
if (tf_has_winlike_resources in target_info.flags) then
|
|
|
if target_res.id=res_ext then
|
|
|
- AddUnit('fpextres')
|
|
|
+ AddUnit('fpextres',true)
|
|
|
else
|
|
|
- AddUnit('fpintres');
|
|
|
+ AddUnit('fpintres',true);
|
|
|
end;
|
|
|
{ Objpas unit? }
|
|
|
if m_objpas in current_settings.modeswitches then
|
|
|
- AddUnit('objpas');
|
|
|
+ AddUnit('objpas',true);
|
|
|
|
|
|
{ Macpas unit? }
|
|
|
if m_mac in current_settings.modeswitches then
|
|
|
- AddUnit('macpas');
|
|
|
+ AddUnit('macpas',true);
|
|
|
|
|
|
if m_iso in current_settings.modeswitches then
|
|
|
- AddUnit('iso7185');
|
|
|
+ AddUnit('iso7185',true);
|
|
|
|
|
|
{ blocks support? }
|
|
|
if m_blocks in current_settings.modeswitches then
|
|
|
- AddUnit('blockrtl');
|
|
|
+ AddUnit('blockrtl',true);
|
|
|
|
|
|
{ default char=widechar? }
|
|
|
if m_default_unicodestring in current_settings.modeswitches then
|
|
|
- AddUnit('uuchar');
|
|
|
+ AddUnit('uuchar',true);
|
|
|
|
|
|
{ Objective-C support unit? }
|
|
|
if (m_objectivec1 in current_settings.modeswitches) then
|
|
|
begin
|
|
|
{ interface to Objective-C run time }
|
|
|
- AddUnit('objc');
|
|
|
+ AddUnit('objc',true);
|
|
|
loadobjctypes;
|
|
|
{ NSObject }
|
|
|
if not(current_module.is_unit) or
|
|
|
(current_module.modulename^<>'OBJCBASE') then
|
|
|
- AddUnit('objcbase');
|
|
|
+ AddUnit('objcbase',true);
|
|
|
end;
|
|
|
{ Profile unit? Needed for go32v2 only }
|
|
|
if (cs_profile in current_settings.moduleswitches) and
|
|
|
(target_info.system in [system_i386_go32v2,system_i386_watcom]) then
|
|
|
- AddUnit('profile');
|
|
|
+ AddUnit('profile',true);
|
|
|
if (cs_load_fpcylix_unit in current_settings.globalswitches) then
|
|
|
begin
|
|
|
- AddUnit('fpcylix');
|
|
|
- AddUnit('dynlibs');
|
|
|
+ AddUnit('fpcylix',true);
|
|
|
+ AddUnit('dynlibs',true);
|
|
|
end;
|
|
|
|
|
|
{ CPU targets with microcontroller support can add a controller specific unit }
|
|
|
if ControllerSupport and (target_info.system in systems_embedded) and
|
|
|
(current_settings.controllertype<>ct_none) and
|
|
|
(embedded_controllers[current_settings.controllertype].controllerunitstr<>'') then
|
|
|
- AddUnit(embedded_controllers[current_settings.controllertype].controllerunitstr);
|
|
|
+ AddUnit(embedded_controllers[current_settings.controllertype].controllerunitstr,true);
|
|
|
end;
|
|
|
|
|
|
|
|
@@ -394,7 +400,7 @@ implementation
|
|
|
s:=GetToken(hs,',');
|
|
|
if s='' then
|
|
|
break;
|
|
|
- AddUnit(s);
|
|
|
+ AddUnit(s,true);
|
|
|
until false;
|
|
|
end;
|
|
|
|
|
@@ -1701,7 +1707,7 @@ type
|
|
|
module_name:=module_name+'.'+orgpattern;
|
|
|
consume(_ID);
|
|
|
end;
|
|
|
- AddUnit(module_name);
|
|
|
+ AddUnit(module_name,false);
|
|
|
end
|
|
|
else
|
|
|
consume(_ID);
|
|
@@ -2259,7 +2265,7 @@ type
|
|
|
if target_info.system in systems_internal_sysinit then
|
|
|
begin
|
|
|
{ add start/halt unit }
|
|
|
- AddUnit(linker.sysinitunit);
|
|
|
+ AddUnit(linker.sysinitunit,true);
|
|
|
end;
|
|
|
|
|
|
{$ifdef arm}
|