* new assembler symbol type AT_LABEL needed for PowerPc64 target

+ added automatic definition of FPC_REQUIRES_PROPER_ALIGNMENT define for PowerPC64 target

git-svn-id: trunk@1278 -
This commit is contained in:
tom_at_work 2005-10-03 22:13:45 +00:00
parent c1f1424640
commit 28381b1287
10 changed files with 71 additions and 79 deletions

View File

@ -42,7 +42,7 @@ interface
TAsmsymbind=(AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL);
TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION);
TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL);
TAsmRelocationType = (RELOC_ABSOLUTE,RELOC_RELATIVE,RELOC_RVA);
@ -348,7 +348,7 @@ implementation
constructor tasmlabel.createlocal(nr:longint;ltyp:TAsmLabelType);
begin;
inherited create(target_asm.labelprefix+asmlabeltypeprefix[ltyp]+tostr(nr),AB_LOCAL,AT_FUNCTION);
inherited create(target_asm.labelprefix+asmlabeltypeprefix[ltyp]+tostr(nr),AB_LOCAL,AT_LABEL);
labelnr:=nr;
labeltype:=ltyp;
is_set:=false;

View File

@ -246,16 +246,16 @@ implementation
procedure TGNUAssembler.WriteTree(p:TAAsmoutput);
{$ifdef powerpc64}
function is_const(hp : tai) : boolean;
function needsObject(hp : tai_symbol) : boolean;
begin
is_const :=
assigned(hp) and
(hp.typ in [ait_const_rva_symbol,
needsObject :=
assigned(hp.next) and
(tai_symbol(hp.next).typ in [ait_const_rva_symbol,
ait_const_32bit,ait_const_16bit,ait_const_8bit,ait_datablock,
ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit]);
end;
{$endif powerpc64}
var
ch : char;
hp : tai;
@ -272,6 +272,8 @@ implementation
e : extended;
{$endif cpuextended}
do_line : boolean;
sepChar : char;
begin
if not assigned(p) then
exit;
@ -669,8 +671,6 @@ implementation
AsmWriteLn(':');
end;
end;
ait_symbol :
begin
if tai_symbol(hp).is_global then
@ -678,45 +678,9 @@ implementation
AsmWrite('.globl'#9);
AsmWriteLn(tai_symbol(hp).sym.name);
end;
if target_info.system in [system_i386_linux,system_i386_beos,
system_powerpc_linux,system_m68k_linux,
system_sparc_linux,system_alpha_linux,
system_x86_64_linux,system_arm_linux] then
begin
AsmWrite(#9'.type'#9);
AsmWrite(tai_symbol(hp).sym.name);
if assigned(tai(hp.next)) and
(tai(hp.next).typ in [ait_const_rva_symbol,
ait_const_32bit,ait_const_16bit,ait_const_8bit,ait_datablock,
ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit]) then
begin
if target_info.system = system_arm_linux then
AsmWriteLn(',#object')
else
AsmWriteLn(',@object')
end
else
begin
if target_info.system = system_arm_linux then
AsmWriteLn(',#function')
else
AsmWriteLn(',@function');
end;
if tai_symbol(hp).sym.size>0 then
begin
AsmWrite(#9'.size'#9);
AsmWrite(tai_symbol(hp).sym.name);
AsmWrite(', ');
AsmWriteLn(tostr(tai_symbol(hp).sym.size));
end;
{$IFDEF POWERPC64}
end else if (target_info.system = system_powerpc64_linux) then begin
if (tai_symbol(hp).sym.typ <> AT_FUNCTION) then begin
AsmWriteLn(#9'.type'#9 + tai_symbol(hp).sym.name + ',@object');
if tai_symbol(hp).sym.size>0 then begin
AsmWriteLn(#9'.size'#9 + tai_symbol(hp).sym.name + ', ' + tostr(tai_symbol(hp).sym.size));
end;
end else begin
if (target_info.system = system_powerpc64_linux) and
(tai_symbol(hp).sym.typ = AT_FUNCTION) then
begin
AsmWriteLn('.section "opd", "aw"');
AsmWriteLn('.align 3');
AsmWriteLn(tai_symbol(hp).sym.name + ':');
@ -724,12 +688,38 @@ implementation
AsmWriteLn('.previous');
AsmWriteLn('.size ' + tai_symbol(hp).sym.name + ', 24');
AsmWriteLn('.globl .' + tai_symbol(hp).sym.name);
AsmWriteLn('.type .' + tai_symbol(hp).sym.name + ', @function');
{ the dotted name is the name of the actual function }
AsmWrite('.');
end
else
begin
if (target_info.system <> system_arm_linux) then
begin
sepChar := '@';
end
else
begin
sepChar := '#';
end;
if (tf_needs_symbol_type in target_info.flags) then
begin
AsmWrite(#9'.type'#9 + tai_symbol(hp).sym.name);
if (needsObject(tai_symbol(hp))) then
begin
AsmWriteLn(',' + sepChar + 'object');
end
else
begin
AsmWriteLn(',' + sepChar + 'function');
end;
end;
if (tf_needs_symbol_size in target_info.flags) and (tai_symbol(hp).sym.size > 0) then begin
AsmWriteLn(#9'.size'#9 + tai_symbol(hp).sym.name + ', ' + tostr(tai_symbol(hp).sym.size));
end;
end;
{$ENDIF}
end;
AsmWrite(tai_symbol(hp).sym.name);
AsmWriteLn(':');
AsmWriteLn(tai_symbol(hp).sym.name + ':');
end;
ait_symbol_end :
@ -740,18 +730,16 @@ implementation
inc(symendcount);
AsmWriteLn(s+':');
AsmWrite(#9'.size'#9);
{$ifdef powerpc64}
if (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then begin
AsmWrite('.');
end;
{$endif powerpc64}
if (target_info.system = system_powerpc64_linux) and (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then
begin
AsmWrite('.');
end;
AsmWrite(tai_symbol_end(hp).sym.name);
AsmWrite(', '+s+' - ');
{$ifdef powerpc64}
if (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then begin
AsmWrite('.');
end;
{$endif powerpc64}
if (target_info.system = system_powerpc64_linux) and (tai_symbol_end(hp).sym.typ = AT_FUNCTION) then
begin
AsmWrite('.');
end;
AsmWriteLn(tai_symbol_end(hp).sym.name);
end;
end;

View File

@ -1831,6 +1831,7 @@ begin
def_system_macro('FPC_INCLUDE_SOFTWARE_INT64_TO_DOUBLE');
def_system_macro('FPC_CURRENCY_IS_INT64');
def_system_macro('FPC_COMP_IS_INT64');
def_system_macro('FPC_REQUIRES_PROPER_ALIGNMENT');
{$endif}
{$ifdef iA64}
def_system_macro('CPUIA64');

View File

@ -853,7 +853,7 @@ var
p: taicpu;
begin
p := taicpu.op_sym(A_B, objectlibrary.newasmsymbol(s, AB_EXTERNAL,
AT_FUNCTION));
AT_LABEL));
p.is_jmp := true;
list.concat(p)
end;
@ -1614,7 +1614,7 @@ var
begin
p := taicpu.op_sym(op, objectlibrary.newasmsymbol(l.name, AB_EXTERNAL,
AT_FUNCTION));
AT_LABEL));
if op <> A_B then
create_cond_norm(c, crval, p.condition);
p.is_jmp := true;

View File

@ -455,7 +455,7 @@ implementation
typedconstsym :
asmlist[cural].concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,AT_DATA,offset));
labelsym :
asmlist[cural].concat(Tai_const.Createname(tlabelsym(srsym).mangledname,AT_FUNCTION,offset));
asmlist[cural].concat(Tai_const.Createname(tlabelsym(srsym).mangledname,AT_LABEL,offset));
constsym :
if tconstsym(srsym).consttyp=constresourcestring then
asmlist[cural].concat(Tai_const.Createname(make_mangledname('RESOURCESTRINGLIST',tconstsym(srsym).owner,''),AT_DATA,tconstsym(srsym).resstrindex*(4+sizeof(aint)*3)+4+sizeof(aint)))

View File

@ -1395,7 +1395,7 @@ unit raatt;
begin
CreateLocalLabel(tempstr,hl,false);
hs:=hl.name;
hssymtyp:=AT_FUNCTION;
hssymtyp:=AT_LABEL;
end
else
if SearchLabel(tempstr,hl,false) then

View File

@ -1538,7 +1538,7 @@ end;
{ linked list of instructions.(used by AT&T styled asm) }
{*********************************************************************}
begin
p.concat(Tai_symbol.Createname_global(s,AT_FUNCTION,0));
p.concat(Tai_symbol.Createname_global(s,AT_LABEL,0));
end;
procedure ConcatLocal(p:TAAsmoutput;const s : string);
@ -1548,7 +1548,7 @@ end;
{ linked list of instructions. }
{*********************************************************************}
begin
p.concat(Tai_symbol.Createname(s,AT_FUNCTION,0));
p.concat(Tai_symbol.Createname(s,AT_LABEL,0));
end;

View File

@ -255,7 +255,8 @@ interface
tf_needs_dwarf_cfi,
tf_use_8_3,
tf_pic_uses_got,
tf_library_needs_pic
tf_library_needs_pic,
tf_needs_symbol_type
);
psysteminfo = ^tsysteminfo;

View File

@ -46,7 +46,7 @@ unit i_linux;
system : system_i386_LINUX;
name : 'Linux for i386';
shortname : 'Linux';
flags : [tf_needs_symbol_size,tf_pic_uses_got{,tf_smartlink_sections}];
flags : [tf_needs_symbol_size,tf_pic_uses_got{,tf_smartlink_sections},tf_needs_symbol_type];
cpu : cpu_i386;
unit_env : 'LINUXUNITS';
extradefines : 'UNIX;HASUNIX';
@ -172,7 +172,7 @@ unit i_linux;
system : system_m68k_linux;
name : 'Linux for m68k';
shortname : 'Linux';
flags : [tf_needs_symbol_size];
flags : [tf_needs_symbol_size,tf_needs_symbol_type];
cpu : cpu_m68k;
unit_env : 'LINUXUNITS';
extradefines : 'UNIX;HASUNIX';
@ -235,7 +235,7 @@ unit i_linux;
system : system_powerpc_LINUX;
name : 'Linux for PowerPC';
shortname : 'Linux';
flags : [tf_needs_symbol_size];
flags : [tf_needs_symbol_size,tf_needs_symbol_type];
cpu : cpu_powerpc;
unit_env : '';
extradefines : 'UNIX;HASUNIX';
@ -298,7 +298,7 @@ unit i_linux;
system : system_powerpc64_LINUX;
name : 'Linux for PowerPC64';
shortname : 'Linux';
flags : [tf_needs_symbol_size];
flags : [tf_needs_symbol_size,tf_needs_symbol_type];
cpu : cpu_powerpc64;
unit_env : '';
extradefines : 'UNIX;HASUNIX';
@ -361,7 +361,7 @@ unit i_linux;
system : system_alpha_LINUX;
name : 'Linux for Alpha';
shortname : 'Linux';
flags : [tf_needs_symbol_size];
flags : [tf_needs_symbol_size,tf_needs_symbol_type];
cpu : cpu_alpha;
unit_env : 'LINUXUNITS';
extradefines : 'UNIX;HASUNIX';
@ -425,7 +425,7 @@ unit i_linux;
name : 'Linux for x86-64';
shortname : 'Linux';
flags : [tf_needs_symbol_size,tf_needs_dwarf_cfi,
tf_library_needs_pic];
tf_library_needs_pic,tf_needs_symbol_type];
cpu : cpu_x86_64;
unit_env : 'LINUXUNITS';
extradefines : 'UNIX;HASUNIX';
@ -488,7 +488,7 @@ unit i_linux;
system : system_SPARC_Linux;
name : 'Linux for SPARC';
shortname : 'Linux';
flags : [tf_needs_symbol_size,tf_library_needs_pic];
flags : [tf_needs_symbol_size,tf_library_needs_pic,tf_needs_symbol_type];
cpu : cpu_SPARC;
unit_env : 'LINUXUNITS';
extradefines : 'UNIX;HASUNIX';
@ -551,7 +551,7 @@ unit i_linux;
system : system_arm_Linux;
name : 'Linux for ARM';
shortname : 'Linux';
flags : [tf_needs_symbol_size];
flags : [tf_needs_symbol_size,tf_needs_symbol_type];
cpu : cpu_arm;
unit_env : 'LINUXUNITS';
extradefines : 'UNIX;HASUNIX';

View File

@ -452,7 +452,7 @@ Procedure ReadAsmSymbols;
type
{ Copied from aasmbase.pas }
TAsmsymbind=(AB_NONE,AB_EXTERNAL,AB_COMMON,AB_LOCAL,AB_GLOBAL);
TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION);
TAsmsymtype=(AT_NONE,AT_FUNCTION,AT_DATA,AT_SECTION,AT_LABEL);
var
s,
bindstr,
@ -483,6 +483,8 @@ begin
typestr:='Data';
AT_SECTION :
typestr:='Section';
AT_LABEL :
typestr:='Label';
else
typestr:='<Error !!>'
end;