* set the dummy exception handling personality function for functions using

exceptions for LLVM (except on Windows targets, since they (will) use
    their own kind of exception handling)
   o ensure we generate an external function symbol definition for such
     personality functions on LLVM

git-svn-id: branches/debug_eh@40402 -
This commit is contained in:
Jonas Maebe 2018-11-29 21:30:49 +00:00
parent b6efcb9105
commit 5b8f7224af
3 changed files with 28 additions and 2 deletions

View File

@ -1195,6 +1195,14 @@ implementation
WriteLinkageVibilityFlags(taillvmdecl(hp).namesym.bind);
writer.AsmWrite(llvmencodeproctype(tprocdef(taillvmdecl(hp).def), '', lpd_def));
WriteFunctionFlags(tprocdef(taillvmdecl(hp).def));
if assigned(tprocdef(taillvmdecl(hp).def).personality) then
begin
writer.AsmWrite(' personality i8* bitcast (');
writer.AsmWrite(llvmencodeproctype(tprocdef(taillvmdecl(hp).def).personality, '', lpd_procvar));
writer.AsmWrite('* ');
writer.AsmWrite(llvmmangledname(tprocdef(taillvmdecl(hp).def).personality.mangledname));
writer.AsmWrite(' to i8*)');
end;
writer.AsmWriteln(' {');
end;
end

View File

@ -38,6 +38,7 @@ interface
public
constructor create(aparent: tprocinfo); override;
destructor destroy; override;
procedure set_first_temp_offset; override;
procedure pushexceptlabel(lab: TAsmLabel);
procedure popexceptlabel(lab: TAsmLabel);
function CurrExceptLabel: TAsmLabel; inline;
@ -46,7 +47,7 @@ interface
implementation
uses
globtype,verbose,
globtype,verbose,systems,
symtable;
@ -65,6 +66,15 @@ implementation
end;
procedure tllvmprocinfo.set_first_temp_offset;
begin
inherited;
if not(target_info.system in systems_windows) and
(([pi_uses_exceptions,pi_needs_implicit_finally]*flags)<>[]) then
procdef.personality:=search_system_proc('_FPC_EXCEPTION_PERSONALITY_DO_NOTHING_V0');
end;
procedure tllvmprocinfo.pushexceptlabel(lab: TAsmLabel);
begin
fexceptlabelstack.add(lab);

View File

@ -401,7 +401,15 @@ implementation
ait_typedconst:
insert_typedconst_typeconversion(toplevellist,tai_abstracttypedconst(p));
ait_llvmdecl:
insert_asmlist_typeconversions(toplevellist,taillvmdecl(p).initdata);
begin
if (ldf_definition in taillvmdecl(p).flags) and
(taillvmdecl(p).def.typ=procdef) and
assigned(tprocdef(taillvmdecl(p).def).personality) then
maybe_insert_extern_sym_decl(toplevellist,
current_asmdata.RefAsmSymbol(tprocdef(taillvmdecl(p).def).personality.mangledname,AT_FUNCTION,false),
tprocdef(taillvmdecl(p).def).personality);
insert_asmlist_typeconversions(toplevellist,taillvmdecl(p).initdata);
end;
end;
end;