mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 07:59:15 +02:00
* fix cross-compiling from i386/linux
git-svn-id: trunk@5186 -
This commit is contained in:
parent
a2dd72cac7
commit
12e8645889
@ -45,9 +45,6 @@
|
|||||||
{$define SUPPORT_MMX}
|
{$define SUPPORT_MMX}
|
||||||
{$define cpumm}
|
{$define cpumm}
|
||||||
{$define fewintregisters}
|
{$define fewintregisters}
|
||||||
{$ifdef linux}
|
|
||||||
{$define has_internal_sysinit}
|
|
||||||
{$endif}
|
|
||||||
{$endif i386}
|
{$endif i386}
|
||||||
|
|
||||||
{$ifdef x86_64}
|
{$ifdef x86_64}
|
||||||
|
@ -68,6 +68,8 @@ interface
|
|||||||
macmodeswitches : tmodeswitches=
|
macmodeswitches : tmodeswitches=
|
||||||
[m_mac,m_all,m_result,m_cvar_support,m_mac_procvar];
|
[m_mac,m_all,m_result,m_cvar_support,m_mac_procvar];
|
||||||
|
|
||||||
|
internal_sysinit_systems = [system_i386_linux];
|
||||||
|
|
||||||
{ maximum nesting of routines }
|
{ maximum nesting of routines }
|
||||||
maxnesting = 32;
|
maxnesting = 32;
|
||||||
|
|
||||||
|
@ -1395,12 +1395,12 @@ implementation
|
|||||||
{ do we need to add the variants unit? }
|
{ do we need to add the variants unit? }
|
||||||
maybeloadvariantsunit;
|
maybeloadvariantsunit;
|
||||||
|
|
||||||
{$ifdef has_internal_sysinit}
|
|
||||||
linker.initsysinitunitname;
|
linker.initsysinitunitname;
|
||||||
|
if target_info.system in internal_sysinit_systems then
|
||||||
{ add start/halt unit }
|
begin
|
||||||
AddUnit('si_'+linker.sysinitunit);
|
{ add start/halt unit }
|
||||||
{$endif}
|
AddUnit('si_'+linker.sysinitunit);
|
||||||
|
end;
|
||||||
|
|
||||||
{$ifdef arm}
|
{$ifdef arm}
|
||||||
{ Insert .pdata section for arm-wince.
|
{ Insert .pdata section for arm-wince.
|
||||||
|
@ -45,17 +45,16 @@ interface
|
|||||||
tlinkerlinux=class(texternallinker)
|
tlinkerlinux=class(texternallinker)
|
||||||
private
|
private
|
||||||
libctype:(libc5,glibc2,glibc21,uclibc);
|
libctype:(libc5,glibc2,glibc21,uclibc);
|
||||||
{$ifdef has_internal_sysinit}
|
cprtobj,
|
||||||
|
gprtobj,
|
||||||
|
prtobj : string[80];
|
||||||
reorder : boolean;
|
reorder : boolean;
|
||||||
linklibc: boolean;
|
linklibc: boolean;
|
||||||
{$endif}
|
|
||||||
Function WriteResponseFile(isdll:boolean) : Boolean;
|
Function WriteResponseFile(isdll:boolean) : Boolean;
|
||||||
public
|
public
|
||||||
constructor Create;override;
|
constructor Create;override;
|
||||||
procedure SetDefaultInfo;override;
|
procedure SetDefaultInfo;override;
|
||||||
{$ifdef has_internal_sysinit}
|
|
||||||
procedure InitSysInitUnitName;override;
|
procedure InitSysInitUnitName;override;
|
||||||
{$endif}
|
|
||||||
function MakeExecutable:boolean;override;
|
function MakeExecutable:boolean;override;
|
||||||
function MakeSharedLibrary:boolean;override;
|
function MakeSharedLibrary:boolean;override;
|
||||||
function postprocessexecutable(const fn : string;isdll:boolean):boolean;
|
function postprocessexecutable(const fn : string;isdll:boolean):boolean;
|
||||||
@ -314,8 +313,6 @@ Begin
|
|||||||
end;
|
end;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
{$ifdef has_internal_sysinit}
|
|
||||||
|
|
||||||
Procedure TLinkerLinux.InitSysInitUnitName;
|
Procedure TLinkerLinux.InitSysInitUnitName;
|
||||||
var
|
var
|
||||||
csysinitunit,
|
csysinitunit,
|
||||||
@ -335,63 +332,6 @@ begin
|
|||||||
sysinitunit:='dll';
|
sysinitunit:='dll';
|
||||||
csysinitunit:='dll';
|
csysinitunit:='dll';
|
||||||
gsysinitunit:='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';
|
prtobj:='dllprt0';
|
||||||
cprtobj:='dllprt0';
|
cprtobj:='dllprt0';
|
||||||
gprtobj:='dllprt0';
|
gprtobj:='dllprt0';
|
||||||
@ -399,39 +339,61 @@ begin
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
prtobj:='prt0';
|
prtobj:='prt0';
|
||||||
|
sysinitunit:='prc';
|
||||||
case libctype of
|
case libctype of
|
||||||
glibc21:
|
glibc21:
|
||||||
begin
|
begin
|
||||||
cprtobj:='cprt21';
|
cprtobj:='cprt21';
|
||||||
gprtobj:='gprt21';
|
gprtobj:='gprt21';
|
||||||
|
csysinitunit:='c21';
|
||||||
|
gsysinitunit:='c21g';
|
||||||
end;
|
end;
|
||||||
uclibc:
|
uclibc:
|
||||||
begin
|
begin
|
||||||
cprtobj:='ucprt0';
|
cprtobj:='ucprt0';
|
||||||
gprtobj:='ugprt0';
|
gprtobj:='ugprt0';
|
||||||
|
csysinitunit:='uc';
|
||||||
|
gsysinitunit:='ucg';
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
cprtobj:='cprt0';
|
cprtobj:='cprt0';
|
||||||
gprtobj:='gprt0';
|
gprtobj:='gprt0';
|
||||||
|
csysinitunit:='c';
|
||||||
|
gsysinitunit:='g';
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$endif}
|
|
||||||
if cs_profile in current_settings.moduleswitches then
|
if cs_profile in current_settings.moduleswitches then
|
||||||
begin
|
begin
|
||||||
{$ifndef has_internal_sysinit}
|
|
||||||
prtobj:=gprtobj;
|
prtobj:=gprtobj;
|
||||||
{$endif}
|
sysinitunit:=gsysinitunit;
|
||||||
if not(libctype in [glibc2,glibc21]) then
|
|
||||||
AddSharedLibrary('gmon');
|
|
||||||
AddSharedLibrary('c');
|
|
||||||
linklibc:=true;
|
linklibc:=true;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
{$ifndef has_internal_sysinit}
|
|
||||||
if linklibc then
|
if linklibc then
|
||||||
prtobj:=cprtobj;
|
begin
|
||||||
{$endif}
|
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;
|
end;
|
||||||
|
|
||||||
{ Open link.res file }
|
{ Open link.res file }
|
||||||
@ -453,11 +415,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
StartSection('INPUT(');
|
StartSection('INPUT(');
|
||||||
{$ifndef has_internal_sysinit}
|
|
||||||
{ add objectfiles, start with prt0 always }
|
{ 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)));
|
AddFileName(maybequoted(FindObjectFile(prtobj,'',false)));
|
||||||
{$endif}
|
|
||||||
{ try to add crti and crtbegin if linking to C }
|
{ try to add crti and crtbegin if linking to C }
|
||||||
if linklibc then
|
if linklibc then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user