Browse Source

* fixed LLVM and non-i386 compilation

git-svn-id: branches/debug_eh@41423 -
Jonas Maebe 6 years ago
parent
commit
5cb5b10f8d
4 changed files with 23 additions and 4 deletions
  1. 17 1
      compiler/llvm/llvmpi.pas
  2. 2 2
      compiler/llvm/nllvmflw.pas
  3. 2 1
      rtl/inc/psabieh.inc
  4. 2 0
      rtl/inc/psabiehh.inc

+ 17 - 1
compiler/llvm/llvmpi.pas

@@ -47,13 +47,15 @@ interface
         procedure pushlandingpad(pad: taillvm);
         procedure poppad;
         function currlandingpad: taillvm;
+        procedure setup_eh; override;
+        procedure finish_eh; override;
       end;
 
 implementation
 
     uses
       globtype,globals,verbose,systems,
-      symtable;
+      symconst,symtable;
 
 
     constructor tllvmprocinfo.create(aparent: tprocinfo);
@@ -119,6 +121,20 @@ implementation
       end;
 
 
+    procedure tllvmprocinfo.setup_eh;
+      begin
+        if po_assembler in procdef.procoptions then
+          inherited;
+      end;
+
+
+    procedure tllvmprocinfo.finish_eh;
+      begin
+        if po_assembler in procdef.procoptions then
+          inherited;
+      end;
+
+
 begin
   if not assigned(cprocinfo) then
     begin

+ 2 - 2
compiler/llvm/nllvmflw.pas

@@ -41,7 +41,7 @@ interface
       class procedure get_exception_temps(list: TAsmList; var t: texceptiontemps); override;
       class procedure unget_exception_temps(list: TAsmList; const t: texceptiontemps); override;
       class procedure new_exception(list: TAsmList; const t: texceptiontemps; const exceptframekind: texceptframekind; out exceptstate: texceptionstate); override;
-      class procedure emit_except_label(list: TAsmList; exceptframekind: texceptframekind; var exceptionstate: texceptionstate); override;
+      class procedure emit_except_label(list: TAsmList; exceptframekind: texceptframekind; var exceptionstate: texceptionstate;var exceptiontemps:texceptiontemps); override;
       class procedure end_try_block(list: TAsmList; exceptframekind: texceptframekind; const t: texceptiontemps; var exceptionstate: texceptionstate; endlabel: TAsmLabel); override;
       class procedure cleanupobjectstack(list: TAsmList); override;
       class procedure popaddrstack(list: TAsmList); override;
@@ -167,7 +167,7 @@ implementation
       end;
 
 
-    class procedure tllvmexceptionstatehandler.emit_except_label(list: TAsmList; exceptframekind: texceptframekind; var exceptionstate: texceptionstate);
+    class procedure tllvmexceptionstatehandler.emit_except_label(list: TAsmList; exceptframekind: texceptframekind; var exceptionstate: texceptionstate;var exceptiontemps:texceptiontemps);
       var
         reg: tregister;
         landingpad: taillvm;

+ 2 - 1
rtl/inc/psabieh.inc

@@ -1205,6 +1205,7 @@ procedure fpc_ReRaise; [public,alias:'FPC_RERAISE']; compilerproc;
   end;
 
 
+{$if defined(cpui386) and not defined(cpullvm)}
 {$define FPC_SYSTEM_HAS_RESUME}
 procedure fpc_Resume(exception_object: PFPC_Unwind_Exception); [public,alias:'FPC_RESUME']; compilerproc; assembler; nostackframe;
   asm
@@ -1213,7 +1214,7 @@ procedure fpc_Resume(exception_object: PFPC_Unwind_Exception); [public,alias:'FP
     pushl %ecx
     jmp _Unwind_Resume
   end;
-
+{$endif}
 
 {$define FPC_SYSTEM_HAS_RAISENESTED}
 procedure fpc_raise_nested;compilerproc;

+ 2 - 0
rtl/inc/psabiehh.inc

@@ -80,7 +80,9 @@ function _FPC_psabieh_personality_v0(version: longint; actions: FPC_Unwind_Actio
 {$endif}
 function FPC_psabi_begin_catch(exc:PFPC_Unwind_Exception): pointer; cdecl; compilerproc;
 procedure FPC_psabi_end_catch; cdecl; compilerproc;
+{$if defined(cpui386) and not defined(cpullvm)}
 Procedure fpc_Resume(exception_object: PFPC_Unwind_Exception); compilerproc;
+{$endif}
 
 { llvm cannot create a catch/cleanup block if there is no call inside the
   try block to a routine that can raise an exception. Hence, we will call