This is the mail archive of the binutils@sources.redhat.com 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: LoadLibrary may fail if DLL is built with gcc -shared


Hi Fabrizio,

>> Please could you try applying the attached (untested) patch,

> I tried it, but unfortunately the result is the same. However, I
> wrote another patch. According to the few tests I've made, it seems
> to work. It can be summarized as:
>
> pe-dll.c (fill_edata): scan table pe_dll->exports, which is sorted
> alphabetically, instead of exported_symbols, which is sorted by ordinal

Thanks very much.  I have applied your patch, together with an
extended comment, to pe-dll.c

Cheers
        Nick

2003-06-02  Fabrizio Gennari  <fabrizio.ge@tiscalinet.it>

	* pe-dll.c (fill_edata): Scan table pe_dll->exports, which is
	sorted alphabetically, instead of exported_symbols, which is
	sorted by ordinal.

Index: ld/pe-dll.c
===================================================================
RCS file: /cvs/src/src/ld/pe-dll.c,v
retrieving revision 1.56
diff -c -3 -p -r1.56 pe-dll.c
*** ld/pe-dll.c	2 Apr 2003 17:39:24 -0000	1.56
--- ld/pe-dll.c	2 Jun 2003 08:37:59 -0000
*************** fill_edata (abfd, info)
*** 959,965 ****
       bfd *abfd;
       struct bfd_link_info *info ATTRIBUTE_UNUSED;
  {
!   int i, hint;
    unsigned char *edirectory;
    unsigned long *eaddresses;
    unsigned long *enameptrs;
--- 959,965 ----
       bfd *abfd;
       struct bfd_link_info *info ATTRIBUTE_UNUSED;
  {
!   int s, hint;
    unsigned char *edirectory;
    unsigned long *eaddresses;
    unsigned long *enameptrs;
*************** fill_edata (abfd, info)
*** 1000,1012 ****
  
    fill_exported_offsets (abfd, info);
  
!   /* Ok, now for the filling in part.  */
    hint = 0;
!   for (i = 0; i < export_table_size; i++)
      {
!       int s = exported_symbols[i];
! 
!       if (s != -1)
  	{
  	  struct sec *ssec = exported_symbol_sections[s];
  	  unsigned long srva = (exported_symbol_offsets[s]
--- 1000,1015 ----
  
    fill_exported_offsets (abfd, info);
  
!   /* Ok, now for the filling in part.
!      Scan alphabetically - ie the ordering in the exports[] table,
!      rather than by ordinal - the ordering in the exported_symbol[]
!      table.  See dlltool.c and:
!         http://sources.redhat.com/ml/binutils/2003-04/msg00379.html
!      for more information.  */  
    hint = 0;
!   for (s = 0; s < NE; s++)
      {
!       if (pe_def_file->exports[s].ordinal != -1)
  	{
  	  struct sec *ssec = exported_symbol_sections[s];
  	  unsigned long srva = (exported_symbol_offsets[s]


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