浏览代码

* use the indirect symbol for resource strings if necessary
* have the unit import the resource string symbol if necessary

git-svn-id: trunk@34188 -

svenbarth 9 年之前
父节点
当前提交
02ebae7658
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      compiler/ncgld.pas

+ 10 - 1
compiler/ncgld.pas

@@ -379,6 +379,8 @@ implementation
         href : treference;
         newsize : tcgsize;
         vd : tdef;
+        indirect : boolean;
+        name : TSymStr;
       begin
         { we don't know the size of all arrays }
         newsize:=def_cgsize(resultdef);
@@ -402,7 +404,14 @@ implementation
                 if tconstsym(symtableentry).consttyp=constresourcestring then
                   begin
                      location_reset_ref(location,LOC_CREFERENCE,def_cgsize(cansistringtype),cansistringtype.size);
-                     location.reference.symbol:=current_asmdata.RefAsmSymbol(make_mangledname('RESSTR',symtableentry.owner,symtableentry.name),AT_DATA);
+                     indirect:=(tf_supports_packages in target_info.flags) and
+                                 (target_info.system in systems_indirect_var_imports) and
+                                 (cs_imported_data in current_settings.localswitches) and
+                                 (symtableentry.owner.moduleid<>current_module.moduleid);
+                     name:=make_mangledname('RESSTR',symtableentry.owner,symtableentry.name);
+                     location.reference.symbol:=current_asmdata.RefAsmSymbol(name,AT_DATA,indirect);
+                     if symtableentry.owner.moduleid<>current_module.moduleid then
+                       current_module.addimportedsym(symtableentry);
                      vd:=search_system_type('TRESOURCESTRINGRECORD').typedef;
                      hlcg.g_set_addr_nonbitpacked_field_ref(
                        current_asmdata.CurrAsmList,