From: Florian Weimer <fweimer@redhat.com>
To: Robin Kuzmin <kuzmin.robin@gmail.com>
Cc: mtk@man7.org, linux-man <linux-man@vger.kernel.org>,
mjw@fedoraproject.org
Subject: Re: elf.5.html: Resolving confusion.
Date: Thu, 12 Dec 2019 13:01:55 +0100 [thread overview]
Message-ID: <87tv65hhvw.fsf@oldenburg2.str.redhat.com> (raw)
In-Reply-To: <CAAztzVHSQPAxY4zcmxtj8v8geEu=SJiSPPBBsZRxUeacxHO+-w@mail.gmail.com> (Robin Kuzmin's message of "Wed, 11 Dec 2019 12:19:24 -0800")
* Robin Kuzmin:
> http://man7.org/linux/man-pages/man5/elf.5.html
>
> I see the fragment:
>
> A section header table index is a subscript into this array. Some
> section header table indices are reserved: the initial entry and the
> indices between SHN_LORESERVE and SHN_HIRESERVE. The initial entry
> is used in ELF extensions for e_phnum, e_shnum and e_strndx; in other
> cases, each field in the initial entry is set to zero. An object
> file does not have sections for these special indices:
>
> SHN_UNDEF
> This value marks an undefined, missing, irrelevant, or other‐
> wise meaningless section reference.
>
> I interpret it like this:
>
> A section header table index **(e_shstrndx)** is a subscript
> into this array.
No, e_shstrndx is just one of the possible indices. It's just the
string table that is used for section names.
> Some
> section header table indices are reserved:
> the initial entry **(index 0)**
> and the indices **from** SHN_LORESERVE **to** SHN_HIRESERVE **,
> inclusive**.
> **Such reserved indices, except SHN_XINDEX (0xffff), cannot be
> used in e_shstrndx.
> If e_shstrndx is SHN_XINDEX (0xffff) then the sh_link filed of
> the initial ElfN_Shdr cannot contain such reserved indices.**
> The **three fields in the** initial entry ** - sh_info, sh_size
> and sh_link - can be** used in ELF extensions for e_phnum, e_shnum and
> **e_shstrndx correspondingly**. **If they are not used then they are
> set to zero. All other fields of the initial entry are set to zero.**
> **The section header table entries with the following special
> indices contain special values, and in the ELF file there are
> no sections associated with such entries.**
>
> SHN_UNDEF
> This value marks an undefined, missing, irrelevant, or other‐
> wise meaningless section reference.
> **This index can be 0 in which case it means the initial
> ElfN_Shdr with a special meaning described above.**
>
> Is such an interpretation correct?
I'm not sure if your clarifications are correct. I don't think the
section header extension mechanism is used for extending e_phum.
The main thing that's not clear to me in the current description is
whether the 256 reserved indices have still entries in the table
(probably of type SHT_NULL).
Cc:ing Mark, in case he has further comments.
Thanks,
Florian
next prev parent reply other threads:[~2019-12-12 12:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-11 20:19 elf.5.html: Resolving confusion Robin Kuzmin
2019-12-12 7:00 ` Michael Kerrisk (man-pages)
2019-12-12 12:01 ` Florian Weimer [this message]
2019-12-22 14:17 ` Mark Wielaard
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=87tv65hhvw.fsf@oldenburg2.str.redhat.com \
--to=fweimer@redhat.com \
--cc=kuzmin.robin@gmail.com \
--cc=linux-man@vger.kernel.org \
--cc=mjw@fedoraproject.org \
--cc=mtk@man7.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 NNTP newsgroup(s).