caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Erik Bourget <ebourget@yahoo-inc.com>
To: caml-list@yquem.inria.fr
Subject: Compiling a shared library on AMD64
Date: Tue, 13 Dec 2005 14:10:11 -0800	[thread overview]
Message-ID: <87oe3kodh8.fsf@raptors.corp.yahoo.com.> (raw)


I'm having trouble building a shared library using components from the ocaml
standard library on my x86_64 box.  I built ocaml 3.09.0 with:
BYTECCCOMPOPTS=-fno-defer-pop -Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
NATIVECCCOMPOPTS=-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
NATIVECCPROFOPTS=-Wall -D_FILE_OFFSET_BITS=64 -D_REENTRANT -fPIC
SUPPORTS_SHARED_LIBRARIES=true
BNG_ARCH=amd64

, but the standard library seems to still have some R_X86_64_32S relocations
in it.

I don't understand ELF very well so I'm kind of lost :) Can anyone give any
pointers?

- Erik

Story in transcript:

$ ocamlopt -ccopt "-fPIC -D_FILE_OFFSET_BITS=64 -D_REENTRANT" -fPIC -I /usr/lib/ocaml/site-packages/pcre -I /usr/local/lib/ocaml/site-lib/pcre -output-obj -fPIC -o camlcode.o unix.cmxa pcre.cmxa range_utils.cmx parser.cmx lexer.cmx memoize.cmx tinydns.cmx netmask.cmx admins.cmx netblocks.cmx evaluate.cmx range.cmx

$ ld -shared --whole-archive -o librange.so camlcode.o librange.o /usr/local/lib/ocaml/libunix.a /usr/local/lib/ocaml/libasmrun.a /usr/local/lib/ocaml/site-lib/pcre/libpcre_stubs.a /usr/lib64/libm.a /usr/lib64/libpcre.a /usr/lib64/libdl.a

ld: camlcode.o: relocation R_X86_64_32S against `a local symbol' can not be used when making a shared object; recompile with -fPIC

$ objdump -r camlcode.o | grep R_X86_64_32S

000000000000377d R_X86_64_32S      .rodata
0000000000003be6 R_X86_64_32S      .rodata+0x000000000000008
... (20 more .rodata, but only .rodata, nothing else)

erik:~/src/packages/ocaml/ocaml-3.09.0/stdlib$ objdump -r scanf.o | grep 64_32
00000000000021de R_X86_64_32S      .rodata
0000000000002a53 R_X86_64_32S      .rodata+0x00000000000003e0
... ( more .rodata)

The pcre.o used to build pcre.cmxa also has some rodata's in it.


             reply	other threads:[~2005-12-13 22:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-13 22:10 Erik Bourget [this message]
2005-12-13 22:34 ` [Caml-list] " Stefano Zacchiroli
2005-12-13 23:45   ` Erik Bourget
2005-12-14 16:45 ` Xavier Leroy
2005-12-14 17:56   ` Erik Bourget

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=87oe3kodh8.fsf@raptors.corp.yahoo.com. \
    --to=ebourget@yahoo-inc.com \
    --cc=caml-list@yquem.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;
as well as URLs for NNTP newsgroup(s).