x86 external Intel assembler:

+ Write name of sec_threadvar
+ Also write actual section alignment instead of always using PARA.

git-svn-id: trunk@19069 -
This commit is contained in:
sergei 2011-09-15 15:05:14 +00:00
parent 05c4c3ae25
commit 782cdd8e9a

View File

@ -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 '''+