This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] elf: Properly compute offsets of desc and next note


Hi H.J.

> According to gABI, in a note entry, the note name field, not note name
> size, is padded for the note descriptor.

Is it possible for there to be notes in already existing binaries where
the name field was not padded up to the alignment boundary, but instead
just contains random bytes after the terminating NUL ?  If so, will the 
patched code attempt to interpret these extra bytes and so run into 
problems ?


By the way - does the gABI mandate what value(s) should be used for padding ?


> Also notes
> are aligned to 4 bytes in 32-bit objects and 8 bytes in 64-bit objects.

I don't mind enforcing this requirement in the notes that the binutils 
generates from now on, but I think that we ought to be relaxed about 
accepting 64-bit notes that have already been generated with only 4-byte 
alignment.


> Since on Linux, .note.ABI-tag and .note.gnu.build-id notes are always
> aligned to 4 bytes, we need to use alignment of note section or note
> segment, instead of assuming alignment based on ELF file class.

IE, going against the gABI specification, yes ?  

Also - doesn't this imply that the alignment of the note section or note
segment in 64-bit binaries is incorrect.  IE, since in theory they should
contain 8-byte aligned notes, their alignment ought to be 8-bytes as well.

Wouldn't it be better to update the gABI document to say that the alignment 
of individual notes must be equal to the alignment of their containing 
section or segment, and not dependent upon their ELF class ?

Alternatively, if we are going to have special cases for certain notes, 
then these ought to be covered in the gABI document, and we need to 
consider if there are other notes, possibly for non-x86 architectures, 
that need to be covered as well.


Either way, I do not think that your patch should go in right now.  We
definitely need some more discussion on this issue.

Cheers
  Nick








Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]