Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Packaging tool
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dmitry Bely <dbely@m...>
Subject: Re: [Caml-list] Packaging tool
malc <malc@pulsesoft.com> writes:

> > 2- Generate an object file X.cmo or X.cmx/X.o that does not define
> > the global variables A, B, C.  The easiest way to do this
> > (without recompiling the source files for A, B and C, of course!)
> > is to rename those global variables into, say, X.A, X.B, X.C.
> > No big deal for the bytecode compiler.  But for the native-code
> > compiler, we need the ability to rename a symbol from a native object
> > file.  And I haven't yet found a way to do this with standard
> > tools, neither under Unix nor Windows!  (Under Unix, the GNU
> > binutils and the BFD library come close to allowing this, but
> > not quite.)
> 
> Actually piece of cake with ELF/GNU binutils, consider this:
> (file a.s)
> .globl A
> A: nop
> <eof>
> 
> (file retain)
> X_A
> <eof>
> 
> rename$ as -o a.o a.s 
> rename$ nm a.o
> 00000000 T A
> rename$ ld -r -o x_a.o --defsym X_A=A a.o --retain-symbols-file retain
> rename$ nm x_a.o 
> 00000000 T X_A

As for Windows, it really seems that there is no an equivalent tool in
MSVC distribution. But fortunately both MSVC and gcc/Win32 use the same COFF
format for object files, so one can use Cygwin or MinGW-compiled binutils
to hack MSVC-produced files (can be taken from www.cygwin.com or
www.mingw.org). Not very elegant, but it should work.

Hope to hear from you soon,
Dmitry


-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr