From: "Alex Bennée" <alex.bennee@linaro.org>
To: peter.maydell@linaro.org
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org
Subject: Re: [PATCH v1 3/4] elf: move elf_ops.h into include/elf/ and rename
Date: Wed, 11 Sep 2019 09:20:17 +0100 [thread overview]
Message-ID: <878sqv1by6.fsf@linaro.org> (raw)
In-Reply-To: <20190910193408.28917-4-alex.bennee@linaro.org>
Alex Bennée <alex.bennee@linaro.org> writes:
> Lets keep all the Elf manipulation bits together. Also rename the file
> to better reflect how it is used and add a little header to the file.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> hw/core/loader.c | 4 ++--
It is arguable this could be a private header in hw/core as it is only
included in one place.
> include/{hw/elf_ops.h => elf/elf_ops.inc.h} | 9 +++++++++
> 2 files changed, 11 insertions(+), 2 deletions(-)
> rename include/{hw/elf_ops.h => elf/elf_ops.inc.h} (98%)
>
> diff --git a/hw/core/loader.c b/hw/core/loader.c
> index e0c6563e643..886179a4947 100644
> --- a/hw/core/loader.c
> +++ b/hw/core/loader.c
> @@ -302,7 +302,7 @@ static void *load_at(int fd, off_t offset, size_t size)
> #define elf_word uint32_t
> #define elf_sword int32_t
> #define bswapSZs bswap32s
> -#include "hw/elf_ops.h"
> +#include "elf/elf_ops.inc.h"
>
> #undef elfhdr
> #undef elf_phdr
> @@ -324,7 +324,7 @@ static void *load_at(int fd, off_t offset, size_t size)
> #define elf_sword int64_t
> #define bswapSZs bswap64s
> #define SZ 64
> -#include "hw/elf_ops.h"
> +#include "elf/elf_ops.inc.h"
>
> const char *load_elf_strerror(int error)
> {
> diff --git a/include/hw/elf_ops.h b/include/elf/elf_ops.inc.h
> similarity index 98%
> rename from include/hw/elf_ops.h
> rename to include/elf/elf_ops.inc.h
> index 1496d7e7536..a820bd821d5 100644
> --- a/include/hw/elf_ops.h
> +++ b/include/elf/elf_ops.inc.h
> @@ -1,3 +1,12 @@
> +/*
> + * Macro expansions for Elf operations. This is included in a
> + * compilation unit with appropriate definitions for SZ and elf
> + * headers to generate utility functions for reading 32 and 64 bit elf
> + * headers.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> static void glue(bswap_ehdr, SZ)(struct elfhdr *ehdr)
> {
> bswap16s(&ehdr->e_type); /* Object file type */
--
Alex Bennée
WARNING: multiple messages have this Message-ID (diff)
From: "Alex Bennée" <alex.bennee@linaro.org>
To: peter.maydell@linaro.org
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v1 3/4] elf: move elf_ops.h into include/elf/ and rename
Date: Wed, 11 Sep 2019 09:20:17 +0100 [thread overview]
Message-ID: <878sqv1by6.fsf@linaro.org> (raw)
In-Reply-To: <20190910193408.28917-4-alex.bennee@linaro.org>
Alex Bennée <alex.bennee@linaro.org> writes:
> Lets keep all the Elf manipulation bits together. Also rename the file
> to better reflect how it is used and add a little header to the file.
>
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> hw/core/loader.c | 4 ++--
It is arguable this could be a private header in hw/core as it is only
included in one place.
> include/{hw/elf_ops.h => elf/elf_ops.inc.h} | 9 +++++++++
> 2 files changed, 11 insertions(+), 2 deletions(-)
> rename include/{hw/elf_ops.h => elf/elf_ops.inc.h} (98%)
>
> diff --git a/hw/core/loader.c b/hw/core/loader.c
> index e0c6563e643..886179a4947 100644
> --- a/hw/core/loader.c
> +++ b/hw/core/loader.c
> @@ -302,7 +302,7 @@ static void *load_at(int fd, off_t offset, size_t size)
> #define elf_word uint32_t
> #define elf_sword int32_t
> #define bswapSZs bswap32s
> -#include "hw/elf_ops.h"
> +#include "elf/elf_ops.inc.h"
>
> #undef elfhdr
> #undef elf_phdr
> @@ -324,7 +324,7 @@ static void *load_at(int fd, off_t offset, size_t size)
> #define elf_sword int64_t
> #define bswapSZs bswap64s
> #define SZ 64
> -#include "hw/elf_ops.h"
> +#include "elf/elf_ops.inc.h"
>
> const char *load_elf_strerror(int error)
> {
> diff --git a/include/hw/elf_ops.h b/include/elf/elf_ops.inc.h
> similarity index 98%
> rename from include/hw/elf_ops.h
> rename to include/elf/elf_ops.inc.h
> index 1496d7e7536..a820bd821d5 100644
> --- a/include/hw/elf_ops.h
> +++ b/include/elf/elf_ops.inc.h
> @@ -1,3 +1,12 @@
> +/*
> + * Macro expansions for Elf operations. This is included in a
> + * compilation unit with appropriate definitions for SZ and elf
> + * headers to generate utility functions for reading 32 and 64 bit elf
> + * headers.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> static void glue(bswap_ehdr, SZ)(struct elfhdr *ehdr)
> {
> bswap16s(&ehdr->e_type); /* Object file type */
--
Alex Bennée
next prev parent reply other threads:[~2019-09-11 8:20 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-10 19:34 [PATCH v1 0/4] ELF and (macro) safety Alex Bennée
2019-09-10 19:34 ` [Qemu-devel] " Alex Bennée
2019-09-10 19:34 ` [PATCH v1 1/4] target/ppc: fix signal delivery for ppc64abi32 Alex Bennée
2019-09-10 19:34 ` [Qemu-devel] " Alex Bennée
2019-09-10 19:45 ` Alex Bennée
2019-09-10 19:45 ` [Qemu-devel] " Alex Bennée
2019-09-10 19:34 ` [Qemu-riscv] [PATCH v1 2/4] elf: move elf.h to elf/elf.h and split out types Alex Bennée
2019-09-10 19:34 ` [Qemu-devel] " Alex Bennée
2019-09-10 19:34 ` Alex Bennée
2019-09-11 0:08 ` [Qemu-riscv] " David Gibson
2019-09-11 0:08 ` [Qemu-devel] " David Gibson
2019-09-11 0:08 ` David Gibson
2019-09-11 8:29 ` [Qemu-riscv] " BALATON Zoltan
2019-09-11 8:29 ` [Qemu-devel] " BALATON Zoltan
2019-09-11 8:29 ` BALATON Zoltan
2019-09-11 9:19 ` [Qemu-riscv] " Alex Bennée
2019-09-11 9:19 ` [Qemu-devel] " Alex Bennée
2019-09-11 9:19 ` Alex Bennée
2019-09-14 18:15 ` [Qemu-riscv] [Qemu-devel] " Richard Henderson
2019-09-14 18:15 ` Richard Henderson
2019-09-14 18:15 ` Richard Henderson
2019-10-21 13:53 ` Laurent Vivier
2019-10-21 13:53 ` Laurent Vivier
2019-10-21 14:04 ` Peter Maydell
2019-10-21 14:04 ` Peter Maydell
2019-09-10 19:34 ` [PATCH v1 3/4] elf: move elf_ops.h into include/elf/ and rename Alex Bennée
2019-09-10 19:34 ` [Qemu-devel] " Alex Bennée
2019-09-11 8:20 ` Alex Bennée [this message]
2019-09-11 8:20 ` Alex Bennée
2019-09-14 18:16 ` Richard Henderson
2019-10-21 13:56 ` Laurent Vivier
2019-09-10 19:34 ` [PATCH v1 4/4] elf: move ELF_ARCH definition to elf-arch.h Alex Bennée
2019-09-10 19:34 ` [Qemu-devel] " Alex Bennée
2019-09-10 21:14 ` Aleksandar Markovic
2019-09-10 21:14 ` Aleksandar Markovic
2019-09-11 9:26 ` Alex Bennée
2019-09-11 9:26 ` Alex Bennée
2019-09-13 14:45 ` Aleksandar Markovic
2019-09-13 14:45 ` Aleksandar Markovic
2019-09-14 15:52 ` Richard Henderson
2019-09-14 17:51 ` Alex Bennée
2019-09-14 17:51 ` Alex Bennée
2019-09-14 18:19 ` Richard Henderson
2019-09-14 18:19 ` Richard Henderson
2019-09-10 21:39 ` Aleksandar Markovic
2019-09-10 21:39 ` Aleksandar Markovic
2019-09-11 8:19 ` Alex Bennée
2019-09-11 8:19 ` Alex Bennée
2019-10-21 14:03 ` Laurent Vivier
2019-10-21 14:03 ` Laurent Vivier
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=878sqv1by6.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.