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

Nick Clifton nickc@redhat.com
Mon Sep 9 11:34:23 GMT 2024


Hi Jan,

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

Cheers
   Nick




More information about the Binutils mailing list