From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 97BB2BC37 for ; Sun, 27 Dec 2009 11:16:45 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AuoAAHPCNkvRVd6vkGdsb2JhbACRZoIYhyY/AQEBAQkJDAcTA6gPgTKDfYdDAQIDBYQuBIFl X-IronPort-AV: E=Sophos;i="4.47,458,1257116400"; d="scan'208";a="39378521" Received: from mail-pz0-f175.google.com ([209.85.222.175]) by mail2-smtp-roc.national.inria.fr with ESMTP; 27 Dec 2009 11:16:44 +0100 Received: by pzk5 with SMTP id 5so403481pzk.1 for ; Sun, 27 Dec 2009 02:16:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=8zF7qp7dswOQEfZWit8GNkRWQbpeJvjXEnZh7cUl0/I=; b=WN1E/NBLnSs5MDf/bwJDVgPELAYAx9d75PmHXKrGN+KiPdrzxAUjwmwoPN9tDaxhSq mXO2ExJJ8wzmRBti7ACMcODJsmjbblwGXAc5v+SRYkm9Abuy0/DYbqTMikd2n+6SmPqt 47vkzuar/29QsKtAhsOAezcN52ggcZJLlt4QY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=exFgDA2cDAJD4sg2jwTuCiHfTkD/JqCSnqYb0GOIL5r9Rht18P7i9W5OntruMrNABv XoanZrH6E7L9cYXuy0/grQn71BljblYnnCXA0bUjciKP30orsPae+Vm3qW8P496adD1T yDlTpvbgEv1iNmuTT9hsUfMmAk5HE+wz6YvuQ= MIME-Version: 1.0 Received: by 10.142.250.38 with SMTP id x38mr5562483wfh.179.1261909003864; Sun, 27 Dec 2009 02:16:43 -0800 (PST) In-Reply-To: References: Date: Sun, 27 Dec 2009 12:16:43 +0200 Message-ID: Subject: Fwd: Compiling shared library with libasmrun.a From: "Eric M. Hielscher" To: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam: no; 0.00; libasmrun:01 ocaml:01 wrappers:01 ocaml:01 libasmrun:01 -fpic:01 makefile:01 asmrun:01 -fpic:01 inserting:01 usr:01 lib:01 recompile:01 gcc:01 -dsys:01 Hi all, As discussed in a few places on this list, I'm trying to compile a shared library which includes both C and OCaml code. =A0Specifically, I'm trying to do the following: - I have a proprietary language X's interpreter which allows me to link into it C shared libraries - I've written C wrappers for OCaml functions which expose the OCaml functions to X via X's library interface - I've written OCaml functions which do the meat of what I want Thus the pipeline is: Ocaml + C =3D shared library, and then shared library gets linked into X. The problem I'm having, on an AMD64 architecture, is that I can't seem to create a shared library which links to libasmrun.a as the default setup compiles libasmrun.a without the -fPIC option, and thus the resultant library has non-position-independent code. In discussions with another guy who's had the same problem, I've tried altering the Makefile in the asmrun directory to have the -fPIC option included as well as inserting PLT directives in some places in the amd64.S file, but I'm still getting the error that libasmrun.a contains non-position-independent code. =A0The error message looks like this: /usr/bin/ld: ../ocaml/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 which makes it seem as though amd64.o includes the bad code, though I verified that amd64.o was compiled as follows: gcc -c -fPIC -DSYS_linux -o amd64.o amd64.S Any ideas on how to get a working libasmrun.a for my situation? Cheers, -- Eric Hielscher