From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32017 invoked by alias); 25 May 2006 15:39:06 -0000 Received: (qmail 31907 invoked from network); 25 May 2006 15:38:55 -0000 Received: from unknown (195.23.133.211) by sourceware.org with QMTP; 25 May 2006 15:38:55 -0000 Received: (qmail 23220 invoked from network); 25 May 2006 15:38:54 -0000 Received: from unknown (HELO mailfrt06.isp.novis.pt) ([195.23.133.198]) (envelope-sender ) by mailrly01.isp.novis.pt with compressed SMTP; 25 May 2006 15:38:54 -0000 Received: (qmail 7568 invoked from network); 25 May 2006 15:19:54 -0000 Received: from unknown (HELO mamas-laptop) ([195.23.225.165]) (envelope-sender ) by mailfrt06.isp.novis.pt with SMTP; 25 May 2006 15:19:54 -0000 Received: from localhost ([127.0.0.1]) by mamas-laptop with esmtp (Exim 4.62) (envelope-from ) id IZTUKN-0003Q4-R0; Thu, 25 May 2006 16:19:36 +0100 Message-ID: <4475CB05.50804@portugalmail.pt> Date: Thu, 25 May 2006 22:49:00 -0000 From: Pedro Alves User-Agent: Thunderbird 1.5.0.2 (Windows/20060308) MIME-Version: 1.0 To: Dave Korn CC: 'Christopher Faylor' , binutils@sourceware.org Subject: Re: environ is autofiltered from dll export list? References: <052601c67f54$bb352300$a501a8c0@CAM.ARTIMI.COM> In-Reply-To: <052601c67f54$bb352300$a501a8c0@CAM.ARTIMI.COM> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 0621-3, 24-05-2006), Outbound message X-Antivirus-Status: Clean X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00465.txt.bz2 Here is a patch that takes the minimal changes try to not break what I know nil about route. It adds a new member to pe_details_type, and splits the autofilter_symbollist into two: one the i386 case, and another one for all the others. I don't think there is any target other than i386-cygwin/i386-mingw that needs those symbols excluded. There are some symbols/prefixes/libs that don't make sense excluding for some targets, but since all has worked well this far as it is now, I think we should fix these lists incrementally as need arises. I moved those cygwin_premain* and cygwin_attach_dll symbols from the prefix list into the symbol list, but I'm not sure if they were put there in the first place because of stdcall decoration. If there are problems with that change, we can just leave them where they are now, since they are cygwin_ prefixed. Comments? Cheers, Pedro Alves ---- 2006-04-14 Pedro Alves * pe-dll.c (pe_details_type): Add new pointer for symbols list autofilter. (autofilter_symbollist): Split into autofilter_symbollist_generic and autofilter_symbollist_i386. (pe_detail_list): Add autofilter_symbollist_i386 to i386 case and autofilter_symbollist_generic for all the others. (autofilter_symbolprefixlist): Moved _fmode, _impure_ptr, cygwin_attach_dll, cygwin_premain0, cygwin_premain1, cygwin_premain2, cygwin_premain3, environ, into autofilter_symbollist_i386. (auto_export): Get autofilter_symbollist from pe_details. Index: ld/pe-dll.c =================================================================== RCS file: /cvs/src/src/ld/pe-dll.c,v retrieving revision 1.84 diff -u -p -r1.84 pe-dll.c --- ld/pe-dll.c 11 May 2006 08:48:58 -0000 1.84 +++ ld/pe-dll.c 25 May 2006 14:44:22 -0000 @@ -144,9 +144,17 @@ static size_t edata_sz, reloc_sz; static int runtime_pseudo_relocs_created = 0; typedef struct +{ + char *name; + int len; +} +autofilter_entry_type; + +typedef struct { char *target_name; char *object_target; + autofilter_entry_type* autofilter_symbollist; unsigned int imagebase_reloc; int pe_arch; int bfd_arch; @@ -154,24 +162,21 @@ typedef struct } pe_details_type; -typedef struct - { - char *name; - int len; - } -autofilter_entry_type; - #define PE_ARCH_i386 1 #define PE_ARCH_sh 2 #define PE_ARCH_mips 3 #define PE_ARCH_arm 4 #define PE_ARCH_arm_epoc 5 +static autofilter_entry_type autofilter_symbollist_generic[]; +static autofilter_entry_type autofilter_symbollist_i386[]; + static pe_details_type pe_detail_list[] = { { "pei-i386", "pe-i386", + autofilter_symbollist_i386, 7 /* R_IMAGEBASE */, PE_ARCH_i386, bfd_arch_i386, @@ -180,6 +185,7 @@ static pe_details_type pe_detail_list[] { "pei-shl", "pe-shl", + autofilter_symbollist_generic, 16 /* R_SH_IMAGEBASE */, PE_ARCH_sh, bfd_arch_sh, @@ -188,6 +194,7 @@ static pe_details_type pe_detail_list[] { "pei-mips", "pe-mips", + autofilter_symbollist_generic, 34 /* MIPS_R_RVA */, PE_ARCH_mips, bfd_arch_mips, @@ -196,6 +203,7 @@ static pe_details_type pe_detail_list[] { "pei-arm-little", "pe-arm-little", + autofilter_symbollist_generic, 11 /* ARM_RVA32 */, PE_ARCH_arm, bfd_arch_arm, @@ -204,32 +212,54 @@ static pe_details_type pe_detail_list[] { "epoc-pei-arm-little", "epoc-pe-arm-little", + autofilter_symbollist_generic, 11 /* ARM_RVA32 */, PE_ARCH_arm_epoc, bfd_arch_arm, 0 }, - { NULL, NULL, 0, 0, 0, 0 } + { NULL, NULL, NULL, 0, 0, 0, 0 } }; static pe_details_type *pe_details; -static autofilter_entry_type autofilter_symbollist[] = +static autofilter_entry_type autofilter_symbollist_generic[] = { + { ".text", 5 }, + /* entry point symbols */ { "DllMain", 7 }, { "DllMainCRTStartup", 17 }, { "_DllMainCRTStartup", 18 }, + /* runtime pseudo-reloc */ + { "_pei386_runtime_relocator", 25 }, + { "do_pseudo_reloc", 15 }, + { NULL, 0 } +}; + +static autofilter_entry_type autofilter_symbollist_i386[] = +{ + { ".text", 5 }, + /* entry point symbols, and entry hooks */ + { "cygwin_crt0", 11 }, { "DllMain@12", 10 }, { "DllEntryPoint@0", 15 }, { "DllMainCRTStartup@12", 20 }, { "_cygwin_dll_entry@12", 20 }, { "_cygwin_crt0_common@8", 21 }, { "_cygwin_noncygwin_dll_entry@12", 30 }, - { "impure_ptr", 10 }, + { "cygwin_attach_dll", 17 }, + { "cygwin_premain0", 15 }, + { "cygwin_premain1", 15 }, + { "cygwin_premain2", 15 }, + { "cygwin_premain3", 15 }, + /* runtime pseudo-reloc */ { "_pei386_runtime_relocator", 25 }, { "do_pseudo_reloc", 15 }, - { "cygwin_crt0", 11 }, - { ".text", 5 }, + /* global vars that should not be exported */ + { "impure_ptr", 10 }, + { "_impure_ptr", 11 }, + { "_fmode", 6 }, + { "environ", 7 }, { NULL, 0 } }; @@ -275,14 +305,6 @@ static autofilter_entry_type autofilter_ { "__builtin_", 10 }, /* Don't export symbols specifying internal DLL layout. */ { "_head_", 6 }, - { "_fmode", 6 }, - { "_impure_ptr", 11 }, - { "cygwin_attach_dll", 17 }, - { "cygwin_premain0", 15 }, - { "cygwin_premain1", 15 }, - { "cygwin_premain2", 15 }, - { "cygwin_premain3", 15 }, - { "environ", 7 }, { NULL, 0 } }; @@ -452,7 +474,7 @@ auto_export (bfd *abfd, def_file *d, con it is too restrictive. */ /* Then, exclude specific symbols. */ - afptr = autofilter_symbollist; + afptr = pe_details->autofilter_symbollist; while (afptr->name) { if (strcmp (n, afptr->name) == 0)