From: Ivo Raisr Date: Mon, 17 Aug 2015 19:13:12 +0000 (+0000) Subject: Runtime linker ld.so.1 can be now run under Valgrind on Solaris. X-Git-Tag: svn/VALGRIND_3_11_0~95 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=707501d444edb9519790fee1cc2f5d1755a3cf95;p=thirdparty%2Fvalgrind.git Runtime linker ld.so.1 can be now run under Valgrind on Solaris. Fixes BZ#351386. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15562 --- diff --git a/NEWS b/NEWS index 6d661f9082..2c2ea7ca47 100644 --- a/NEWS +++ b/NEWS @@ -306,6 +306,7 @@ where XXXXXX is the bug number as listed below. 350813 Use handwritten memcheck assembly helpers on x86/Solaris in addition to {arm,x86}-linux 350854 hard-to-understand code in VG_(load_ELF)() 351140 arm64 syscalls setuid (146) and setresgid (149) not implemented +351386 Cannot run ld.so.1 under Valgrind n-i-bz Provide implementations of certain compiler builtins to support compilers who may not provide those n-i-bz Old STABS code is still being compiled, but never used. Remove it. diff --git a/coregrind/m_initimg/initimg-solaris.c b/coregrind/m_initimg/initimg-solaris.c index 4db11a87fa..49e4981e6a 100644 --- a/coregrind/m_initimg/initimg-solaris.c +++ b/coregrind/m_initimg/initimg-solaris.c @@ -367,7 +367,7 @@ static Addr setup_client_stack(void *init_sp, AT_SUN_PLATFORM AT_SUN_EXECNAME - AT_PHDR + AT_PHDR (not for elfs with no PT_PHDR, such as ld.so.1) AT_BASE AT_FLAGS AT_PAGESZ @@ -538,7 +538,7 @@ static Addr setup_client_stack(void *init_sp, auxv++; /* AT_PHDR */ - if (info->phdr) { + if ((info->real_phdr_present) && (info->phdr != 0)) { auxv->a_type = VKI_AT_PHDR; auxv->a_un.a_val = info->phdr; auxv++; diff --git a/coregrind/m_ume/elf.c b/coregrind/m_ume/elf.c index 93f28de315..af84fae1b0 100644 --- a/coregrind/m_ume/elf.c +++ b/coregrind/m_ume/elf.c @@ -350,6 +350,11 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info) if (ebase < hacky_load_address) ebase = hacky_load_address; # endif + +# if defined(VGO_solaris) + /* Record for later use in AT_BASE. */ + info->interp_offset = ebase; +# endif } info->phnum = e->e.e_phnum; @@ -363,6 +368,9 @@ Int VG_(load_ELF)(Int fd, const HChar* name, /*MOD*/ExeInfo* info) switch(ph->p_type) { case PT_PHDR: info->phdr = ph->p_vaddr + ebase; +# if defined(VGO_solaris) + info->real_phdr_present = True; +# endif break; case PT_LOAD: diff --git a/coregrind/pub_core_ume.h b/coregrind/pub_core_ume.h index d9f64918c8..2fe97aa635 100644 --- a/coregrind/pub_core_ume.h +++ b/coregrind/pub_core_ume.h @@ -65,7 +65,8 @@ typedef #endif #if defined(VGO_solaris) - Addr init_thrptr; // OUT: architecture-specific user per-thread location + Addr init_thrptr; // OUT: architecture-specific user per-thread location + Bool real_phdr_present; // OUT: PT_PHDR found, include phdr in auxv #endif Addr entry; // OUT: entrypoint in main executable