From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 7D654BB9A for ; Wed, 9 Nov 2005 12:49:42 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jA9Bngmw008594 for ; Wed, 9 Nov 2005 12:49:42 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA09684 for ; Wed, 9 Nov 2005 12:49:41 +0100 (MET) Received: from mx2.mail.ru (mx2.mail.ru [194.67.23.122]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id jA9Bnf0q028102 for ; Wed, 9 Nov 2005 12:49:41 +0100 Received: from [198.252.201.22] (port=22098 helo=bely) by mx2.mail.ru with asmtp id 1EZoSO-0008Av-00 for caml-list@inria.fr; Wed, 09 Nov 2005 14:49:38 +0300 X-Comment-To: malc To: caml-list@inria.fr Subject: Re: [Caml-list] No unused code linking? References: From: Dmitry Bely Date: Wed, 09 Nov 2005 14:49:29 +0300 In-Reply-To: (malc@pulsesoft.com's message of "Wed, 9 Nov 2005 14:19:55 +0300 (MSK)") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.5 (chayote, windows-nt) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at nez-perce with ID 4371E256.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 4371E255.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 malc:01 malc:01 pulsesoft:01 stdlib:01 otherlibs:01 gcc's:01 ocamlopt:01 compiler:01 ocaml:01 pointers:01 externally:01 -gy:98 writes:01 imho:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 malc 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