* fix cross-compiling from i386/linux

git-svn-id: trunk@5186 -
This commit is contained in:
micha 2006-11-02 21:19:24 +00:00
parent a2dd72cac7
commit 12e8645889
4 changed files with 42 additions and 83 deletions

View File

@ -45,9 +45,6 @@
{$define SUPPORT_MMX}
{$define cpumm}
{$define fewintregisters}
{$ifdef linux}
{$define has_internal_sysinit}
{$endif}
{$endif i386}
{$ifdef x86_64}

View File

@ -68,6 +68,8 @@ interface
macmodeswitches : tmodeswitches=
[m_mac,m_all,m_result,m_cvar_support,m_mac_procvar];
internal_sysinit_systems = [system_i386_linux];
{ maximum nesting of routines }
maxnesting = 32;

View File

@ -1395,12 +1395,12 @@ implementation
{ do we need to add the variants unit? }
maybeloadvariantsunit;
{$ifdef has_internal_sysinit}
linker.initsysinitunitname;
{ add start/halt unit }
AddUnit('si_'+linker.sysinitunit);
{$endif}
if target_info.system in internal_sysinit_systems then
begin
{ add start/halt unit }
AddUnit('si_'+linker.sysinitunit);
end;
{$ifdef arm}
{ Insert .pdata section for arm-wince.

View File

@ -45,17 +45,16 @@ interface
tlinkerlinux=class(texternallinker)
private
libctype:(libc5,glibc2,glibc21,uclibc);
{$ifdef has_internal_sysinit}
cprtobj,
gprtobj,
prtobj : string[80];
reorder : boolean;
linklibc: boolean;
{$endif}
Function WriteResponseFile(isdll:boolean) : Boolean;
public
constructor Create;override;
procedure SetDefaultInfo;override;
{$ifdef has_internal_sysinit}
procedure InitSysInitUnitName;override;
{$endif}
function MakeExecutable:boolean;override;
function MakeSharedLibrary:boolean;override;
function postprocessexecutable(const fn : string;isdll:boolean):boolean;
@ -314,8 +313,6 @@ Begin
end;
End;
{$ifdef has_internal_sysinit}
Procedure TLinkerLinux.InitSysInitUnitName;
var
csysinitunit,
@ -335,63 +332,6 @@ begin
sysinitunit:='dll';
csysinitunit:='dll';
gsysinitunit:='dll';
end
else
begin
sysinitunit:='prc';
case libctype of
glibc21:
begin
csysinitunit:='c21';
gsysinitunit:='c21g';
end;
uclibc:
begin
csysinitunit:='uc';
gsysinitunit:='ucg';
end
else
csysinitunit:='c';
gsysinitunit:='g';
end;
end;
if cs_profile in current_settings.moduleswitches then
begin
sysinitunit:=gsysinitunit;
linklibc:=true;
end
else
begin
if linklibc then
sysinitunit:=csysinitunit;
end;
end;
{$endif}
Function TLinkerLinux.WriteResponseFile(isdll:boolean) : Boolean;
Var
linkres : TLinkRes;
i : longint;
{$ifndef has_internal_sysinit}
cprtobj,
gprtobj,
prtobj : string[80];
reorder,
linklibc : boolean;
{$endif}
HPath : TStringListItem;
s,s1,s2 : string;
found1,
found2 : boolean;
begin
result:=False;
{ set special options for some targets }
{$ifndef has_internal_sysinit}
linklibc:=(SharedLibFiles.Find('c')<>nil);
reorder := linklibc and ReOrderEntries;
if isdll then
begin
prtobj:='dllprt0';
cprtobj:='dllprt0';
gprtobj:='dllprt0';
@ -399,39 +339,61 @@ begin
else
begin
prtobj:='prt0';
sysinitunit:='prc';
case libctype of
glibc21:
begin
cprtobj:='cprt21';
gprtobj:='gprt21';
csysinitunit:='c21';
gsysinitunit:='c21g';
end;
uclibc:
begin
cprtobj:='ucprt0';
gprtobj:='ugprt0';
csysinitunit:='uc';
gsysinitunit:='ucg';
end
else
cprtobj:='cprt0';
gprtobj:='gprt0';
csysinitunit:='c';
gsysinitunit:='g';
end;
end;
{$endif}
if cs_profile in current_settings.moduleswitches then
begin
{$ifndef has_internal_sysinit}
prtobj:=gprtobj;
{$endif}
if not(libctype in [glibc2,glibc21]) then
AddSharedLibrary('gmon');
AddSharedLibrary('c');
sysinitunit:=gsysinitunit;
linklibc:=true;
end
else
begin
{$ifndef has_internal_sysinit}
if linklibc then
prtobj:=cprtobj;
{$endif}
begin
prtobj:=cprtobj;
sysinitunit:=csysinitunit;
end;
end;
end;
Function TLinkerLinux.WriteResponseFile(isdll:boolean) : Boolean;
Var
linkres : TLinkRes;
i : longint;
HPath : TStringListItem;
s,s1,s2 : string;
found1,
found2 : boolean;
begin
result:=False;
{ set special options for some targets }
if cs_profile in current_settings.moduleswitches then
begin
if not(libctype in [glibc2,glibc21]) then
AddSharedLibrary('gmon');
AddSharedLibrary('c');
end;
{ Open link.res file }
@ -453,11 +415,9 @@ begin
end;
StartSection('INPUT(');
{$ifndef has_internal_sysinit}
{ add objectfiles, start with prt0 always }
if prtobj<>'' then
if not (target_info.system in internal_sysinit_systems) and (prtobj<>'') then
AddFileName(maybequoted(FindObjectFile(prtobj,'',false)));
{$endif}
{ try to add crti and crtbegin if linking to C }
if linklibc then
begin