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

Tao Liu ltao at redhat.com
Tue Apr 14 04:03:30 PDT 2026


Hi Stephen,

On Fri, Apr 3, 2026 at 12:31 PM Stephen Brennan
<stephen.s.brennan at oracle.com> wrote:
>
> Tao Liu <ltao at redhat.com> writes:
> > 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>
>
> As I mentioned before, I don't think this patch is strictly necessary.
> If we rename the sections to avoid the "." at the start of the names,
> then the compiler should automatically provide the start and stop
> symbols. But that said, there's nothing wrong with doing it this way,
> and it is a bit more explicit, so I see the value in keeping it.
>
Please checkout the repo[1] with the "." removed for section names. I
didn't see the section start/end symbols generated automatically when
the makedumpfile.ld script is disabled. This is what I hit:

$ ./makedumpfile -d 31 -l
/var/crash/127.0.0.1-2025-06-10-18\:03\:12/vmcore /tmp/out --extension
sample.so
Loaded extension: ./extensions/sample.so
register_ksym_section: Invalid section start/stop
init_extensions: fail & skip all extensions
$ ls
amdgpu_filter.c  amdgpu_filter.so  Makefile  Makefile.orig
maple_tree.c  maple_tree.h  sample.c  sample.so
$ nm sample.so |grep __start_init_ksyms
$ nm sample.so |grep __start_init_ktypes

However with makedumpfile.ld enabled, I can see:
$ nm sample.so |grep ksyms
0000000000004108 D __start_init_ksyms
0000000000004110 D __stop_init_ksyms
$ nm sample.so |grep ktypes
0000000000004110 D __start_init_ktypes
0000000000004128 D __stop_init_ktypes

Maybe I didn't code it correctly, or due to the version of gcc, I'm not sure.

[1]: https://github.com/liutgnu/makedumpfile/commits/v5/

> Reviewed-by: Stephen Brennan <stephen.s.brennan at oracle.com>

Sorry I didn't take your "Reviewed-by" signature in v5, because v5
contains plenty of code change since v4, and I'm not sure if you are
still OK with v5 or any improvement should be made. I will add your
signature in later upstream posts when the code is stable. Thanks
again for your patch review / suggestion and being a great support!

Thanks,
Tao Liu

>
> > ---
> >  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
> > --
> > 2.47.0
>




More information about the kexec mailing list