The runtime linker needs to include a path to itself in the link map

it exports to the debugger.  It currently has two choices: it can use
a compiled-in path (/libexec/ld-elf.so.1) or it can use the path stored
in the interpreter path in the binary being executed.  The runtime linker
currently prefers the second.  However, this is usually wrong for compat32
binaries since the binary specifies the path of rtld on a 32-bit system
(/libexec/ld-elf.so.1) instead of the actual path (/libexec/ld-elf32.so.1).
For now, always assume the compiled in path (/libexec/ld-elf32.so.1) as
the rtld path and ignore the path in the binary for the 32-bit runtime
linker.

Differential Revision:	https://reviews.freebsd.org/D1236
Reviewed by:	kib
This commit is contained in:
John Baldwin 2014-12-02 16:22:08 +00:00
parent 3047cb6803
commit 9abeb029d4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=275412

View File

@ -503,6 +503,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
aux_info[AT_STACKPROT]->a_un.a_val != 0)
stack_prot = aux_info[AT_STACKPROT]->a_un.a_val;
#ifndef COMPAT_32BIT
/*
* Get the actual dynamic linker pathname from the executable if
* possible. (It should always be possible.) That ensures that
@ -515,6 +516,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
obj_rtld.path = xstrdup(obj_main->interp);
__progname = obj_rtld.path;
}
#endif
digest_dynamic(obj_main, 0);
dbg("%s valid_hash_sysv %d valid_hash_gnu %d dynsymcount %d",