summaryrefslogtreecommitdiff
path: root/debian/patches/kfreebsd-amd64_bootstrap.patch
blob: 60f7c962135c6bec1d46d6af67fdb174c0cb8e6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Description: kfreebsd bootstrap necessities
 In the case we use freebsd as OS_TARGET the following goes wrong:
 .
 In fastcgi and fcl-web, something goes wrong with linking:
   ELF interpreter /usr/libexec/ld-elf.so.1 not found
 I have no idea where this comes from as all references to libexec are either
 in fpmake itself after compilation or in t_bsd.pas in parts that should not be
 used. However, if we force it in t_bsd.pas, it at least calls the right linker.
 It still doesn't work though, as the symbols it links to are wrong.
Author: Paul Gevers <elbrus@debian.org>

--- a/fpcsrc/compiler/systems/t_bsd.pas
+++ b/fpcsrc/compiler/systems/t_bsd.pas
@@ -187,13 +187,8 @@
        DllCmd[2]:='strip --strip-unneeded $EXE'
      else
        DllCmd[2]:='strip -x $EXE';
-     { OpenBSD seems to use a wrong dynamic linker by default }
-     if target_info.system in systems_openbsd then
-      DynamicLinker:='/usr/libexec/ld.so'
-     else if target_info.system in systems_netbsd then
-      DynamicLinker:='/usr/libexec/ld.elf_so'
-     else
-       DynamicLinker:='';
+     { On Debian systems it seems we have to set the dynamicLinker }
+     DynamicLinker:='/lib/ld-kfreebsd-x86-64.so.1';
    end;
 end;
 
--- a/fpcsrc/rtl/unix/initc.pp
+++ b/fpcsrc/rtl/unix/initc.pp
@@ -56,7 +56,7 @@
 {$endif}
 
 {$ifdef FreeBSD} // tested on x86
-function geterrnolocation: pcint; cdecl;external clib name '__error';
+function geterrnolocation: pcint; cdecl;external clib name '__errno_location';
 {$endif}
 
 {$ifdef OpenBSD} // tested on x86
--- a/fpcsrc/rtl/bsd/sysos.inc
+++ b/fpcsrc/rtl/bsd/sysos.inc
@@ -23,7 +23,7 @@
      plibcint=^libcint;
 
 {$ifdef FreeBSD} // tested on x86
-function geterrnolocation: Plibcint; cdecl;external clib name '__error';
+function geterrnolocation: Plibcint; cdecl;external clib name '__errno_location';
 {$else}
 {$ifdef NetBSD} // from a sparc dump.
 function geterrnolocation: Plibcint; cdecl;external clib name '__errno';