[fpc-devel] fpc libraries do not work in freeBSD...

Michal Wallace michal.wallace at gmail.com
Wed Aug 6 22:37:19 CEST 2014


It looks like my old post had an error when I tried to copy and paste the
text.
The last line that is repeated 3 times should be three separate lines with
an
have an offset for each variable.

For what it's worth, here is the actual patch I used. (I haven't re-tested
it
today. If it doesn't work, I would have originally used the latest version
of
the svn trunk on the day I posted, so you might try that...)

######### BEGIN PATCH ############################

diff --git a/rtl/freebsd/x86_64/dllprt0.as b/rtl/freebsd/x86_64/dllprt0.as
index 7213eae..2a68c6f 100644
--- a/rtl/freebsd/x86_64/dllprt0.as
+++ b/rtl/freebsd/x86_64/dllprt0.as
@@ -68,8 +68,20 @@ _haltproc:
         movzwl  (%rbx),%edi
         syscall
         jmp     _haltproc at PLT
-       /* Do not fail linkage if argc, argv and envp are not found. */
-       .weak   operatingsystem_parameter_argc
-       .weak   operatingsystem_parameter_argv
-       .weak   operatingsystem_parameter_envp
+//     /* Do not fail linkage if argc, argv and envp are not found. */
+//     .weak   operatingsystem_parameter_argc
+//     .weak   operatingsystem_parameter_argv
+//     .weak   operatingsystem_parameter_envp

+/* Although these variables are useless, they actually do need to be
declared
+ * to create shared libraries usable from other environments. (eg, python).
+ */
+operatingsystem_parameters:
+        .skip 3*8
+
+        .global operatingsystem_parameter_envp
+        .global operatingsystem_parameter_argc
+        .global operatingsystem_parameter_argv
+        .set operatingsystem_parameter_envp,operatingsystem_parameters+0
+        .set operatingsystem_parameter_argc,operatingsystem_parameters+8
+        .set operatingsystem_parameter_argv,operatingsystem_parameters+16

########### END PATCH #############################


On Wed, Aug 6, 2014 at 1:28 PM, Fred van Stappen <fiens at hotmail.com> wrote:

> > I know virtually nothing about FreeBSD, but if this comment (about linker
> > behaving in special way to 'magical name _init') still applies for the
> > linker used under FreeBSD, this could be the potential solution for
> > initialization of these values for FPC RTL in shared libraries (rather
> > then for shared libc).
>
> Yep, this is a excellent opportunity for fpc to become the unique compiler
> who can produce True Universal Libraries.
>
> freeBSD is growing, freeBSD is used by OSX too..., if fpc can create
> libraries for freeBSD, accessible for lot of languages (like fpc libraries
> do for Linux and Windows), fpc becomes the Libraries's King... ;-)
>
> Thanks Tomas.
>
> Fred.
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140806/7aa0e95e/attachment.html>


More information about the fpc-devel mailing list