kpatch/kmod/patch/kpatch.lds.S
Jessica Yu b1cdc83d57 kpatch-build: build dynrelas or klp relas depending on kernel version
Introduce a second phase in the kpatch-build process that creates kpatch
modules or livepatch modules that use the new klp rela sections depending on
the kernel version being worked on. This change uses the two new programs to
either create a patch module that uses dynrelas (create-kpatch-module) or a
patch module that uses klp rela and arch sections + klp symbols marked with the
correct Elf flags (create-klp-module).

For klp patch modules, the --unique flag for ld is needed to prevent
.parainstructions and .altinstructions sections from different objects
from being merged, as arch_klp_init_object_loaded() applies these sections
per-object.
2017-01-23 12:43:43 -08:00

38 lines
1.1 KiB
ArmAsm

__kpatch_funcs = ADDR(.kpatch.funcs);
__kpatch_funcs_end = ADDR(.kpatch.funcs) + SIZEOF(.kpatch.funcs);
#ifdef __KPATCH_MODULE__
__kpatch_dynrelas = ADDR(.kpatch.dynrelas);
__kpatch_dynrelas_end = ADDR(.kpatch.dynrelas) + SIZEOF(.kpatch.dynrelas);
__kpatch_checksum = ADDR(.kpatch.checksum);
#endif
SECTIONS
{
.kpatch.hooks.load : {
__kpatch_hooks_load = . ;
*(.kpatch.hooks.load)
__kpatch_hooks_load_end = . ;
/*
* Pad the end of the section with zeros in case the section is empty.
* This prevents the kernel from discarding the section at module
* load time. __kpatch_hooks_load_end will still point to the end of
* the section before the padding. If the .kpatch.hooks.load section
* is empty, __kpatch_hooks_load equals __kpatch_hooks_load_end.
*/
QUAD(0);
}
.kpatch.hooks.unload : {
__kpatch_hooks_unload = . ;
*(.kpatch.hooks.unload)
__kpatch_hooks_unload_end = . ;
QUAD(0);
}
.kpatch.force : {
__kpatch_force_funcs = . ;
*(.kpatch.force)
__kpatch_force_funcs_end = . ;
QUAD(0);
}
}