[File] [PATCH] Add magic for ARM COFF object files

Mark Harmstone mark at harmstone.com
Sun Apr 4 17:17:49 UTC 2021


Magic for COFF object files for the various ARM architectures, following
the example of hitach-sh. Architecture names match those in msdos.

---
 magic/Magdir/arm  | 41 +++++++++++++++++++++++++++++++++++++++++
 magic/Magdir/coff |  5 +++++
 magic/Makefile.am |  1 +
 3 files changed, 47 insertions(+)
 create mode 100644 magic/Magdir/arm

diff --git a/magic/Magdir/arm b/magic/Magdir/arm
new file mode 100644
index 00000000..dfa992c5
--- /dev/null
+++ b/magic/Magdir/arm
@@ -0,0 +1,41 @@
+#------------------------------------------------------------------------------
+# $File$
+# arm: file(1) magic for ARM COFF
+#
+# https://docs.microsoft.com/en-us/windows/win32/debug/pe-format
+
+# Aarch64
+0	leshort		0xaa64
+# test for unused flag bits in f_flags
+>18	uleshort&0x8E80	0
+# use little endian variant of subroutine to
+# display name+variables+flags for common object formated files
+>>0	use				display-coff
+!:strength -10
+
+# ARM
+0	leshort		0x01c0
+# test for unused flag bits in f_flags
+>18	uleshort&0x8E80	0
+# use little endian variant of subroutine to
+# display name+variables+flags for common object formated files
+>>0	use				display-coff
+!:strength -10
+
+# ARM Thumb
+0	leshort		0x01c2
+# test for unused flag bits in f_flags
+>18	uleshort&0x8E80	0
+# use little endian variant of subroutine to
+# display name+variables+flags for common object formated files
+>>0	use				display-coff
+!:strength -10
+
+# ARMv7 Thumb
+0	leshort		0x01c4
+# test for unused flag bits in f_flags
+>18	uleshort&0x8E80	0
+# use little endian variant of subroutine to
+# display name+variables+flags for common object formated files
+>>0	use				display-coff
+!:strength -10
diff --git a/magic/Magdir/coff b/magic/Magdir/coff
index 18e7b665..a6f2c125 100644
--- a/magic/Magdir/coff
+++ b/magic/Magdir/coff
@@ -34,6 +34,11 @@
 # https://msdn.microsoft.com/en-us/library/windows/desktop/ms680313(v=vs.85).aspx
 >>>>0	uleshort	0x0200		Intel ia64
 >>>>0	uleshort	0x8664		Intel amd64
+# ARM COFF (./arm)
+>>>>0	uleshort	0xaa64		Aarch64
+>>>>0	uleshort	0x01c0		ARM
+>>>>0	uleshort	0x01c2		ARM Thumb
+>>>>0	uleshort	0x01c4		ARMv7 Thumb
 # TODO for other COFFs
 #>>>>0	uleshort	0xABCD		COFF_TEMPLATE
 >>>>0	default		x
diff --git a/magic/Makefile.am b/magic/Makefile.am
index 0eb5865b..f21d2643 100644
--- a/magic/Makefile.am
+++ b/magic/Makefile.am
@@ -29,6 +29,7 @@ $(MAGIC_FRAGMENT_DIR)/application \
 $(MAGIC_FRAGMENT_DIR)/applix \
 $(MAGIC_FRAGMENT_DIR)/apt \
 $(MAGIC_FRAGMENT_DIR)/archive \
+$(MAGIC_FRAGMENT_DIR)/arm \
 $(MAGIC_FRAGMENT_DIR)/asf \
 $(MAGIC_FRAGMENT_DIR)/assembler \
 $(MAGIC_FRAGMENT_DIR)/asterix \
-- 
2.26.3



More information about the File mailing list