From: "Eric M. Hielscher" <hielscher@gmail.com>
To: caml-list@inria.fr
Subject: Fwd: Compiling shared library with libasmrun.a
Date: Sun, 27 Dec 2009 12:16:43 +0200 [thread overview]
Message-ID: <d550840e0912270216u4d0fb86ev11a2378c6ef8d346@mail.gmail.com> (raw)
In-Reply-To: <d550840e0912270213t5ebbef4n632676718753c92c@mail.gmail.com>
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
next prev parent reply other threads:[~2009-12-27 10:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-27 10:13 Eric M. Hielscher
2009-12-27 10:16 ` Eric M. Hielscher [this message]
2009-12-29 12:27 ` [Caml-list] " Richard Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d550840e0912270216u4d0fb86ev11a2378c6ef8d346@mail.gmail.com \
--to=hielscher@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox