* sunos to solaris

This commit is contained in:
peter 2005-02-13 20:11:16 +00:00
parent ae8b7b153b
commit 97e28bd218
4 changed files with 82 additions and 70 deletions

View File

@ -196,9 +196,9 @@ uses
{$ifdef palmos} {$ifdef palmos}
,i_palmos ,i_palmos
{$endif palmos} {$endif palmos}
{$ifdef sunos} {$ifdef solaris}
,i_sunos ,i_sunos
{$endif sunos} {$endif solaris}
{$ifdef wdosx} {$ifdef wdosx}
,i_wdosx ,i_wdosx
{$endif wdosx} {$endif wdosx}
@ -435,7 +435,10 @@ end;
end. end.
{ {
$Log$ $Log$
Revision 1.54 2005-02-13 18:55:19 florian Revision 1.55 2005-02-13 20:11:16 peter
* sunos to solaris
Revision 1.54 2005/02/13 18:55:19 florian
+ overflow checking for the arm + overflow checking for the arm
Revision 1.53 2005/01/31 21:30:56 olle Revision 1.53 2005/01/31 21:30:56 olle

View File

@ -92,14 +92,14 @@ interface
system_alpha_linux, { 12 } system_alpha_linux, { 12 }
system_powerpc_linux, { 13 } system_powerpc_linux, { 13 }
system_powerpc_macos, { 14 } system_powerpc_macos, { 14 }
system_i386_sunos, { 15 } system_i386_solaris, { 15 }
system_i386_beos, { 16 } system_i386_beos, { 16 }
system_i386_netbsd, { 17 } system_i386_netbsd, { 17 }
system_m68k_netbsd, { 18 } system_m68k_netbsd, { 18 }
system_i386_Netware, { 19 } system_i386_Netware, { 19 }
system_i386_qnx, { 20 } system_i386_qnx, { 20 }
system_i386_wdosx, { 21 } system_i386_wdosx, { 21 }
system_sparc_sunos, { 22 } system_sparc_solaris, { 22 }
system_sparc_linux, { 23 } system_sparc_linux, { 23 }
system_i386_openbsd, { 24 } system_i386_openbsd, { 24 }
system_m68k_openbsd, { 25 } system_m68k_openbsd, { 25 }
@ -718,7 +718,10 @@ finalization
end. end.
{ {
$Log$ $Log$
Revision 1.101 2005-02-06 00:05:56 florian Revision 1.102 2005-02-13 20:11:16 peter
* sunos to solaris
Revision 1.101 2005/02/06 00:05:56 florian
+ x86_64 pic draft + x86_64 pic draft
Revision 1.100 2005/01/25 18:48:15 peter Revision 1.100 2005/01/25 18:48:15 peter

View File

@ -2,7 +2,7 @@
$Id$ $Id$
Copyright (c) 1998-2002 by Peter Vreman Copyright (c) 1998-2002 by Peter Vreman
This unit implements support information structures for SunOS This unit implements support information structures for solaris
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -19,7 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**************************************************************************** ****************************************************************************
} }
{ This unit implements support information structures for SunOS. } { This unit implements support information structures for solaris. }
unit i_sunos; unit i_sunos;
interface interface
@ -28,15 +28,15 @@ unit i_sunos;
systems; systems;
const const
system_i386_sunos_info : tsysteminfo = system_i386_solaris_info : tsysteminfo =
( (
system : system_i386_sunos; system : system_i386_solaris;
name : 'SunOS/ELF for i386'; name : 'Solaris for i386';
shortname : 'SunOS'; shortname : 'solaris';
flags : [tf_under_development]; flags : [tf_under_development];
cpu : cpu_i386; cpu : cpu_i386;
unit_env : 'SUNOSUNITS'; unit_env : 'SOLARISUNITS';
extradefines : 'UNIX;SOLARIS;LIBC'; extradefines : 'UNIX;LIBC';
sourceext : '.pp'; sourceext : '.pp';
pasext : '.pas'; pasext : '.pas';
exeext : ''; exeext : '';
@ -90,15 +90,15 @@ unit i_sunos;
use_function_relative_addresses : true use_function_relative_addresses : true
); );
system_sparc_sunos_info : tsysteminfo = system_sparc_solaris_info : tsysteminfo =
( (
system : system_sparc_sunos; system : system_sparc_solaris;
name : 'SunOS for SPARC'; name : 'Solaris for SPARC';
shortname : 'SunOS'; shortname : 'solaris';
flags : [tf_needs_symbol_size]; flags : [tf_needs_symbol_size];
cpu : cpu_SPARC; cpu : cpu_SPARC;
unit_env : 'SUNOSUNITS'; unit_env : 'SOLARISUNITS';
extradefines : 'UNIX;HASUNIX'; extradefines : 'UNIX;LIBC;';
sourceext : '.pp'; sourceext : '.pp';
pasext : '.pas'; pasext : '.pas';
exeext : ''; exeext : '';
@ -156,25 +156,28 @@ unit i_sunos;
initialization initialization
{$ifdef CPU86} {$ifdef CPU86}
{$ifdef sunos} {$ifdef solaris}
set_source_info(system_i386_sunos_info); set_source_info(system_i386_solaris_info);
{$endif sunos} {$endif solaris}
{$endif CPU86} {$endif CPU86}
{$ifdef CPUSparc} {$ifdef CPUSparc}
{$ifdef sunos} {$ifdef solaris}
set_source_info(system_sparc_sunos_info); set_source_info(system_sparc_solaris_info);
{$endif sunos} {$endif solaris}
{$endif CPUSparc} {$endif CPUSparc}
end. end.
{ {
$Log$ $Log$
Revision 1.5 2004-10-25 15:38:41 peter Revision 1.6 2005-02-13 20:11:16 peter
* sunos to solaris
Revision 1.5 2004/10/25 15:38:41 peter
* heap and heapsize removed * heap and heapsize removed
* checkpointer fixes * checkpointer fixes
Revision 1.4 2004/10/01 17:41:21 marco Revision 1.4 2004/10/01 17:41:21 marco
* small updates to make playing with sparc/sunos easier * small updates to make playing with sparc/solaris easier
Revision 1.3 2004/06/20 08:55:32 florian Revision 1.3 2004/06/20 08:55:32 florian
* logs truncated * logs truncated

View File

@ -3,7 +3,7 @@
Copyright (c) 1998-2002 by Peter Vreman Copyright (c) 1998-2002 by Peter Vreman
This unit implements support import,export,link routines This unit implements support import,export,link routines
for the (i386) sunos target for the (i386) solaris target
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -39,24 +39,25 @@ implementation
verbose,systems,globtype,globals, verbose,systems,globtype,globals,
symconst,script, symconst,script,
fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,symdef, fmodule,aasmbase,aasmtai,aasmcpu,cpubase,symsym,symdef,
cgobj,
import,export,link,i_sunos; import,export,link,i_sunos;
type type
timportlibsunos=class(timportlib) timportlibsolaris=class(timportlib)
procedure preparelib(const s:string);override; procedure preparelib(const s:string);override;
procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override; procedure importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);override;
procedure importvariable(vs:tglobalvarsym;const name,module:string);override; procedure importvariable(vs:tglobalvarsym;const name,module:string);override;
procedure generatelib;override; procedure generatelib;override;
end; end;
texportlibsunos=class(texportlib) texportlibsolaris=class(texportlib)
procedure preparelib(const s : string);override; procedure preparelib(const s : string);override;
procedure exportprocedure(hp : texported_item);override; procedure exportprocedure(hp : texported_item);override;
procedure exportvar(hp : texported_item);override; procedure exportvar(hp : texported_item);override;
procedure generatelib;override; procedure generatelib;override;
end; end;
tlinkersunos=class(texternallinker) tlinkersolaris=class(texternallinker)
private private
Glibc2, Glibc2,
Glibc21 : boolean; Glibc21 : boolean;
@ -70,10 +71,10 @@ implementation
{***************************************************************************** {*****************************************************************************
TIMPORTLIBsunos TIMPORTLIBsolaris
*****************************************************************************} *****************************************************************************}
procedure timportlibsunos.preparelib(const s : string); procedure timportlibsolaris.preparelib(const s : string);
begin begin
{$ifDef LinkTest} {$ifDef LinkTest}
WriteLN('Prepare import: ',s); WriteLN('Prepare import: ',s);
@ -81,7 +82,7 @@ begin
end; end;
procedure timportlibsunos.importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string); procedure timportlibsolaris.importprocedure(aprocdef:tprocdef;const module:string;index:longint;const name:string);
begin begin
{ insert sharedlibrary } { insert sharedlibrary }
{$ifDef LinkTest} {$ifDef LinkTest}
@ -91,7 +92,7 @@ begin
end; end;
procedure timportlibsunos.importvariable(vs:tglobalvarsym;const name,module:string); procedure timportlibsolaris.importvariable(vs:tglobalvarsym;const name,module:string);
begin begin
{ insert sharedlibrary } { insert sharedlibrary }
current_module.linkothersharedlibs.add(SplitName(module),link_allways); current_module.linkothersharedlibs.add(SplitName(module),link_allways);
@ -101,28 +102,28 @@ begin
end; end;
procedure timportlibsunos.generatelib; procedure timportlibsolaris.generatelib;
begin begin
end; end;
{***************************************************************************** {*****************************************************************************
TEXPORTLIBsunos TEXPORTLIBsolaris
*****************************************************************************} *****************************************************************************}
procedure texportlibsunos.preparelib(const s:string); procedure texportlibsolaris.preparelib(const s:string);
begin begin
end; end;
procedure texportlibsunos.exportprocedure(hp : texported_item); procedure texportlibsolaris.exportprocedure(hp : texported_item);
var var
hp2 : texported_item; hp2 : texported_item;
begin begin
{ first test the index value } { first test the index value }
if (hp.options and eo_index)<>0 then if (hp.options and eo_index)<>0 then
begin begin
Message1(parser_e_no_export_with_index_for_target,'SunOS'); Message1(parser_e_no_export_with_index_for_target,'solaris');
exit; exit;
end; end;
{ use pascal name is none specified } { use pascal name is none specified }
@ -158,17 +159,18 @@ begin
end; end;
procedure texportlibsunos.exportvar(hp : texported_item); procedure texportlibsolaris.exportvar(hp : texported_item);
begin begin
hp.is_var:=true; hp.is_var:=true;
exportprocedure(hp); exportprocedure(hp);
end; end;
procedure texportlibsunos.generatelib; procedure texportlibsolaris.generatelib;
var var
hp2 : texported_item; hp2 : texported_item;
begin begin
new_section(codesegment,sec_code,'',0);
hp2:=texported_item(current_module._exports.first); hp2:=texported_item(current_module._exports.first);
while assigned(hp2) do while assigned(hp2) do
begin begin
@ -179,27 +181,25 @@ begin
is declared with cdecl } is declared with cdecl }
if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then if tprocsym(hp2.sym).first_procdef.mangledname<>hp2.name^ then
begin begin
{$ifdef i386}
{ place jump in codesegment } { place jump in codesegment }
codesegment.concat(Tai_align.Create_op(4,$90)); codesegment.concat(tai_align.create(target_info.alignment.procalign));
codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0)); codeSegment.concat(Tai_symbol.Createname_global(hp2.name^,AT_FUNCTION,0));
codeSegment.concat(Taicpu.Op_sym(A_JMP,S_NO,objectlibrary.newasmsymbol(tprocsym(hp2.sym).first_procdef.mangledname,AB_EXTERNAL,AT_FUNCTION))); cg.a_jmp_name(codesegment,tprocsym(hp2.sym).first_procdef.mangledname);
codeSegment.concat(Tai_symbol_end.Createname(hp2.name^)); codeSegment.concat(Tai_symbol_end.Createname(hp2.name^));
{$endif i386}
end; end;
end end
else else
Message1(parser_e_no_export_of_variables_for_target,'SunOS'); Message1(parser_e_no_export_of_variables_for_target,'linux');
hp2:=texported_item(hp2.next); hp2:=texported_item(hp2.next);
end; end;
end; end;
{***************************************************************************** {*****************************************************************************
TLINKERSUNOS TLINKERsolaris
*****************************************************************************} *****************************************************************************}
Constructor TLinkersunos.Create; Constructor TLinkersolaris.Create;
begin begin
Inherited Create; Inherited Create;
if NOT Dontlinkstdlibpath Then if NOT Dontlinkstdlibpath Then
@ -212,7 +212,7 @@ begin
end; end;
procedure TLinkersunos.SetDefaultInfo; procedure TLinkersolaris.SetDefaultInfo;
{ {
This will also detect which libc version will be used This will also detect which libc version will be used
} }
@ -249,7 +249,7 @@ begin
end; end;
Function TLinkersunos.WriteResponseFile(isdll:boolean) : Boolean; Function TLinkersolaris.WriteResponseFile(isdll:boolean) : Boolean;
Var Var
linkres : TLinkRes; linkres : TLinkRes;
i : longint; i : longint;
@ -282,7 +282,7 @@ begin
if linklibc then if linklibc then
prtobj:=cprtobj prtobj:=cprtobj
else else
AddSharedLibrary('c'); { quick hack: this sunos implementation needs alwys libc } AddSharedLibrary('c'); { quick hack: this solaris implementation needs alwys libc }
end; end;
{ Open link.res file } { Open link.res file }
@ -307,7 +307,7 @@ begin
if prtobj<>'' then if prtobj<>'' then
LinkRes.AddFileName(FindObjectFile(prtobj,'',false)); LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
{ try to add crti and crtbegin if linking to C } { try to add crti and crtbegin if linking to C }
if linklibc then { Needed in sunos? } if linklibc then { Needed in solaris? }
begin begin
{ if librarysearchpath.FindFile('crtbegin.o',s) then { if librarysearchpath.FindFile('crtbegin.o',s) then
LinkRes.AddFileName(s);} LinkRes.AddFileName(s);}
@ -353,7 +353,7 @@ begin
else else
begin begin
linklibc:=true; linklibc:=true;
linkdynamic:=false; { libc will include the ld-sunos (war ld-linux) for us } linkdynamic:=false; { libc will include the ld-solaris (war ld-linux) for us }
end; end;
end; end;
{ be sure that libc is the last lib } { be sure that libc is the last lib }
@ -363,12 +363,12 @@ begin
if (cs_link_staticflag in aktglobalswitches) then begin if (cs_link_staticflag in aktglobalswitches) then begin
LinkRes.Add('-lgcc'); LinkRes.Add('-lgcc');
end; end;
if linkdynamic and (Info.DynamicLinker<>'') then { gld has a default, DynamicLinker is not set in sunos } if linkdynamic and (Info.DynamicLinker<>'') then { gld has a default, DynamicLinker is not set in solaris }
LinkRes.AddFileName(Info.DynamicLinker); LinkRes.AddFileName(Info.DynamicLinker);
LinkRes.Add(')'); LinkRes.Add(')');
end; end;
{ objects which must be at the end } { objects which must be at the end }
if linklibc then {needed in sunos ? } if linklibc then {needed in solaris ? }
begin begin
if {librarysearchpath.FindFile('crtend.o',s1) or} if {librarysearchpath.FindFile('crtend.o',s1) or}
librarysearchpath.FindFile('crtn.o',s2) then librarysearchpath.FindFile('crtn.o',s2) then
@ -387,7 +387,7 @@ begin
end; end;
function TLinkersunos.MakeExecutable:boolean; function TLinkersolaris.MakeExecutable:boolean;
var var
binstr : String; binstr : String;
cmdstr : TCmdStr; cmdstr : TCmdStr;
@ -410,7 +410,7 @@ begin
If (cs_profile in aktmoduleswitches) or If (cs_profile in aktmoduleswitches) or
((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
DynLinkStr:='-dynamic-linker='+Info.DynamicLinker; DynLinkStr:='-dynamic-linker='+Info.DynamicLinker;
{ sunos sets DynamicLinker, but gld will (hopefully) defaults to -Bdynamic and add the default-linker } { solaris sets DynamicLinker, but gld will (hopefully) defaults to -Bdynamic and add the default-linker }
{ Write used files and libraries } { Write used files and libraries }
WriteResponseFile(false); WriteResponseFile(false);
@ -433,7 +433,7 @@ begin
end; end;
Function TLinkersunos.MakeSharedLibrary:boolean; Function TLinkersolaris.MakeSharedLibrary:boolean;
var var
binstr : String; binstr : String;
cmdstr : TCmdStr; cmdstr : TCmdStr;
@ -476,22 +476,25 @@ end;
initialization initialization
{$ifdef i386} {$ifdef i386}
RegisterExternalLinker(system_i386_sunos_info,TLinkerSunos); RegisterExternalLinker(system_i386_solaris_info,TLinkersolaris);
RegisterImport(system_i386_sunos,TImportLibSunos); RegisterImport(system_i386_solaris,TImportLibsolaris);
RegisterExport(system_i386_sunos,TExportLibSunos); RegisterExport(system_i386_solaris,TExportLibsolaris);
RegisterTarget(system_i386_sunos_info); RegisterTarget(system_i386_solaris_info);
{$endif i386} {$endif i386}
{$ifdef sparc} {$ifdef sparc}
RegisterExternalLinker(system_sparc_sunos_info,TLinkerSunos); RegisterExternalLinker(system_sparc_solaris_info,TLinkersolaris);
RegisterImport(system_sparc_sunos,TImportLibSunos); RegisterImport(system_sparc_solaris,TImportLibsolaris);
RegisterExport(system_sparc_sunos,TExportLibSunos); RegisterExport(system_sparc_solaris,TExportLibsolaris);
RegisterTarget(system_sparc_sunos_info); RegisterTarget(system_sparc_solaris_info);
{$endif sparc} {$endif sparc}
end. end.
{ {
$Log$ $Log$
Revision 1.16 2004-12-22 16:32:46 peter Revision 1.17 2005-02-13 20:11:16 peter
* sunos to solaris
Revision 1.16 2004/12/22 16:32:46 peter
* maybequoted() added * maybequoted() added
Revision 1.15 2004/11/19 16:30:24 peter Revision 1.15 2004/11/19 16:30:24 peter
@ -508,7 +511,7 @@ end.
* Need to be optimized in performance * Need to be optimized in performance
Revision 1.11 2004/10/01 17:41:21 marco Revision 1.11 2004/10/01 17:41:21 marco
* small updates to make playing with sparc/sunos easier * small updates to make playing with sparc/solaris easier
Revision 1.10 2004/09/22 15:25:14 mazen Revision 1.10 2004/09/22 15:25:14 mazen
* Fix error committing : previous version must be in branch USE_SYSUTILS * Fix error committing : previous version must be in branch USE_SYSUTILS