RFC: Objcopy: Section alignment
Jan Beulich
jbeulich@suse.com
Tue Apr 2 09:19:46 GMT 2024
On 02.04.2024 10:45, Nick Clifton wrote:
>>> 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?
>
> I am not sure. But if it is not relevant for PE sections then shouldn't
> changing the SectionAlignment field in the PE header generate an error if
> any section's VMA does not match that alignment ?
Well, this I'm unsure about, largely because of not really knowing any good
spec for PE/COFF (which would cover such details).
>> And didn't Alan, not so long ago, remove its
>> propagation into PE binaries?
>
> I must admit that I do not remember this, but it certainly could have happened.
Commit 6f8f6017a0c4 ("PR27567, Linking PE files adds alignment section flags
to executables"), to deal with PR 27567. But indeed ...
>> (This then also being a reason why the
>> alignment values weren't dumped for PE.)
>
> I think that we should not hide the alignment values from the user, even if
> they are not going to be honoured. We do not dictate the policy for the how
> PE binaries are going to be treated by the OS, and there could be good
> reasons for why a user needs to know them.
... I was mis-remembering that said change would also have removed the
dumping that you now add. In principle I'm okay with such dumping being
added; I merely would have been puzzled if it was re-added after having
been removed.
Jan
More information about the Binutils
mailing list