* 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); 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); TAsmRelocationType = (RELOC_ABSOLUTE,RELOC_RELATIVE,RELOC_RVA);
@ -348,7 +348,7 @@ implementation
constructor tasmlabel.createlocal(nr:longint;ltyp:TAsmLabelType); constructor tasmlabel.createlocal(nr:longint;ltyp:TAsmLabelType);
begin; 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; labelnr:=nr;
labeltype:=ltyp; labeltype:=ltyp;
is_set:=false; is_set:=false;

View File

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

View File

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

View File

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

View File

@ -455,7 +455,7 @@ implementation
typedconstsym : typedconstsym :
asmlist[cural].concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,AT_DATA,offset)); asmlist[cural].concat(Tai_const.Createname(ttypedconstsym(srsym).mangledname,AT_DATA,offset));
labelsym : 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 : constsym :
if tconstsym(srsym).consttyp=constresourcestring then 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))) 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 begin
CreateLocalLabel(tempstr,hl,false); CreateLocalLabel(tempstr,hl,false);
hs:=hl.name; hs:=hl.name;
hssymtyp:=AT_FUNCTION; hssymtyp:=AT_LABEL;
end end
else else
if SearchLabel(tempstr,hl,false) then if SearchLabel(tempstr,hl,false) then

View File

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

View File

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

View File

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

View File

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