From 4e9b47b8d4d03c7e38861887e91ec05136986624 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 10 Aug 2009 21:56:42 +0000 Subject: [PATCH] bfd/ Stop using bfd_usrdata in libbfd. * coff-stgo32.c (bfd_coff_go32stub): Remove. (stub_bytes, comment): Replace STUBSIZE by GO32_STUBSIZE. (adjust_filehdr_in_post): Declare the abfd parameter as unused. Replace STUBSIZE by GO32_STUBSIZE. Save now the stub in filehdr_dst->u.go32.stub. New comment with the reason. (adjust_filehdr_out_pre): Replace STUBSIZE by GO32_STUBSIZE. Substitute the removed macro bfd_coff_go32stub. (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): Replace STUBSIZE by GO32_STUBSIZE. (create_go32_stub, go32_stubbed_coff_bfd_copy_private_bfd_data): Replace STUBSIZE by GO32_STUBSIZE. Substitute the removed macro bfd_coff_go32stub. * coffcode.h (coff_mkobject_hook): Initialize coff->go32stub. * libcoff-in.h (coff_data_type): New field go32stub. * libcoff.h: Regenerated. include/coff/ Stop using bfd_usrdata in libbfd. * go32exe.h (struct external_filehdr_go32_exe , FILHSZ): Replace STUBSIZE by GO32_STUBSIZE. (STUBSIZE): Move the definition ... * internal.h (GO32_STUBSIZE): ... here and rename it. (struct internal_filehdr , F_GO32STUB): New. --- include/coff/ChangeLog | 9 +++++++++ include/coff/go32exe.h | 6 ++---- include/coff/internal.h | 13 ++++++++++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index db6c55a4d..a38228b33 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,12 @@ +2009-08-10 Jan Kratochvil + + Stop using bfd_usrdata in libbfd. + * go32exe.h (struct external_filehdr_go32_exe , FILHSZ): Replace + STUBSIZE by GO32_STUBSIZE. + (STUBSIZE): Move the definition ... + * internal.h (GO32_STUBSIZE): ... here and rename it. + (struct internal_filehdr , F_GO32STUB): New. + 2009-06-03 Ulrich Weigand * symconst.h (btLong64, btULong64, btLongLong64, btULongLong64, diff --git a/include/coff/go32exe.h b/include/coff/go32exe.h index c85da0cc3..2248ff2f4 100644 --- a/include/coff/go32exe.h +++ b/include/coff/go32exe.h @@ -16,11 +16,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ -#define STUBSIZE 2048 - struct external_filehdr_go32_exe { - char stub[STUBSIZE];/* the stub to load the image */ + 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 */ @@ -34,4 +32,4 @@ struct external_filehdr_go32_exe #undef FILHDR #define FILHDR struct external_filehdr_go32_exe #undef FILHSZ -#define FILHSZ STUBSIZE+20 +#define FILHSZ GO32_STUBSIZE+20 diff --git a/include/coff/internal.h b/include/coff/internal.h index c5d6cd1fc..36d03eb91 100644 --- a/include/coff/internal.h +++ b/include/coff/internal.h @@ -58,10 +58,19 @@ 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 short f_nscns; /* number of sections */ @@ -84,7 +93,8 @@ 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_DLL PE format DLL + F_GO32STUB Field go32stub contains valid data. */ #define F_RELFLG (0x0001) #define F_EXEC (0x0002) @@ -96,6 +106,7 @@ 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