[PATCH RFC] bfd/ELF: restrict file alignment for object files

Jan Beulich jbeulich@suse.com
Mon Sep 9 11:45:32 GMT 2024


Nick,

On 09.09.2024 13:34, Nick Clifton wrote:
>>> For architectures with fixed instruction size(s) I think that we should
>>> keep executable sections at least aligned to the correct size.  There are
>>> cases where object files are loaded and executed without ever being fully
>>> linked.  (I am thinking of kernel object files here - .ko - but there are
>>> probably others as well).
>>
>> I actually considered this as an option. Just that I found nowhere that
>> this particular alignment was announced (for e.g. ia64 I take it that it
>> would want to be 16, due to fixed-size insns being grouped into bundles
>> of [typically] three insns, who individually have no sensible alignment
>> at all).
>>
>> Considering your kernel modules example, the concern might easily extend
>> to data sections then as well, I guess. Hence my mentioning of "word
>> size".
> 
> A fair point.  To be honest I am not sure how much the kernel cares about
> alignments of any sections in .ko files.  But better to play safe is my
> feeling.

yet then - any hint from where to take the two alignment values? Do they
need adding from scratch, for every architecture?

Jan


More information about the Binutils mailing list