From 0ac46a4ae90a58ebd43912c01b31969c793390eb Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 31 Aug 2021 22:00:36 -0400 Subject: [PATCH] kernel/debug: Adjust range marker macros. Previously these were just using the raw function name, which led to markers like "Slab_begin". Now we prefix RANGE_MARKER_ so there is absolutely no chance of confusion, and the symbols are clearly visible in dumps. Also add a note that the kernel must be built with -fno-toplevel-reorder for these to work. (It seems when this was implemented, GCC had not yet implemented top-level reordering.) They are only used for debugging with the tracing system in a handful of places, and -ftoplevel-reorder is enabled with optimizations for a reason, so it makes more sense just to note this and not to enable that option by default (i.e. in the off chance someone will want to use these in non-debug builds, like I did.) --- headers/private/kernel/debug.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/headers/private/kernel/debug.h b/headers/private/kernel/debug.h index ba3d63e208..af9a38156d 100644 --- a/headers/private/kernel/debug.h +++ b/headers/private/kernel/debug.h @@ -91,20 +91,21 @@ // Macros for for placing marker functions. They can be used to mark the // beginning and end of code sections (e.g. used in the slab code). +// Note that in order for these to work, the kernel must be built with -fno-toplevel-reorder. #define RANGE_MARKER_FUNCTION(functionName) \ - void functionName() {} + void RANGE_MARKER_##functionName() {} #define RANGE_MARKER_FUNCTION_BEGIN(scope) \ RANGE_MARKER_FUNCTION(scope##_begin) #define RANGE_MARKER_FUNCTION_END(scope) \ RANGE_MARKER_FUNCTION(scope##_end) #define RANGE_MARKER_FUNCTION_PROTOTYPE(functionName) \ - void functionName(); + void RANGE_MARKER_##functionName(); #define RANGE_MARKER_FUNCTION_PROTOTYPES(scope) \ RANGE_MARKER_FUNCTION_PROTOTYPE(scope##_begin) \ RANGE_MARKER_FUNCTION_PROTOTYPE(scope##_end) #define RANGE_MARKER_FUNCTION_ADDRESS_RANGE(scope) \ - (addr_t)&scope##_begin, (addr_t)&scope##_end + (addr_t)&RANGE_MARKER_##scope##_begin, (addr_t)&RANGE_MARKER_##scope##_end // command return value