: __crc_* symbols in System.map
PATCH 1/1 : __crc_* symbols in System.map
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_split00000000004cf2a0 t add_dirent_to_buf00000000004cf5a7 A __crc_init_special_inode00000000004cf640 t make_indexed_dir00000000004cf900 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 =====
Makefile +1 -1
@@ -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
Quoted 18 lines · David S. Miller
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:
00000000004cef80tdo_split00000000004cf2a0tadd_dirent_to_buf00000000004cf5a7A__crc_init_special_inode00000000004cf640tmake_indexed_dir00000000004cf900text3_add_entry
Quoted 5 lines
So no symbols after
add_dirent_to_bufwill 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
Quoted 1 line · On Thu, 12 Aug 2004 07:01:36 +0200 Sam Ravnborg <[email protected]> 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.
Quoted 8 lines · David S. Miller
Quoted 1 line · On Thu, 12 Aug 2004 07:01:36 +0200 Sam Ravnborg <[email protected]> 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_endfor 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
Quoted 5 lines
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · Sam Ravnborg
$NM -n $1 | grep '\( [aUw] \)\|\(__crc_\)' > $2
The missing -v ito grep was just to check if you were awake :-(
Sam
Quoted 5 lines · On Fri, 13 Aug 2004 20:10:42 +0200 Sam Ravnborg <[email protected]> wrote:
Quoted 2 lines · Sam Ravnborg
$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.