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]

ELF runpath handling


Hi there, 

I've found the problem of ELF runpath handling.

My environment is cross target sh-unknown-linux-gnu (host is
i686-linux-gnu).  Linker aborts in objalloc_free_block, because
the memory allocated with different BFD is released.

The process is:
   libc.so (RPATH=/lib) + libpthreads.so (RPATH=/lib, RUNPATH=/lib)
     ===> librt.so 

When handling libpthreads.so's RUNPATH, it releases the memory
allocated for libc.so's RPATH.

Here's the patch to point out the issue.  It's not the solution, 
obviously.  Perhaps, it should be allocated by bfd_malloc?

--- binutils-000925/bfd/elflink.h~	Fri Aug 25 02:41:40 2000
+++ binutils-000925/bfd/elflink.h	Fri Sep 29 19:11:00 2000
@@ -1194,6 +1194,8 @@ elf_link_add_object_symbols (abfd, info)
 		     to free runpath. */
 		  if (rpath && elf_hash_table (info)->runpath)
 		    {
+#if 0
+/* XXX: The memory for RUNPATH might be allocated with different ABFD */
 		      struct bfd_link_needed_list *nn;
 		      for (n = elf_hash_table (info)->runpath;
 			   n != NULL; n = nn)
@@ -1202,6 +1204,7 @@ elf_link_add_object_symbols (abfd, info)
 			  bfd_release (abfd, n);
 			}
 		      bfd_release (abfd, elf_hash_table (info)->runpath);
+#endif
 		      elf_hash_table (info)->runpath = NULL;
 		    }
 
-- 

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