* make cycle fixed

+ pic support for darwin
  + support of importing vars from shared libs on darwin implemented
This commit is contained in:
florian 2004-03-02 17:32:12 +00:00
parent 49202644df
commit 61f15e4ec4
20 changed files with 439 additions and 161 deletions

View File

@ -84,10 +84,15 @@ interface
{$ifdef m68k}
ait_labeled_instruction,
{$endif m68k}
ait_cut, { used to split into tiny assembler files }
{ used to split into tiny assembler files }
ait_cut,
ait_regalloc,
ait_tempalloc,
ait_marker { used to mark assembler blocks and inlined functions }
{ used to mark assembler blocks and inlined functions }
ait_marker,
{ special symbols for darwin pic code }
ait_indirect_symbol,
ait_non_lazy_symbol_pointer
);
const
@ -135,7 +140,9 @@ interface
'cut',
'regalloc',
'tempalloc',
'marker'
'marker',
'indirect_symbol',
'non_lazy_symbol_pointer'
);
type
@ -192,8 +199,6 @@ interface
{$endif GDB}
,ait_regalloc, ait_tempalloc, ait_symbol_end];
{ ait_* types which do not have line information (and hence which are of type
tai, otherwise, they are of type tailineinfo }
{ ait_* types which do not have line information (and hence which are of type
tai, otherwise, they are of type tailineinfo }
SkipLineInfo =[ait_label,
@ -203,7 +208,8 @@ interface
{$endif GDB}
ait_cut,ait_marker,ait_align,ait_section,ait_comment,
ait_const_8bit,ait_const_16bit,ait_const_32bit,
ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_real_128bit
ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_real_128bit,
ait_non_lazy_symbol_pointer
];
@ -243,6 +249,9 @@ interface
procedure ppuwrite(ppufile:tcompilerppufile);override;
end;
tai_simple = class(tai)
constructor create(_typ : taitype);
end;
taiclass = class of tai;
@ -350,13 +359,15 @@ interface
procedure ppuwrite(ppufile:tcompilerppufile);override;
end;
tai_const_symbol = class(tailineinfo)
sym : tasmsymbol;
offset : longint;
offset : aint;
constructor Create(_sym:tasmsymbol);
constructor Create_offset(_sym:tasmsymbol;ofs:longint);
constructor Create_offset(_sym:tasmsymbol;ofs:aint);
constructor Create_rva(_sym:tasmsymbol);
constructor Createname(const name:string;_symtyp:Tasmsymtype;ofs:longint);
constructor Create_indirect(_sym:tasmsymbol);
constructor Createname(const name:string;_symtyp:Tasmsymtype;ofs:aint);
constructor Createname_rva(const name:string);
constructor ppuload(t:taitype;ppufile:tcompilerppufile);override;
procedure ppuwrite(ppufile:tcompilerppufile);override;
@ -386,6 +397,7 @@ interface
procedure ppuwrite(ppufile:tcompilerppufile);override;
end;
{ Generates an extended float (80 bit real) }
tai_real_80bit = class(tai)
value : ts80real;
@ -394,7 +406,8 @@ interface
procedure ppuwrite(ppufile:tcompilerppufile);override;
end;
{ Generates an extended float (128 bit real) }
{ Generates an float128 (128 bit real) }
tai_real_128bit = class(tai)
value : ts128real;
constructor Create(_value : ts128real);
@ -552,6 +565,8 @@ interface
debuglist,withdebuglist,consts,
importssection,exportssection,
resourcesection,rttilist,
{ data used by pic code }
picdata,
resourcestringlist : taasmoutput;
function ppuloadai(ppufile:tcompilerppufile):tai;
@ -679,6 +694,17 @@ implementation
end;
{****************************************************************************
TAI_SIMPLE
****************************************************************************}
constructor tai_simple.create(_typ : taitype);
begin
inherited create;
typ:=_typ;
end;
{****************************************************************************
TAI_SECTION
****************************************************************************}
@ -948,6 +974,7 @@ implementation
sym.increfs;
end;
constructor tai_const_symbol.Create_rva(_sym:tasmsymbol);
begin
inherited Create;
@ -958,6 +985,18 @@ implementation
sym.increfs;
end;
constructor tai_const_symbol.Create_indirect(_sym:tasmsymbol);
begin
inherited Create;
typ:=ait_indirect_symbol;
sym:=_sym;
offset:=0;
{ update sym info }
sym.increfs;
end;
constructor tai_const_symbol.Createname(const name:string;_symtyp:Tasmsymtype;ofs:longint);
begin
inherited Create;
@ -968,6 +1007,7 @@ implementation
sym.increfs;
end;
constructor tai_const_symbol.Createname_rva(const name:string);
begin
inherited Create;
@ -1960,7 +2000,12 @@ implementation
end.
{
$Log$
Revision 1.75 2004-03-02 00:36:32 olle
Revision 1.76 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.75 2004/03/02 00:36:32 olle
* big transformation of Tai_[const_]Symbol.Create[data]name*
Revision 1.74 2004/02/27 12:13:15 daniel

View File

@ -492,6 +492,13 @@ var
AsmLn;
end;
ait_indirect_symbol :
begin
AsmWrite(#9'.indirect_symbol'#9);
AsmWrite(tai_const_symbol(hp).sym.name);
AsmLn;
end;
ait_const_rva :
begin
AsmWrite(#9'.rva'#9);
@ -781,6 +788,9 @@ var
else if tai_marker(hp).kind=InlineEnd then
dec(InlineLevel);
ait_non_lazy_symbol_pointer:
AsmWriteLn('.non_lazy_symbol_pointer');
else
internalerror(10000);
end;
@ -846,6 +856,7 @@ var
WriteTree(datasegment);
WriteTree(consts);
WriteTree(rttilist);
WriteTree(picdata);
Writetree(resourcestringlist);
WriteTree(bsssegment);
Writetree(importssection);
@ -868,7 +879,12 @@ var
end.
{
$Log$
Revision 1.46 2004-02-22 16:51:50 peter
Revision 1.47 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.46 2004/02/22 16:51:50 peter
* tf_need_symbol_size added
Revision 1.45 2004/01/24 18:12:40 florian

View File

@ -1583,6 +1583,7 @@ Implementation
addlist(datasegment);
addlist(consts);
addlist(rttilist);
addlist(picdata);
if assigned(resourcestringlist) then
addlist(resourcestringlist);
addlist(bsssegment);
@ -1659,7 +1660,12 @@ Implementation
end.
{
$Log$
Revision 1.63 2004-03-02 00:36:33 olle
Revision 1.64 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.63 2004/03/02 00:36:33 olle
* big transformation of Tai_[const_]Symbol.Create[data]name*
Revision 1.62 2004/02/27 10:21:05 florian

View File

@ -1296,7 +1296,7 @@ Unit Ra386int;
if GotStar then
Message(asmr_e_only_add_relocatable_symbol);
if not assigned(oper.opr.ref.symbol) then
oper.opr.ref.symbol:=objectlibrary.newasmsymbol(tempstr)
oper.opr.ref.symbol:=objectlibrary.newasmsymbol(tempstr,AB_EXTERNAL,AT_FUNCTION)
else
Message(asmr_e_cant_have_multiple_relocatable_symbols);
end;
@ -1977,7 +1977,12 @@ begin
end.
{
$Log$
Revision 1.70 2004-03-02 00:36:33 olle
Revision 1.71 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.70 2004/03/02 00:36:33 olle
* big transformation of Tai_[const_]Symbol.Create[data]name*
Revision 1.69 2004/01/14 23:39:05 florian

View File

@ -2073,6 +2073,8 @@ option_help_pages=11025_[
**1C<x>_code generation options:
**2CD_create also dynamic library (not supported)
**2Ce_Compilation with emulated floating point opcodes
**2Cf_Select fpu instruction set to use
**2Cg_Generate PIC code
**2Ch<n>_<n> bytes heap (between 1023 and 67107840)
**2Ci_IO-checking
**2Cn_omit linking stage
@ -2236,7 +2238,7 @@ P*1T<x>_Target operating system:
P*2Tdarwin_Darwin and MacOS X on PowerPC
P*2Tlinux_Linux on PowerPC
P*2Tmacos_MacOS (classic) on PowerPC
P*2Tmorphos_MorphOS
P*2Tmorphos_MorphOS
**1*_
**1?_shows this help
**1h_shows this help without waiting

View File

@ -633,7 +633,7 @@ const
option_info=11024;
option_help_pages=11025;
MsgTxtSize = 35986;
MsgTxtSize = 36049;
MsgIdxMax : array[1..20] of longint=(
17,63,197,53,57,44,99,20,35,60,

View File

@ -1,7 +1,7 @@
{$ifdef Delphi}
const msgtxt : array[0..000149] of string[240]=(
const msgtxt : array[0..000150] of string[240]=(
{$else Delphi}
const msgtxt : array[0..000149,1..240] of char=(
const msgtxt : array[0..000150,1..240] of char=(
{$endif Delphi}
'01000_T_Compiler: $1'#000+
'01001_D_Compiler OS: $1'#000+
@ -706,173 +706,174 @@ const msgtxt : array[0..000149,1..240] of char=(
'**1C<x>_code generation options:'#010+
'**2CD_create also dynamic library (not supported)'#010+
'**2Ce_Compilation with emulated floating point opcodes'#010+
'**2Ch<n>_<n> bytes heap (between 1023 and 67107840)'#010+
'**2Ci_IO-checking',#010+
'**2Cf_Select fpu instruction set to use'#010+
'**2Cg_Generate PIC code'#010+
'**2Ch','<n>_<n> bytes heap (between 1023 and 67107840)'#010+
'**2Ci_IO-checking'#010+
'**2Cn_omit linking stage'#010+
'**2Co_check overflow of integer operations'#010+
'**2Cr_range checking'#010+
'**2CR_verify object method call validity'#010+
'**2Cs<n>_set stack size to <n>'#010+
'**2Ct_stack checking'#010+
'**2Ct_stack ch','ecking'#010+
'**2CX_create also smartlinked library'#010+
'**1d<x>_defines the',' symbol <x>'#010+
'**1d<x>_defines the symbol <x>'#010+
'*O1D_generate a DEF file'#010+
'*O2Dd<x>_set description to <x>'#010+
'*O2Dw_PM application'#010+
'**1e<x>_set path to executable'#010+
'**1E_same as -Cn'#010+
'**1F<x>_set file names and paths:'#010+
'**2FD<x>_sets the directory where to search for compiler utilities'#010+
'*','*2Fe<x>_redirect error output to <x>'#010+
'**2F','D<x>_sets the directory where to search for compiler utilities'#010+
'**2Fe<x>_redirect error output to <x>'#010+
'**2FE<x>_set exe/unit output path to <x>'#010+
'**2Fi<x>_adds <x> to include path'#010+
'**2Fl<x>_adds <x> to library path'#010+
'*L2FL<x>_uses <x> as dynamic linker'#010+
'*L2FL<x>_uses <x> as dynamic l','inker'#010+
'**2Fo<x>_adds <x> to object path'#010+
'**2Fr<x>_load error messa','ge file <x>'#010+
'**2Fr<x>_load error message file <x>'#010+
'**2Fu<x>_adds <x> to unit path'#010+
'**2FU<x>_set unit output path to <x>, overrides -FE'#010+
'*g1g_generate debugger information:'#010+
'*g2gg_use gsym'#010+
'*g2gd_use dbx'#010+
'*g2gh_use heap trace unit (for memory leak debugging)'#010+
'*g2gl_use line info unit t','o show more info for backtraces'#010+
'*g2gh_use heap t','race unit (for memory leak debugging)'#010+
'*g2gl_use line info unit to show more info for backtraces'#010+
'*g2gc_generate checks for pointers'#010+
'**1i_information'#010+
'**2iD_return compiler date'#010+
'**2iV_return compiler version'#010+
'**2iSO_return compiler OS'#010+
'**2iSP_return compiler processor'#010+
'**2iSP_re','turn compiler processor'#010+
'**2iTO_return target OS'#010+
'**2iTP_return ta','rget processor'#010+
'**2iTP_return target processor'#010+
'**1I<x>_adds <x> to include path'#010+
'**1k<x>_Pass <x> to the linker'#010+
'**1l_write logo'#010+
'**1M<x>_set language mode to <x>'#010+
'**2Mfpc_free pascal dialect (default)'#010+
'**2Mobjfpc_switch some Delphi 2 extensions on'#010+
'**2Mdelphi_tries to be Delph','i compatible'#010+
'**2Mobjfpc','_switch some Delphi 2 extensions on'#010+
'**2Mdelphi_tries to be Delphi compatible'#010+
'**2Mtp_tries to be TP/BP 7.0 compatible'#010+
'**2Mgpc_tries to be gpc compatible'#010+
'**2Mmac_tries to be compatible to the macintosh pascal dialects'#010+
'**1n_don'#039't read the default config file'#010+
'**1o<x>_change the name of the executable produc','ed to <x>'#010+
'**1n_don'#039't read the defa','ult config file'#010+
'**1o<x>_change the name of the executable produced to <x>'#010+
'**1pg_generate profile code for gprof (defines FPC_PROFILE)'#010+
'*L1P_use pipes instead of creating temporary assembler files'#010+
'**1S<x>_syntax options:'#010+
'**2S2_same as -Mobjfpc'#010+
'**2S2_same as -Mobjfp','c'#010+
'**2Sc_supports operators like C (*=,+=,/= and -=)'#010+
'**2Sa_includ','e assertion code.'#010+
'**2Sa_include assertion code.'#010+
'**2Sd_same as -Mdelphi'#010+
'**2Se<x>_compiler stops after the <x> errors (default is 1)'#010+
'**2Sg_allow LABEL and GOTO'#010+
'**2Sh_Use ansistrings'#010+
'**2Si_support C++ styled INLINE'#010+
'**2Si_support C++ styled I','NLINE'#010+
'**2Sm_support macros like C (global)'#010+
'**2So_same as -Mtp'#010+
'**','2Sp_same as -Mgpc'#010+
'**2Sp_same as -Mgpc'#010+
'**2Ss_constructor name must be init (destructor must be done)'#010+
'**2St_allow static keyword in objects'#010+
'**1s_don'#039't call assembler and linker'#010+
'**2sh_Generate script to link on host'#010+
'**2sh_Generate script',' to link on host'#010+
'**2st_Generate script to link on target'#010+
'**2sr_S','kip register allocation phase (optimizations will be disabled'+
')'#010+
'**2sr_Skip register allocation phase (optimizations will be disabled)'#010+
'**1u<x>_undefines the symbol <x>'#010+
'**1U_unit options:'#010+
'**2Un_don'#039't check the unit name'#010+
'**2Ur_generate release unit files'#010+
'**2Ur_generate release unit f','iles'#010+
'**2Us_compile a system unit'#010+
'**1v<x>_Be verbose. <x> is a co','mbination of the following letters:'#010+
'**1v<x>_Be verbose. <x> is a combination of the following letters:'#010+
'**2*_e : Show errors (default) d : Show debug info'#010+
'**2*_w : Show warnings u : Show unit info'#010+
'**2*_n : Show notes t : Show tried/used files'#010+
'**2*_h : Show hints ',' m : Show defined macros'#010+
'**2*_n : Show notes ',' t : Show tried/used files'#010+
'**2*_h : Show hints m : Show defined macros'#010+
'**2*_i : Show general info p : Show compiled procedures'#010+
'**2*_l : Show linenumbers c : Show conditionals'#010+
'**2*_a : Show everything 0 : Show nothing (except errors)'#010+
'**2*_b : Sho','w all procedure r : Rhide/GCC compatibility mod'+
'e'#010+
'**2*_a : Show ever','ything 0 : Show nothing (except errors'+
')'#010+
'**2*_b : Show all procedure r : Rhide/GCC compatibility mode'#010+
'**2*_ declarations if an error x : Executable info (Win32 only)'#010+
'**2*_ occurs'#010+
'**1V_write fpcdebug.txt file with lots of debugging info'#010+
'**1V_write fpcdebug.txt file wit','h lots of debugging info'#010+
'**1X_executable options:'#010+
'*L2Xc_link wit','h the c library'#010+
'*L2Xc_link with the c library'#010+
'**2Xs_strip all symbols from executable'#010+
'**2XD_try to link dynamic (defines FPC_LINK_DYNAMIC)'#010+
'**2XS_try to link static (default) (defines FPC_LINK_STATIC)'#010+
'**2XS_try to link static (default) (defines FPC_LINK_STATI','C)'#010+
'**2XX_try to link smart (defines FPC_LINK_SMART)'#010+
'*','*0*_Processor specific options:'#010+
'**0*_Processor specific options:'#010+
'3*1A<x>_output format:'#010+
'3*2Aas_assemble using GNU AS'#010+
'3*2Anasmcoff_coff (Go32v2) file using Nasm'#010+
'3*2Anasmelf_elf32 (Linux) file using Nasm'#010+
'3*2Awasm_obj file using Wasm (Watcom)'#010+
'3*2Awas','m_obj file using Wasm (Watcom)'#010+
'3*2Anasmobj_obj file using Nasm'#010+
'3','*2Amasm_obj file using Masm (Microsoft)'#010+
'3*2Amasm_obj file using Masm (Microsoft)'#010+
'3*2Atasm_obj file using Tasm (Borland)'#010+
'3*2Acoff_coff (Go32v2) using internal writer'#010+
'3*2Apecoff_pecoff (Win32) using internal writer'#010+
'3*1R<x>_assembler reading style:'#010+
'3*1R','<x>_assembler reading style:'#010+
'3*2Ratt_read AT&T style assembler'#010+
'3','*2Rintel_read Intel style assembler'#010+
'3*2Rintel_read Intel style assembler'#010+
'3*2Rdirect_copy assembler text directly to assembler file'#010+
'3*1O<x>_optimizations:'#010+
'3*2Og_generate smaller code'#010+
'3*2OG_generate faster code (default)'#010+
'3*2OG_generate faster code (def','ault)'#010+
'3*2Or_keep certain variables in registers'#010+
'3*2Ou_enable unc','ertain optimizations (see docs)'#010+
'3*2Ou_enable uncertain optimizations (see docs)'#010+
'3*2O1_level 1 optimizations (quick optimizations)'#010+
'3*2O2_level 2 optimizations (-O1 + slower optimizations)'#010+
'3*2O3_level 3 optimizations (-O2 repeatedly, max 5 times)'#010+
'3*2O3_level 3 optimizations (-O2 repe','atedly, max 5 times)'#010+
'3*2Op<x>_target processor:'#010+
'3*3Op1_set targe','t processor to 386/486'#010+
'3*3Op1_set target processor to 386/486'#010+
'3*3Op2_set target processor to Pentium/PentiumMMX (tm)'#010+
'3*3Op3_set target processor to PPro/PII/c6x86/K6 (tm)'#010+
'3*1T<x>_Target operating system:'#010+
'3*2Temx_OS/2 via EMX (including EMX/RSX extender)'#010+
'3*2Tgo32v2_Version 2 of D','J Delorie DOS extender'#010+
'3*2Temx_OS/','2 via EMX (including EMX/RSX extender)'#010+
'3*2Tgo32v2_Version 2 of DJ Delorie DOS extender'#010+
'3*2Tlinux_Linux'#010+
'3*2Tnetware_Novell Netware Module (clib)'#010+
'3*2Tos2_OS/2 / eComStation'#010+
'3*2Tsunos_SunOS/Solaris'#010+
'3*2Twatcom_Watcom compatible DOS extender'#010+
'3*2Twdosx_WDOSX DOS extender'#010+
'3*2','Twdosx_WDOSX DOS extender'#010+
'3*2Twin32_Windows 32 Bit'#010+
'3*1W<x>_Win32','-like target options'#010+
'3*1W<x>_Win32-like target options'#010+
'3*2WB<x>_Set Image base to Hexadecimal <x> value'#010+
'3*2WC_Specify console type application'#010+
'3*2WD_Use DEFFILE to export functions of DLL or EXE'#010+
'3*2WF_Specify full-screen type application (OS/2 only)'#010+
'3*2WG_Specify graphic ty','pe application'#010+
'3*2WF_Specify f','ull-screen type application (OS/2 only)'#010+
'3*2WG_Specify graphic type application'#010+
'3*2WN_Do not generate relocation code (necessary for debugging)'#010+
'3*2WR_Generate relocation code'#010+
'6*1A<x>_output format'#010+
'6*2Aas_Unix o-file using GNU AS'#010+
'6*2Agas_GNU Motorola assembler'#010+
'6*2Agas_GNU ','Motorola assembler'#010+
'6*2Amit_MIT Syntax (old GAS)'#010+
'6*2Amot_Standard',' Motorola assembler'#010+
'6*2Amot_Standard Motorola assembler'#010+
'6*1O_optimizations:'#010+
'6*2Oa_turn on the optimizer'#010+
'6*2Og_generate smaller code'#010+
'6*2OG_generate faster code (default)'#010+
'6*2Ox_optimize maximum (still BUGGY!!!)'#010+
'6*2O0_set target processor to a MC68000'#010+
'6*2O2_set target processor ','to a MC68020+ (default)'#010+
'6*2','O0_set target processor to a MC68000'#010+
'6*2O2_set target processor to a MC68020+ (default)'#010+
'6*1R<x>_assembler reading style:'#010+
'6*2RMOT_read motorola style assembler'#010+
'6*1T<x>_Target operating system:'#010+
'6*2Tamiga_Commodore Amiga'#010+
'6*2Tatari_Atari ST/STe/TT'#010+
'6*2Tatari_Atari ST/STe','/TT'#010+
'6*2Tlinux_Linux-68k'#010+
'6*2Tmacos_Macintosh m68k'#010+
'6*2Tpalmos_Palm','OS'#010+
'6*2Tpalmos_PalmOS'#010+
'P*1T<x>_Target operating system:'#010+
'P*2Tdarwin_Darwin and MacOS X on PowerPC'#010+
'P*2Tlinux_Linux on PowerPC'#010+
'P*2Tmacos_MacOS (classic) on PowerPC'#010+
'P*2Tmorphos_MorphOS '#010+
'P*2Tmorphos_MorphOS'#010+
'**1*_'#010+
'**1?_shows this help'#010+
'**1?_show','s this help'#010+
'**1h_shows this help without waiting'#000
);

View File

@ -232,6 +232,7 @@ interface
case hp2.typ of
ait_label :
ReLabel(tasmsymbol(tai_label(hp2).l));
ait_indirect_symbol,
ait_const_rva,
ait_const_symbol :
ReLabel(tai_const_symbol(hp2).sym);
@ -474,7 +475,12 @@ begin
end.
{
$Log$
Revision 1.57 2004-02-27 19:30:23 jonas
Revision 1.58 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.57 2004/02/27 19:30:23 jonas
* fixed relsymbol copy/paste bug
Revision 1.56 2004/02/27 10:21:05 florian

View File

@ -33,6 +33,7 @@ interface
type
tcgloadnode = class(tloadnode)
procedure pass_2;override;
procedure generate_picvaraccess;virtual;
end;
tcgassignmentnode = class(tassignmentnode)
@ -64,6 +65,13 @@ implementation
SecondLoad
*****************************************************************************}
procedure tcgloadnode.generate_picvaraccess;
begin
location.reference.base:=current_procinfo.got;
location.reference.symbol:=objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname+'@GOT',AB_EXTERNAL,AT_DATA);
end;
procedure tcgloadnode.pass_2;
var
hregister : tregister;
@ -121,15 +129,24 @@ implementation
{ DLL variable }
else if (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
begin
hregister:=cg.getaddressregister(exprasmlist);
location.reference.symbol:=objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,location.reference,hregister);
reference_reset_base(location.reference,hregister,0);
if target_info.system=system_powerpc_darwin then
begin
generate_picvaraccess;
if not(pi_needs_got in current_procinfo.flags) then
internalerror(200403022);
end
else
begin
hregister:=cg.getaddressregister(exprasmlist);
location.reference.symbol:=objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,location.reference,hregister);
reference_reset_base(location.reference,hregister,0);
end;
end
{ external variable }
else if (vo_is_external in tvarsym(symtableentry).varoptions) then
begin
location.reference.symbol:=objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
location.reference.symbol:=objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
end
{ thread variable }
else if (vo_is_thread_var in tvarsym(symtableentry).varoptions) then
@ -226,8 +243,9 @@ implementation
begin
if cs_create_pic in aktmoduleswitches then
begin
location.reference.base:=current_procinfo.got;
location.reference.symbol:=objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname+'@GOT',AB_EXTERNAL,AT_DATA);
generate_picvaraccess;
if not(pi_needs_got in current_procinfo.flags) then
internalerror(200403023);
end
else
location.reference.symbol:=objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA);
@ -908,7 +926,12 @@ begin
end.
{
$Log$
Revision 1.113 2004-03-02 00:36:33 olle
Revision 1.114 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.113 2004/03/02 00:36:33 olle
* big transformation of Tai_[const_]Symbol.Create[data]name*
Revision 1.112 2004/02/27 10:21:05 florian

View File

@ -334,6 +334,8 @@ implementation
registersint:=1;
if ([vo_is_thread_var,vo_is_dll_var]*tvarsym(symtableentry).varoptions)<>[] then
registersint:=1;
if (target_info.system=system_powerpc_darwin) and (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
include(current_procinfo.flags,pi_needs_got);
{ call to get address of threadvar }
if (vo_is_thread_var in tvarsym(symtableentry).varoptions) then
include(current_procinfo.flags,pi_do_call);
@ -1122,7 +1124,12 @@ begin
end.
{
$Log$
Revision 1.124 2004-02-20 22:15:26 peter
Revision 1.125 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.124 2004/02/20 22:15:26 peter
* fixed compiler err
Revision 1.123 2004/02/20 21:55:59 peter

View File

@ -500,6 +500,8 @@ begin
IllegalPara(opt);
break;
end;
'g' :
include(initmoduleswitches,cs_create_pic);
'h' :
begin
val(copy(more,j+1,length(more)-j),heapsize,code);
@ -1125,8 +1127,6 @@ begin
rlinkpath:=Copy(more,2,length(More)-1);
More:='';
end;
'p' :
include(initmoduleswitches,cs_create_pic);
'S' :
begin
def_symbol('FPC_LINK_STATIC');
@ -1999,7 +1999,12 @@ finalization
end.
{
$Log$
Revision 1.125 2004-02-22 12:04:04 florian
Revision 1.126 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.125 2004/02/22 12:04:04 florian
+ nx86set added
* some more x86-64 fixes

View File

@ -252,6 +252,9 @@ implementation
withdebuglist:=taasmoutput.create;
consts:=taasmoutput.create;
rttilist:=taasmoutput.create;
picdata:=taasmoutput.create;
if target_info.system=system_powerpc_darwin then
picdata.concat(tai_simple.create(ait_non_lazy_symbol_pointer));
ResourceStringList:=Nil;
importssection:=nil;
exportssection:=nil;
@ -280,6 +283,7 @@ implementation
withdebuglist.free;
consts.free;
rttilist.free;
picdata.free;
if assigned(ResourceStringList) then
ResourceStringList.free;
if assigned(importssection) then
@ -325,6 +329,7 @@ implementation
oldexports,
oldresource,
oldrttilist,
oldpicdata,
oldresourcestringlist,
oldbsssegment,
olddatasegment,
@ -402,6 +407,7 @@ implementation
oldwithdebuglist:=withdebuglist;
oldconsts:=consts;
oldrttilist:=rttilist;
oldpicdata:=picdata;
oldexprasmlist:=exprasmlist;
oldimports:=importssection;
oldexports:=exportssection;
@ -585,6 +591,7 @@ implementation
exportssection:=oldexports;
resourcesection:=oldresource;
rttilist:=oldrttilist;
picdata:=oldpicdata;
resourcestringlist:=oldresourcestringlist;
{ object data }
ResourceStrings:=OldResourceStrings;
@ -691,7 +698,12 @@ implementation
end.
{
$Log$
Revision 1.60 2004-02-04 22:15:15 daniel
Revision 1.61 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.60 2004/02/04 22:15:15 daniel
* Rtti generation moved to ncgutil
* Assmtai usage of symsym removed
* operator overloading cleanup up

View File

@ -154,14 +154,15 @@ implementation
end;
{ align code segment }
codeSegment.concat(Tai_align.Create(aktalignment.procalign));
{ Insert start and end of sections }
{ Insert start and end of sections }
fixseg(codesegment,sec_code);
fixseg(datasegment,sec_data);
fixseg(bsssegment,sec_bss);
{ we should use .rdata section for these two no ? }
{ .rdata is a read only data section (PM) }
{ we should use .rdata section for these two no ?
.rdata is a read only data section (PM) }
fixseg(rttilist,sec_data);
fixseg(consts,sec_data);
fixseg(picdata,sec_data);
if assigned(resourcestringlist) then
fixseg(resourcestringlist,sec_data);
{$ifdef GDB}
@ -1438,7 +1439,12 @@ implementation
end.
{
$Log$
Revision 1.141 2004-03-02 00:36:33 olle
Revision 1.142 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.141 2004/03/02 00:36:33 olle
* big transformation of Tai_[const_]Symbol.Create[data]name*
Revision 1.140 2004/02/26 16:16:38 peter

View File

@ -130,7 +130,11 @@ unit agppcgas;
s :='';
s := s+'(';
if assigned(symbol) then
s:= s+symbol.name;
begin
s:=s+symbol.name;
if assigned(relsymbol) then
s:=s+'-'+relsymbol.name;
end;
end;
if offset<0 then
s:=s+tostr(offset)
@ -138,9 +142,9 @@ unit agppcgas;
if (offset>0) then
begin
if assigned(symbol) then
s:=s+'+'+tostr(offset)
s:=s+'+'+tostr(offset)
else
s:=s+tostr(offset);
s:=s+tostr(offset);
end;
if (refaddr in [addr_lo,addr_hi]) then
@ -154,13 +158,13 @@ unit agppcgas;
begin
if offset=0 then
begin
if assigned(symbol) then
begin
if target_info.system <> system_powerpc_darwin then
s:=s+'+0'
end
else
s:=s+'0';
if assigned(symbol) then
begin
if target_info.system <> system_powerpc_darwin then
s:=s+'+0'
end
else
s:=s+'0';
end;
s:=s+'('+gas_regname(base)+')';
end
@ -192,7 +196,7 @@ unit agppcgas;
internalerror(200402262);
hs:=o.ref^.symbol.name;
if o.ref^.offset>0 then
hs:=hs+'+'+tostr(o.ref^.offset)
hs:=hs+'+'+tostr(o.ref^.offset)
else
if o.ref^.offset<0 then
hs:=hs+tostr(o.ref^.offset);
@ -269,7 +273,7 @@ unit agppcgas;
else
internalerror(2003112901);
end;
cond2str:=cond2str+#9+tostr(c.bo)+','+tostr(c.bi)+',';
cond2str:=cond2str+#9+tostr(c.bo)+','+tostr(c.bi);
end;
true:
if (op >= A_B) and (op <= A_BCLRL) then
@ -375,7 +379,12 @@ begin
end.
{
$Log$
Revision 1.41 2004-02-27 10:21:05 florian
Revision 1.42 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.41 2004/02/27 10:21:05 florian
* top_symbol killed
+ refaddr to treference added
+ refsymbol to treference added

View File

@ -165,7 +165,28 @@ const
procedure tcgppc.init_register_allocators;
begin
inherited init_register_allocators;
rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,
if target_info.system=system_powerpc_darwin then
begin
if pi_needs_got in current_procinfo.flags then
begin
current_procinfo.got:=NR_R31;
rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,
[RS_R3,RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,
RS_R9,RS_R10,RS_R11,RS_R12,RS_R30,RS_R29,
RS_R28,RS_R27,RS_R26,RS_R25,RS_R24,RS_R23,RS_R22,
RS_R21,RS_R20,RS_R19,RS_R18,RS_R17,RS_R16,RS_R15,
RS_R14,RS_R13],first_int_imreg,[]);
end
else
rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,
[RS_R3,RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,
RS_R9,RS_R10,RS_R11,RS_R12,RS_R31,RS_R30,RS_R29,
RS_R28,RS_R27,RS_R26,RS_R25,RS_R24,RS_R23,RS_R22,
RS_R21,RS_R20,RS_R19,RS_R18,RS_R17,RS_R16,RS_R15,
RS_R14,RS_R13],first_int_imreg,[]);
end
else
rg[R_INTREGISTER]:=trgcpu.create(R_INTREGISTER,R_SUBWHOLE,
[RS_R3,RS_R4,RS_R5,RS_R6,RS_R7,RS_R8,
RS_R9,RS_R10,RS_R11,RS_R12,RS_R31,RS_R30,RS_R29,
RS_R28,RS_R27,RS_R26,RS_R25,RS_R24,RS_R23,RS_R22,
@ -173,19 +194,11 @@ const
RS_R14,RS_R13],first_int_imreg,[]);
case target_info.abi of
abi_powerpc_aix:
{ darwin uses R10 as got }
if target_info.system=system_powerpc_darwin then
rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
[RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5,RS_F6,RS_F7,RS_F8,RS_F9,
RS_F11,RS_F12,RS_F13,RS_F31,RS_F30,RS_F29,RS_F28,RS_F27,
RS_F26,RS_F25,RS_F24,RS_F23,RS_F22,RS_F21,RS_F20,RS_F19,RS_F18,
RS_F17,RS_F16,RS_F15,RS_F14],first_fpu_imreg,[])
else
rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
[RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5,RS_F6,RS_F7,RS_F8,RS_F9,
RS_F10,RS_F11,RS_F12,RS_F13,RS_F31,RS_F30,RS_F29,RS_F28,RS_F27,
RS_F26,RS_F25,RS_F24,RS_F23,RS_F22,RS_F21,RS_F20,RS_F19,RS_F18,
RS_F17,RS_F16,RS_F15,RS_F14],first_fpu_imreg,[]);
rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
[RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5,RS_F6,RS_F7,RS_F8,RS_F9,
RS_F10,RS_F11,RS_F12,RS_F13,RS_F31,RS_F30,RS_F29,RS_F28,RS_F27,
RS_F26,RS_F25,RS_F24,RS_F23,RS_F22,RS_F21,RS_F20,RS_F19,RS_F18,
RS_F17,RS_F16,RS_F15,RS_F14],first_fpu_imreg,[]);
abi_powerpc_sysv:
rg[R_FPUREGISTER]:=trgcpu.create(R_FPUREGISTER,R_SUBNONE,
[RS_F0,RS_F1,RS_F2,RS_F3,RS_F4,RS_F5,RS_F6,RS_F7,RS_F8,RS_F9,
@ -963,6 +976,8 @@ const
l : tasmlabel;
regcounter2, firstfpureg: Tsuperregister;
hp: tparaitem;
cond : tasmcond;
instr : taicpu;
begin
{ CR and LR only have to be saved in case they are modified by the current }
@ -1159,28 +1174,29 @@ const
if usesfpr or usesgpr then
a_reg_dealloc(list,NR_R12);
{ PIC code support, }
if cs_create_pic in aktmoduleswitches then
begin
{ if we didn't get the GOT pointer till now, we've to calculate it now }
if not(gotgot) and (pi_needs_got in current_procinfo.flags) then
case target_info.system of
system_powerpc_darwin:
begin
list.concat(taicpu.op_reg_reg(A_MFSPR,NR_R0,NR_LR));
objectlibrary.getlabel(l);
list.concat(taicpu.op_const_const_sym(A_BCL,20,31,l));
a_label(list,l);
list.concat(taicpu.op_reg_reg(A_MFSPR,NR_R10,NR_LR));
list.concat(taicpu.op_reg_reg(A_MTSPR,NR_R0,NR_LR));
end;
else
begin
a_reg_alloc(list,NR_R31);
{ place GOT ptr in r31 }
list.concat(taicpu.op_reg_reg(A_MFSPR,NR_R31,NR_LR));
end;
end;
{ if we didn't get the GOT pointer till now, we've to calculate it now }
if not(gotgot) and (pi_needs_got in current_procinfo.flags) then
case target_info.system of
system_powerpc_darwin:
begin
list.concat(taicpu.op_reg_reg(A_MFSPR,NR_R0,NR_LR));
fillchar(cond,sizeof(cond),0);
cond.simple:=false;
cond.bo:=20;
cond.bi:=31;
instr:=taicpu.op_sym(A_BCL,current_procinfo.gotlabel);
instr.setcondition(cond);
list.concat(instr);
a_label(list,current_procinfo.gotlabel);
list.concat(taicpu.op_reg_reg(A_MFSPR,current_procinfo.got,NR_LR));
list.concat(taicpu.op_reg_reg(A_MTSPR,NR_R0,NR_LR));
end;
else
begin
a_reg_alloc(list,NR_R31);
{ place GOT ptr in r31 }
list.concat(taicpu.op_reg_reg(A_MFSPR,NR_R31,NR_LR));
end;
end;
{ save the CR if necessary ( !!! always done currently ) }
{ still need to find out where this has to be done for SystemV
@ -1699,6 +1715,7 @@ const
reference_reset(tmpref);
tmpref.offset := ref2.offset;
tmpref.symbol := ref2.symbol;
tmpref.relsymbol := ref2.relsymbol;
tmpref.refaddr := addr_hi;
if ref2.base<> NR_NO then
begin
@ -2174,6 +2191,7 @@ const
tmpreg := rg[R_INTREGISTER].getregister(list,R_SUBWHOLE);
reference_reset(tmpref);
tmpref.symbol := ref.symbol;
tmpref.relsymbol := ref.relsymbol;
tmpref.offset := ref.offset;
tmpref.refaddr := addr_hi;
if ref.base <> NR_NO then
@ -2321,7 +2339,12 @@ begin
end.
{
$Log$
Revision 1.165 2004-03-02 00:36:33 olle
Revision 1.166 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.165 2004/03/02 00:36:33 olle
* big transformation of Tai_[const_]Symbol.Create[data]name*
Revision 1.164 2004/02/27 10:21:05 florian

View File

@ -46,13 +46,19 @@ unit cpunode;
{ this not really a node }
nppcobj,
nppcmat,
nppccnv
nppccnv,
nppcld
;
end.
{
$Log$
Revision 1.17 2003-12-10 01:10:25 florian
Revision 1.18 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.17 2003/12/10 01:10:25 florian
+ initial interface support added
Revision 1.16 2003/04/24 11:24:00 florian

View File

@ -0,0 +1,94 @@
{
$Id$
Copyright (c) 1998-2002 by Florian Klaempfl
Generate ppc assembler for nodes that handle loads and assignments
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
****************************************************************************
}
unit nppcld;
{$i fpcdefs.inc}
interface
uses
node,ncgld;
type
tppcloadnode = class(tcgloadnode)
procedure generate_picvaraccess;override;
end;
implementation
uses
verbose,
systems,
cpubase,
cgutils,cgobj,
aasmbase,aasmtai,
symconst,symsym,
procinfo,
nld;
procedure tppcloadnode.generate_picvaraccess;
var
l : tasmsymbol;
ref : treference;
begin
case target_info.system of
system_powerpc_darwin:
begin
if (tvarsym(symtableentry).owner.unitid<>0) or (vo_is_dll_var in tvarsym(symtableentry).varoptions) then
begin
l:=objectlibrary.getasmsymbol('L'+tvarsym(symtableentry).mangledname+'$non_lazy_ptr');
if not(assigned(l)) then
begin
l:=objectlibrary.newasmsymbol('L'+tvarsym(symtableentry).mangledname+'$non_lazy_ptr',AB_COMMON,AT_DATA);
picdata.concat(tai_symbol.create(l,0));
picdata.concat(tai_const_symbol.create_indirect(objectlibrary.newasmsymbol(tvarsym(symtableentry).mangledname,AB_EXTERNAL,AT_DATA)));
picdata.concat(tai_const.create_32bit(0));
end;
reference_reset_symbol(ref,l,0);
ref.base:=current_procinfo.got;
ref.relsymbol:=current_procinfo.gotlabel;
reference_reset_base(location.reference,cg.getaddressregister(exprasmlist),0);
cg.a_load_ref_reg(exprasmlist,OS_ADDR,OS_ADDR,ref,location.reference.base);
end
else
internalerror(200403021);
end
else
internalerror(200402291);
end;
end;
begin
cloadnode:=tppcloadnode;
end.
{
$Log$
Revision 1.1 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
}

View File

@ -79,8 +79,9 @@ unit procinfo;
{ register containing currently the got }
got : tregister;
gotlabel : tasmlabel;
{ Holds the reference used to store alll saved registers. }
{ Holds the reference used to store all saved registers. }
save_regs_ref : treference;
{ label to leave the sub routine }
@ -144,6 +145,7 @@ implementation
reference_reset(save_regs_ref);
{ labels }
objectlibrary.getlabel(aktexitlabel);
objectlibrary.getlabel(gotlabel);
end;
@ -181,7 +183,12 @@ implementation
end.
{
$Log$
Revision 1.13 2004-02-27 10:21:05 florian
Revision 1.14 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.13 2004/02/27 10:21:05 florian
* top_symbol killed
+ refaddr to treference added
+ refsymbol to treference added

View File

@ -202,15 +202,15 @@ implementation
if refcount=0 then
inherited freeinstance;
end;
function tsymtable.getcopy:tsymtable;
begin
inc(refcount);
result:=self;
end;
{$ifdef EXTDEBUG}
procedure tsymtable.dumpsym(p : TNamedIndexItem;arg:pointer);
begin
@ -283,10 +283,9 @@ implementation
function tsymtable.search(const s : stringid) : tsymentry;
begin
search:=speedsearch(s,getspeedvalue(s));
end;
begin
search:=speedsearch(s,getspeedvalue(s));
end;
function tsymtable.speedsearch(const s : stringid;speedvalue : cardinal) : tsymentry;
@ -334,7 +333,12 @@ implementation
end.
{
$Log$
Revision 1.19 2004-02-04 22:15:15 daniel
Revision 1.20 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.19 2004/02/04 22:15:15 daniel
* Rtti generation moved to ncgutil
* Assmtai usage of symsym removed
* operator overloading cleanup up

View File

@ -41,11 +41,7 @@ interface
;
type
{************************************************
TSym
***********************************************}
{ this object is the base for all symbol objects }
{ this class is the base for all symbol objects }
tstoredsym = class(tsym)
protected
_mangledname : pstring;
@ -2254,7 +2250,12 @@ implementation
end.
{
$Log$
Revision 1.162 2004-03-02 00:36:33 olle
Revision 1.163 2004-03-02 17:32:12 florian
* make cycle fixed
+ pic support for darwin
+ support of importing vars from shared libs on darwin implemented
Revision 1.162 2004/03/02 00:36:33 olle
* big transformation of Tai_[const_]Symbol.Create[data]name*
Revision 1.161 2004/02/24 16:12:39 peter