* environ is autofiltered from dll export list? @ 2006-05-24 7:38 Pedro Alves 2006-05-24 13:38 ` Dave Korn 0 siblings, 1 reply; 8+ messages in thread From: Pedro Alves @ 2006-05-24 7:38 UTC (permalink / raw) To: binutils Hi all, char** environ is explicitly disabled from dll exporting in pe-dll.c's autofilters. Why is it? I tried to look in the archives, back when the auto-importing was introduced, but couldn't find the rationale. Should every dll have its own environ? Also, while looking at it, why are _fmode, _impure_ptr, cygwin_attach_dll, cygwin_premain0, cygwin_premain1, cygwin_premain2, cygwin_premain3 and environ in the autofilter_symbolprefixlist[] instead of the autofilter_symbollist[]? Probably an oversight. Cheers, Pedro Alves from pe-dll.c: static autofilter_entry_type autofilter_symbolprefixlist[] = { { "__imp", 5 }, /* Do __imp_ explicitly to save time. */ (...) { "_impure_ptr", 11 }, { "cygwin_attach_dll", 17 }, { "cygwin_premain0", 15 }, { "cygwin_premain1", 15 }, { "cygwin_premain2", 15 }, { "cygwin_premain3", 15 }, { "environ", 7 }, { NULL, 0 } }; ^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: environ is autofiltered from dll export list? 2006-05-24 7:38 environ is autofiltered from dll export list? Pedro Alves @ 2006-05-24 13:38 ` Dave Korn 2006-05-24 14:33 ` Pedro Alves 0 siblings, 1 reply; 8+ messages in thread From: Dave Korn @ 2006-05-24 13:38 UTC (permalink / raw) To: 'Pedro Alves', binutils On 23 May 2006 22:02, Pedro Alves wrote: > Also, while looking at it, why are _fmode, _impure_ptr, > cygwin_attach_dll, cygwin_premain0, cygwin_premain1, cygwin_premain2, > cygwin_premain3 and environ in the autofilter_symbolprefixlist[] instead > of the autofilter_symbollist[]? Probably an oversight. Actually, it really suggests that "cygwin_premain" should be in the prefix list. The others should probably move to the symbol list as you suggest. cheers, DaveK -- Can't think of a witty .sigline today.... ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: environ is autofiltered from dll export list? 2006-05-24 13:38 ` Dave Korn @ 2006-05-24 14:33 ` Pedro Alves 2006-05-25 1:18 ` Christopher Faylor 0 siblings, 1 reply; 8+ messages in thread From: Pedro Alves @ 2006-05-24 14:33 UTC (permalink / raw) To: binutils Dave Korn wrote: > On 23 May 2006 22:02, Pedro Alves wrote: > > >> Also, while looking at it, why are _fmode, _impure_ptr, >> cygwin_attach_dll, cygwin_premain0, cygwin_premain1, cygwin_premain2, >> cygwin_premain3 and environ in the autofilter_symbolprefixlist[] instead >> of the autofilter_symbollist[]? Probably an oversight. >> > > Actually, it really suggests that "cygwin_premain" should be in the prefix > list. The others should probably move to the symbol list as you suggest. > > Ok, I can provide a patch for that, but I would like to understand the environ part of my question first. > char** environ is explicitly disabled from dll exporting in pe-dll.c's autofilters. Why is it? I tried to look in the archives, > back when the auto-importing was introduced, but couldn't find the rationale. > Should every dll have its own environ? I think this was needed when there was no auto-importing, and cygwin defined environ as __cygwin_environ: http://www.zsh.org/mla/workers/2000/msg03158.html Is it still needed? In that case I will have to conditionally compile out that part for arm-wince-pe target. Cheers, Pedro Alves ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: environ is autofiltered from dll export list? 2006-05-24 14:33 ` Pedro Alves @ 2006-05-25 1:18 ` Christopher Faylor 2006-05-25 3:18 ` Dave Korn 0 siblings, 1 reply; 8+ messages in thread From: Christopher Faylor @ 2006-05-25 1:18 UTC (permalink / raw) To: Pedro Alves, binutils On Wed, May 24, 2006 at 01:55:53PM +0100, Pedro Alves wrote: >Dave Korn wrote: >>On 23 May 2006 22:02, Pedro Alves wrote: >> >> >>>Also, while looking at it, why are _fmode, _impure_ptr, >>>cygwin_attach_dll, cygwin_premain0, cygwin_premain1, cygwin_premain2, >>>cygwin_premain3 and environ in the autofilter_symbolprefixlist[] instead >>>of the autofilter_symbollist[]? Probably an oversight. >>> >> >> Actually, it really suggests that "cygwin_premain" should be in the >> prefix >>list. The others should probably move to the symbol list as you suggest. >> >> >Ok, I can provide a patch for that, but I would like to understand the >environ part of my question first. > >> char** environ is explicitly disabled from dll exporting in >pe-dll.c's autofilters. Why is it? I tried to look in the archives, >> back when the auto-importing was introduced, but couldn't find the >rationale. >> Should every dll have its own environ? > >I think this was needed when there was no auto-importing, and cygwin >defined environ as __cygwin_environ: >http://www.zsh.org/mla/workers/2000/msg03158.html > >Is it still needed? In that case I will have to conditionally compile >out that part for arm-wince-pe target. Are you asking if cygwin still exports environ as __cygwin_environ? If so, then the answer is "yes". cgf ^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: environ is autofiltered from dll export list? 2006-05-25 1:18 ` Christopher Faylor @ 2006-05-25 3:18 ` Dave Korn 2006-05-25 22:49 ` Pedro Alves 0 siblings, 1 reply; 8+ messages in thread From: Dave Korn @ 2006-05-25 3:18 UTC (permalink / raw) To: 'Christopher Faylor', 'Pedro Alves', binutils On 24 May 2006 17:20, Christopher Faylor wrote: > On Wed, May 24, 2006 at 01:55:53PM +0100, Pedro Alves wrote: >> Dave Korn wrote: >>> On 23 May 2006 22:02, Pedro Alves wrote: >> Ok, I can provide a patch for that, but I would like to understand the >> environ part of my question first. Can't say I understand what it's need for myself, but ... >>> char** environ is explicitly disabled from dll exporting in >> pe-dll.c's autofilters. Why is it? I tried to look in the archives, >>> back when the auto-importing was introduced, but couldn't find the >>> rationale. Should every dll have its own environ? >> >> I think this was needed when there was no auto-importing, and cygwin >> defined environ as __cygwin_environ: >> http://www.zsh.org/mla/workers/2000/msg03158.html >> >> Is it still needed? In that case I will have to conditionally compile >> out that part for arm-wince-pe target. > > Are you asking if cygwin still exports environ as __cygwin_environ? If > so, then the answer is "yes". > > cgf ... since it's still needed, you will indeed have to disable it for arm-wince-pe. However, you shouldn't conditionally compile it out, because that's the kind of non-multi-arch borkenness that we want to avoid; using "#ifdef" in binutils makes --enable-targets=all fall down in very mysterious and hard-to-isolate ways! Take a look at pe_dll_id_target; you could add a flag in the pe_details_type entries that control which arches use which autofilter names. Or you could do it the other way round, and add flags to autofilter_entry_type to tell it which arches should use or ignore that particular entry. cheers, DaveK -- Can't think of a witty .sigline today.... ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: environ is autofiltered from dll export list? 2006-05-25 3:18 ` Dave Korn @ 2006-05-25 22:49 ` Pedro Alves 2006-06-23 12:16 ` Nick Clifton 0 siblings, 1 reply; 8+ messages in thread From: Pedro Alves @ 2006-05-25 22:49 UTC (permalink / raw) To: Dave Korn; +Cc: 'Christopher Faylor', binutils 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 <pedro_alves@portugalmail.pt> * 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) ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: environ is autofiltered from dll export list? 2006-05-25 22:49 ` Pedro Alves @ 2006-06-23 12:16 ` Nick Clifton 2006-06-23 14:01 ` Pedro Alves 0 siblings, 1 reply; 8+ messages in thread From: Nick Clifton @ 2006-06-23 12:16 UTC (permalink / raw) To: Pedro Alves; +Cc: Dave Korn, 'Christopher Faylor', binutils Hi Pedro, > 2006-04-14 Pedro Alves <pedro_alves@portugalmail.pt> > > * 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. Approved and applied. I am sorry it took me so long to get rounding to reviewing and applying this patch. Cheers Nick ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: environ is autofiltered from dll export list? 2006-06-23 12:16 ` Nick Clifton @ 2006-06-23 14:01 ` Pedro Alves 0 siblings, 0 replies; 8+ messages in thread From: Pedro Alves @ 2006-06-23 14:01 UTC (permalink / raw) To: Nick Clifton; +Cc: binutils Nick Clifton wrote: > Hi Pedro, > >> 2006-04-14 Pedro Alves <pedro_alves@portugalmail.pt> >> >> * 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. > > > Approved and applied. > > I am sorry it took me so long to get rounding to reviewing and > applying this patch. Thank you Nick. Cheers, Pedro Alves ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2006-06-23 12:16 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-05-24 7:38 environ is autofiltered from dll export list? Pedro Alves 2006-05-24 13:38 ` Dave Korn 2006-05-24 14:33 ` Pedro Alves 2006-05-25 1:18 ` Christopher Faylor 2006-05-25 3:18 ` Dave Korn 2006-05-25 22:49 ` Pedro Alves 2006-06-23 12:16 ` Nick Clifton 2006-06-23 14:01 ` Pedro Alves
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 read-only IMAP folder(s) and NNTP newsgroup(s).