public inbox for gnu-gabi@sourceware.org
 help / color / mirror / Atom feed
From: Suprateeka R Hegde <hegdesmailbox@gmail.com>
To: generic-abi@googlegroups.com, Cary Coutant <ccoutant@gmail.com>,
	Ali Bahrami <Ali.Bahrami@Oracle.COM>,
	"H.J. Lu" <hjl.tools@gmail.com>,
	Mark Mentovai <mark@chromium.org>
Cc: gnu-gabi@sourceware.org
Subject: Re: What integer type should ELF note header have?
Date: Sun, 01 Jan 2017 00:00:00 -0000	[thread overview]
Message-ID: <993f8818-65a6-b83a-9d55-1fbbd88db8c8@gmail.com> (raw)
In-Reply-To: <CAJimCsHE8cMY8MY=BYyQ+o4b14LtQKa2u+SiXWi1o4zBQB9t9Q@mail.gmail.com>

On 09-Dec-2017 08:11 PM, Cary Coutant wrote:
> I'm pretty sure that at HP, we implemented the 8-byte wording.

That might be in the initial days. I do not have any archive that says
so. The current implementation is extremely very clear. It follows gABI
completely. Its 4 byte word with 4 byte alignment for 32-bit and 8 byte
word with 8 byte alignment for 64-bit. Read below.

On 10-Dec-2017 12:18 AM, Ali Bahrami wrote:
> Would the following work, and be backward compatible on other platforms?

What you mentioned below is exactly what we have on HP-UX too.

> 
>     - The ELFCLASS of an object no longer dictates the wordsize of
>       note sections.
> 
>     - In SHT_NOTE section headers, valid values of sh_addralign are
>       4, or 8. This value specifies the required alignment, as well
>       as the note wordsize, and padding.

Thats precisely what I wrote a week back:

supra wrote:
> And p_align of PT_NOTE may be set to the
> maximum of all sh_addralign of all SHT_NOTE that make up the PT_NOTE.

Since it is unlikely that there could be SHT_NOTE of different
alignments (in the same data model), it boils down to precisely what you
said above.

>       - In PT_NOTE program headers, the p_align field must match the
>         sh_addralign value for the note(s) that it encapsulates, and is
>         expected to be 4 for 32-bit notes, and 8 for 64-bit notes. For
>         historical reasons, values of 0 or 1 are also allowed, and refer
>         to a 32-bit note. 

Looks perfect. I agree.

> I have several reasons for thinking these are intended to be 8 bytes in 64-bit
> notes, starting with the words in the gABI. As HP-UX already implemented this
> years ago, Cary and Supra can confirm or deny that.

> What do other platforms (again, thinking about HP-UX) do for 64-bit notes?

Thats right. Reiterating, its 4 byte word with 4 byte alignment for
32-bit, and 8 byte word with 8 byte alignment for 64-bit.

>     - If those three fields are always 32-bit, then it means that name is
>       aligned on 4 bytes. This complicates the padding of name,

Agree. See below.

On 05-Dec-2017 03:11 AM, Mark Mentovai wrote:
> typedef uint32_t Elf32_Word;
> typedef uint32_t Elf64_Word;

This is the reason why on HP-UX we do not even have that
Elf[64|32]_Nhdr. It would make the word size same for both 32-bit and
64-bit data models. I think even gABI does not define *_Nhdr. Or am I
mistaken?

We generate contents of SHT_NOTE sections using internal data structs
and ensure gABI compatibility in a very simple way.

--
Supra

       reply	other threads:[~2017-12-10 19:52 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAMe9rOoV5u263JotP=XpiYEzcnjCJOG3U-0X5bnK-WwZoOKTQA@mail.gmail.com>
     [not found] ` <99c8440b-54d8-41bc-6e4d-cd1894536bb7@Oracle.COM>
     [not found]   ` <CAJimCsHE8cMY8MY=BYyQ+o4b14LtQKa2u+SiXWi1o4zBQB9t9Q@mail.gmail.com>
2017-01-01  0:00     ` Suprateeka R Hegde [this message]
2017-01-01  0:00       ` Ali Bahrami
2017-01-01  0:00         ` Mark Wielaard
2017-01-01  0:00           ` H.J. Lu
2017-01-01  0:00             ` Mark Wielaard
2017-01-01  0:00               ` H.J. Lu
2017-01-01  0:00                 ` Mark Wielaard
     [not found]                   ` <3704867e-58b8-3da1-2b29-959ad67a540d@Oracle.COM>
     [not found]                     ` <1513355861.15696.95.camel@klomp.org>
     [not found]                       ` <CAMe9rOrAFX5gPCB355A=vP0VpWQT1x8V3Hrttxm5ZRsvG1FXXw@mail.gmail.com>
2017-01-01  0:00                         ` Mark Wielaard
     [not found]                           ` <CAMe9rOosYw=9kF8eTUnxwQXNguvCrcK5GSaM=vbUUSA6+J49Zw@mail.gmail.com>
2017-01-01  0:00                             ` Mark Wielaard
2017-01-01  0:00                   ` H.J. Lu
2017-01-01  0:00                     ` Mark Wielaard
2017-01-01  0:00                       ` H.J. Lu
2017-01-01  0:00       ` Ali Bahrami

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=993f8818-65a6-b83a-9d55-1fbbd88db8c8@gmail.com \
    --to=hegdesmailbox@gmail.com \
    --cc=Ali.Bahrami@Oracle.COM \
    --cc=ccoutant@gmail.com \
    --cc=generic-abi@googlegroups.com \
    --cc=gnu-gabi@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=mark@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).