aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2007-03-19 23:06:06 +0000
committerH.J. Lu <hjl.tools@gmail.com>2007-03-19 23:06:06 +0000
commitd13c9dc69aa73469d177e6cb10d1f6ba9dc8fb58 (patch)
treec0be8ddbba7cf4d8b98a32ef1e460383c990a12b
parent1615fd16305c225358605485142d1cc6724f96d8 (diff)
downloadgdb-d13c9dc69aa73469d177e6cb10d1f6ba9dc8fb58.zip
gdb-d13c9dc69aa73469d177e6cb10d1f6ba9dc8fb58.tar.gz
gdb-d13c9dc69aa73469d177e6cb10d1f6ba9dc8fb58.tar.bz2
*** empty log message ***
-rw-r--r--bfd/ChangeLog18
-rw-r--r--bfd/peXXigen.c64
-rw-r--r--include/coff/ChangeLog7
-rw-r--r--include/coff/internal.h22
4 files changed, 107 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index ab0cee5..07946e6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,21 @@
+2003-03-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Store Magic,
+ MajorLinkerVersion, MinorLinkerVersion, SizeOfCode,
+ SizeOfInitializedData, SizeOfUninitializedData,
+ AddressOfEntryPoint, BaseOfCode and BaseOfData in internal
+ extra PE a.out header.
+ (IMAGE_NT_OPTIONAL_HDR_MAGIC): Defined as 0x10b if not defined.
+ (IMAGE_NT_OPTIONAL_HDR64_MAGIC): Defined as 0x20b if not
+ defined.
+ (IMAGE_NT_OPTIONAL_HDRROM_MAGIC): Defined as 0x107 if not
+ defined.
+ (_bfd_XX_print_private_bfd_data_common): Also print Magic,
+ MajorLinkerVersion, MinorLinkerVersion, SizeOfCode,
+ SizeOfInitializedData, SizeOfUninitializedData,
+ AddressOfEntryPoint, BaseOfCode and BaseOfData from internal
+ extra PE a.out header.
+
2003-03-18 H.J. Lu <hongjiu.lu@intel.com>
* targets.c (_bfd_target_vector): Add bfd_efi_app_x86_64_vec
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index 3848f53..2454436 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -388,10 +388,11 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
void * aouthdr_ext1,
void * aouthdr_int1)
{
- struct internal_extra_pe_aouthdr *a;
- PEAOUTHDR * src = (PEAOUTHDR *) (aouthdr_ext1);
+ PEAOUTHDR * src = (PEAOUTHDR *) aouthdr_ext1;
AOUTHDR * aouthdr_ext = (AOUTHDR *) aouthdr_ext1;
- struct internal_aouthdr *aouthdr_int = (struct internal_aouthdr *)aouthdr_int1;
+ struct internal_aouthdr *aouthdr_int
+ = (struct internal_aouthdr *) aouthdr_int1;
+ struct internal_extra_pe_aouthdr *a = &aouthdr_int->pe;
aouthdr_int->magic = H_GET_16 (abfd, aouthdr_ext->magic);
aouthdr_int->vstamp = H_GET_16 (abfd, aouthdr_ext->vstamp);
@@ -405,9 +406,17 @@ _bfd_XXi_swap_aouthdr_in (bfd * abfd,
/* PE32+ does not have data_start member! */
aouthdr_int->data_start =
GET_AOUTHDR_DATA_START (abfd, aouthdr_ext->data_start);
+ a->BaseOfData = aouthdr_int->data_start;
#endif
- a = &aouthdr_int->pe;
+ a->Magic = aouthdr_int->magic;
+ a->MajorLinkerVersion = H_GET_8 (abfd, aouthdr_ext->vstamp);
+ a->MinorLinkerVersion = H_GET_8 (abfd, aouthdr_ext->vstamp + 1);
+ a->SizeOfCode = aouthdr_int->tsize ;
+ a->SizeOfInitializedData = aouthdr_int->dsize ;
+ a->SizeOfUninitializedData = aouthdr_int->bsize ;
+ a->AddressOfEntryPoint = aouthdr_int->entry;
+ a->BaseOfCode = aouthdr_int->text_start;
a->ImageBase = GET_OPTHDR_IMAGE_BASE (abfd, src->ImageBase);
a->SectionAlignment = H_GET_32 (abfd, src->SectionAlignment);
a->FileAlignment = H_GET_32 (abfd, src->FileAlignment);
@@ -1802,6 +1811,7 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile)
pe_data_type *pe = pe_data (abfd);
struct internal_extra_pe_aouthdr *i = &pe->pe_opthdr;
const char *subsystem_name = NULL;
+ const char *name;
/* The MS dumpbin program reportedly ands with 0xff0f before
printing the characteristics field. Not sure why. No reason to
@@ -1827,6 +1837,52 @@ _bfd_XX_print_private_bfd_data_common (bfd * abfd, void * vfile)
time_t t = pe->coff.timestamp;
fprintf (file, "\nTime/Date\t\t%s", ctime (&t));
}
+
+#ifndef IMAGE_NT_OPTIONAL_HDR_MAGIC
+# define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
+#endif
+#ifndef IMAGE_NT_OPTIONAL_HDR64_MAGIC
+# define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
+#endif
+#ifndef IMAGE_NT_OPTIONAL_HDRROM_MAGIC
+# define IMAGE_NT_OPTIONAL_HDRROM_MAGIC 0x107
+#endif
+
+ switch (i->Magic)
+ {
+ case IMAGE_NT_OPTIONAL_HDR_MAGIC:
+ name = "PE32";
+ break;
+ case IMAGE_NT_OPTIONAL_HDR64_MAGIC:
+ name = "PE32+";
+ break;
+ case IMAGE_NT_OPTIONAL_HDRROM_MAGIC:
+ name = "ROM";
+ break;
+ default:
+ name = NULL;
+ break;
+ }
+ fprintf (file, "Magic\t\t\t%04x", i->Magic);
+ if (name)
+ fprintf (file, "\t(%s)",name);
+ fprintf (file, "\nMajorLinkerVersion\t%d\n", i->MajorLinkerVersion);
+ fprintf (file, "MinorLinkerVersion\t%d\n", i->MinorLinkerVersion);
+ fprintf (file, "SizeOfCode\t\t%08lx\n", i->SizeOfCode);
+ fprintf (file, "SizeOfInitializedData\t%08lx\n",
+ i->SizeOfInitializedData);
+ fprintf (file, "SizeOfUninitializedData\t%08lx\n",
+ i->SizeOfUninitializedData);
+ fprintf (file, "AddressOfEntryPoint\t");
+ fprintf_vma (file, i->AddressOfEntryPoint);
+ fprintf (file, "\nBaseOfCode\t\t");
+ fprintf_vma (file, i->BaseOfCode);
+#if !defined(COFF_WITH_pep) && !defined(COFF_WITH_pex64)
+ /* PE32+ does not have BaseOfData member! */
+ fprintf (file, "\nBaseOfData\t\t");
+ fprintf_vma (file, i->BaseOfData);
+#endif
+
fprintf (file, "\nImageBase\t\t");
fprintf_vma (file, i->ImageBase);
fprintf (file, "\nSectionAlignment\t");
diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog
index b8af0fe..a7bde4a 100644
--- a/include/coff/ChangeLog
+++ b/include/coff/ChangeLog
@@ -1,3 +1,10 @@
+2003-03-19 H.J. Lu <hongjiu.lu@intel.com>
+
+ * internal.h (internal_extra_pe_aouthdr): Add Magic,
+ MajorLinkerVersion, MinorLinkerVersion, SizeOfCode,
+ SizeOfInitializedData, SizeOfUninitializedData,
+ AddressOfEntryPoint, BaseOfCode and BaseOfData.
+
2006-12-05 Michael Tautschnig <tautschn@model.in.tum.de>
Nick Clifton <nickc@redhat.com>
diff --git a/include/coff/internal.h b/include/coff/internal.h
index 61ca4e3..afe6889 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -138,6 +138,28 @@ typedef struct _IMAGE_DATA_DIRECTORY
struct internal_extra_pe_aouthdr
{
+ /* FIXME: The following entries are in AOUTHDR. But they aren't
+ available internally in bfd. We add them here so that objdump
+ can dump them. */
+ /* The state of the image file */
+ short Magic;
+ /* Linker major version number */
+ char MajorLinkerVersion;
+ /* Linker minor version number */
+ char MinorLinkerVersion;
+ /* Total size of all code sections */
+ long SizeOfCode;
+ /* Total size of all initialized data sections */
+ long SizeOfInitializedData;
+ /* Total size of all uninitialized data sections */
+ long SizeOfUninitializedData;
+ /* Address of entry point relative to image base. */
+ bfd_vma AddressOfEntryPoint;
+ /* Address of the first code section relative to image base. */
+ bfd_vma BaseOfCode;
+ /* Address of the first data section relative to image base. */
+ bfd_vma BaseOfData;
+
/* PE stuff */
bfd_vma ImageBase; /* address of specific location in memory that
file is located, NT default 0x10000 */