소스 검색

x86 external Intel assembler:
+ Write name of sec_threadvar
+ Also write actual section alignment instead of always using PARA.

git-svn-id: trunk@19069 -

sergei 14 년 전
부모
커밋
782cdd8e9a
1개의 변경된 파일17개의 추가작업 그리고 3개의 파일을 삭제
  1. 17 3
      compiler/x86/agx86int.pas

+ 17 - 3
compiler/x86/agx86int.pas

@@ -60,7 +60,7 @@ implementation
       line_length = 70;
 
       secnames : array[TAsmSectiontype] of string[4] = ('','',
-        'CODE','DATA','DATA','DATA','BSS','',
+        'CODE','DATA','DATA','DATA','BSS','TLS',
         '','','','','','',
         '','','','',
         '',
@@ -110,7 +110,7 @@ implementation
       );
 
       secnamesml64 : array[TAsmSectiontype] of string[7] = ('','',
-        '_TEXT','_DATA','_DATA','_DATA','_BSS','',
+        '_TEXT','_DATA','_DATA','_DATA','_BSS','_TLS',
         '','','','',
         'idata$2','idata$4','idata$5','idata$6','idata$7','edata',
         '',
@@ -220,6 +220,19 @@ implementation
          comp2str:=double2str(dd^);
       end;
 
+    { MASM supports aligns up to 8192 }
+    function alignstr(b : integer) : string;
+      begin
+        case b of
+          1: result:='BYTE';
+          2: result:='WORD';
+          4: result:='DWORD';
+          16: result:='PARA';
+          256: result:='PAGE';
+        else
+          result:='ALIGN('+tostr(b)+')';
+        end;
+      end;
 
 {****************************************************************************
                                tx86IntelAssembler
@@ -503,7 +516,7 @@ implementation
                         AsmWriteLn('_'+secnames[LasTSecType]+#9#9'ENDS');
                       AsmLn;
                       AsmWriteLn('_'+secnames[tai_section(hp).sectype]+#9#9+
-                                 'SEGMENT'#9'PARA PUBLIC USE32 '''+
+                                 'SEGMENT'#9+alignstr(tai_section(hp).secalign)+' PUBLIC USE32 '''+
                                  secnames[tai_section(hp).sectype]+'''');
                     end;
                 end;
@@ -801,6 +814,7 @@ implementation
                  { I was told that this isn't necesarry because }
                  { the labels generated by FPC are unique (FK)  }
                  { AsmWriteLn(#9'LOCALS '+target_asm.labelprefix); }
+                 { TODO: PARA is incorrect, must use actual section align }
                  if lasTSectype<>sec_none then
                     AsmWriteLn('_'+secnames[lasTSectype]+#9#9+
                                'SEGMENT'#9'PARA PUBLIC USE32 '''+