Jelajahi Sumber

win64 unwinding, misc fixes:
* Insert seh_endprologue directive after the last prologue instruction, not before it
* Omit seh_stackalloc for zero bytes
* (For now) ignore SEH directives in NASM and MASM writers, instead of failing with internal error.

git-svn-id: trunk@19246 -

sergei 14 tahun lalu
induk
melakukan
4c21beb48e

+ 2 - 1
compiler/x86/agx86int.pas

@@ -843,7 +843,8 @@ implementation
                  AsmWrite(tai_directive(hp).name^);
                AsmLn;
              end;
-
+           ait_seh_directive :
+             { Ignore for now };
            else
             internalerror(10000);
          end;

+ 2 - 1
compiler/x86/agx86nsm.pas

@@ -973,7 +973,8 @@ interface
                  end;
                AsmLn;
              end;
-
+           ait_seh_directive :
+             { Ignore for now };
            else
              internalerror(10000);
          end;

+ 2 - 1
compiler/x86/cgx86.pas

@@ -2209,7 +2209,8 @@ unit cgx86;
                 current_procinfo.final_localsize:=localsize;
                 if (target_info.system=system_x86_64_win64) then
                   begin
-                    list.concat(cai_seh_directive.create_offset(ash_stackalloc,localsize));
+                    if localsize<>0 then
+                      list.concat(cai_seh_directive.create_offset(ash_stackalloc,localsize));
                     include(current_procinfo.flags,pi_has_unwind_info);
                   end;
               end;

+ 1 - 1
compiler/x86_64/cgcpu.pas

@@ -165,7 +165,7 @@ unit cgcpu;
           end;
         templist.concat(cai_seh_directive.create(ash_endprologue));
         if assigned(current_procinfo.endprologue_ai) then
-          current_procinfo.aktproccode.insertlistbefore(current_procinfo.endprologue_ai,templist)
+          current_procinfo.aktproccode.insertlistafter(current_procinfo.endprologue_ai,templist)
         else
           list.concatlist(templist);
         templist.free;