* Compiling shared library with libasmrun.a
@ 2009-12-27 10:13 Eric M. Hielscher
2009-12-27 10:16 ` Fwd: " Eric M. Hielscher
2009-12-29 12:27 ` [Caml-list] " Richard Jones
0 siblings, 2 replies; 3+ messages in thread
From: Eric M. Hielscher @ 2009-12-27 10:13 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Fwd: Compiling shared library with libasmrun.a
2009-12-27 10:13 Compiling shared library with libasmrun.a Eric M. Hielscher
@ 2009-12-27 10:16 ` Eric M. Hielscher
2009-12-29 12:27 ` [Caml-list] " Richard Jones
1 sibling, 0 replies; 3+ messages in thread
From: Eric M. Hielscher @ 2009-12-27 10:16 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] Compiling shared library with libasmrun.a
2009-12-27 10:13 Compiling shared library with libasmrun.a Eric M. Hielscher
2009-12-27 10:16 ` Fwd: " Eric M. Hielscher
@ 2009-12-29 12:27 ` Richard Jones
1 sibling, 0 replies; 3+ messages in thread
From: Richard Jones @ 2009-12-29 12:27 UTC (permalink / raw)
To: Eric M. Hielscher; +Cc: caml-list
On Sun, Dec 27, 2009 at 12:13:23PM +0200, Eric M. Hielscher wrote:
> 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?
I think you've hit this bug:
http://caml.inria.fr/mantis/view.php?id=4795
Probably would get fixed faster if someone would work out the
assembler hoops required to generate PIC code on x86-64 and then post
a patch to the bug.
Rich.
--
Richard Jones
Red Hat
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-29 12:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-27 10:13 Compiling shared library with libasmrun.a Eric M. Hielscher
2009-12-27 10:16 ` Fwd: " Eric M. Hielscher
2009-12-29 12:27 ` [Caml-list] " Richard Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox