haiku: linker support code for internal sysinit and make the x86_64 port use it

git-svn-id: trunk@40756 -
This commit is contained in:
Károly Balogh 2019-01-04 03:00:03 +00:00
parent a6cd62b358
commit 0d8ef46195
2 changed files with 30 additions and 15 deletions

View File

@ -350,7 +350,8 @@ interface
systems_internal_sysinit = [system_i386_win32,system_x86_64_win64, systems_internal_sysinit = [system_i386_win32,system_x86_64_win64,
system_i386_linux,system_powerpc64_linux,system_sparc64_linux,system_x86_64_linux, system_i386_linux,system_powerpc64_linux,system_sparc64_linux,system_x86_64_linux,
system_m68k_atari,system_m68k_palmos system_m68k_atari,system_m68k_palmos,
system_x86_64_haiku
]+systems_darwin+systems_amigalike; ]+systems_darwin+systems_amigalike;
{ all systems that use garbage collection for reference-counted types } { all systems that use garbage collection for reference-counted types }

View File

@ -49,6 +49,7 @@ interface
public public
constructor Create;override; constructor Create;override;
procedure SetDefaultInfo;override; procedure SetDefaultInfo;override;
procedure InitSysInitUnitName;override;
function MakeExecutable:boolean;override; function MakeExecutable:boolean;override;
function MakeSharedLibrary:boolean;override; function MakeSharedLibrary:boolean;override;
end; end;
@ -224,6 +225,14 @@ begin
end; end;
procedure TLinkerHaiku.InitSysInitUnitName;
const
SysInitUnitNames: array[boolean] of string[15] = ( 'si_c', 'si_dllc' );
begin
sysinitunit:=SysInitUnitNames[current_module.islibrary];
end;
function TLinkerHaiku.WriteResponseFile(isdll:boolean;makelib:boolean) : Boolean; function TLinkerHaiku.WriteResponseFile(isdll:boolean;makelib:boolean) : Boolean;
Var Var
linkres : TLinkRes; linkres : TLinkRes;
@ -238,8 +247,6 @@ begin
{ set special options for some targets } { set special options for some targets }
linklibc:=(SharedLibFiles.Find('root')<>nil); linklibc:=(SharedLibFiles.Find('root')<>nil);
prtobj:='prt0';
cprtobj:='cprt0';
if (cs_profile in current_settings.moduleswitches) or if (cs_profile in current_settings.moduleswitches) or
(not SharedLibFiles.Empty) then (not SharedLibFiles.Empty) then
begin begin
@ -247,20 +254,27 @@ begin
linklibc:=true; linklibc:=true;
end; end;
if (not linklibc) and makelib then prtobj:='';
begin cprtobj:='';
linklibc:=true; if not (target_info.system in systems_internal_sysinit) then
cprtobj:='dllprt.o'; begin
end prtobj:='prt0';
else if makelib then cprtobj:='cprt0';
begin
// Making a dll with libc linking. Should be always the case under Haiku. if (not linklibc) and makelib then
cprtobj:='dllcprt0'; begin
end; linklibc:=true;
cprtobj:='dllprt.o';
end
else if makelib then
begin
// Making a dll with libc linking. Should be always the case under Haiku.
cprtobj:='dllcprt0';
end;
end;
if linklibc then if linklibc then
prtobj:=cprtobj; prtobj:=cprtobj;
{ Open link.res file } { Open link.res file }
LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,false); LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,false);