caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Compiling a shared library on AMD64
@ 2005-12-13 22:10 Erik Bourget
  2005-12-13 22:34 ` [Caml-list] " Stefano Zacchiroli
  2005-12-14 16:45 ` Xavier Leroy
  0 siblings, 2 replies; 5+ messages in thread
From: Erik Bourget @ 2005-12-13 22:10 UTC (permalink / raw)
  To: caml-list


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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Compiling a shared library on AMD64
  2005-12-13 22:10 Compiling a shared library on AMD64 Erik Bourget
@ 2005-12-13 22:34 ` Stefano Zacchiroli
  2005-12-13 23:45   ` Erik Bourget
  2005-12-14 16:45 ` Xavier Leroy
  1 sibling, 1 reply; 5+ messages in thread
From: Stefano Zacchiroli @ 2005-12-13 22:34 UTC (permalink / raw)
  To: caml-list

On Tue, Dec 13, 2005 at 02:10:11PM -0800, Erik Bourget wrote:
> 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:

Have a look at this entry in the ocaml BTS:

  http://caml.inria.fr/mantis/view.php?id=3866

-- 
Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Compiling a shared library on AMD64
  2005-12-13 22:34 ` [Caml-list] " Stefano Zacchiroli
@ 2005-12-13 23:45   ` Erik Bourget
  0 siblings, 0 replies; 5+ messages in thread
From: Erik Bourget @ 2005-12-13 23:45 UTC (permalink / raw)
  To: Stefano Zacchiroli; +Cc: caml-list


Stefano Zacchiroli <zack@bononia.it> writes:

> On Tue, Dec 13, 2005 at 02:10:11PM -0800, Erik Bourget wrote:
>> 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:
>
> Have a look at this entry in the ocaml BTS:
>
>   http://caml.inria.fr/mantis/view.php?id=3866


Is dynamic bytecode loading/interpeting going to be the only way I can do
this?

I think the specific remedy I'm looking for is a way to get rid of this:

$ ocamlopt -ccopt '-fPIC' -fPIC -c pcre.ml
$ objdump -r pcre.o | grep 64_32
0000000000000087 R_X86_64_32S      .rodata
0000000000000955 R_X86_64_32S      .rodata+0x0000000000000020
0000000000002ac0 R_X86_64_32S      .rodata+0x00000000000000e8
0000000000002e93 R_X86_64_32S      .rodata+0x0000000000000168

- Erik


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Compiling a shared library on AMD64
  2005-12-13 22:10 Compiling a shared library on AMD64 Erik Bourget
  2005-12-13 22:34 ` [Caml-list] " Stefano Zacchiroli
@ 2005-12-14 16:45 ` Xavier Leroy
  2005-12-14 17:56   ` Erik Bourget
  1 sibling, 1 reply; 5+ messages in thread
From: Xavier Leroy @ 2005-12-14 16:45 UTC (permalink / raw)
  To: Erik Bourget; +Cc: caml-list

> 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 think I see what the problem is, and will try to fix it in 3.09.1.
However, it would help if you could file a bug report with repro case
at http://caml.inria.fr/mantis

Regards,

- Xavier Leroy


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Caml-list] Compiling a shared library on AMD64
  2005-12-14 16:45 ` Xavier Leroy
@ 2005-12-14 17:56   ` Erik Bourget
  0 siblings, 0 replies; 5+ messages in thread
From: Erik Bourget @ 2005-12-14 17:56 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: caml-list

Xavier Leroy <Xavier.Leroy@inria.fr> writes:

>> 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 think I see what the problem is, and will try to fix it in 3.09.1.
> However, it would help if you could file a bug report with repro case
> at http://caml.inria.fr/mantis

Sure.

http://caml.inria.fr/mantis/view.php?id=3924

Thanks for looking into it!  Is the problem simple-ish?  I don't mind hacking
on it myself if I have a pointer to where to look.

- Erik


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-12-14 18:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-13 22:10 Compiling a shared library on AMD64 Erik Bourget
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

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).