summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compiler/llvm/llvmpi.pas10
-rw-r--r--compiler/options.pas6
-rw-r--r--compiler/procinfo.pas8
-rw-r--r--compiler/psub.pas13
-rw-r--r--compiler/systems.pas4
-rw-r--r--compiler/systems/i_bsd.pas3
6 files changed, 32 insertions, 12 deletions
diff --git a/compiler/llvm/llvmpi.pas b/compiler/llvm/llvmpi.pas
index 6bbc723ce7..e214de9e19 100644
--- a/compiler/llvm/llvmpi.pas
+++ b/compiler/llvm/llvmpi.pas
@@ -38,7 +38,6 @@ 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;
@@ -66,15 +65,6 @@ 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);
diff --git a/compiler/options.pas b/compiler/options.pas
index 366e9f1301..e6a1e68590 100644
--- a/compiler/options.pas
+++ b/compiler/options.pas
@@ -3157,6 +3157,12 @@ begin
else
undef_system_macro('FPC_SECTION_THREADVARS');
+ if (tf_use_psabieh in target_info.flags) then
+ if def then
+ def_system_macro('FPC_USE_PSABIEH')
+ else
+ undef_system_macro('FPC_USE_PSABIEH');
+
{ Code generation flags }
if (tf_pic_default in target_info.flags) then
if def then
diff --git a/compiler/procinfo.pas b/compiler/procinfo.pas
index 7e2fe97f25..d09d269c46 100644
--- a/compiler/procinfo.pas
+++ b/compiler/procinfo.pas
@@ -178,6 +178,9 @@ unit procinfo;
procedure updatestackalignment(alignment: longint);
{ Specific actions after the code has been generated }
procedure postprocess_code; virtual;
+
+ { set exception handling info }
+ procedure set_eh_info; virtual;
end;
tcprocinfo = class of tprocinfo;
@@ -312,4 +315,9 @@ implementation
{ no action by default }
end;
+ procedure tprocinfo.set_eh_info;
+ begin
+ { default code is in tcgprocinfo }
+ end;
+
end.
diff --git a/compiler/psub.pas b/compiler/psub.pas
index 090003ab04..ddcce14d32 100644
--- a/compiler/psub.pas
+++ b/compiler/psub.pas
@@ -65,6 +65,7 @@ interface
procedure parse_body;
function has_assembler_child : boolean;
+ procedure set_eh_info; override;
end;
@@ -1126,6 +1127,16 @@ implementation
end;
end;
+ procedure tcgprocinfo.set_eh_info;
+ begin
+ inherited;
+ if (tf_use_psabieh in target_info.flags) and
+ ((pi_uses_exceptions in flags) or
+ ((cs_implicit_exceptions in current_settings.moduleswitches) and
+ (pi_needs_implicit_finally in flags))) then
+ procdef.personality:=search_system_proc('_FPC_PSABIEH_PERSONALITY_V0');
+ end;
+
procedure tcgprocinfo.generate_code_tree;
var
hpi : tcgprocinfo;
@@ -1749,6 +1760,8 @@ implementation
not(target_info.system in systems_garbage_collected_managed_types) then
internalerror(200405231);
+ current_procinfo.set_eh_info;
+
{ Position markers are only used to insert additional code after the secondpass
and before this point. They are of no use in optimizer. Instead of checking and
ignoring all over the optimizer, just remove them here. }
diff --git a/compiler/systems.pas b/compiler/systems.pas
index 19c004feb5..1a413c5b7d 100644
--- a/compiler/systems.pas
+++ b/compiler/systems.pas
@@ -165,7 +165,9 @@ interface
tf_x86_far_procs_push_odd_bp,
{ indicates that this target can use dynamic packages otherwise an
error will be generated if a package file is compiled }
- tf_supports_packages
+ tf_supports_packages,
+ { use PSABI/Dwarf-based "zero cost" exception handling }
+ tf_use_psabieh
);
psysteminfo = ^tsysteminfo;
diff --git a/compiler/systems/i_bsd.pas b/compiler/systems/i_bsd.pas
index d14bf7fd2f..8882a62748 100644
--- a/compiler/systems/i_bsd.pas
+++ b/compiler/systems/i_bsd.pas
@@ -1015,7 +1015,8 @@ unit i_bsd;
system : system_x86_64_darwin;
name : 'Darwin for x86_64';
shortname : 'Darwin';
- flags : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default,tf_has_winlike_resources];
+ flags : [tf_p_ext_support,tf_files_case_sensitive,tf_smartlink_sections,tf_dwarf_relative_addresses,tf_dwarf_only_local_labels,tf_pic_default,tf_has_winlike_resources
+ {$ifdef llvm},tf_use_psabieh{$endif}];
cpu : cpu_x86_64;
unit_env : 'BSDUNITS';
extradefines : 'UNIX;BSD;HASUNIX';