bfd/pe*.c including bfd/coff*.c The model of a coff-<arch>.c file providing older COFF support, with a pe-<arch>.c file defining some macros then including the coff-<arch>.c file to provide PE support has been followed by a number of architectures. Some of them have PE specific code in their coff-<arch>.c files, unconditionally compiled. ie. they are not for old COFF support, and there was no reason to follow the model. They now get an error if they are compiled stand-alone rather than being included from pe-<arch>.c or pei-<arch>.c. * coff-aarch64.c (COFF_WITH_peAArch64): Don't define here. (COFF_WITH_PE): Error if not defined. * coff-ia64.c (COFF_WITH_PE): Error if not defined. * coff-loongarch64.c (COFF_WITH_peLoongArch64): Don't define here. (COFF_WITH_PE): Error if not defined. * coff-mcore.c (COFF_WITH_PE): Error if not defined. * coff-riscv64.c (COFF_WITH_PE): Error if not defined. * pei-aarch64.c: Remove duplicate includes. * pei-loongarch64.c: Likewise. * pei-riscv64.c: Likewise. * pei-x86_64.c: Likewise.
diff --git a/bfd/coff-aarch64.c b/bfd/coff-aarch64.c index af4a44d..48b8bfa 100644 --- a/bfd/coff-aarch64.c +++ b/bfd/coff-aarch64.c
@@ -18,9 +18,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef COFF_WITH_peAArch64 -#define COFF_WITH_peAArch64 +#ifndef COFF_WITH_PE +#error non-PE COFF unsupported #endif #include "sysdep.h"
diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c index 3a947ef..b2873ae 100644 --- a/bfd/coff-ia64.c +++ b/bfd/coff-ia64.c
@@ -19,6 +19,10 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef COFF_WITH_PE +#error non-PE COFF unsupported +#endif + #include "sysdep.h" #include "bfd.h" #include "libbfd.h"
diff --git a/bfd/coff-loongarch64.c b/bfd/coff-loongarch64.c index c1fe70b..a852108 100644 --- a/bfd/coff-loongarch64.c +++ b/bfd/coff-loongarch64.c
@@ -18,9 +18,8 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ - -#ifndef COFF_WITH_peLoongArch64 -#define COFF_WITH_peLoongArch64 +#ifndef COFF_WITH_PE +#error non-PE COFF unsupported #endif #include "sysdep.h"
diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c index e15c4b4..fab10a7 100644 --- a/bfd/coff-mcore.c +++ b/bfd/coff-mcore.c
@@ -18,6 +18,10 @@ Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef COFF_WITH_PE +#error non-PE COFF unsupported +#endif + #include "sysdep.h" #include "bfd.h" #include "libbfd.h"
diff --git a/bfd/coff-riscv64.c b/bfd/coff-riscv64.c index 870eef3..2356a6b 100644 --- a/bfd/coff-riscv64.c +++ b/bfd/coff-riscv64.c
@@ -18,6 +18,10 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifndef COFF_WITH_PE +#error non-PE COFF unsupported +#endif + #include "sysdep.h" #include "bfd.h" #include "libbfd.h"
diff --git a/bfd/pei-aarch64.c b/bfd/pei-aarch64.c index 00f38e0..835b547 100644 --- a/bfd/pei-aarch64.c +++ b/bfd/pei-aarch64.c
@@ -20,6 +20,7 @@ #include "sysdep.h" #include "bfd.h" +#include "libbfd.h" #define TARGET_SYM aarch64_pei_le_vec #define TARGET_NAME "pei-aarch64-little" @@ -58,9 +59,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } -#include "sysdep.h" -#include "bfd.h" -#include "libbfd.h" #include "coff/aarch64.h" #include "coff/internal.h" #include "coff/pe.h"
diff --git a/bfd/pei-loongarch64.c b/bfd/pei-loongarch64.c index f22498c..0b00cb2 100644 --- a/bfd/pei-loongarch64.c +++ b/bfd/pei-loongarch64.c
@@ -20,6 +20,7 @@ #include "sysdep.h" #include "bfd.h" +#include "libbfd.h" #define TARGET_SYM loongarch64_pei_vec #define TARGET_NAME "pei-loongarch64" @@ -58,9 +59,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } -#include "sysdep.h" -#include "bfd.h" -#include "libbfd.h" #include "coff/loongarch64.h" #include "coff/internal.h" #include "coff/pe.h"
diff --git a/bfd/pei-riscv64.c b/bfd/pei-riscv64.c index c4ae7bf..d8d4b5d 100644 --- a/bfd/pei-riscv64.c +++ b/bfd/pei-riscv64.c
@@ -20,6 +20,7 @@ #include "sysdep.h" #include "bfd.h" +#include "libbfd.h" #define TARGET_SYM riscv64_pei_vec #define TARGET_NAME "pei-riscv64-little" @@ -58,9 +59,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } -#include "sysdep.h" -#include "bfd.h" -#include "libbfd.h" #include "coff/riscv64.h" #include "coff/internal.h" #include "coff/pe.h"
diff --git a/bfd/pei-x86_64.c b/bfd/pei-x86_64.c index a5c2fd8..045fedb 100644 --- a/bfd/pei-x86_64.c +++ b/bfd/pei-x86_64.c
@@ -22,6 +22,7 @@ #include "sysdep.h" #include "bfd.h" +#include "libbfd.h" #define TARGET_SYM x86_64_pei_vec #define TARGET_NAME "pei-x86-64" @@ -60,9 +61,6 @@ { COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi."), \ COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 } -#include "sysdep.h" -#include "bfd.h" -#include "libbfd.h" #include "coff/x86_64.h" #include "coff/internal.h" #include "coff/pe.h"