aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorOmar Majid <omajid@redhat.com>2019-07-23 09:44:57 +0100
committerNick Clifton <nickc@redhat.com>2019-07-23 09:44:57 +0100
commit1dd1bc4daf99ec7ad1f9a6feea8cf4ebe715a92d (patch)
tree968e6d80c069a68fcb0bc8630dd2b67ab14362e3 /bfd
parent5ba29434765feed692b6342a8b0f853050be2402 (diff)
downloadgdb-1dd1bc4daf99ec7ad1f9a6feea8cf4ebe715a92d.zip
gdb-1dd1bc4daf99ec7ad1f9a6feea8cf4ebe715a92d.tar.gz
gdb-1dd1bc4daf99ec7ad1f9a6feea8cf4ebe715a92d.tar.bz2
Allow objdump to recognise the System.Runtime.dll files that get shipped with .NET Core 2.1.
include * coff/i386.h (IMAGE_FILE_MACHINE_NATIVE_APPLE_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_FREEBSD_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_LINUX_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_NETBSD_OVERRIDE): Define. (I386_APPLE_MAGIC): Define. (I386_FREEBSD_MAGIC): Define. (I386_LINUX_MAGIC): Define. (I386_NETBSD_MAGIC): Define. (I386BADMAG): Extend macro to allow new magic numbers. * coff/x86_64.h (IMAGE_FILE_MACHINE_NATIVE_APPLE_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_FREEBSD_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_LINUX_OVERRIDE): Define. (IMAGE_FILE_MACHINE_NATIVE_NETBSD_OVERRIDE): Define. (AMD64_APPLE_MAGIC): Define. (AMD64_FREEBSD_MAGIC): Define. (AMD64_LINUX_MAGIC): Define. (AMD64_NETBSD_MAGIC): Define. (AMD64BADMAG): Extend macro to allow new magic numbers. bfd * coffcode.h (coff_set_arch_mach_hook): Handle I386_APPLE_MAGIC, I386_FREEBSD_MAGIC, I386_LINUX_MAGIC, I386_NETBSD_MAGIC, AMD64_APPLE_MAGIC, AMD64_FREEBSD_MAGIC, AMD64_LINUX_MAGIC, AMD64_NETBSD_MAGIC. * peXXigen.c: Add comment about source of .NET magic numbers. binutils* Makefile.am (AUTOMAKE_OPTIONS): Add subdir-objects (GENTESTDLLSPROG): Define. (TEST_PROGS): Add GENTESTDLLSPROG. * Makefile.in: Regenerate. * testsuite/binutils-all/objdump.exp (test_objdump_dotnet_assemblies): New proc. Run the new proc. * testsuite/gentestdlls.c: New source file.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog8
-rw-r--r--bfd/coffcode.h8
-rw-r--r--bfd/peXXigen.c7
3 files changed, 23 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 62e4beb..2beeb3d 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2019-07-23 Omar Majid <omajid@redhat.com>
+
+ * coffcode.h (coff_set_arch_mach_hook): Handle I386_APPLE_MAGIC,
+ I386_FREEBSD_MAGIC, I386_LINUX_MAGIC, I386_NETBSD_MAGIC,
+ AMD64_APPLE_MAGIC, AMD64_FREEBSD_MAGIC, AMD64_LINUX_MAGIC,
+ AMD64_NETBSD_MAGIC.
+ * peXXigen.c: Add comment about source of .NET magic numbers.
+
2019-07-19 Alan Modra <amodra@gmail.com>
* reloc.c (BFD_RELOC_PPC64_TPREL34, BFD_RELOC_PPC64_DTPREL34),
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index c67bfbb..c3f1330 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -2107,11 +2107,19 @@ coff_set_arch_mach_hook (bfd *abfd, void * filehdr)
case I386PTXMAGIC:
case I386AIXMAGIC: /* Danbury PS/2 AIX C Compiler. */
case LYNXCOFFMAGIC:
+ case I386_APPLE_MAGIC:
+ case I386_FREEBSD_MAGIC:
+ case I386_LINUX_MAGIC:
+ case I386_NETBSD_MAGIC:
arch = bfd_arch_i386;
break;
#endif
#ifdef AMD64MAGIC
case AMD64MAGIC:
+ case AMD64_APPLE_MAGIC:
+ case AMD64_FREEBSD_MAGIC:
+ case AMD64_LINUX_MAGIC:
+ case AMD64_NETBSD_MAGIC:
arch = bfd_arch_i386;
machine = bfd_mach_x86_64;
break;
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 77fb493..ee6da64 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -35,6 +35,13 @@
"Peering Inside the PE: A Tour of the Win32 Portable Executable
File Format", MSJ 1994, Volume 9.
+ The PE/PEI format is also used by .NET. ECMA-335 describes this:
+
+ "Standard ECMA-335 Common Language Infrastructure (CLI)", 6th Edition, June 2012.
+
+ This is also available at
+ https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-335.pdf.
+
The *sole* difference between the pe format and the pei format is that the
latter has an MSDOS 2.0 .exe header on the front that prints the message
"This app must be run under Windows." (or some such).