From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 79443BC37 for ; Sun, 27 Dec 2009 11:13:26 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtsGADbCNkvRVdiwi2dsb2JhbACOVIMSghiHJj8BAQEKCwoHEQWoFIEyg32HQwECAwWELgSBZQ X-IronPort-AV: E=Sophos;i="4.47,458,1257116400"; d="scan'208";a="42790860" Received: from mail-px0-f176.google.com ([209.85.216.176]) by mail1-smtp-roc.national.inria.fr with ESMTP; 27 Dec 2009 11:13:25 +0100 Received: by pxi6 with SMTP id 6so5044135pxi.0 for ; Sun, 27 Dec 2009 02:13:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=sJ0jGc0Jr4U2A04YFZ0nquJcfyxF2J0hPoIl5+a9JIY=; b=P/0I6uyc9/QpiemdBUHhRzchy9DZiioTEdUXF+h3XrUhxOVBpItN3xzgUqaGAqRwVs N2Q4We13sUMNRZnK4VI/7UG9OIgzG8FrO3VyISKxr6UeIPhIJdqlyUTMc34XvBdU0sII x3haRCeDTBSvlOzQTD0DvD0Z9CJxvE2xfguvY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=Wx+U11PvXZS6GBkdgscnIwpH3bwz1AYLx/+km9XPbAuNNsAbP5+zJo/QpECsThE+6Q l/r9G5sFkxYUDQE9vOqD1DpXOgICSZwn9y1BC9Yzrq09VOsft30tw6LbRPAXgp2SvH2w xYhp631RpmXHkUDtS4kwsuiQ9REC0UczT62lM= MIME-Version: 1.0 Received: by 10.142.59.12 with SMTP id h12mr4972776wfa.267.1261908803962; Sun, 27 Dec 2009 02:13:23 -0800 (PST) Date: Sun, 27 Dec 2009 12:13:23 +0200 Message-ID: Subject: Compiling shared library with libasmrun.a From: "Eric M. Hielscher" To: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 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. Specifically, 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 = 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. The 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 "Het zal me worst wezen." http://ehielscher.org