recordmcount: Rewrite error/success handling
authorMatt Helsley <mhelsley@vmware.com>
Wed, 31 Jul 2019 18:24:12 +0000 (11:24 -0700)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Sat, 31 Aug 2019 16:19:39 +0000 (12:19 -0400)
commit3f1df12019f333442b12c3b5d110b8fc43eb0b36
treebd81e94a57bb644dc05a6763a0ebc1f8c059a09f
parent7f5291da4b15ad0ebc0965af41a1a2e3f04c3f08
recordmcount: Rewrite error/success handling

Recordmcount uses setjmp/longjmp to manage control flow as
it reads and then writes the ELF file. This unusual control
flow is hard to follow and check in addition to being unlike
kernel coding style.

So we rewrite these paths to use regular return values to
indicate error/success. When an error or previously-completed object
file is found we return an error code following kernel
coding conventions -- negative error values and 0 for success when
we're not returning a pointer. We return NULL for those that fail
and return non-NULL pointers otherwise.

One oddity is already_has_rel_mcount -- there we use pointer comparison
rather than string comparison to differentiate between
previously-processed object files and returning the name of a text
section.

Link: http://lkml.kernel.org/r/8ba8633d4afe444931f363c8d924bf9565b89a86.1564596289.git.mhelsley@vmware.com
Signed-off-by: Matt Helsley <mhelsley@vmware.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
scripts/recordmcount.c
scripts/recordmcount.h