RFC: Objcopy: Section alignment
Jan Beulich
jbeulich@suse.com
Thu Mar 28 16:57:03 GMT 2024
On 28.03.2024 14:08, Nick Clifton wrote:
> Hi Jan,
>
>>> Any further comments ?
>>
>> Actually, there are: First, is the last doc hunk still applicable /
>> appropriately worded? "ensures" in particular I'm not sure about.
>>
>> Perhaps related to that, the two new diagnostics look more like
>> errors than warnings to me. I think those ought to be just warnings
>> (by default at least), especially also with the FIXME for the LMA
>> related code. Which would in particular mean to not bail early from
>> setup_section(), and perhaps also to not set "status" to non-zero.
>>
>> Further, while the new power_of_two() is merely split out code,
>> that code doesn't (already didn't before) deal with 0 properly. It
>> would spin indefinitely then afaict, rather than reporting "not a
>> power of two".
>>
>> Finally, in the new --section-alignment related diagnostic, wouldn't
>> you better mention the option name, and not the internal variable's?
>
> All very good points. Plus I also realised that I had not included a
> testcase to check the new behaviour. Plus, as it turns out, I was
> assuming that calling bfd_set_section_alignment() was enough to set
> the alignment for a PE section.
Which also shouldn't be necessary? Isn't section alignment relevant for
COFF objects only? And didn't Alan, not so long ago, remove its
propagation into PE binaries? (This then also being a reason why the
alignment values weren't dumped for PE.)
Jan
> But it seems that this function does
> not set the necessary IMAGE_SCN_ALIGN_xxx flag in the section's header.
>
> So here is a v3 patch with all of these bugs corrected.
>
> Cheers
> Nick
>
More information about the Binutils
mailing list