Pārlūkot izejas kodu

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

git-svn-id: trunk@43543 -
svenbarth 5 gadi atpakaļ
vecāks
revīzija
2e259ee3cc
3 mainītis faili ar 11 papildinājumiem un 5 dzēšanām
  1. 5 2
      compiler/i386/n386flw.pas
  2. 5 2
      compiler/x86_64/nx64flw.pas
  3. 1 1
      rtl/win/syswin.inc

+ 5 - 2
compiler/i386/n386flw.pas

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

+ 5 - 2
compiler/x86_64/nx64flw.pas

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

+ 1 - 1
rtl/win/syswin.inc

@@ -209,7 +209,7 @@ begin
     CurFilt:=@PFilterRec(Filter+sizeof(Longint))[i];
     if (CurFilt^.RvaClass=$FFFFFFFF) or
       { 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
       result:=Pointer(imagebase+CurFilt^.RvaHandler);
       exit;