[PATCH 0/2] bfd/x86: Fix handling of secondary relocations on objcopy/strip

Antoine Damhet adamhet@scaleway.com
Fri Nov 13 17:11:04 GMT 2026


On Fri, Nov 13, 2026 at 05:01:47PM +0100, Jan Beulich wrote:
> On 13.11.2026 16:54, Antoine Damhet wrote:
> > On Fri, Nov 13, 2026 at 11:40:45AM +0100, Jan Beulich wrote:
> >> On 09.11.2026 13:31, Antoine Damhet wrote:
> >>> As outlined in the bug[1], relocations of '.klp.rela.*' sections would
> >>> be silently corrupted by both strip and objcopy. This series restore the
> >>> original behavior for both regressions.
> >>>
> >>> [1]: https://sourceware.org/bugzilla/show_bug.cgi?id=34970
> > 
> > [...]
> > 
> >> Of course to prevent this regressing again, a testcase would have been nice.
> > 
> > Would it be OK to ship the stripped kernel module binary (3.8K once
> > bzipped) and check that `objcopy` doesn't change the binary ?
> 
> That would be more like a last resort approach. Generally testcases want
> to come with source, such that one can see what's going on, and such that
> one can make adjustments if needed (after all testcases also aren't
> necessarily bug free).

`kpatch` builds it's livepatch module "manually" using `libelf` to emit
the required secondary relocations and I don't think we can produce
such a binary with `as + ld + objcopy`. I might be wrong because I am
merely a user of both binutils and kernel live patching.

As for the binary generation process, all the required steps and helper
script are attached in the bug report.

We also could build a generator script but IMHO, it would be shipping
the binary with extra steps.

-- 
Antoine 'xdbob' Damhet
Engineer @scaleway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20261113/48c1947b/attachment.sig>


More information about the Binutils mailing list