RFC: Objcopy: Section alignment

Nick Clifton nickc@redhat.com
Thu Mar 28 13:08:27 GMT 2024


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.  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: objcopy-section-align.patch.3
Type: application/x-troff-man
Size: 11253 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20240328/ef6ececa/attachment.3>


More information about the Binutils mailing list