This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: environ is autofiltered from dll export list?


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)





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]