]> xenbits.xensource.com Git - unikraft/unikraft.git/commitdiff
lib/ukdebug: Mark tracepoint sections as unallocated notes
authorMarco Schlumpp <marco@unikraft.io>
Wed, 12 Apr 2023 09:06:17 +0000 (11:06 +0200)
committerUnikraft <monkey@unikraft.io>
Wed, 10 May 2023 11:50:10 +0000 (11:50 +0000)
At runtime we don't care about the content of them, and we only need
them on host side to decode the trace buffer.
This also prevents the linker from adding a segment for these sections.
Because the resulting segment sometimes only contained these two
sections, the final `strip` step would end up with an empty segment.
And in the case of the linuxu platform the resulting image was not
working anymore.

Signed-off-by: Marco Schlumpp <marco@unikraft.io>
Reviewed-by: Sergiu Moga <sergiu.moga@protonmail.com>
Reviewed-by: Razvan Deaconescu <razvand@unikraft.io>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #833

lib/ukdebug/include/uk/trace.h
lib/ukdebug/trace.c

index 89148c323652bbc31d926c7a37bccf89c2290d6f..9c4819461582f38049e9137128eeb6739d7d7aa6 100644 (file)
@@ -173,7 +173,8 @@ static inline void __uk_trace_save_arg(char **pbuff,
 #define __UK_TRACE_REG(NR, regname, trace_name, fmt, ...)      \
        UK_CTASSERT(sizeof(#trace_name) < 255);                 \
        UK_CTASSERT(sizeof(fmt) < 255);                         \
-       __attribute((__section__(".uk_tracepoints_list")))      \
+       __attribute((__section__(                               \
+               ".uk_tracepoints_list,\"\",@note#")))           \
        static struct {                                         \
                uint32_t magic;                                 \
                uint32_t size;                                  \
index 2572560c163017f43ca0bac2748ffbf9b8f0fecf..7721ea717bf83bc78e565f7a0e84b57ba20bdc4b 100644 (file)
@@ -54,7 +54,8 @@ char *uk_trace_buffer_writep = uk_trace_buffer;
  *     $ readelf -p .uk_trace_keyvals <your_image.gdb>
  */
 #define TRACE_DEFINE_KEY(key, val)                     \
-       __attribute((__section__(".uk_trace_keyvals"))) \
+       __attribute((__section__(                       \
+               ".uk_trace_keyvals,\"\",@note#")))      \
        static const char key[] __used =                \
                #key " = " #val