From f50671fe44eff08e403f6f5d8330272fd3c2df1b Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 19 Aug 2016 14:54:28 +0000 Subject: [PATCH] * reference the RTTI assembler symbols if they're queried from a different unit than the own they're declared in git-svn-id: trunk@34347 - --- compiler/ncgrtti.pas | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/compiler/ncgrtti.pas b/compiler/ncgrtti.pas index e71f0de21a..c12779d96f 100644 --- a/compiler/ncgrtti.pas +++ b/compiler/ncgrtti.pas @@ -1591,27 +1591,42 @@ implementation function TRTTIWriter.get_rtti_label(def:tdef;rt:trttitype;indirect:boolean):tasmsymbol; + var + name : tsymstr; begin - result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt),AT_DATA,indirect); + name:=def.rtti_mangledname(rt); + result:=current_asmdata.RefAsmSymbol(name,AT_DATA,indirect); if (cs_create_pic in current_settings.moduleswitches) and assigned(current_procinfo) then include(current_procinfo.flags,pi_needs_got); + if assigned(current_module) and (findunitsymtable(def.owner).moduleid<>current_module.moduleid) then + current_module.add_extern_asmsym(name,AB_EXTERNAL,AT_DATA); end; function TRTTIWriter.get_rtti_label_ord2str(def:tdef;rt:trttitype;indirect:boolean):tasmsymbol; + var + name : tsymstr; begin - result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_o2s',AT_DATA,indirect); + name:=def.rtti_mangledname(rt)+'_o2s'; + result:=current_asmdata.RefAsmSymbol(name,AT_DATA,indirect); if (cs_create_pic in current_settings.moduleswitches) and assigned(current_procinfo) then include(current_procinfo.flags,pi_needs_got); + if assigned(current_module) and (findunitsymtable(def.owner).moduleid<>current_module.moduleid) then + current_module.add_extern_asmsym(name,AB_EXTERNAL,AT_DATA); end; function TRTTIWriter.get_rtti_label_str2ord(def:tdef;rt:trttitype;indirect:boolean):tasmsymbol; + var + name : tsymstr; begin - result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt)+'_s2o',AT_DATA,indirect); + name:=def.rtti_mangledname(rt)+'_s2o'; + result:=current_asmdata.RefAsmSymbol(name,AT_DATA,indirect); if (cs_create_pic in current_settings.moduleswitches) and assigned(current_procinfo) then include(current_procinfo.flags,pi_needs_got); + if assigned(current_module) and (findunitsymtable(def.owner).moduleid<>current_module.moduleid) then + current_module.add_extern_asmsym(name,AB_EXTERNAL,AT_DATA); end; end.