recordmcount: Correct st_shndx handling
authorPeter Zijlstra <peterz@infradead.org>
Wed, 16 Jun 2021 15:41:26 +0000 (23:41 +0800)
committerSasha Levin <sashal@kernel.org>
Wed, 30 Jun 2021 12:47:23 +0000 (08:47 -0400)
commitd91c50e6a67800bee69f681ee78c3b767e9a0c2e
treeaf9cfb62390295974c9cec1634e7726139c0d186
parentfb71d81ccd69c3d607c44a8562f7abf606ae74e8
recordmcount: Correct st_shndx handling

[ Upstream commit fb780761e7bd9f2e94f5b9a296ead6b35b944206 ]

One should only use st_shndx when >SHN_UNDEF and <SHN_LORESERVE. When
SHN_XINDEX, then use .symtab_shndx. Otherwise use 0.

This handles the case: st_shndx >= SHN_LORESERVE && st_shndx != SHN_XINDEX.

Link: https://lore.kernel.org/lkml/20210607023839.26387-1-mark-pk.tsai@mediatek.com/
Link: https://lkml.kernel.org/r/20210616154126.2794-1-mark-pk.tsai@mediatek.com
Reported-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Tested-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
[handle endianness of sym->st_shndx]
Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
scripts/recordmcount.h