public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: __crc_* symbols in System.map
@ 2004-08-12  3:55 David S. Miller
  2004-08-12  5:01 ` Sam Ravnborg
  0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2004-08-12  3:55 UTC (permalink / raw)
  To: torvalds; +Cc: akpm, linux-kernel


Shouldn't we be grepping these things out of the System.map file?

For one thing, these can confuse readprofile.  It's algorithm is
to start at _stext, then stop when it sees a line in the System.map
which is not text (mode is one of 'T' 't' 'W' or 'w')

It will exit early if there are some intermixed __crc_* things in
there (since they are are mode 'A').

For example, in my current sparc64 kernel I have this:

00000000004cef80 t do_split
00000000004cf2a0 t add_dirent_to_buf
00000000004cf5a7 A __crc_init_special_inode
00000000004cf640 t make_indexed_dir
00000000004cf900 t ext3_add_entry

So no symbols after add_dirent_to_buf will be shown in the profiling
output of readprofile.

So we should grep them out, right?  If so, here is a patch which
implements that.

===== Makefile 1.511 vs edited =====
--- 1.511/Makefile	2004-08-09 19:12:34 -07:00
+++ edited/Makefile	2004-08-11 20:21:36 -07:00
@@ -538,7 +538,7 @@
 	echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
 endef
 
-do_system_map = $(NM) $(1) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | sort > $(2)
+do_system_map = $(NM) $(1) | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)\|\(__crc_\)' | sort > $(2)
 
 LDFLAGS_vmlinux += -T arch/$(ARCH)/kernel/vmlinux.lds.s
 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH]: __crc_* symbols in System.map
  2004-08-12  3:55 [PATCH]: __crc_* symbols in System.map David S. Miller
@ 2004-08-12  5:01 ` Sam Ravnborg
  2004-08-12  7:05   ` David S. Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2004-08-12  5:01 UTC (permalink / raw)
  To: David S. Miller; +Cc: torvalds, akpm, linux-kernel

On Wed, Aug 11, 2004 at 08:55:29PM -0700, David S. Miller wrote:
> 
> Shouldn't we be grepping these things out of the System.map file?
> 
> For one thing, these can confuse readprofile.  It's algorithm is
> to start at _stext, then stop when it sees a line in the System.map
> which is not text (mode is one of 'T' 't' 'W' or 'w')
> 
> It will exit early if there are some intermixed __crc_* things in
> there (since they are are mode 'A').
> 
> For example, in my current sparc64 kernel I have this:
> 
> 00000000004cef80 t do_split
> 00000000004cf2a0 t add_dirent_to_buf
> 00000000004cf5a7 A __crc_init_special_inode
> 00000000004cf640 t make_indexed_dir
> 00000000004cf900 t ext3_add_entry
> 
> So no symbols after add_dirent_to_buf will be shown in the profiling
> output of readprofile.
> 
> So we should grep them out, right?  If so, here is a patch which
> implements that.

I have a patch in this area pending, it moves System.map generation
out of the top-level makefile. And btw simplifies the expression a bit.

iMy patches are only at linux-sam.bkbits.net/kbuild for now,
will post patches later this week.

Would it be an option to skip all 'A' symbols?

	Sam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH]: __crc_* symbols in System.map
  2004-08-12  5:01 ` Sam Ravnborg
@ 2004-08-12  7:05   ` David S. Miller
  2004-08-13 18:02     ` Sam Ravnborg
  0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2004-08-12  7:05 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: torvalds, akpm, linux-kernel

On Thu, 12 Aug 2004 07:01:36 +0200
Sam Ravnborg <sam@ravnborg.org> wrote:

> Would it be an option to skip all 'A' symbols?

I doubt it.  Symbols defined via the linker script will
end up as " A ".  On sparc64 this happens for swapper_pmd_dir,
empty_pg_dir, _etext, _edata, and _end for example.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH]: __crc_* symbols in System.map
  2004-08-12  7:05   ` David S. Miller
@ 2004-08-13 18:02     ` Sam Ravnborg
  2004-08-13 18:10       ` Sam Ravnborg
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2004-08-13 18:02 UTC (permalink / raw)
  To: David S. Miller; +Cc: Sam Ravnborg, torvalds, akpm, linux-kernel

On Thu, Aug 12, 2004 at 12:05:58AM -0700, David S. Miller wrote:
> On Thu, 12 Aug 2004 07:01:36 +0200
> Sam Ravnborg <sam@ravnborg.org> wrote:
> 
> > Would it be an option to skip all 'A' symbols?
> 
> I doubt it.  Symbols defined via the linker script will
> end up as " A ".  On sparc64 this happens for swapper_pmd_dir,
> empty_pg_dir, _etext, _edata, and _end for example.
Did a:
nm vmlinux | grep ' A ' | grep -v '__crc_' | wc -l
32

So yep.

Modified your patch to match my tree - patched soon to appear at lkml.

	Sam

In my tree I now have a script to generate System.map - that now looks like this:

#!/bin/sh -x
# Based on the vmlinux file create the System.map file
# System.map is used by module-init tools and some debugging
# tools to retreive the actual addresses of symbols in the kernel.
#
# Before creating the System.map file as a sideeffect check for
# undefined symbols.
# At least one version of the ARM bin-utils did not error out on
# undefined symbols, so catch them here instead.

# Usage
# mksysmap vmlinux System.map


#####
# Check for undefined symbols.
# Undefined symbols with three leading underscores are ignored since
# they are used by the sparc BTFIXUP logic - and is assumed to be undefined.


if [ "`$NM -u $1 | grep -v ' ___'`" != "" ]; then
	echo "$1: error: undefined symbol(s) found:"
	$NM -u $1 | grep -v ' ___'
	exit 1
fi

#####
# Generate System.map (actual filename passed as second argument)

# $NM produces the following output:
# f0081e80 T alloc_vfsmnt

#   The second row specify the type of the symbol:
#   A = Absolute
#   B = Uninitialised data (.bss)
#   C = Comon symbol
#   D = Initialised data
#   G = Initialised data for small objects
#   I = Indirect reference to another symbol
#   N = Debugging symbol
#   R = Read only
#   S = Uninitialised data for small objects
#   T = Text code symbol
#   U = Undefined symbol
#   V = Weak symbol
#   W = Weak symbol
#   Corresponding small letters are local symbols

# For System.map filter away:
#   a - local absolute symbols
#   U - undefined global symbols
#   w - local weak symbols

# readprofile starts reading symbols when _stext is found, and
# continue until it finds a symbol which is not either of 'T', 't',
# 'W' or 'w'. __crc_ are 'A' and placed in the middle
# so we just ignore them to let readprofile continue to work.
# (At least sparc64 has __crc_ in the middle).

$NM -n $1 | grep  '\( [aUw] \)\|\(__crc_\)' > $2



> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH]: __crc_* symbols in System.map
  2004-08-13 18:02     ` Sam Ravnborg
@ 2004-08-13 18:10       ` Sam Ravnborg
  2004-08-13 20:18         ` David S. Miller
  0 siblings, 1 reply; 6+ messages in thread
From: Sam Ravnborg @ 2004-08-13 18:10 UTC (permalink / raw)
  To: David S. Miller, Sam Ravnborg, torvalds, akpm, linux-kernel

On Fri, Aug 13, 2004 at 08:02:39PM +0200, Sam Ravnborg wrote:
> 
> $NM -n $1 | grep  '\( [aUw] \)\|\(__crc_\)' > $2

The missing -v ito grep was just to check if you were awake :-(

	Sam

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH]: __crc_* symbols in System.map
  2004-08-13 18:10       ` Sam Ravnborg
@ 2004-08-13 20:18         ` David S. Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2004-08-13 20:18 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: sam, torvalds, akpm, linux-kernel

On Fri, 13 Aug 2004 20:10:42 +0200
Sam Ravnborg <sam@ravnborg.org> wrote:

> On Fri, Aug 13, 2004 at 08:02:39PM +0200, Sam Ravnborg wrote:
> > 
> > $NM -n $1 | grep  '\( [aUw] \)\|\(__crc_\)' > $2
> 
> The missing -v ito grep was just to check if you were awake :-(

Final version looks good to me. :-)
Thanks Sam.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-08-13 20:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-12  3:55 [PATCH]: __crc_* symbols in System.map David S. Miller
2004-08-12  5:01 ` Sam Ravnborg
2004-08-12  7:05   ` David S. Miller
2004-08-13 18:02     ` Sam Ravnborg
2004-08-13 18:10       ` Sam Ravnborg
2004-08-13 20:18         ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox