[PATCH] objcopy: check input flavor before setting PE/COFF section alignment

Nick Clifton nickc@redhat.com
Wed May 8 10:26:37 GMT 2024


Hi Jan,

>>> Of course the value (first) being set on the input bfd is suspicious
>>> in the first place: When copying e.g. ELF to PE/COFF, the option ought
>>> to be similarly respected, yet clearly it can't be set like this then on
>>> the incoming object. The change here is merely to address the testsuite
>>> failures observed for Arm64 and RISC-V ("Check if efi app format is
>>> recognized") as well as the (latent) memory corruption.

> Well, before putting it in - any thoughts on the post-commit-message remark
> above?

Sorry.  Well in the first place converting from ELF to PE is always going to
be a difficult process.  So trying to combine it with adjustments to other
properties, such as alignment, is just asking for trouble.  My feeling therefore
is that we ought to be have a warning in the documentation telling users
to be careful and maybe take things one step at a time.

> Is it really meant to stay the way of the input bfd's data is being
> altered, rather than keeping that intact and fiddling only with the output?
> And thus - afaict - rendering the command line option (silently) useless
> when copying ELF to PE?

You are right.  For this particular case maybe we should add a test for
ELF->PE format changing and refuse to adjust the alignments.

Cheers
   Nick





More information about the Binutils mailing list