ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: devel@altlinux.ru
Subject: [devel] Re: verify_elfsym
Date: Wed, 21 Sep 2005 19:05:43 +0400
Message-ID: <20050921150543.GD20965@solemn.turbinal.org> (raw)
In-Reply-To: <20050921111727.GH1848@solemn.turbinal.org>

[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]

On Wed, Sep 21, 2005 at 03:17:27PM +0400, Alexey Tourbin wrote:
> Вот упрощенная реализация проверки ELF'ов, как я её себе представляю.
> 	err="$(ldd -r "$elf" 2>&1 1>/dev/null)" || return

Я пришел к выводу, что `ldd -r' не очень хорошо подходит для этой
проверки.  Есть несколько проблем, связанных со спецификой проверки
в %buildroot.  В частности, ldd не позволяет "перебить" rpath.

Вот альтернативная реализация `ldd -r'.

RTLD=/lib/ld-linux.so.2
RTLD_libpath=/lib:/usr/lib:/usr/X11R6/lib

elf1_libpath()
{
	local elf="$1"
	local libpath="$RTLD_libpath"
	[ -z "$LD_LIBRARY_PATH" ] ||
		libpath="$LD_LIBRARY_PATH:$libpath"
	[ -z "$RPM_FINDPROV_LIB_PATH" ] ||
		libpath="$RPM_FINDPROV_LIB_PATH:$libpath"
	local info= rpath=
	info="$(objdump -p "$elf")" || return
	rpath="$(echo "$info" |awk '($1=="RPATH"){printf "%s:", $2}')"
	[ -z "$rpath" ] ||
		libpath="$rpath$libpath"
	if [ -n "$RPM_BUILD_ROOT" ]; then
		local BR_libpath= path= IFS=:
		for path in $libpath; do
			BR_libpath="$BR_libpath:$RPM_BUILD_ROOT$path"
		done
		libpath="${BR_libpath#:}:$libpath"
	fi
	[ "$libpath" = "$RTLD_libpath" ] ||
		echo "${libpath%%:$RTLD_libpath}"
}

elf1_ldd()
{
	local elf="$1" libpath=
	libpath="$(elf1_libpath "$elf")" || return
	LD_TRACE_LOADED_OBJECTS=1 LD_WARN=yes LD_BIND_NOW=yes LD_VERBOSE= \
		"$RTLD" --library-path "$libpath" --inhibit-rpath "$elf" "$elf"
}


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2005-09-21 15:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-21 11:17 [devel] verify_elfsym Alexey Tourbin
2005-09-21 12:18 ` [devel] verify_elfsym Alexey Tourbin
2005-09-21 15:05 ` Alexey Tourbin [this message]
2005-09-21 16:57   ` Alexey Tourbin
2005-09-21 17:16     ` Dmitry V. Levin
2005-09-21 17:57       ` Alexey Tourbin
2005-09-21 18:06         ` Alexey Tourbin
2005-09-21 20:24         ` Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050921150543.GD20965@solemn.turbinal.org \
    --to=at@altlinux.ru \
    --cc=devel@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git