]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
bfd/pe*.c including bfd/coff*.c
authorAlan Modra <amodra@gmail.com>
Sat, 23 Aug 2025 06:57:12 +0000 (16:27 +0930)
committerAlan Modra <amodra@gmail.com>
Sun, 24 Aug 2025 22:58:38 +0000 (08:28 +0930)
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.

bfd/coff-aarch64.c
bfd/coff-ia64.c
bfd/coff-loongarch64.c
bfd/coff-mcore.c
bfd/coff-riscv64.c
bfd/pei-aarch64.c
bfd/pei-loongarch64.c
bfd/pei-riscv64.c
bfd/pei-x86_64.c

index af4a44dede0b9c734e7075944477f2680e1cf00a..48b8bfaf4966f99507d7103a1f87975e050f5446 100644 (file)
@@ -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"
index 3a947ef17a39158f6b56ddf36cee9af45960bfb1..b2873ae868409b1628b9eebe304becd680baeabc 100644 (file)
    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"
index c1fe70ba5938cca3784244b028b43e17525dbea7..a85210864aebb8b48642c961686dd30effc2fb38 100644 (file)
@@ -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"
index e15c4b4a6e238f0dd9a571a6588a16732d300e14..fab10a7ae081227d16f12ae61cf7e4145dae48c6 100644 (file)
    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"
index 870eef3530581a66df9cc5e8416fdde7d4842951..2356a6bb94d84ecdaa535a26ed475305c4309b95 100644 (file)
    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"
index 00f38e0f9bbfbf47d831b20a2d6be568bff2dfe8..835b547ebc68f3bb19a2c809e322623ec05ab90e 100644 (file)
@@ -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"
index f22498cab21919e99ac2833876ac5794102068d5..0b00cb2d5570823f8fc6a18d3f0b6fab60b15c12 100644 (file)
@@ -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"
index c4ae7bfb89a511f66f682a5c16c6608e264eef6b..d8d4b5de145b777e731d356a1084058e9fbc31e6 100644 (file)
@@ -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"
index a5c2fd85f06e460e0ca1d77a5932b3f1426babad..045fedb79a5b9f1963843a9b2fc27cfea04a7eb3 100644 (file)
@@ -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"