aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJan W. Jagersma <jwjagersma@gmail.com>2020-04-02 14:31:43 +0100
committerNick Clifton <nickc@redhat.com>2020-04-02 14:31:43 +0100
commit4d095f5b5e57584133f85df42da2123e20834aec (patch)
treed7368d31a7417cb1295596aa0e89567c15a0af63 /include
parent0dd7b52ede3de7c5e43cc7c0a52a4e2f2b4297b7 (diff)
downloadgdb-4d095f5b5e57584133f85df42da2123e20834aec.zip
gdb-4d095f5b5e57584133f85df42da2123e20834aec.tar.gz
gdb-4d095f5b5e57584133f85df42da2123e20834aec.tar.bz2
coff-go32-exe: support variable-length stubs
The stub size in GO32 executables has historically been fixed at 2048 bytes, due to hardcoded limitations in bfd. Recent patches to djgpp by Stas Sergeev (CC'd) have pushed the stub right up to this limit, so if any further expansion is desired, this must first be patched in bfd. This series includes three patches: The first changes the meaning of the bfd->origin field slightly, so that target code can use this to specify an offset into the file where the actual bfd is located. The second patch then uses this to enable support for variable-sized stubs in the coff-go32-exe format. The final patch is only a cleanup, it normalizes function and variable names in coff-stgo32.c so that they all begin with the same prefix. bfd * bfdio.c (bfd_bread, bfd_tell, bfd_seek, bfd_mmap): Always add bfd->origin to file offset. * bfdwin.c (bfd_get_file_window): Likewise. * bfd.c: Clarify the use of the bfd->origin field. * bfd-in2.h: Regenerate. * coff-i386.c: Don't include go32exe.h. Allow overriding coff_write_object_contents via COFF_WRITE_CONTENTS. * coff-stgo32.c (go32exe_cleanup, go32exe_mkobject) (go32exe_write_object_contents): New functions. (go32exe_temp_stub, go32exe_temp_stub_size): New static globals. (COFF_WRITE_CONTENTS, GO32EXE_DEFAULT_STUB_SIZE): Define. (create_go32_stub): Remove check for 2k size limit. Read stub from go32exe_temp_stub if present. (go32_stubbed_coff_bfd_copy_private_bfd_data): Allocate and copy variable-length stub. (go32_check_format): Read stub to go32exe_temp_stub, set origin, return go32exe_cleanup. (adjust_filehdr_in_post, adjust_filehdr_out_pre) (adjust_filehdr_out_post, adjust_scnhdr_in_post) (adjust_scnhdr_out_pre, adjust_scnhdr_out_post) (adjust_aux_in_post, adjust_aux_out_pre, adjust_aux_out_post): Remove functions and their associated #defines. * coffcode.h (coff_mkobject_hook): Remove stub copying code. * libcoff-in.h: (struct coff_tdata): New field stub_size. Rename field go32stub to stub. * libcoff.h: Regenerate. * coff-stgo32.c (go32_check_format): Rename to... (go32exe_check_format): ...this. (go32_stubbed_coff_bfd_copy_private_bfd_data): Rename to... (go32exe_copy_private_bfd_data): ...this. (stub_bytes): Rename to... (go32exe_default_stub): ...this. (create_go32_stub): Rename to... (go32exe_create_stub): ...this. * coff-stgo32.c (go32exe_copy_private_bfd_data): Avoid realloc when possible. include * coff/go32exe.h: Remove file. * coff/internal.h (struct internal_filehdr): Remove field go32stub. Remove flag F_GO32STUB.
Diffstat (limited to 'include')
-rw-r--r--include/ChangeLog6
-rw-r--r--include/coff/go32exe.h36
-rw-r--r--include/coff/internal.h13
3 files changed, 7 insertions, 48 deletions
diff --git a/include/ChangeLog b/include/ChangeLog
index 65107bd..7964db2 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,9 @@
+2020-04-02 Jan W. Jagersma <jwjagersma@gmail.com>
+
+ * coff/go32exe.h: Remove file.
+ * coff/internal.h (struct internal_filehdr): Remove field
+ go32stub. Remove flag F_GO32STUB.
+
2020-04-01 Martin Liska <mliska@suse.cz>
Maciej W. Rozycki <macro@linux-mips.org>
diff --git a/include/coff/go32exe.h b/include/coff/go32exe.h
deleted file mode 100644
index af6de2c..0000000
--- a/include/coff/go32exe.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* COFF information for PC running go32.
-
- Copyright (C) 2001-2020 Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
- MA 02110-1301, USA. */
-
-struct external_filehdr_go32_exe
- {
- char stub[GO32_STUBSIZE]; /* the stub to load the image */
- /* the standard COFF header */
- char f_magic[2]; /* magic number */
- char f_nscns[2]; /* number of sections */
- char f_timdat[4]; /* time & date stamp */
- char f_symptr[4]; /* file pointer to symtab */
- char f_nsyms[4]; /* number of symtab entries */
- char f_opthdr[2]; /* sizeof(optional hdr) */
- char f_flags[2]; /* flags */
- };
-
-#undef FILHDR
-#define FILHDR struct external_filehdr_go32_exe
-#undef FILHSZ
-#define FILHSZ GO32_STUBSIZE+20
diff --git a/include/coff/internal.h b/include/coff/internal.h
index 86fe070..2b6c08c 100644
--- a/include/coff/internal.h
+++ b/include/coff/internal.h
@@ -58,19 +58,10 @@ struct internal_extra_pe_filehdr
bfd_vma nt_signature; /* required NT signature, 0x4550 */
};
-#define GO32_STUBSIZE 2048
-
struct internal_filehdr
{
struct internal_extra_pe_filehdr pe;
- /* coff-stgo32 EXE stub header before BFD tdata has been allocated.
- Its data is kept in INTERNAL_FILEHDR.GO32STUB afterwards.
-
- F_GO32STUB is set iff go32stub contains a valid data. Artifical headers
- created in BFD have no pre-set go32stub. */
- char go32stub[GO32_STUBSIZE];
-
/* Standard coff internal info. */
unsigned short f_magic; /* magic number */
unsigned int f_nscns; /* number of sections */
@@ -93,8 +84,7 @@ struct internal_filehdr
F_AR32W file is 32-bit big-endian
F_DYNLOAD rs/6000 aix: dynamically loadable w/imports & exports
F_SHROBJ rs/6000 aix: file is a shared object
- F_DLL PE format DLL
- F_GO32STUB Field go32stub contains valid data. */
+ F_DLL PE format DLL */
#define F_RELFLG (0x0001)
#define F_EXEC (0x0002)
@@ -106,7 +96,6 @@ struct internal_filehdr
#define F_DYNLOAD (0x1000)
#define F_SHROBJ (0x2000)
#define F_DLL (0x2000)
-#define F_GO32STUB (0x4000)
/* Extra structure which is used in the optional header. */
typedef struct _IMAGE_DATA_DIRECTORY