summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarino <marino@FreeBSD.org>2015-12-21 09:57:34 +0000
committermarino <marino@FreeBSD.org>2015-12-21 09:57:34 +0000
commitca77e0ed437a634df1f4ea042dd8cd506af63e6c (patch)
tree59be9dd1df50b8bfa22664d411ff0b4c31a4e009
parent1a8d6d9c105796469b89a441b1520c848d4b57ef (diff)
downloadFreeBSD-ports-ca77e0ed437a634df1f4ea042dd8cd506af63e6c.zip
FreeBSD-ports-ca77e0ed437a634df1f4ea042dd8cd506af63e6c.tar.gz
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.
-rw-r--r--lang/fpc/Makefile2
-rw-r--r--lang/fpc/files/patch-compiler_cfileutl.pas12
-rw-r--r--lang/fpc/files/patch-compiler_systems_t__bsd.pas23
-rw-r--r--lang/fpc/files/patch-rtl_bsd_ossysc.inc14
-rw-r--r--lang/fpc/files/patch-rtl_bsd_ostypes.inc27
5 files changed, 77 insertions, 1 deletions
diff --git a/lang/fpc/Makefile b/lang/fpc/Makefile
index 010e9c8..11a4140 100644
--- a/lang/fpc/Makefile
+++ b/lang/fpc/Makefile
@@ -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
diff --git a/lang/fpc/files/patch-compiler_cfileutl.pas b/lang/fpc/files/patch-compiler_cfileutl.pas
new file mode 100644
index 0000000..c5e1f8e
--- /dev/null
+++ b/lang/fpc/files/patch-compiler_cfileutl.pas
@@ -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
+
diff --git a/lang/fpc/files/patch-compiler_systems_t__bsd.pas b/lang/fpc/files/patch-compiler_systems_t__bsd.pas
new file mode 100644
index 0000000..30263c3
--- /dev/null
+++ b/lang/fpc/files/patch-compiler_systems_t__bsd.pas
@@ -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:='';
diff --git a/lang/fpc/files/patch-rtl_bsd_ossysc.inc b/lang/fpc/files/patch-rtl_bsd_ossysc.inc
new file mode 100644
index 0000000..8523477
--- /dev/null
+++ b/lang/fpc/files/patch-rtl_bsd_ossysc.inc
@@ -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
diff --git a/lang/fpc/files/patch-rtl_bsd_ostypes.inc b/lang/fpc/files/patch-rtl_bsd_ostypes.inc
new file mode 100644
index 0000000..62fa7e7
--- /dev/null
+++ b/lang/fpc/files/patch-rtl_bsd_ostypes.inc
@@ -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 }
OpenPOWER on IntegriCloud