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]

Fix for pe.em


Hi Guys,

  I am checking the following patch in under the obviously correct
  rule.

  In pe.em the variable 'pe_dll_search_prefix' is created only if
  DLL_SUPPORT is defined, but there was a section of code in
  _open_dynamic_archive that was using this variable without being
  protected by a #ifdef.  The patch adds that protection.

  The patch also removes a couple of unused local variables, in order
  to reduce the number of warnings when the file is compiled.

Cheers
	Nick

2000-10-13  Nick Clifton  <nickc@redhat.com>

	* emultempl/pe.em (_after_open): Delete 'is2' and 'nsyms'
	local variables - they are not used.
	(_open_dynamic_archive): Add #ifdef DLL_SUPPORT around use of
	pe_dll_search_prefix.

Index: pe.em
===================================================================
RCS file: /cvs/src//src/ld/emultempl/pe.em,v
retrieving revision 1.34
diff -p -w -r1.34 pe.em
*** pe.em	2000/10/12 19:18:20	1.34
--- pe.em	2000/10/13 20:09:58
*************** gld_${EMULATION_NAME}_after_open ()
*** 823,830 ****
  #endif
  
    {
-     lang_input_statement_type *is2;
- 
      /* This next chunk of code tries to detect the case where you have
         two import libraries for the same DLL (specifically,
         symbolically linking libm.a and libc.a in cygwin to
--- 823,828 ----
*************** gld_${EMULATION_NAME}_after_open ()
*** 859,866 ****
  		    int i;
  		    int symsize = bfd_get_symtab_upper_bound (is->the_bfd);
  		    asymbol **symbols = (asymbol **) xmalloc (symsize);
- 		    int nsyms = bfd_canonicalize_symtab (is->the_bfd, symbols);
- 
  		    int relsize = bfd_get_reloc_upper_bound (is->the_bfd, sec);
  		    arelent **relocs = (arelent **) xmalloc ((size_t) relsize);
  		    int nrelocs = bfd_canonicalize_reloc (is->the_bfd, sec,
--- 857,862 ----
*************** gld_${EMULATION_NAME}_open_dynamic_archi
*** 1461,1467 ****
--- 1457,1465 ----
    string = (char *) xmalloc (strlen (search->name)
                               + strlen (filename) 
                               + sizeof "/lib.a.dll"
+ #ifdef DLL_SUPPORT
                               + (pe_dll_search_prefix ? strlen (pe_dll_search_prefix) : 0)
+ #endif
                               + 1);
  
    /* Try "libfoo.dll.a" first (preferred explicit import library for dll's */
*************** gld_${EMULATION_NAME}_open_dynamic_archi
*** 1489,1495 ****
            sprintf (string, "%s/lib%s.a", search->name, filename);
            if (! ldfile_try_open_bfd (string, entry))
              {
! 
                if ( pe_dll_search_prefix )
                  {  
                    /* Try "<prefix>foo.dll" (preferred dll name, if specified) */
--- 1487,1493 ----
            sprintf (string, "%s/lib%s.a", search->name, filename);
            if (! ldfile_try_open_bfd (string, entry))
              {
! #ifdef DLL_SUPPORT
                if (pe_dll_search_prefix)
                  {  
                    /* Try "<prefix>foo.dll" (preferred dll name, if specified) */
*************** gld_${EMULATION_NAME}_open_dynamic_archi
*** 1511,1516 ****
--- 1509,1515 ----
                      }
                  }
                else /* pe_dll_search_prefix not specified */
+ #endif		
                  {
                    /* Try "libfoo.dll" (preferred dll name) */
                    sprintf (string, "%s/lib%s.dll", search->name, filename);
*************** gld_${EMULATION_NAME}_open_dynamic_archi
*** 1524,1531 ****
                            return false;
                          }
                      }
!                 } /* if (pe_dll_search_prefix) */
! 					 
              }
          }
      }
--- 1523,1529 ----
                            return false;
                          }
                      }
!                 }
              }
          }
      }

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