www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-apps/2002/04/25/05:35:36

Mailing-List: contact cygwin-apps-help AT cygwin DOT com; run by ezmlm
Sender: cygwin-apps-owner AT cygwin DOT com
List-Subscribe: <mailto:cygwin-apps-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-apps/>
List-Post: <mailto:cygwin-apps AT cygwin DOT com>
List-Help: <mailto:cygwin-apps-help AT cygwin DOT com>, <http://sources.redhat.com/lists.html#faqs>
Mail-Followup-To: cygwin-apps AT cygwin DOT com
Delivered-To: mailing list cygwin-apps AT cygwin DOT com
From: "Ralf Habacker" <Ralf DOT Habacker AT freenet DOT de>
To: "Kde-Cygwin" <kde-cygwin AT kde DOT org>,
"Binutils" <binutils AT sources DOT redhat DOT com>,
"Cygwin-Apps" <cygwin-apps AT cygwin DOT com>
Subject: cygwin ld import library issue fix (removing unused "_nm_" symbols)
Date: Thu, 25 Apr 2002 11:32:44 +0200
Message-ID: <001101c1ec3c$27465c40$651c440a@BRAMSCHE>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400

Hi,
this patch fixes an cygwin ld issue (GNU ld version 2.11.92 20011001) I've
encountered while analysing the runtime linking performance for kde.

Background:

The ld-auto-import stuff introduces additional symbols (_nm_...) in the import
library which are only needed for data exports.
Unfortunally this symbols are generated for every export.
Additional ld rexports imported "_nm_" symbols from other dlls, so one get
symbols like "_nm___nm__scanf" for example.

One can say this isn't a real problem and the answer is yes ... for little
dll's.
But if you look in the below mentioned import libraries, one can save about 30%
of the import libraries size.
For the kde 2.2.2 devel libs and base package this would save about 26MB.
And this seems to be a fact for applying this fix.

without patch
-rwxrwxrwx    1 1002     Kein      3190016 Apr 20 19:12 libkdecore.dll.a
-rwxrwxrwx    1 1002     Kein         7526 Apr 20 19:01 libkdefakes.dll.a
-rwxrwxrwx    1 1002     Kein      5693370 Apr 20 01:16 libkdeui.dll.a


with patch
-rwxrwxrwx    1 1002     Kein      2126660 Apr 25 10:48 libkdecore.dll.a
-rwxrwxrwx    1 1002     Kein         1448 Apr 25 10:45 libkdefakes.dll.a
-rwxrwxrwx    1 1002     Kein      3622512 Apr 25 11:06 libkdeui.dll.a


$ diff pe-dll.c.orig pe-dll.c -ubBp
--- pe-dll.c.orig       Wed Apr 24 09:48:59 2002
+++ pe-dll.c    Thu Apr 25 08:33:08 2002
@@ -248,6 +250,8 @@ static autofilter_entry_type autofilter_
   /* Do __imp_ explicitly to save time.  */
   { "__rtti_", 7 },
   { "__builtin_", 10 },
+  // RH: prevent generating reimported functions
+  { "_nm_", 4 },
   /* Don't export symbols specifying internal DLL layout.  */
   { "_head_", 6 },
   { "_fmode", 6 },
@@ -1789,6 +1793,8 @@ make_one (exp, parent)
   quick_symbol (abfd, U ("_imp__"), exp->internal_name, "", id5, BSF_GLOBAL,
0);
   /* Symbol to reference ord/name of imported
      symbol, used to implement auto-import.  */
+  /* RH: only for auto-imported data */
+  if (exp->flag_data)
   quick_symbol (abfd, U("_nm__"), exp->internal_name, "", id6, BSF_GLOBAL, 0);
   if (pe_dll_compat_implib)
     quick_symbol (abfd, U ("__imp_"), exp->internal_name, "",

Any comments ?

Regards
Ralf Habacker


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019