Browse Source

* fix compilation on PE/COFF based systems with GNU AS as there the progbits are not supported

git-svn-id: trunk@43345 -
svenbarth 5 years ago
parent
commit
f481587bee
1 changed files with 43 additions and 23 deletions
  1. 43 23
      compiler/aggas.pas

+ 43 - 23
compiler/aggas.pas

@@ -474,10 +474,12 @@ implementation
       var
         s : string;
         secflag: TSectionFlag;
+        sectionprogbits,
         sectionflags: boolean;
       begin
         writer.AsmLn;
         sectionflags:=false;
+        sectionprogbits:=false;
         case target_info.system of
          system_i386_OS2,
          system_i386_EMX: ;
@@ -489,8 +491,19 @@ implementation
                begin
                  writer.AsmWrite('.section ');
                  sectionflags:=true;
+                 sectionprogbits:=true;
                end;
            end;
+         system_i386_win32,
+         system_x86_64_win64,
+         system_i386_wince,
+         system_arm_wince:
+           begin
+             { according to the GNU AS guide AS for COFF does not support the
+               progbits }
+             writer.AsmWrite('.section ');
+             sectionflags:=true;
+           end;
          system_powerpc_darwin,
          system_i386_darwin,
          system_i386_iphonesim,
@@ -509,38 +522,45 @@ implementation
            begin
              writer.AsmWrite('.section ');
              sectionflags:=true;
+             sectionprogbits:=true;
            end
         end;
         s:=sectionname(atype,aname,aorder);
         writer.AsmWrite(s);
         { flags explicitly defined? }
-        if sectionflags and
+        if (sectionflags or sectionprogbits) and
            ((secflags<>[]) or
             (secprogbits<>SPB_None)) then
           begin
-            s:=',"';
-            for secflag in secflags do
-              case secflag of
-                SF_A:
-                  s:=s+'a';
-                SF_W:
-                  s:=s+'w';
-                SF_X:
-                  s:=s+'x';
+            if sectionflags then
+              begin
+                s:=',"';
+                for secflag in secflags do
+                  case secflag of
+                    SF_A:
+                      s:=s+'a';
+                    SF_W:
+                      s:=s+'w';
+                    SF_X:
+                      s:=s+'x';
+                  end;
+                writer.AsmWrite(s+'"');
+              end;
+            if sectionprogbits then
+              begin
+                case secprogbits of
+                  SPB_PROGBITS:
+                    writer.AsmWrite(',%progbits');
+                  SPB_NOBITS:
+                    writer.AsmWrite(',%nobits');
+                  SPB_NOTE:
+                    writer.AsmWrite(',%note');
+                  SPB_None:
+                    ;
+                  else
+                    InternalError(2019100801);
+                end;
               end;
-            writer.AsmWrite(s+'"');
-            case secprogbits of
-              SPB_PROGBITS:
-                writer.AsmWrite(',%progbits');
-              SPB_NOBITS:
-                writer.AsmWrite(',%nobits');
-              SPB_NOTE:
-                writer.AsmWrite(',%note');
-              SPB_None:
-                ;
-              else
-                InternalError(2019100801);
-            end;
           end
         else
           case atype of