From: Christophe Lyon <christophe.lyon@st.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
Christophe Lyon <christophe.lyon@linaro.org>,
Riku Voipio <riku.voipio@iki.fi>,
Laurent Vivier <laurent@vivier.eu>
Subject: Re: [Qemu-devel] [ARM/FDPIC v2 2/4] linux-user: ARM-FDPIC: Identify ARM FDPIC binaries
Date: Mon, 23 Apr 2018 14:53:38 +0200 [thread overview]
Message-ID: <d3762ab7-e23c-9078-0e1f-57addc334cbe@st.com> (raw)
In-Reply-To: <CAFEAcA9tnh9j=QMxZm7RTMzaRVxh10oEGDCYYO5TL5TvAuvLXw@mail.gmail.com>
On 23/04/2018 14:17, Peter Maydell wrote:
> On 23 April 2018 at 08:51, Christophe Lyon <christophe.lyon@st.com> wrote:
>> Define an ARM-specific version of elf_is_fdpic:
>> FDPIC ELF objects are identified with e_ident[EI_OSABI] ==
>> ELFOSABI_ARM_FDPIC.
>>
>> Co-Authored-By: Mickaël Guêné <mickael.guene@st.com>
>> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
>>
>> diff --git a/include/elf.h b/include/elf.h
>> index c0dc9bb..934dbbd 100644
>> --- a/include/elf.h
>> +++ b/include/elf.h
>> @@ -1483,6 +1483,7 @@ typedef struct elf64_shdr {
>> #define ELFOSABI_TRU64 10 /* Compaq TRU64 UNIX. */
>> #define ELFOSABI_MODESTO 11 /* Novell Modesto. */
>> #define ELFOSABI_OPENBSD 12 /* OpenBSD. */
>> +#define ELFOSABI_ARM_FDPIC 65 /* ARM FDPIC */
>> #define ELFOSABI_ARM 97 /* ARM */
>> #define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
>>
>> diff --git a/linux-user/elfload.c b/linux-user/elfload.c
>> index bbe93b0..76d7718 100644
>> --- a/linux-user/elfload.c
>> +++ b/linux-user/elfload.c
>> @@ -1681,11 +1681,18 @@ static void zero_bss(abi_ulong elf_bss, abi_ulong last_bss, int prot)
>> }
>> }
>>
>> +#ifdef TARGET_ARM
>> +static int elf_is_fdpic(struct elfhdr *exec)
>> +{
>> + return exec->e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC;
>> +}
>> +#else
>> /* Default implementation, always false. */
>> static int elf_is_fdpic(struct elfhdr *exec)
>> {
>> return 0;
>> }
>> +#endif
>
> I have a strong dislike for per-target ifdef ladders. Can we instead
> put the target's implementation of elf_is_fdpic() into
> linux-user/$ARCH/target_elf.h
> and also have that header do
> #define TARGET_HAS_ELF_FDPIC
>
> and then in the generic code we can protect the default elf_is_fdpic()
> with #ifndef TARGET_HAS_ELF_FDPIC.
>
How invasive could that be?
Your proposal is appealing, but target_elf.h is only included by linux-user/main.c, which does not define elfhdr etc...
All that knowledge is in linux-user/elfload.c, which controls what include/elf.h defines.
Should I re-engineer that?
Thanks,
Christophe
> thanks
> -- PMM
> .
>
next prev parent reply other threads:[~2018-04-23 12:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 7:51 [Qemu-devel] [ARM/FDPIC v2 0/4] FDPIC ABI for ARM Christophe Lyon
2018-04-23 7:51 ` [Qemu-devel] [ARM/FDPIC v2 1/4] Remove CONFIG_USE_FDPIC Christophe Lyon
2018-04-23 12:23 ` Peter Maydell
2018-04-23 7:51 ` [Qemu-devel] [ARM/FDPIC v2 2/4] linux-user: ARM-FDPIC: Identify ARM FDPIC binaries Christophe Lyon
2018-04-23 12:17 ` Peter Maydell
2018-04-23 12:53 ` Christophe Lyon [this message]
2018-04-23 13:26 ` Peter Maydell
2018-04-23 7:51 ` [Qemu-devel] [ARM/FDPIC v2 3/4] linux-user: ARM-FDPIC: Add support of FDPIC for ARM Christophe Lyon
2018-04-23 12:49 ` Peter Maydell
2018-04-23 14:13 ` Christophe Lyon
2018-04-23 15:13 ` Peter Maydell
2018-04-23 7:51 ` [Qemu-devel] [ARM/FDPIC v2 4/4] linux-user: ARM-FDPIC: Add support for signals for FDPIC targets Christophe Lyon
2018-04-23 13:05 ` Peter Maydell
2018-04-23 14:22 ` Christophe Lyon
2018-04-23 15:31 ` Peter Maydell
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=d3762ab7-e23c-9078-0e1f-57addc334cbe@st.com \
--to=christophe.lyon@st.com \
--cc=christophe.lyon@linaro.org \
--cc=laurent@vivier.eu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/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).