svn commit: r404085 - in head/lang/fpc: . files

John Marino marino at FreeBSD.org
Mon Dec 21 09:57:36 UTC 2015


Author: marino
Date: Mon Dec 21 09:57:34 2015
New Revision: 404085
URL: https://svnweb.freebsd.org/changeset/ports/404085

Log:
  lang/fpc: Restore DragonFly support
  
  FPC cannot use the gold linker.  Gold requires that the linker script have
  the --script flag passed, but doing so will break FreePascal (the flags
  causes the internal linker to be bypassed).  Since DragonFly switches
  linkers through the environment and it's not clear how to set that, I've
  hardcoded the linker path for DragonFly for now.  Also, we must avoid using
  Gold for the bootstrap compiler (which has not been hardcoded) so passing
  LDVER=ld.bfd during the bootstrap stage is necessary to guarantee this.
  FreeBSD doesn't use this variable so its harmless on that OPSYS.
  
  The other major fix was fixing the dirent record which differs on DragonFly.
  This is why unit searching has always failed.
  
  All patches will be submitted upstream.  This should be a no-op for FreeBSD,
  thus no bump.

Added:
  head/lang/fpc/files/patch-compiler_cfileutl.pas   (contents, props changed)
  head/lang/fpc/files/patch-compiler_systems_t__bsd.pas   (contents, props changed)
  head/lang/fpc/files/patch-rtl_bsd_ossysc.inc   (contents, props changed)
  head/lang/fpc/files/patch-rtl_bsd_ostypes.inc   (contents, props changed)
Modified:
  head/lang/fpc/Makefile

Modified: head/lang/fpc/Makefile
==============================================================================
--- head/lang/fpc/Makefile	Mon Dec 21 03:37:45 2015	(r404084)
+++ head/lang/fpc/Makefile	Mon Dec 21 09:57:34 2015	(r404085)
@@ -115,7 +115,7 @@ do-build:
 # build fpc compiler
 	@${ECHO_MSG} "##### STARTING COMPILER #####"
 	(cd ${WRKDIR}/${FPCSRCDIR}/compiler && ${SETENV} ${MAKE_ENV} \
-		${MAKE_CMD} cycle ${MAKE_ARGS} ${BOOTPPC})
+		LDVER=ld.bfd ${MAKE_CMD} cycle ${MAKE_ARGS} ${BOOTPPC})
 	@${ECHO_MSG} "##### COMPLETE COMPILER #####"
 
 # build fpcmkcfg

Added: head/lang/fpc/files/patch-compiler_cfileutl.pas
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/fpc/files/patch-compiler_cfileutl.pas	Mon Dec 21 09:57:34 2015	(r404085)
@@ -0,0 +1,12 @@
+--- compiler/cfileutl.pas.orig	2015-11-13 21:15:29 UTC
++++ compiler/cfileutl.pas
+@@ -23,9 +23,7 @@ unit cfileutl;
+ 
+ {$i fpcdefs.inc}
+ 
+-{$ifndef DragonFly}
+ {$define usedircache}
+-{$endif DragonFly}
+ 
+ interface
+ 

Added: head/lang/fpc/files/patch-compiler_systems_t__bsd.pas
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/fpc/files/patch-compiler_systems_t__bsd.pas	Mon Dec 21 09:57:34 2015	(r404085)
@@ -0,0 +1,23 @@
+--- compiler/systems/t_bsd.pas.orig	2015-11-13 21:15:29 UTC
++++ compiler/systems/t_bsd.pas
+@@ -192,6 +192,8 @@ begin
+       DynamicLinker:='/usr/libexec/ld.so'
+      else if target_info.system in systems_netbsd then
+       DynamicLinker:='/usr/libexec/ld.elf_so'
++     else if target_info.system=system_x86_64_dragonfly then
++      DynamicLinker:='/libexec/ld-elf.so.2'
+      else
+        DynamicLinker:='';
+    end;
+@@ -718,7 +720,10 @@ begin
+   Replace(cmdstr,'$DYNLINK',DynLinkStr);
+   if (target_info.system in systems_darwin) then
+     Replace(cmdstr,'$PRTOBJ',GetDarwinPrtobjName(false));
+-  BinStr:=FindUtil(utilsprefix+BinStr);
++  if target_info.system=system_x86_64_dragonfly then
++     BinStr:='/usr/libexec/binutils225/elf/ld.bfd'
++  else
++     BinStr:=FindUtil(utilsprefix+BinStr);
+ 
+   { create dsym file? }
+   extdbgbinstr:='';

Added: head/lang/fpc/files/patch-rtl_bsd_ossysc.inc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/fpc/files/patch-rtl_bsd_ossysc.inc	Mon Dec 21 09:57:34 2015	(r404085)
@@ -0,0 +1,14 @@
+--- rtl/bsd/ossysc.inc.orig	2015-11-13 21:15:29 UTC
++++ rtl/bsd/ossysc.inc
+@@ -282,7 +282,11 @@ begin
+  repeat
+   novalid:=false;
+   CurEntry:=pdirent(dirp^.dd_rewind);
++{$ifdef dragonfly}
++  RecLen:=(CurEntry^.d_namlen + 24) and $FFFFFFF8;
++{$else}
+   RecLen:=CurEntry^.d_reclen;
++{$endif}
+   if RecLen<>0 Then
+    begin {valid direntry?}
+     if CurEntry^.d_fileno<>0 then

Added: head/lang/fpc/files/patch-rtl_bsd_ostypes.inc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/lang/fpc/files/patch-rtl_bsd_ostypes.inc	Mon Dec 21 09:57:34 2015	(r404085)
@@ -0,0 +1,27 @@
+--- rtl/bsd/ostypes.inc.orig	2015-11-13 21:15:29 UTC
++++ rtl/bsd/ostypes.inc
+@@ -145,6 +145,16 @@ TYPE
+ 
+   { directory services }
+ {$ifndef darwinarm}
++{$ifdef dragonfly}
++   dirent  = record
++        d_fileno      : ino_t;                          // file number of entry
++        d_namlen      : cuint16;                        // strlen (d_name)
++        d_type        : cuint8;                         // file type, see below
++        d_unused1     : cuint8;                         // padding, reserved
++        d_unused2     : cuint32;                        // reserved
++        d_name        : array[0..255] of char;          // name, null terminated
++   end;
++{$else}
+    dirent  = record
+         d_fileno      : cuint32;                        // file number of entry
+         d_reclen      : cuint16;                        // length of this record
+@@ -152,6 +162,7 @@ TYPE
+         d_namlen      : cuint8;                         // length of string in d_name
+         d_name        : array[0..(255 + 1)-1] of char;  // name must be no longer than this
+    end;
++{$endif}
+ {$else not darwinarm}
+    {$packrecords 4}
+    { available on Mac OS X 10.6 and later, and used by all iPhoneOS versions }


More information about the svn-ports-all mailing list