Przeglądaj źródła

* on aarch64-win64 do the assignment of the exception frame pointer only after the SEH prologue has been done as there is no SEH directive for assigning a register to FP

Sven/Sarah Barth 9 miesięcy temu
rodzic
commit
465537583b
1 zmienionych plików z 16 dodań i 2 usunięć
  1. 16 2
      compiler/aarch64/cgcpu.pas

+ 16 - 2
compiler/aarch64/cgcpu.pas

@@ -1889,6 +1889,7 @@ implementation
         hitem: tlinkedlistitem;
         seh_proc: tai_seh_directive;
         templist: TAsmList;
+        genloadframeforexcept,
         suppress_endprologue: boolean;
         ref: treference;
         totalstackframesize: longint;
@@ -1905,6 +1906,7 @@ implementation
           SEH directives in assembler body. In this case, .seh_endprologue
           is expected to be one of those directives, and not generated here. }
         suppress_endprologue:=(pi_has_unwind_info in current_procinfo.flags);
+        genloadframeforexcept:=false;
 
         if not nostackframe then
           begin
@@ -1934,7 +1936,12 @@ implementation
                   end
                 else
                   begin
-                    gen_load_frame_for_exceptfilter(list);
+                    { do this after the prologue is done for aarch64-win64 as
+                      there is no SEH directive for setting FP to a register }
+                    if target_info.system<>system_aarch64_win64 then
+                      gen_load_frame_for_exceptfilter(list)
+                    else
+                      genloadframeforexcept:=true;
                     localsize:=current_procinfo.maxpushedparasize;
                   end;
               end;
@@ -1994,7 +2001,11 @@ implementation
           end;
 
         if not (pi_has_unwind_info in current_procinfo.flags) then
-          exit;
+          begin
+            if genloadframeforexcept then
+              gen_load_frame_for_exceptfilter(list);
+            exit;
+          end;
 
         { Generate unwind data for aarch64-win64 }
         seh_proc:=cai_seh_directive.create_name(ash_proc,current_procinfo.procdef.mangledname);
@@ -2015,6 +2026,9 @@ implementation
         else
           list.concatlist(templist);
         templist.free;
+
+        if genloadframeforexcept then
+          gen_load_frame_for_exceptfilter(list);
       end;