From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 5CF5F3858D1E; Thu, 3 Aug 2023 13:47:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5CF5F3858D1E Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: bfd-cvs@sourceware.org Subject: [binutils-gdb] Remove PEI_HEADERS define X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: f8c4789c7f4efa3726ec39256b9860e4df9f8177 X-Git-Newrev: f559e52a8e79585e0b13156e949a7fd46060a714 Message-Id: <20230803134716.5CF5F3858D1E@sourceware.org> Date: Thu, 3 Aug 2023 13:47:16 +0000 (GMT) X-BeenThere: binutils-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Aug 2023 13:47:16 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Df559e52a8e79= 585e0b13156e949a7fd46060a714 commit f559e52a8e79585e0b13156e949a7fd46060a714 Author: Tom Tromey Date: Sun Jul 30 10:26:07 2023 -0600 Remove PEI_HEADERS define =20 I noticed a few files double-included libcoff.h, and digging deeper I found that the PEI_HEADERS define is a sort of external include guard. =20 This patch adds include guards to the few files in include/coff that were missing one, and then removes the PEI_HEADERS workaround and the redundant includes. =20 I didn't see anything in these files that indicated that double-inclusion would be useful, so it seems to me that this approach is ok. =20 Tested by rebuilding with --enable-targets=3Dall. =20 2023-08-02 Tom Tromey =20 * pei-x86_64.c (PEI_HEADERS): Do not define. * pei-loongarch64.c (PEI_HEADERS): Do not define. * pei-aarch64.c (PEI_HEADERS): Do not define. * pe-x86_64.c (PEI_HEADERS): Do not define. * pe-aarch64.c (PEI_HEADERS): Do not define. * libpei.h (_LIBPEI_H): Add include guard. * coff-x86_64.c (PEI_HEADERS): Do not check. * coff-loongarch64.c (PEI_HEADERS): Do not check. * coff-aarch64.c (PEI_HEADERS): Do not check. =20 include/ChangeLog 2023-08-02 Tom Tromey =20 * coff/x86_64.h (COFF_X86_64_H): Add include guard. * coff/loongarch64.h (COFF_LOONGARCH64_H): Add include guard. * coff/aarch64.h (COFF_AARCH64_H): Add include guard. Diff: --- bfd/ChangeLog | 12 ++++++++++++ bfd/coff-aarch64.c | 7 ------- bfd/coff-loongarch64.c | 7 ------- bfd/coff-x86_64.c | 5 ----- bfd/libpei.h | 3 +++ bfd/pe-aarch64.c | 1 - bfd/pe-x86_64.c | 1 - bfd/pei-aarch64.c | 1 - bfd/pei-loongarch64.c | 1 - bfd/pei-x86_64.c | 4 ---- include/ChangeLog | 6 ++++++ include/coff/aarch64.h | 5 +++++ include/coff/loongarch64.h | 5 +++++ include/coff/x86_64.h | 5 +++++ 14 files changed, 36 insertions(+), 27 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 56c858e6ce4..0087aed06a0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,15 @@ +2023-08-02 Tom Tromey + + * pei-x86_64.c (PEI_HEADERS): Do not define. + * pei-loongarch64.c (PEI_HEADERS): Do not define. + * pei-aarch64.c (PEI_HEADERS): Do not define. + * pe-x86_64.c (PEI_HEADERS): Do not define. + * pe-aarch64.c (PEI_HEADERS): Do not define. + * libpei.h (_LIBPEI_H): Add include guard. + * coff-x86_64.c (PEI_HEADERS): Do not check. + * coff-loongarch64.c (PEI_HEADERS): Do not check. + * coff-aarch64.c (PEI_HEADERS): Do not check. + 2023-07-24 Johannes Schauer Marin Rodrigues =20 * peXXigen.c (_bfd_XXi_only_swap_filehdr_out): If inserting a diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c index 659cd4f162d..60e23134344 100644 --- a/bfd/coff-aarch64.c +++ b/bfd/coff-aarch64.c @@ -23,10 +23,6 @@ #define COFF_WITH_peAArch64 #endif =20 -/* Note we have to make sure not to include headers twice. - Not all headers are wrapped in #ifdef guards, so we define - PEI_HEADERS to prevent double including here. */ -#ifndef PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" @@ -35,9 +31,6 @@ #include "coff/pe.h" #include "libcoff.h" #include "libiberty.h" -#endif - -#include "libcoff.h" =20 /* For these howto special functions, output_bfd =3D=3D NULL =3D> final link, or objdump -W and other calls to diff --git a/bfd/coff-loongarch64.c b/bfd/coff-loongarch64.c index 9136e06fea2..8ae3f842271 100644 --- a/bfd/coff-loongarch64.c +++ b/bfd/coff-loongarch64.c @@ -23,10 +23,6 @@ #define COFF_WITH_peLoongArch64 #endif =20 -/* Note we have to make sure not to include headers twice. - Not all headers are wrapped in #ifdef guards, so we define - PEI_HEADERS to prevent double including here. */ -#ifndef PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" @@ -35,9 +31,6 @@ #include "coff/pe.h" #include "libcoff.h" #include "libiberty.h" -#endif - -#include "libcoff.h" =20 /* The page size is a guess based on ELF. */ =20 diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c index f5bd5a27c40..9a3f85cd1e5 100644 --- a/bfd/coff-x86_64.c +++ b/bfd/coff-x86_64.c @@ -20,10 +20,6 @@ =20 Written by Kai Tietz, OneVision Software GmbH&CoKg. */ =20 -/* Note we have to make sure not to include headers twice. - Not all headers are wrapped in #ifdef guards, so we define - PEI_HEADERS to prevent double including here. */ -#ifndef PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" @@ -31,7 +27,6 @@ #include "coff/internal.h" #include "libcoff.h" #include "libiberty.h" -#endif =20 #define BADMAG(x) AMD64BADMAG(x) =20 diff --git a/bfd/libpei.h b/bfd/libpei.h index eafb9cf92c2..9837d4628dd 100644 --- a/bfd/libpei.h +++ b/bfd/libpei.h @@ -19,6 +19,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ =20 +#ifndef _LIBPEI_H +#define _LIBPEI_H =20 /* Most of this hacked by Steve Chamberlain, sac@cygnus.com @@ -445,3 +447,4 @@ bool _bfd_peAArch64_print_ce_compressed_pdata (bfd *, v= oid *); bool _bfd_peLoongArch64_print_ce_compressed_pdata (bfd *, void *); bool _bfd_pep_print_ce_compressed_pdata (bfd *, void *); =20 +#endif /* _LIBPEI_H */ diff --git a/bfd/pe-aarch64.c b/bfd/pe-aarch64.c index 9abc1cce5ea..2d5a7e25cea 100644 --- a/bfd/pe-aarch64.c +++ b/bfd/pe-aarch64.c @@ -55,7 +55,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } =20 -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/pe-x86_64.c b/bfd/pe-x86_64.c index 04bf98e007c..b9c241edc7f 100644 --- a/bfd/pe-x86_64.c +++ b/bfd/pe-x86_64.c @@ -20,7 +20,6 @@ =20 Written by Kai Tietz, OneVision Software GmbH&CoKg. */ =20 -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/pei-aarch64.c b/bfd/pei-aarch64.c index 3fa2ff84b70..2ec1254ea85 100644 --- a/bfd/pei-aarch64.c +++ b/bfd/pei-aarch64.c @@ -56,7 +56,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } =20 -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/pei-loongarch64.c b/bfd/pei-loongarch64.c index 89401291da4..3b7751a2b38 100644 --- a/bfd/pei-loongarch64.c +++ b/bfd/pei-loongarch64.c @@ -56,7 +56,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } =20 -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c index 4d2ba71def9..65bd83e917d 100644 --- a/bfd/pei-x86_64.c +++ b/bfd/pei-x86_64.c @@ -58,10 +58,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } =20 -/* Note we have to make sure not to include headers twice. - Not all headers are wrapped in #ifdef guards, so we define - PEI_HEADERS to prevent double including in coff-x86_64.c */ -#define PEI_HEADERS #include "sysdep.h" #include "bfd.h" #include "libbfd.h" diff --git a/include/ChangeLog b/include/ChangeLog index 4d407403944..eb54da44146 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,9 @@ +2023-08-02 Tom Tromey + + * coff/x86_64.h (COFF_X86_64_H): Add include guard. + * coff/loongarch64.h (COFF_LOONGARCH64_H): Add include guard. + * coff/aarch64.h (COFF_AARCH64_H): Add include guard. + 2023-07-30 Jose E. Marchesi =20 * elf/bpf.h (EF_BPF_CPUVER): Define. diff --git a/include/coff/aarch64.h b/include/coff/aarch64.h index 4616cfef2b8..a3f2bcb76f7 100644 --- a/include/coff/aarch64.h +++ b/include/coff/aarch64.h @@ -17,6 +17,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ =20 +#ifndef COFF_AARCH64_H +#define COFF_AARCH64_H + #define COFFAARCH64 1 =20 #define L_LNNO_SIZE 2 @@ -82,3 +85,5 @@ struct external_reloc #define IMAGE_REL_ARM64_REL32 0x0011 /* The 32-bit relative add= ress from the byte following the relocation. */ =20 #define ARM_NOTE_SECTION ".note" + +#endif /* COFF_AARCH64_H */ diff --git a/include/coff/loongarch64.h b/include/coff/loongarch64.h index 5a21bcf9976..d273881623a 100644 --- a/include/coff/loongarch64.h +++ b/include/coff/loongarch64.h @@ -17,6 +17,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ =20 +#ifndef COFF_LOONGARCH64_H +#define COFF_LOONGARCH64_H + #define COFFLOONGARCH64 1 =20 #define L_LNNO_SIZE 2 @@ -59,3 +62,5 @@ struct external_reloc =20 #define RELOC struct external_reloc #define RELSZ 14 + +#endif /* COFF_LOONGARCH64_H */ diff --git a/include/coff/x86_64.h b/include/coff/x86_64.h index 9980a84a835..3be9ee3874c 100644 --- a/include/coff/x86_64.h +++ b/include/coff/x86_64.h @@ -20,6 +20,9 @@ =20 Written by Kai Tietz, OneVision Software GmbH&CoKg. */ =20 +#ifndef COFF_X86_64_H +#define COFF_X86_64_H + #define L_LNNO_SIZE 2 #define INCLUDE_COMDAT_FIELDS_IN_AUXENT =20 @@ -105,3 +108,5 @@ struct external_reloc #define R_PCRBYTE 18 #define R_PCRWORD 19 #define R_PCRLONG 20 + +#endif /* COFF_X86_64_H */