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

Re: What integer type should ELF note header have?



On Thu, Dec 14, 2017 at 2:06 AM, Mark Wielaard <mark@klomp.org> wrote:
> On Wed, 2017-12-13 at 10:09 -0800, H.J. Lu wrote:
>> 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:
>> > > 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.
>
> Not necessarily. You can have not naturally aligned data in files. ELF
> files are cross architectures, so you have to account for different

64-bit integers in NT_GNU_PROPERTY_TYPE_0 note are naturally aligned
by design so that int64 can be used to access 64-bit integers in
NT_GNU_PROPERTY_TYPE_0 note on all architectures.

> alignments and endian issues anyway. Is there a specific property of
> these 64-bit integers that require them to be 8 byte aligned in the
> note descriptor data?

Currently it has GNU_PROPERTY_STACK_SIZE as 64-bit integer
in 64-bit objects.  We may add more in the future.


-- 
H.J.