Re: [PATCH v2 5/5] dyndbg.lds.S: fix lost dyndbg sections in modules
From: Petr Pavlu
Date: Thu May 14 2026 - 02:48:21 EST
On 5/7/26 10:40 PM, Jim Cromie wrote:
> With CONFIG_DRM_USE_DYNAMIC_DEBUG=y, several build configs had
> problems with __dyndbg* sections getting lost in drm drivers. Fix
> this by following the model demonstrated in codetag.lds.h.
>
> Introduce include/asm-generic/dyndbg.lds.h, to bundle dynamic-debug's
> multiple sections together, into 2 macros:
>
> vmlinux.lds.h DATA_DATA: move the 2 BOUNDED_SECTION_BY(__dyndbg*)
> calls into dyndbg.lds.h DYNDBG_SECTIONS(). vmlinux.lds.h now includes
> the new file and calls the new macro.
>
> MOD_DYNDBG_SECTIONS declares the 2 BOUNDED_SECTION_BY calls, but wraps
> them with output section syntax to keep them as known and separate ELF
> sections in the module.ko. The KEEP fixes the lost section.
>
> dyndbg.lds.h includes (reuses) bounded-section.lds.h
>
> scripts/module.lds.S: now calls MOD_DYNDBG_SECTIONS right before the
> CODETAG macro (consistent with their placements in vmlinux.lds.h), and
> also includes dyndbg.lds.h
>
> This isolates vmlinux.lds.h from further __dyndbg section additions.
>
> CC: Arnd Bergmann <arnd@xxxxxxxx>
> Signed-off-by: Jim Cromie <jim.cromie@xxxxxxxxx>
> ---
> [...]
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index d9d2eb708355..54897d742c6c 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -332,6 +332,7 @@
> /*
> * .data section
> */
> +#include <asm-generic/dyndbg.lds.h>
> #define DATA_DATA \
> *(.xiptext) \
> *(DATA_MAIN)
Nit: I suggest placing the dyndbg.lds.h include at the top of the file,
as is usual, together with the codetag.lds.h include.
Otherwise, this looks ok to me. Feel free to add:
Reviewed-by: Petr Pavlu <petr.pavlu@xxxxxxxx>
--
Thanks,
Petr