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] No unused code linking?
Date: Wed, 09 Nov 2005 14:49:29 +0300	[thread overview]
Message-ID: <oe4uxcqe.fsf@mail.ru> (raw)
In-Reply-To: <Pine.LNX.4.61.0511091417490.1089@home.oyster.ru> (malc@pulsesoft.com's message of "Wed, 9 Nov 2005 14:19:55 +0300 (MSK)")

malc <malc@pulsesoft.com> writes:

>> I am thinking of reducing the size of ocamlopt-generated executables that
>> easily grows to 1Mb and above. The problem as I see it is that any module is
>> linked as a single whole (as all its functions are placed into the single
>> object file), no matter what is actually used. So almost all
>> stdlib/otherlibs become quickly linked into even not very complex project.
>>
>> In C world there is a solution that lets the linker to do its job smartly
>> for monolitic object files: place each function into the separate section
>> (gcc's "-ffunction-sections" or msvc's "-Gy" options) and then ask linker
>> to eliminate unused sections during the link stage. Can anything similar be
>> done with Ocamlopt compiler?
>>
>> Of course, placing each function into the separate section is not a problem -
>> modifications of the code generator would be minimal. The real problem are
>> the frame tables - the single table references all functions in the
>> module. Maybe they can be split and linked separately? What Ocaml
>> developers think of that?
>
> I have played with this idea myself, the problem is not only frametables
> but also the module header (which more or less contains pointers to all
> externally visible(don't take my word on it, been a while, might as well
> be ALL) symbols.

IMHO, each header item can be placed into the separate DATA section, so
it's not the real problem (the frame table is).

> All in all this would require quite an effort in restructuring almost
> everything. I wouldn't count on it.

Probably you are right, but I still hope for a miracle :-) 

- Dmitry Bely


  reply	other threads:[~2005-11-09 11:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-09 11:11 Dmitry Bely
2005-11-09 11:19 ` [Caml-list] " malc
2005-11-09 11:49   ` Dmitry Bely [this message]
2005-11-09 12:44     ` malc
2005-11-11 13:41       ` Florian Weimer
2005-11-11 15:29       ` Dmitry Bely

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