Browse Source

* the clang assembler for COFF requires at least an "r" to generate a readonly section

git-svn-id: trunk@44929 -
svenbarth 5 years ago
parent
commit
3f40e00392
1 changed files with 15 additions and 1 deletions
  1. 15 1
      compiler/aarch64/agcpugas.pas

+ 15 - 1
compiler/aarch64/agcpugas.pas

@@ -30,7 +30,7 @@ unit agcpugas;
 
     uses
        globtype,systems,
-       aasmtai,
+       aasmtai,aasmbase,
        assemble,aggas,
        cpubase,cpuinfo;
 
@@ -50,6 +50,8 @@ unit agcpugas;
       TAArch64ClangGASAssembler=class(TGNUassembler)
       private
         function TargetStr:String;
+      protected
+        function sectionflags(secflags:TSectionFlags):string;override;
       public
         function MakeCmdLine:TCmdStr; override;
         constructor CreateWithWriter(info: pasminfo; wr: TExternalAssemblerOutputFile; freewriter, smart: boolean); override;
@@ -119,6 +121,18 @@ unit agcpugas;
       end;
 
 
+    function TAArch64ClangGASAssembler.sectionflags(secflags:TSectionFlags):string;
+      begin
+        Result:=inherited sectionflags(secflags);
+        if (target_info.system=system_aarch64_win64) then
+          begin
+            { we require an explicit "r" if write is not allowed }
+            if not (SF_W in secflags) then
+              result:=result+'r';
+          end;
+      end;
+
+
     function TAArch64ClangGASAssembler.MakeCmdLine:TCmdStr;
       begin
         Result:=inherited MakeCmdLine;