aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2025-08-23 16:27:12 +0930
committerAlan Modra <amodra@gmail.com>2025-08-25 08:28:38 +0930
commit2c193469846d9b8ca6a62ae32e9b093a3dccf197 (patch)
tree67dcc028146e1971f6845846b81080743f9bd12c
parent3825c972a636852600b47c242826313f4b9963b8 (diff)
downloadbinutils-2c193469846d9b8ca6a62ae32e9b093a3dccf197.zip
binutils-2c193469846d9b8ca6a62ae32e9b093a3dccf197.tar.gz
binutils-2c193469846d9b8ca6a62ae32e9b093a3dccf197.tar.bz2
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.
-rw-r--r--bfd/coff-aarch64.c5
-rw-r--r--bfd/coff-ia64.c4
-rw-r--r--bfd/coff-loongarch64.c5
-rw-r--r--bfd/coff-mcore.c4
-rw-r--r--bfd/coff-riscv64.c4
-rw-r--r--bfd/pei-aarch64.c4
-rw-r--r--bfd/pei-loongarch64.c4
-rw-r--r--bfd/pei-riscv64.c4
-rw-r--r--bfd/pei-x86_64.c4
9 files changed, 20 insertions, 18 deletions
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"