From: "Alex Bennée" <alex.bennee@linaro.org>
To: BALATON Zoltan <balaton@eik.bme.hu>
Cc: peter.maydell@linaro.org,
"open list:RISC-V TCG CPUs" <qemu-riscv@nongnu.org>,
qemu-devel@nongnu.org,
"open list:S390-ccw boot" <qemu-s390x@nongnu.org>,
qemu-arm@nongnu.org, "open list:PReP" <qemu-ppc@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v1 2/4] elf: move elf.h to elf/elf.h and split out types
Date: Wed, 11 Sep 2019 10:19:28 +0100 [thread overview]
Message-ID: <875zlz197j.fsf@linaro.org> (raw)
In-Reply-To: <alpine.BSF.2.21.9999.1909111015260.4726@zero.eik.bme.hu>
BALATON Zoltan <balaton@eik.bme.hu> writes:
> On Tue, 10 Sep 2019, Alex Bennée wrote:
>> diff --git a/include/elf/elf-types.inc.h b/include/elf/elf-types.inc.h
>> new file mode 100644
>> index 00000000000..35163adb2b5
>> --- /dev/null
>> +++ b/include/elf/elf-types.inc.h
>> @@ -0,0 +1,63 @@
>> +/*
>> + * Elf Type Specialisation
>> + *
>> + * Copyright (c) 2019
>> + * Written by Alex Bennée <alex.bennee@linaro.org>
>> + *
>> + * This code is licensed under the GNU .
>
> You're missing end of licence sentence here. Also original file did
> not have copyright and licence header so you may want to fix that too
> or leave it out here as well for consistency,
The fault of my header macro - I'll try and fix it up when it's
expanding on the QEMU tree.
I'm going to assume that is should be the whole project license (GPL
v2). Most of the original file dates from 2003 and is Frabrice's commit
with the occasional commit mentioning be copied from Linux.
>
>> + */
>> +
>> +#ifndef _ELF_TYPES_INC_H_
>> +#define _ELF_TYPES_INC_H_
>> +
>> +#ifndef ELF_CLASS
>> +#error you must define ELF_CLASS before including elf-types.inc.h
>> +#else
>> +
>> +#if ELF_CLASS == ELFCLASS32
>> +
>> +#define elfhdr elf32_hdr
>> +#define elf_phdr elf32_phdr
>> +#define elf_note elf32_note
>> +#define elf_shdr elf32_shdr
>> +#define elf_sym elf32_sym
>> +#define elf_addr_t Elf32_Off
>> +#define elf_rela elf32_rela
>> +
>> +#ifdef ELF_USES_RELOCA
>> +# define ELF_RELOC Elf32_Rela
>> +#else
>> +# define ELF_RELOC Elf32_Rel
>> +#endif
>> +
>> +#ifndef ElfW
>> +# define ElfW(x) Elf32_ ## x
>> +# define ELFW(x) ELF32_ ## x
>> +#endif
>> +
>> +#else /* ELF_CLASS == ELFCLASS64 */
>> +
>> +#define elfhdr elf64_hdr
>> +#define elf_phdr elf64_phdr
>> +#define elf_note elf64_note
>> +#define elf_shdr elf64_shdr
>> +#define elf_sym elf64_sym
>> +#define elf_addr_t Elf64_Off
>> +#define elf_rela elf64_rela
>> +
>> +#ifdef ELF_USES_RELOCA
>> +# define ELF_RELOC Elf64_Rela
>> +#else
>> +# define ELF_RELOC Elf64_Rel
>> +#endif
>> +
>> +#ifndef ElfW
>> +# define ElfW(x) Elf64_ ## x
>> +# define ELFW(x) ELF64_ ## x
>> +#endif
>> +
>> +#endif /* ELF_CLASS == ELFCLASS64 */
>> +#endif /* ELF_CLASS */
>> +#else
>> +#error elf-types.inc.h should not be included twice in one compilation unit
>> +#endif /* _ELF_TYPES_INC_H_ */
>> diff --git a/include/elf.h b/include/elf/elf.h
>> similarity index 98%
>> rename from include/elf.h
>> rename to include/elf/elf.h
>> index 3501e0c8d03..2e264c1a7a0 100644
>> --- a/include/elf.h
>> +++ b/include/elf/elf.h
>> @@ -1696,49 +1696,7 @@ struct elf32_fdpic_loadmap {
>> };
>>
>> #ifdef ELF_CLASS
>> -#if ELF_CLASS == ELFCLASS32
>> -
>> -#define elfhdr elf32_hdr
>> -#define elf_phdr elf32_phdr
>> -#define elf_note elf32_note
>> -#define elf_shdr elf32_shdr
>> -#define elf_sym elf32_sym
>> -#define elf_addr_t Elf32_Off
>> -#define elf_rela elf32_rela
>> -
>> -#ifdef ELF_USES_RELOCA
>> -# define ELF_RELOC Elf32_Rela
>> -#else
>> -# define ELF_RELOC Elf32_Rel
>> -#endif
>> -
>> -#else
>> -
>> -#define elfhdr elf64_hdr
>> -#define elf_phdr elf64_phdr
>> -#define elf_note elf64_note
>> -#define elf_shdr elf64_shdr
>> -#define elf_sym elf64_sym
>> -#define elf_addr_t Elf64_Off
>> -#define elf_rela elf64_rela
>> -
>> -#ifdef ELF_USES_RELOCA
>> -# define ELF_RELOC Elf64_Rela
>> -#else
>> -# define ELF_RELOC Elf64_Rel
>> -#endif
>> -
>> -#endif /* ELF_CLASS */
>>
>> -#ifndef ElfW
>> -# if ELF_CLASS == ELFCLASS32
>> -# define ElfW(x) Elf32_ ## x
>> -# define ELFW(x) ELF32_ ## x
>> -# else
>> -# define ElfW(x) Elf64_ ## x
>> -# define ELFW(x) ELF64_ ## x
>> -# endif
>> -#endif
>>
>> #endif /* ELF_CLASS */
>
> Is there anything remaining in this #ifdef ELF_CLASS after this patch?
> If not why do you keep it?
>
> Regards,
> BALATON Zoltan
--
Alex Bennée
next prev parent reply other threads:[~2019-09-11 9:21 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-10 19:34 [Qemu-devel] [PATCH v1 0/4] ELF and (macro) safety Alex Bennée
2019-09-10 19:34 ` [Qemu-devel] [PATCH v1 1/4] target/ppc: fix signal delivery for ppc64abi32 Alex Bennée
2019-09-10 19:45 ` Alex Bennée
2019-09-10 19:34 ` [Qemu-devel] [PATCH v1 2/4] elf: move elf.h to elf/elf.h and split out types Alex Bennée
2019-09-11 0:08 ` David Gibson
2019-09-11 8:29 ` BALATON Zoltan
2019-09-11 9:19 ` Alex Bennée [this message]
2019-09-14 18:15 ` Richard Henderson
2019-10-21 13:53 ` Laurent Vivier
2019-10-21 14:04 ` Peter Maydell
2019-09-10 19:34 ` [Qemu-devel] [PATCH v1 3/4] elf: move elf_ops.h into include/elf/ and rename Alex Bennée
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 ` [Qemu-devel] [PATCH v1 4/4] elf: move ELF_ARCH definition to elf-arch.h Alex Bennée
2019-09-10 21:14 ` Aleksandar Markovic
2019-09-11 9:26 ` Alex Bennée
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 18:19 ` Richard Henderson
2019-09-10 21:39 ` Aleksandar Markovic
2019-09-11 8:19 ` Alex Bennée
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=875zlz197j.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=balaton@eik.bme.hu \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu-s390x@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 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).