From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id E4129BBAF for ; Wed, 23 Jul 2008 10:24:27 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuMCACKIhkhQDPIaXWdsb2JhbACSRRUFBAQYBZ8g X-IronPort-AV: E=Sophos;i="4.31,237,1215381600"; d="scan'208";a="15409245" Received: from smtp20.orange.fr ([80.12.242.26]) by mail1-smtp-roc.national.inria.fr with ESMTP; 23 Jul 2008 10:24:21 +0200 Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2003.orange.fr (SMTP Server) with ESMTP id 2CDA21C000A4; Wed, 23 Jul 2008 10:24:21 +0200 (CEST) Received: from [192.168.1.66] (APuteaux-154-1-65-47.w81-249.abo.wanadoo.fr [81.249.48.47]) by mwinf2003.orange.fr (SMTP Server) with ESMTP id E2CFD1C0009D; Wed, 23 Jul 2008 10:24:20 +0200 (CEST) X-ME-UUID: 20080723082420929.E2CFD1C0009D@mwinf2003.orange.fr Message-ID: <4886EAB2.9000101@frisch.fr> Date: Wed, 23 Jul 2008 10:24:18 +0200 From: Alain Frisch User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) MIME-Version: 1.0 To: Jonathan Marchand Cc: Caml mailing list Subject: Re: [Caml-list] Compiling a shared library with amd64 References: <9a3dee4b0807220208v6f81dda5m8ad3802ec266977c@mail.gmail.com> <4885A55E.2070302@frisch.fr> <9a3dee4b0807230008t3d68e3bu920c1a4af658e857@mail.gmail.com> <4886DAE6.605@frisch.fr> <9a3dee4b0807230117m102363a1ubca8ed069e15db41@mail.gmail.com> In-Reply-To: <9a3dee4b0807230117m102363a1ubca8ed069e15db41@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; frisch:01 frisch:01 libasmrun:01 cvs:01 -fpic:01 libasmrun:01 usr:01 lib:01 usr:01 lib:01 -fpic:01 foo:01 ocamlc:01 camlp:01 -pp:01 Jonathan Marchand wrote: > I got rid of the complains with 3.10.2 version (for libasmrun.a only). > In the CVS version, if I compile by adding -fPIC in *COMOPTS, I still > have some errors with libasmrun.a: > > Here is the complete build trace for rocaml (I use it as an exemple as > it the same problem with the library I'm making and it is freely > available): > > cc -I. -I/usr/lib/ruby/1.8/x86_64-linux > -I/usr/lib/ruby/1.8/x86_64-linux -I. -fPIC -fno-strict-aliasing -g > -g -O2 -fPIC -c foo_rocaml_wrapper.c > ocamlc -c -I +camlp4 -pp "camlp4orf -loc _loc" pa_rocaml.ml > ocamlopt.opt -c -pp 'camlp4o -I . pa_rocaml.cmo' rubyOCamlUtil.ml > ocamlopt.opt -output-obj -o foo_rocaml_runtime.o nums.cmxa > rubyOCamlUtil.cmx rubyOCamlUtil.o > cc -shared -o foo.so foo_rocaml_wrapper.o -L. -L/usr/lib -L. > -rdynamic -Wl,-export-dynamic foo_rocaml_runtime.o > /usr/local/lib/ocaml/libasmrun.a /usr/local/lib/ocaml/libunix.a > /usr/local/lib/ocaml/libnums.a -lruby1.8 -lpthread -ldl -lcrypt -lm > -lc > /usr/bin/ld: /usr/local/lib/ocaml/libasmrun.a(amd64.o): relocation > R_X86_64_PC32 against `caml_last_return_address' can not be used when > making a shared object; recompile with -fPIC > /usr/bin/ld: final link failed: Bad value > collect2: ld returned 1 exit status > make: *** [foo.so] Erreur 1 > > I don't know how to compile every libraries with -fPIC. I tried to add > more or less randomly the -fPIC flag in the Makefiles, but they are a > bit obscure to me. > The best I achieved is printed above. Now the error is in code written directly in assembler (asmrun/amd64.S). Unfortunately, I don't think there is an easy solution here: this code should be adapted to be position-independent. -- Alain