summaryrefslogtreecommitdiff
path: root/bfd/coff-mcore.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>1999-12-17 19:03:09 +0000
committerNick Clifton <nickc@redhat.com>1999-12-17 19:03:09 +0000
commitcb92cd43207fff501df88e87d0d96b38a24a86d5 (patch)
tree586cd0afc4b7eb72f22236de84e27e8109bf1fc6 /bfd/coff-mcore.c
parent31bcefa8af7db9de6575c06e14f40184ea15f6fa (diff)
downloadgdb-cb92cd43207fff501df88e87d0d96b38a24a86d5.tar.gz
Move PE format object file detection code into common place.
Diffstat (limited to 'bfd/coff-mcore.c')
-rw-r--r--bfd/coff-mcore.c63
1 files changed, 0 insertions, 63 deletions
diff --git a/bfd/coff-mcore.c b/bfd/coff-mcore.c
index 09d8bf164e6..7a3cfaa7591 100644
--- a/bfd/coff-mcore.c
+++ b/bfd/coff-mcore.c
@@ -582,69 +582,6 @@ coff_mcore_relocate_section (output_bfd, info, input_bfd, input_section,
#include "coffcode.h"
-static const bfd_target *
-pe_object_p (abfd)
- bfd * abfd;
-{
-#ifdef COFF_IMAGE_WITH_PE
- /* We need to hack badly to handle a PE image correctly. In PE
- images created by the GNU linker, the offset to the COFF header
- is always the size. However, this is not the case in images
- generated by other PE linkers. The PE format stores a four byte
- offset to the PE signature just before the COFF header at
- location 0x3c of the file. We pick up that offset, verify that
- the PE signature is there, and then set ourselves up to read in
- the COFF header. */
- {
- bfd_byte ext_offset[4];
- file_ptr offset;
- bfd_byte ext_signature[4];
- unsigned long signature;
-
- if (bfd_seek (abfd, 0x3c, SEEK_SET) != 0
- || bfd_read (ext_offset, 1, 4, abfd) != 4)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- offset = bfd_h_get_32 (abfd, ext_offset);
-
- if (bfd_seek (abfd, offset, SEEK_SET) != 0
- || bfd_read (ext_signature, 1, 4, abfd) != 4)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
-
- return NULL;
- }
-
- signature = bfd_h_get_32 (abfd, ext_signature);
-
- if (signature != 0x4550)
- {
- bfd_set_error (bfd_error_wrong_format);
- return NULL;
- }
-
- /* Here is the hack. coff_object_p wants to read filhsz bytes to
- pick up the COFF header. We adjust so that that will work. 20
- is the size of the mips COFF filehdr. */
- if (bfd_seek (abfd, (bfd_tell (abfd) - bfd_coff_filhsz (abfd) + 20),
- SEEK_SET) != 0)
- {
- if (bfd_get_error () != bfd_error_system_call)
- bfd_set_error (bfd_error_wrong_format);
-
- return NULL;
- }
- }
-#endif
-
- return coff_object_p (abfd);
-}
-
/* Forward declaration to initialise alterbative_target field. */
extern const bfd_target TARGET_LITTLE_SYM;