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: malc <malc@p...>
Subject: Re: [Caml-list] Packaging tool
On Thu, 3 Jan 2002, Xavier Leroy wrote:

> To work around this, we'd need to:
> 
> 1- Synthesize a signature X.cmi for X that does not refer to A.cmi, etc.
> This is fairly easy to do.
> 
> 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

-- 
mailto:malc@pulsesoft.com

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