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]

Re: Patch: Re: bug in ld -rpath ??



I have tracked down the bug that stopped your patches from working for me in
my build environment.  In function gldelf_i386_after_open in file
eelf_i386.c near the top, there is the statement:

  run_path = bfd_elf_get_runpath_list (output_bfd, &link_info);

Later, run_path is searched.  Unfortunately, if run_path is NULL and a call
to gldelf_i386_search_needed results in a library being read, the contents
of

    bfd_elf_get_runpath_list (output_bfd, &link_info)

can be set to contain a non-NULL runpath, making the local run_path variable
invalid.  Hence, run_path should be set right before it is used.

				bob

====================

*** eelf_i386.c.orig	Tue Aug 22 19:21:23 2000
--- eelf_i386.c	Tue Aug 22 19:21:31 2000
***************
*** 250,256 ****
  static void
  gldelf_i386_after_open ()
  {
!   struct bfd_link_needed_list *needed, *l, *run_path;
  
    /* We only need to worry about this when doing a final link.  */
    if (link_info.relocateable || link_info.shared)
--- 250,256 ----
  static void
  gldelf_i386_after_open ()
  {
!   struct bfd_link_needed_list *needed, *l;
  
    /* We only need to worry about this when doing a final link.  */
    if (link_info.relocateable || link_info.shared)
***************
*** 266,272 ****
       needed list can actually grow while we are stepping through this
       loop.  */
    needed = bfd_elf_get_needed_list (output_bfd, &link_info);
-   run_path = bfd_elf_get_runpath_list (output_bfd, &link_info);
    for (l = needed; l != NULL; l = l->next)
      {
        struct bfd_link_needed_list *ll, *rp;
--- 266,271 ----
***************
*** 303,308 ****
--- 302,308 ----
  	  const char *lib_path;
  	  size_t len;
  	  search_dirs_type *search;
+ 	  struct bfd_link_needed_list *run_path;
  
  	  if (gldelf_i386_search_needed (command_line.rpath_link,
  						  l->name, force))
***************
*** 323,328 ****
--- 323,329 ----
  	    break;
  
  	  found = 0;
+ 	  run_path = bfd_elf_get_runpath_list (output_bfd, &link_info);
  	  for (rp = run_path; !found && rp != NULL; rp = rp->next)
  	    {
  	      found = (rp->by == l->by


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