diff --git a/compiler/llvm/llvmpi.pas b/compiler/llvm/llvmpi.pas index 4446961928..c19a266a61 100644 --- a/compiler/llvm/llvmpi.pas +++ b/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 diff --git a/compiler/llvm/nllvmflw.pas b/compiler/llvm/nllvmflw.pas index 9c9cbc9a63..b950210426 100644 --- a/compiler/llvm/nllvmflw.pas +++ b/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; diff --git a/rtl/inc/psabieh.inc b/rtl/inc/psabieh.inc index e1e70bfea8..0f9c554c89 100644 --- a/rtl/inc/psabieh.inc +++ b/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; diff --git a/rtl/inc/psabiehh.inc b/rtl/inc/psabiehh.inc index bb1f442d8a..9ff0727e59 100644 --- a/rtl/inc/psabiehh.inc +++ b/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