[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What integer type should ELF note header have?



On Wed, Dec 13, 2017 at 5:57 AM, Mark Wielaard <mark@klomp.org> wrote:
> On Mon, 2017-12-11 at 04:11 -0800, H.J. Lu wrote:
>> Changing ELF64_Nhdr is going to be hard, but not impossible.  In
>> theory, an 64-bit object may have a note entry which is bigger than 4
>> GB.  We can add a new note header:
>>
>> typedef struct
>> {
>>   Elf64_Xword n_namesz;                  /* Length of the note's name.  */
>>   Elf64_Xword n_descsz;                  /* Length of the note's descriptor.  */
>>   Elf64_Xword n_type;                    /* Type of the note.  */
>> } Elf64_Nhdr64;
>>
>> Note segments/sections with 8 byte alignment should use Elf64_Nhdr64.
>> If we want to do it, we should do it now before
>> NT_GNU_PROPERTY_TYPE_0
>> notes with the existing Elf64_Nhdr are generated by GCC 8 with
>> -fcf-protection -mcet.
>
> Yes, I think having a new note type is the way to go, if we want to
> change the alignment requirements.
>
> BTW. What is the reason you need 8 byte aligned notes?
>

NT_GNU_PROPERTY_TYPE_0 can have 64-bit integer properties
in 64-bit objects.  They should be aligned to 8 bytes.  This is
independent of Elf64_Nhdr.

-- 
H.J.