[PATCH v4][makedumpfile 1/7] Reserve sections for makedumpfile and extenions

HAGIO KAZUHITO(萩尾 一仁) k-hagio-ab at nec.com
Fri Apr 3 01:10:02 PDT 2026


On 2026/03/18 0:07, Tao Liu wrote:
> This patch makes preparation for btf/kallsyms support of
> makedumpfile and extensions. Any needed kernel symbols/types
> will be reserved within a special section, .init_ksyms for
> kallsyms symbols and .init_ktypes for kernel types. During
> makedumpfile kallsyms/btf initialization, those missing info
> will be resolved. A makedumpfile.ld script is introduced for the
> purpose.
> 
> Suggested-by: Stephen Brennan <stephen.s.brennan at oracle.com>
> Signed-off-by: Tao Liu <ltao at redhat.com>
> ---
>   Makefile        |  2 +-
>   makedumpfile.ld | 15 +++++++++++++++
>   2 files changed, 16 insertions(+), 1 deletion(-)
>   create mode 100644 makedumpfile.ld
> 
> diff --git a/Makefile b/Makefile
> index 05ab5f2..15a4ba0 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -113,7 +113,7 @@ $(OBJ_ARCH): $(SRC_ARCH)
>   	$(CC) $(CFLAGS_ARCH) -c -o ./$@ $(VPATH)$(@:.o=.c)
>   
>   makedumpfile: $(SRC_BASE) $(OBJ_PART) $(OBJ_ARCH)
> -	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -rdynamic -o $@ $< $(LIBS)
> +	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJ_PART) $(OBJ_ARCH) -rdynamic -Wl,-T,makedumpfile.ld -o $@ $< $(LIBS)
>   	@sed -e "s/@DATE@/$(DATE)/" \
>   	     -e "s/@VERSION@/$(VERSION)/" \
>   	     $(VPATH)makedumpfile.8.in > $(VPATH)makedumpfile.8
> diff --git a/makedumpfile.ld b/makedumpfile.ld
> new file mode 100644
> index 0000000..231a162
> --- /dev/null
> +++ b/makedumpfile.ld
> @@ -0,0 +1,15 @@
> +SECTIONS
> +{
> +	.init_ksyms ALIGN(8) : {
> +		__start_init_ksyms = .;
> +		KEEP(*(.init_ksyms*))
> +		__stop_init_ksyms = .;
> +	}
> +
> +	.init_ktypes ALIGN(8) : {
> +		__start_init_ktypes = .;
> +		KEEP(*(.init_ktypes*))
> +		__stop_init_ktypes = .;
> +	}
> +}
> +INSERT AFTER .data;
> \ No newline at end of file

Please add a newline to files that have this line?

Command prompt is shown on the same line like this:

[root at rhel97u makedumpfile]# cat makedumpfile.ld
...
INSERT AFTER .data;[root at rhel97u makedumpfile]#

Thanks,
Kazu


More information about the kexec mailing list