]> xenbits.xensource.com Git - livepatch-build-tools.git/commit
livepatch-build-tools: account for section alignment when calculating function size
authorRoger Pau Monne <roger.pau@citrix.com>
Tue, 28 Nov 2023 09:21:52 +0000 (10:21 +0100)
committerRoss Lagerwall <ross.lagerwall@citrix.com>
Wed, 6 Dec 2023 11:32:57 +0000 (11:32 +0000)
commit0ed8ef88dc300750696a64e89efa3b82502f6dc7
treeaa038d57196d1ca31aaf15b5385e53286745351e
parente838847498b9667bc83c5ab63275abf8536ba5bd
livepatch-build-tools: account for section alignment when calculating function size

Forcing function section alignment at the compiler level ensures that enough
space is present in the text section so that at least a jump can be encoded in
the old function body to switch to the newly loaded code payload.

Modify create-diff-object to account for any section alignment when calculating
the size of the old function.

When used with a suitable -falign-function compiler parameter on the Xen
hypervisor build this ensures that all functions have enough space to
accommodate for any control flow instructions plus a jump.

Note that while the rounding could be applied to all (text) symbols, it's not
required, as the size is only relevant for functions that are live patched, and
hence only do the rounding when calculating the old (previous) function size.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
common.h
create-diff-object.c