This is the mail archive of the
mailing list for the binutils project.
ELF runpath handling
- To: binutils at sources dot redhat dot com
- Subject: ELF runpath handling
- From: NIIBE Yutaka <gniibe at chroot dot org>
- Date: Fri, 29 Sep 2000 19:36:56 +0900
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)
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)
+/* 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);
elf_hash_table (info)->runpath = NULL;