Hi,

Here are two little patchs for the BeOS port of FPC :
- compiler_systems_r8756.diff reenable creating shared object using the libc based rtl. I have also added gc-sections support.
- rtl_beos_ptypes.inc fix a compilation error since a recent change.

A previous one was forgotten in the critical fpc 2.2.0 release rush :-)
It should be apply too as there is some missing files (available here : http://olivier.coursiere.free.fr/diff/beos_r8398.diff).

Here is the content of this older patch :
- rtl/beos/i386/sighnd.inc
- packages/base/pthreads/pthrbeos.inc (basically a verbatim copy of the bsd one, just to compile as pthread support is limited under BeOS)
- utils/fppkg/Makefile.fpc

Olivier
Index: i_beos.pas
===================================================================
--- i_beos.pas	(revision 8756)
+++ i_beos.pas	(working copy)
@@ -33,7 +33,7 @@
             name         : 'Beos for i386';
             shortname    : 'Beos';
             flags        : [tf_under_development,tf_needs_symbol_size,tf_files_case_sensitive,tf_use_function_relative_addresses,
-                            tf_smartlink_library];
+                            tf_smartlink_sections, tf_smartlink_library];
             cpu          : cpu_i386;
             unit_env     : 'BEOSUNITS';
             extradefines : 'UNIX;HASUNIX';
Index: t_beos.pas
===================================================================
--- t_beos.pas	(revision 8756)
+++ t_beos.pas	(working copy)
@@ -279,8 +279,8 @@
      if prtobj<>'' then
       LinkRes.AddFileName(FindObjectFile(prtobj,'',false));
 
-     if isdll then
-      LinkRes.AddFileName(FindObjectFile('func.o','',false));
+//     if isdll then
+//      LinkRes.AddFileName(FindObjectFile('func.o','',false));
 
      if librarysearchpath.FindFile('init_term_dyn.o',false,s) then
       LinkRes.AddFileName(s);
@@ -361,9 +361,10 @@
 function TLinkerBeOS.MakeExecutable:boolean;
 var
   binstr,
-  cmdstr  : TCmdStr;
+  cmdstr : TCmdStr;
   success : boolean;
   DynLinkStr : string[60];
+  GCSectionsStr,
   StaticStr,
   StripStr   : string[40];
 begin
@@ -374,10 +375,16 @@
   StaticStr:='';
   StripStr:='';
   DynLinkStr:='';
+  GCSectionsStr:='';
   if (cs_link_staticflag in current_settings.globalswitches) then
    StaticStr:='-static';
   if (cs_link_strip in current_settings.globalswitches) then
    StripStr:='-s';
+
+  if (cs_link_smart in current_settings.globalswitches) and
+     (tf_smartlink_sections in target_info.flags) then
+      GCSectionsStr:='--gc-sections';
+
   If (cs_profile in current_settings.moduleswitches) or
      ((Info.DynamicLinker<>'') and (not SharedLibFiles.Empty)) then
    begin
@@ -398,6 +405,7 @@
   Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STRIP',StripStr);
+  Replace(cmdstr,'$GCSECTIONS',GCSectionsStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
   success:=DoExec(FindUtil(utilsprefix+BinStr),CmdStr,true,true);
 
@@ -412,7 +420,8 @@
 Function TLinkerBeOS.MakeSharedLibrary:boolean;
 var
   binstr,
-  cmdstr  : TCmdStr;
+  cmdstr,
+  SoNameStr : TCmdStr;
   success : boolean;
   DynLinkStr : string[60];
   StaticStr,
@@ -443,14 +452,18 @@
 { Write used files and libraries }
   WriteResponseFile(true,true);
 
+  SoNameStr:='-soname '+ExtractFileName(current_module.sharedlibfilename^);
+
 { Call linker }
   SplitBinCmd(Info.DllCmd[1],binstr,cmdstr);
-  Replace(cmdstr,'$EXE',maybequoted(current_module.exefilename^));
+  Replace(cmdstr,'$EXE',maybequoted(current_module.sharedlibfilename^));
   Replace(cmdstr,'$OPT',Info.ExtraOptions);
   Replace(cmdstr,'$RES',maybequoted(outputexedir+Info.ResName));
   Replace(cmdstr,'$STATIC',StaticStr);
   Replace(cmdstr,'$STRIP',StripStr);
   Replace(cmdstr,'$DYNLINK',DynLinkStr);
+  Replace(cmdstr,'$SONAME',SoNameStr);
+
   success:=DoExec(FindUtil(utilsprefix+binstr),cmdstr,true,true);
 
 { Strip the library ? }
Index: ptypes.inc
===================================================================
--- ptypes.inc	(revision 8793)
+++ ptypes.inc	(working copy)
@@ -45,6 +45,7 @@
     gid_t    = cuint32;         { used for group IDs           }
     TGid     = gid_t;
     pGid     = ^gid_t;
+    TIOCtlRequest = cuLong;
 
     ino_t    = clonglong;           { used for file serial numbers }
     TIno     = ino_t;
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to