* the VMT of the exception class needs to be referenced indirectly

git-svn-id: trunk@43543 -
This commit is contained in:
svenbarth 2019-11-21 21:44:48 +00:00
parent a041f899d3
commit 2e259ee3cc
3 changed files with 11 additions and 5 deletions

View File

@ -53,7 +53,7 @@ interface
implementation implementation
uses uses
cutils,globtype,globals,verbose,systems, cutils,globtype,globals,verbose,systems,fmodule,
nbas,ncal,nmem,nutils, nbas,ncal,nmem,nutils,
symconst,symbase,symtable,symsym,symdef, symconst,symbase,symtable,symsym,symdef,
cgbase,cgobj,cgcpu,cgutils,tgobj, cgbase,cgobj,cgcpu,cgutils,tgobj,
@ -463,6 +463,7 @@ procedure ti386tryexceptnode.pass_generate_code;
hnode : tnode; hnode : tnode;
hlist : tasmlist; hlist : tasmlist;
onnodecount : tai_const; onnodecount : tai_const;
sym : tasmsymbol;
label label
errorexit; errorexit;
begin begin
@ -593,8 +594,10 @@ procedure ti386tryexceptnode.pass_generate_code;
if hnode.nodetype<>onn then if hnode.nodetype<>onn then
InternalError(2011103101); InternalError(2011103101);
current_asmdata.getjumplabel(onlabel); current_asmdata.getjumplabel(onlabel);
hlist.concat(tai_const.create_sym(current_asmdata.RefAsmSymbol(tonnode(hnode).excepttype.vmt_mangledname,AT_DATA))); sym:=current_asmdata.RefAsmSymbol(tonnode(hnode).excepttype.vmt_mangledname,AT_DATA,true);
hlist.concat(tai_const.create_sym(sym));
hlist.concat(tai_const.create_sym(onlabel)); hlist.concat(tai_const.create_sym(onlabel));
current_module.add_extern_asmsym(sym);
cg.a_label(current_asmdata.CurrAsmList,onlabel); cg.a_label(current_asmdata.CurrAsmList,onlabel);
secondpass(hnode); secondpass(hnode);
inc(onnodecount.value); inc(onnodecount.value);

View File

@ -52,7 +52,7 @@ interface
implementation implementation
uses uses
globtype,globals,verbose,systems, globtype,globals,verbose,systems,fmodule,
nbas,ncal,nutils, nbas,ncal,nutils,
symconst,symsym,symdef, symconst,symsym,symdef,
cgbase,cgobj,cgutils,tgobj, cgbase,cgobj,cgutils,tgobj,
@ -366,6 +366,7 @@ procedure tx64tryexceptnode.pass_generate_code;
hnode : tnode; hnode : tnode;
hlist : tasmlist; hlist : tasmlist;
onnodecount : tai_const; onnodecount : tai_const;
sym : tasmsymbol;
label label
errorexit; errorexit;
begin begin
@ -448,8 +449,10 @@ procedure tx64tryexceptnode.pass_generate_code;
if hnode.nodetype<>onn then if hnode.nodetype<>onn then
InternalError(2011103101); InternalError(2011103101);
current_asmdata.getjumplabel(onlabel); current_asmdata.getjumplabel(onlabel);
hlist.concat(tai_const.create_rva_sym(current_asmdata.RefAsmSymbol(tonnode(hnode).excepttype.vmt_mangledname,AT_DATA))); sym:=current_asmdata.RefAsmSymbol(tonnode(hnode).excepttype.vmt_mangledname,AT_DATA,true);
hlist.concat(tai_const.create_rva_sym(sym));
hlist.concat(tai_const.create_rva_sym(onlabel)); hlist.concat(tai_const.create_rva_sym(onlabel));
current_module.add_extern_asmsym(sym);
cg.a_label(current_asmdata.CurrAsmList,onlabel); cg.a_label(current_asmdata.CurrAsmList,onlabel);
secondpass(hnode); secondpass(hnode);
inc(onnodecount.value); inc(onnodecount.value);

View File

@ -209,7 +209,7 @@ begin
CurFilt:=@PFilterRec(Filter+sizeof(Longint))[i]; CurFilt:=@PFilterRec(Filter+sizeof(Longint))[i];
if (CurFilt^.RvaClass=$FFFFFFFF) or if (CurFilt^.RvaClass=$FFFFFFFF) or
{ TODO: exception might be coming from another module, need more advanced comparing } { TODO: exception might be coming from another module, need more advanced comparing }
(ExClass.InheritsFrom(TClass(imagebase+CurFilt^.RvaClass))) then (ExClass.InheritsFrom({$if not defined(ver3_0) and not defined(ver3_2)}PClass(imagebase+CurFilt^.RvaClass)^{$else}TClass(imagebase+CurFilt^.RvaClass){$endif})) then
begin begin
result:=Pointer(imagebase+CurFilt^.RvaHandler); result:=Pointer(imagebase+CurFilt^.RvaHandler);
exit; exit;