Przeglądaj źródła

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

git-svn-id: trunk@40756 -
Károly Balogh 6 lat temu
rodzic
commit
0d8ef46195
2 zmienionych plików z 30 dodań i 15 usunięć
  1. 2 1
      compiler/systems.pas
  2. 28 14
      compiler/systems/t_haiku.pas

+ 2 - 1
compiler/systems.pas

@@ -350,7 +350,8 @@ interface
 
        systems_internal_sysinit = [system_i386_win32,system_x86_64_win64,
                                    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;
 
        { all systems that use garbage collection for reference-counted types }

+ 28 - 14
compiler/systems/t_haiku.pas

@@ -49,6 +49,7 @@ interface
     public
       constructor Create;override;
       procedure SetDefaultInfo;override;
+      procedure InitSysInitUnitName;override;
       function  MakeExecutable:boolean;override;
       function  MakeSharedLibrary:boolean;override;
     end;
@@ -224,6 +225,14 @@ begin
 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;
 Var
   linkres  : TLinkRes;
@@ -238,8 +247,6 @@ begin
 { set special options for some targets }
   linklibc:=(SharedLibFiles.Find('root')<>nil);
 
-  prtobj:='prt0';
-  cprtobj:='cprt0';
   if (cs_profile in current_settings.moduleswitches) or
      (not SharedLibFiles.Empty) then
    begin
@@ -247,20 +254,27 @@ begin
      linklibc:=true;
    end;
 
-  if (not linklibc) and makelib then
-   begin
-     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;
-   
+  prtobj:='';
+  cprtobj:='';
+  if not (target_info.system in systems_internal_sysinit) then
+    begin
+      prtobj:='prt0';
+      cprtobj:='cprt0';
+
+      if (not linklibc) and makelib then
+        begin
+          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
-   prtobj:=cprtobj;
+    prtobj:=cprtobj;
 
   { Open link.res file }
   LinkRes:=TLinkRes.Create(outputexedir+Info.ResName,false);