From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id ECAA37FA5F for ; Thu, 19 Jan 2017 13:12:06 +0100 (CET) Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=info@gerd-stolpmann.de; spf=None smtp.mailfrom=info@gerd-stolpmann.de; spf=None smtp.helo=postmaster@mout.kundenserver.de Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=pra; client-ip=212.227.126.133; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of info@gerd-stolpmann.de) identity=mailfrom; client-ip=212.227.126.133; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="info@gerd-stolpmann.de"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mout.kundenserver.de) identity=helo; client-ip=212.227.126.133; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="info@gerd-stolpmann.de"; x-sender="postmaster@mout.kundenserver.de"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3A+whdkRHVhYk3ci41dFpZWJ1GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ75pcqwAkXT6L1XgUPTWs2DsrQf2raQ7/mrAjZIoc7Y9itdINoUD15NoP?= =?us-ascii?q?5VtjJjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9?= =?us-ascii?q?fbytScaBx/iwgsuy4ZzIfwJQhHKd/7x/Nl3ipgXLt9IKhpNibKY2xxTEuFNDdu?= =?us-ascii?q?Bb32pvI1/VlBH5sIP495dm92FUuuk9389GS6TzOaoiHpJCCzFzHG0v6IXQqR7H?= =?us-ascii?q?VQ6G4H1UBmQQnB1gDAXf4FThQpD1qi7zsOw71CTMbp6+dqw9RTn3t/QjcxTvki?= =?us-ascii?q?pSbzM=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DYAgB4rIBYf4V+49ReHAEBBAEBCgEBF?= =?us-ascii?q?wEBBAEBCgEBgxQBAQEBAX+BCYNRighyngiINYIMLIV2AoF4PxgBAQEBAQEBAQE?= =?us-ascii?q?BARIBAQkLCwobMkIBAQECAQYGgV8Zgh4GIzI0CwQ+AgJXBgESCYh+AQmvXYIli?= =?us-ascii?q?j4BAQEHAQEBAQEUD4VahV+EVYJADC6CXgWIdweHcYpVgVEChQ6NTYdihkOScA8?= =?us-ascii?q?QgWEeFDqGOHIBgTiDcoEbgx4BAQE?= X-IPAS-Result: =?us-ascii?q?A0DYAgB4rIBYf4V+49ReHAEBBAEBCgEBFwEBBAEBCgEBgxQ?= =?us-ascii?q?BAQEBAX+BCYNRighyngiINYIMLIV2AoF4PxgBAQEBAQEBAQEBARIBAQkLCwobM?= =?us-ascii?q?kIBAQECAQYGgV8Zgh4GIzI0CwQ+AgJXBgESCYh+AQmvXYIlij4BAQEHAQEBAQE?= =?us-ascii?q?UD4VahV+EVYJADC6CXgWIdweHcYpVgVEChQ6NTYdihkOScA8QgWEeFDqGOHIBg?= =?us-ascii?q?TiDcoEbgx4BAQE?= X-IronPort-AV: E=Sophos;i="5.33,253,1477954800"; d="asc'?scan'208,217";a="256233103" Received: from mout.kundenserver.de ([212.227.126.133]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jan 2017 13:11:29 +0100 Received: from office1.lan.sumadev.de ([85.183.69.161]) by mrelayeu.kundenserver.de (mreue001 [212.227.15.167]) with ESMTPSA (Nemesis) id 0M6ahg-1cI1tr48mq-00wU68; Thu, 19 Jan 2017 13:11:28 +0100 Received: from e130 (e130.fritz.box [192.168.5.100]) by office1.lan.sumadev.de (Postfix) with ESMTPSA id 6EE07DC05D; Thu, 19 Jan 2017 13:11:27 +0100 (CET) Message-ID: <1484827880.14465.105.camel@gerd-stolpmann.de> From: Gerd Stolpmann To: Christoph =?ISO-8859-1?Q?H=F6ger?= , caml-list@inria.fr Date: Thu, 19 Jan 2017 13:11:20 +0100 In-Reply-To: References: Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-k8scP2zSjMW2joCUZ7u9" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 X-Provags-ID: V03:K0:UceT6EAcUUlqxKnmaF39J8kc+ppvPMndcElD0sgNX+xXiaHSNyE pYBIRM7M2Ib3zo7y0ZzFkhApuQMEf/24tMapsZXXYAqt4DsEd9zc5xyTjhQg8TdnQfYVdQP JTJHP6Czn7HbOh54I1gvEMcPhru2JSS/jZLjGlHBCDr2fQxkiXXUVer4s1d8CkvgD0hqve/ NhH/CqhxZq95FIwvsSWjg== X-UI-Out-Filterresults: notjunk:1;V01:K0:fhU4hHqqkGE=:6UcNSQ0f1Z6LVL0AxJcP0h s7jVsLz9bI0JFtnDsCnsEuUGSuSccM15zsXhgM726JGKLZ4cPB0nZbqQ48hONw0+j16Ru0Nfi 5z967e1r7cq1IlmB4RckPG2e+2bs2H69eJujAzErtVRrCkpNFg8hlfQA8YOJzye7DN4cYADt1 9bcbB3gEq2dAM+d1F1L1OVsYwHanxcDaxPrggbTppdwBGXJxXrIMmZo89s7tB7cRNwvOr5ZMo n89DUA1GMo6KziJi15Rm76+wF3WY3VNz3ARUCiDHcWq2iKkwMQwBRWibv0LZNHbm2gs7wJBtN D19nFVzTTCQADYJ7mIMdW6dpIVS15gmGFREWFLUdjGTyIrLZot1rFMFLc0RSSbwbvMHoobH/p 3RktGfPimwQ6hAKpPa77dDYvgJUHei77RjULB1ZeTVTqp0q7wHCBkoDLmROEy0fcg4WxJ/WPz 2N7lKQfKLSj6O7diwxkoo8MdP/TGu2GKIP/YfErAxfAaxEde+ppJhbE+sSP27aqFNs/Rgist/ h0GvyXddxUpbUi1RUeYFyfDhhVUFfi4jF0btvmeqPjWRUQFINKWGlyFJ8f+eI0RPYpouadnN9 YUCnjMdK7nPai+mxU61efAPVbwWX8RFPlEYA5sZ/JuDyTsAs5t0W03Mo6SxBIZ4iXjqjjAYhk HvDYcpsBOxLADjyTRNmOB+BvQSWncK1ykdfA3Y9o7SIt430N0TYPLIZm7HlFLib5kCZs= Subject: Re: [Caml-list] Manually linking generated native code --=-k8scP2zSjMW2joCUZ7u9 Content-Type: multipart/alternative; boundary="=-I+o6CuNkIvBkMrWEtrxc" --=-I+o6CuNkIvBkMrWEtrxc Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable Am Donnerstag, den 19.01.2017, 10:44 +0100 schrieb Christoph H=F6ger: > Dear all, >=20 > consider a simple test program: >=20 > =A0 let _ =3D Printf.printf "Hello world!\n" >=20 > I can generate the relevant assembly just fine, e.g.: >=20 > ocamlopt -dstartup -S test.ml > gcc -c a.out.startup.s -c >=20 > But I cannot link it: >=20 > gcc a.out.startup.o -L$(ocamlc -where) -lasmrun_shared > .... > a.out.startup.o(.data+0x6e8): error: undefined reference to > 'camlStd_exit__frametable' > collect2: Fehler: ld gab 1 als Ende-Status zur=FCck > distcc[9960] ERROR: compile (null) on localhost failed >=20 > It seems that the whole Pervasives is missing (which is kind of > expected).=A0 >=20 > How do I link it, manually? Where are the relevant object files? There's stdlib.a in the OCaml library directory. This is not the only problem with your approach. The OCaml linker generates a number of functions that are global to the whole OCaml program (in particular currying helpers). These are first known at link time and thus generated that late. AFAIK you cannot generate these functions outside the linker step.=A0 The only official way how to turn OCaml code into a linkable object is described here:=A0http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#s %3Aembedded-code Gerd > > thanks,>=20 > Christoph>=20 >=20 --=20 ------------------------------------------------------------ Gerd Stolpmann, Darmstadt, Germany gerd@gerd-stolpmann.de My OCaml site: http://www.camlcity.org Contact details: http://www.camlcity.org/contact.html Company homepage: http://www.gerd-stolpmann.de ------------------------------------------------------------ --=-I+o6CuNkIvBkMrWEtrxc Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Am Donnerstag, den 19.01.2017, 10:44 +0100 sc= hrieb Christoph H=C3=B6ger:
Dear all,

consider a simple test program:

&n= bsp; let _ =3D Printf.printf "Hello world!\n"

I can generate t= he relevant assembly just fine, e.g.:

ocamlopt -dstartup -S test.ml
gcc -c a.out.startup.s -c=

But I cannot link it:

gcc a.out.startu= p.o -L$(ocamlc -where) -lasmrun_shared
....
a.out.startup.o(.data+0x6= e8): error: undefined reference to 'camlStd_exit__frametable'
collect2: = Fehler: ld gab 1 als Ende-Status zur=C3=BCck
distcc[9960] ERROR: compile= (null) on localhost failed

It seems that the whole Perva= sives is missing (which is kind of expected).

How do I l= ink it, manually? Where are the relevant object files?

There's stdlib.a in the OCaml library directory= .

This is not the only problem with your approach.= The OCaml linker generates a number of functions that are global to the wh= ole OCaml program (in particular currying helpers). These are first known a= t link time and thus generated that late. AFAIK you cannot generate these f= unctions outside the linker step. 

The only o= fficial way how to turn OCaml code into a linkable object is described here= : http://caml.inria.fr/pub/docs/manual-ocaml/intfc.html#s%3Ae= mbedded-code

Gerd


thanks,

Christoph

--=20
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
My OCaml site:          http://www.camlcity.org
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------

= --=-I+o6CuNkIvBkMrWEtrxc-- --=-k8scP2zSjMW2joCUZ7u9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJYgKzoAAoJEAaM4b9ZLB5TyUYH/AvOD7RZ6oXfqxNLqGqjealg VyVCNCtjWOpTM4aSsADcYKqKRLQrNaV7v5rbeJDR/HyRknDxnF7KvqAFDvK1dRQQ A9NzdOzYP89J+VdAtNuZtql1vvGxITT9W2sIOlYdNoGb7QNUTiPrRSOWRMBLmK1W Bfq4qhWZHwD8kEHAagT8huch/8DV74byYlyi44XbfQrtW/JjuK8MprX/HvauB/Lw 25zvO/yYjBatZJyXBGjNxtune9PwmgvETYjfrvP0snDGXhvNk1WV4Dx+SQm6riEh RFOO/EDLDZipk653kV6qwZlFhKKljtgzNSttDTxbRdUcYMRQjDzXWnEmkGal08s= =tVoe -----END PGP SIGNATURE----- --=-k8scP2zSjMW2joCUZ7u9--