Bladeren bron

* write basic attributes for riscvXX-linux

florian 7 maanden geleden
bovenliggende
commit
40f9d006d6
2 gewijzigde bestanden met toevoegingen van 28 en 0 verwijderingen
  1. 17 0
      compiler/aggas.pas
  2. 11 0
      compiler/riscv/nrvutil.pas

+ 17 - 0
compiler/aggas.pas

@@ -1653,6 +1653,23 @@ implementation
                  end;
              end;
 
+           ait_attribute:
+             begin
+               case tai_attribute(hp).eattr_typ of
+                 eattrtype_dword:
+                   writer.AsmWrite(#9'.attribute '+tostr(tai_attribute(hp).tag)+','+tostr(tai_attribute(hp).value));
+                 eattrtype_ntbs:
+                   begin
+                     if assigned(tai_attribute(hp).valuestr) then
+                       writer.AsmWrite(#9'.attribute '+tostr(tai_attribute(hp).tag)+',"'+tai_attribute(hp).valuestr^+'"')
+                     else
+                       writer.AsmWrite(#9'.attribute '+tostr(tai_attribute(hp).tag)+',""');
+                   end
+                 else
+                   Internalerror(2024123001);
+               end;
+               writer.AsmLn;
+             end;
 {$ifdef WASM}
            ait_local:
              WriteWasmLocalDirective(tai_local(hp));

+ 11 - 0
compiler/riscv/nrvutil.pas

@@ -41,6 +41,14 @@ implementation
     systems,
     aasmdata,aasmtai;
 
+  const
+    tag_stack_align = 4;
+    tag_arch = 5;
+    tag_unaligned_access = 6;
+    tag_priv_spec = 8;
+    tag_priv_spec_minor = 10;
+    tag_priv_spec_revision = 12;
+
   class procedure trvnodeutils.InsertObjectInfo;
     begin
       inherited InsertObjectInfo;
@@ -50,6 +58,9 @@ implementation
             current_asmdata.asmlists[al_start].Concat(tai_directive.create(asd_option,'pic'))
           else
             current_asmdata.asmlists[al_start].Concat(tai_directive.create(asd_option,'nopic'));
+
+          current_asmdata.asmlists[al_start].Concat(tai_attribute.create(ait_attribute,tag_stack_align,target_info.stackalign));
+          current_asmdata.asmlists[al_start].Concat(tai_attribute.create(ait_attribute,tag_unaligned_access,0));
         end;
     end;