mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 17:09:09 +02:00
* always pass (g)crt1.o/bundle1.o as first argument to the linker
for darwin (see #11270) git-svn-id: trunk@10996 -
This commit is contained in:
parent
e9543b90d0
commit
7d1a8f3de2
@ -61,6 +61,7 @@ implementation
|
|||||||
LdSupportsNoResponseFile : boolean;
|
LdSupportsNoResponseFile : boolean;
|
||||||
LibrarySuffix : Char;
|
LibrarySuffix : Char;
|
||||||
Function WriteResponseFile(isdll:boolean) : Boolean;
|
Function WriteResponseFile(isdll:boolean) : Boolean;
|
||||||
|
Function GetDarwinPrtobjName(isdll: boolean): TCmdStr;
|
||||||
public
|
public
|
||||||
constructor Create;override;
|
constructor Create;override;
|
||||||
procedure SetDefaultInfo;override;
|
procedure SetDefaultInfo;override;
|
||||||
@ -151,11 +152,11 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
ExeCmd[1]:='ld $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE `cat $RES`';
|
ExeCmd[1]:='ld $PRTOBJ $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP -multiply_defined suppress -L. -o $EXE `cat $RES`';
|
||||||
if (apptype<>app_bundle) then
|
if (apptype<>app_bundle) then
|
||||||
DllCmd[1]:='libtool $OPT -dynamic -multiply_defined suppress -L. -o $EXE `cat $RES`'
|
DllCmd[1]:='libtool $PRTOBJ $OPT -dynamic -multiply_defined suppress -L. -o $EXE `cat $RES`'
|
||||||
else
|
else
|
||||||
DllCmd[1]:='ld $OPT -dynamic -bundle -multiply_defined suppress -L. -o $EXE `cat $RES`'
|
DllCmd[1]:='ld $PRTOBJ $OPT -dynamic -bundle -multiply_defined suppress -L. -o $EXE `cat $RES`'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@ -197,6 +198,33 @@ else
|
|||||||
end;
|
end;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
|
||||||
|
Function TLinkerBSD.GetDarwinPrtobjName(isdll: boolean): TCmdStr;
|
||||||
|
begin
|
||||||
|
if not(isdll) then
|
||||||
|
if not(cs_profile in current_settings.moduleswitches) then
|
||||||
|
begin
|
||||||
|
if not librarysearchpath.FindFile('crt1.o',false,result) then
|
||||||
|
result:='/usr/lib/crt1.o';
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if not librarysearchpath.FindFile('gcrt1.o',false,result) then
|
||||||
|
result:='/usr/lib/gcrt1.o';
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if (apptype=app_bundle) then
|
||||||
|
begin
|
||||||
|
if not librarysearchpath.FindFile('bundle1.o',false,result) then
|
||||||
|
result:='/usr/lib/bundle1.o'
|
||||||
|
end
|
||||||
|
else
|
||||||
|
result:=''
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function TLinkerBSD.WriteResponseFile(isdll:boolean) : Boolean;
|
Function TLinkerBSD.WriteResponseFile(isdll:boolean) : Boolean;
|
||||||
Var
|
Var
|
||||||
linkres : TLinkRes;
|
linkres : TLinkRes;
|
||||||
@ -258,33 +286,7 @@ begin
|
|||||||
AddSharedLibrary('SystemStubs_profile');
|
AddSharedLibrary('SystemStubs_profile');
|
||||||
{$endif MACOSX104ORHIGHER}
|
{$endif MACOSX104ORHIGHER}
|
||||||
reorder:=reorderentries;
|
reorder:=reorderentries;
|
||||||
if not(isdll) then
|
prtobj:='';
|
||||||
if not(cs_profile in current_settings.moduleswitches) then
|
|
||||||
begin
|
|
||||||
if librarysearchpath.FindFile('crt1.o',false,s) then
|
|
||||||
prtobj:=s
|
|
||||||
else
|
|
||||||
prtobj:='/usr/lib/crt1.o';
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
if librarysearchpath.FindFile('gcrt1.o',false,s) then
|
|
||||||
prtobj:=s
|
|
||||||
else
|
|
||||||
prtobj:='/usr/lib/gcrt1.o';
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
if (apptype=app_bundle) then
|
|
||||||
begin
|
|
||||||
if librarysearchpath.FindFile('bundle1.o',false,s) then
|
|
||||||
prtobj:=s
|
|
||||||
else
|
|
||||||
prtobj:='/usr/lib/bundle1.o'
|
|
||||||
end
|
|
||||||
else
|
|
||||||
prtobj:=''
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if reorder Then
|
if reorder Then
|
||||||
@ -538,6 +540,8 @@ begin
|
|||||||
Replace(cmdstr,'$STRIP',StripStr);
|
Replace(cmdstr,'$STRIP',StripStr);
|
||||||
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
|
||||||
Replace(cmdstr,'$DYNLINK',DynLinkStr);
|
Replace(cmdstr,'$DYNLINK',DynLinkStr);
|
||||||
|
if (target_info.system in systems_darwin) then
|
||||||
|
Replace(cmdstr,'$PRTOBJ',GetDarwinPrtobjName(false));
|
||||||
BinStr:=FindUtil(utilsprefix+BinStr);
|
BinStr:=FindUtil(utilsprefix+BinStr);
|
||||||
|
|
||||||
{ create dsym file? }
|
{ create dsym file? }
|
||||||
@ -623,6 +627,8 @@ begin
|
|||||||
Replace(cmdstr,'$INIT',InitStr);
|
Replace(cmdstr,'$INIT',InitStr);
|
||||||
Replace(cmdstr,'$FINI',FiniStr);
|
Replace(cmdstr,'$FINI',FiniStr);
|
||||||
Replace(cmdstr,'$SONAME',SoNameStr);
|
Replace(cmdstr,'$SONAME',SoNameStr);
|
||||||
|
if (target_info.system in systems_darwin) then
|
||||||
|
Replace(cmdstr,'$PRTOBJ',GetDarwinPrtobjName(true));
|
||||||
BinStr:=FindUtil(utilsprefix+BinStr);
|
BinStr:=FindUtil(utilsprefix+BinStr);
|
||||||
|
|
||||||
{ create dsym file? }
|
{ create dsym file? }
|
||||||
|
Loading…
Reference in New Issue
Block a user