ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] rpmelfsymv
Date: Sun, 13 Aug 2006 20:59:15 +0400
Message-ID: <20060813165915.GQ24054@localhost.localdomain> (raw)
In-Reply-To: <20060808231659.GA11505@basalt.office.altlinux.org>

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

On Wed, Aug 09, 2006 at 03:16:59AM +0400, Dmitry V. Levin wrote:
> 000012cc g    DO .bss   00000004 (V1)         foo
> 00000248 g    DF .text  00000005  V2          foo
  1        2    3  4      5         6           7

Где бы узнать про формат вывода objdump -Tw?
binutils-*/bfd/elf.c не предлагать.

2 -- visibility
3 -- что это??

> Таким образом, нужно использовать objdump -wT вместо nm -D.

Вот так вроде работает.

--- /home/at/cvs/qa/qa-robot/rpmelfsym	2006-05-27 11:15:29 +0000
+++ /home/at/cvs/qa/qa-robot/rpmelfsymv	2006-08-13 16:57:32 +0000
@@ -1,17 +1,39 @@
 #!/bin/sh -ef
 export LC_ALL=C
 
-rpmelfsym()
+rpmelfsymv()
 {
 	rpmfile "$1" >files
 	awk -F'\t' '$NF~/ELF.*(dynamic|shared)/{printf"./%s\0",$1}' files >elfs0
 	[ -s elfs0 ] || return 0
-	rpmpeek "$1" xargs -r0 nm -Do <elfs0 >nm.out
-	awk '{OFS="\t";sub("^./","",$1);sub(":[0-9a-fA-F]*$","",$1);print}' nm.out
+	rpmpeek "$1" xargs -r0 objdump -Tw  <elfs0 >objdump.out
+	perl -ln - objdump.out <<'__EOF__'
+#!/usr/bin/perl	
+	if (/^$/ or /^DYNAMIC SYMBOL TABLE:$/) { next; }
+	if (s/:\s+file format.+//) { s[^./][]; $f = $_; next; }
+BEGIN { $x = qr/([a-f0-9]+)/; $w = qr/(\w+)/; $S = qr/(\S+?)/; $s = qr/[ ]+/; }
+BEGIN { %T = qw(.text T .data D .bss B .rodata R .data.rel.ro D *ABS* A *UND* U
+		.init T .fini T __libc_freeres_fn T __libc_thread_freeres_fn T
+		.interp R text.hot T text.unlikely T); }
+	if (/^$x$s(?:$w$s)?$w$s$S\t$x$s(?:[(]?$S[)]?$s)?(?:[.0]$w$s)?$S$/) {
+		$vis = $2; $typ = $4; $abi = $6; $sym = $8;
+		next if $vis eq "l";
+		$t = $T{$typ} or die "$f: $sym: unknown type $typ\n";
+		$vis eq "w" and $t eq "U" and $t = "w" or
+		$vis eq "w" and $t .= "W";
+		$abi = "-" if $abi eq "" or $abi eq "Base";
+		print "$f\t$t\t$sym\t$abi";
+		next;
+	}
+	if (/^$x$s(?:$w$s)?$w$s$S\t$x$s$/) {
+		next;
+	}
+	die "bad objdump output:\n$_";
+__EOF__
 }
 
 . cmdcache ""
-. rpmargs -c "cmdcache rpmelfsym" "$@"
+. rpmargs -c "rpmelfsymv" "$@"
 
 : <<'__EOF__'
 

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

  reply	other threads:[~2006-08-13 16:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-08 11:50 ` [devel] [Sisyphus-cybertalk] I: Sisyphus-20060808 abi_drifts: +23 -18 (5193) Michael Shigorin
2006-08-08 12:30   ` Dmitry V. Levin
2006-08-08 18:36     ` Alexey Tourbin
2006-08-08 22:03       ` [devel] rpmelfsymv Alexey Tourbin
2006-08-08 23:16         ` Dmitry V. Levin
2006-08-13 16:59           ` Alexey Tourbin [this message]
2006-08-21 15:19             ` Alexey Tourbin
2006-08-08 19:07     ` [devel] [Sisyphus-cybertalk] I: Sisyphus-20060808 abi_drifts: +23 -18 (5193) Michael Shigorin

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=20060813165915.GQ24054@localhost.localdomain \
    --to=at@altlinux.ru \
    --cc=devel@lists.altlinux.org \
    /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