public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <pedro_alves@portugalmail.pt>
To: Dave Korn <dave.korn@artimi.com>
Cc: 'Christopher Faylor' <me@cgf.cx>,  binutils@sourceware.org
Subject: Re: environ is autofiltered from dll export list?
Date: Thu, 25 May 2006 22:49:00 -0000	[thread overview]
Message-ID: <4475CB05.50804@portugalmail.pt> (raw)
In-Reply-To: <052601c67f54$bb352300$a501a8c0@CAM.ARTIMI.COM>

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)




  reply	other threads:[~2006-05-25 15:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-24  7:38 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 [this message]
2006-06-23 12:16           ` Nick Clifton
2006-06-23 14:01             ` Pedro Alves

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=4475CB05.50804@portugalmail.pt \
    --to=pedro_alves@portugalmail.pt \
    --cc=binutils@sourceware.org \
    --cc=dave.korn@artimi.com \
    --cc=me@cgf.cx \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).