caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dmitry Bely <dbely@mail.ru>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Packaging tool
Date: 04 Jan 2002 00:00:16 +0300	[thread overview]
Message-ID: <m34rm3p2xs.fsf@mail.ru> (raw)
In-Reply-To: <Pine.LNX.4.21.0201031826001.9474-100000@oyster>

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


  reply	other threads:[~2002-01-03 21:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-29  8:39 Ohad Rodeh
2002-01-03 14:15 ` Xavier Leroy
2002-01-03 15:29   ` malc
2002-01-03 21:00     ` Dmitry Bely [this message]
2002-01-09 16:14 Ohad Rodeh

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=m34rm3p2xs.fsf@mail.ru \
    --to=dbely@mail.ru \
    --cc=caml-list@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).