[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Mingw32 cross compile fixes from 64-bit host
From: |
Gwenole Beauchesne |
Subject: |
Re: [Qemu-devel] [PATCH] Mingw32 cross compile fixes from 64-bit host |
Date: |
Thu, 19 May 2005 09:02:15 +0200 (CEST) |
On Wed, 18 May 2005, Paul Brook wrote:
> It doesn't really make any difference, but wouldn't it be more consistent to
> use [u]int8_t instead of char?
OK, here is a patch that uses uint8_t and also changes the cross_prefix to
i386-mingw32msvc- so that we are consistent with the later use of
i386-mingw32msvc-sdl-config.
I have not tested it beyond a simple build configured as
--enable-mingw32 --target-list="i386-softmmu ppc-softmmu" --cpu=i386
(dyngen no longer segfaults and op.h looks fine at quick glance)
BTW, what about assuming HOST_I386 when cross-compiling to win32? At least
for dyngen.c, which turns out to be the only use of that macro anyway.
Index: a.out.h
===================================================================
RCS file: /cvsroot/qemu/qemu/a.out.h,v
retrieving revision 1.2
diff -u -r1.2 a.out.h
--- a.out.h 19 Dec 2004 20:57:26 -0000 1.2
+++ a.out.h 19 May 2005 06:17:29 -0000
@@ -23,13 +23,13 @@
/********************** FILE HEADER **********************/
struct external_filehdr {
- short f_magic; /* magic number */
- short f_nscns; /* number of sections */
- unsigned long f_timdat; /* time & date stamp */
- unsigned long f_symptr; /* file pointer to symtab */
- unsigned long f_nsyms; /* number of symtab entries */
- short f_opthdr; /* sizeof(optional hdr) */
- short f_flags; /* flags */
+ int16_t f_magic; /* magic number */
+ int16_t f_nscns; /* number of sections */
+ uint32_t f_timdat; /* time & date stamp */
+ uint32_t f_symptr; /* file pointer to symtab */
+ uint32_t f_nsyms; /* number of symtab entries */
+ int16_t f_opthdr; /* sizeof(optional hdr) */
+ int16_t f_flags; /* flags */
};
/* Bits for f_flags:
@@ -70,14 +70,14 @@
typedef struct
{
- unsigned short magic; /* type of file
*/
- unsigned short vstamp; /* version stamp */
- unsigned long tsize; /* text size in bytes, padded to FW
bdry*/
- unsigned long dsize; /* initialized data " "
*/
- unsigned long bsize; /* uninitialized data " "
*/
- unsigned long entry; /* entry pt.
*/
- unsigned long text_start; /* base of text used for this file */
- unsigned long data_start; /* base of data used for this file=
+ uint16_t magic; /* type of file */
+ uint16_t vstamp; /* version stamp */
+ uint32_t tsize; /* text size in bytes, padded to FW bdry*/
+ uint32_t dsize; /* initialized data " " */
+ uint32_t bsize; /* uninitialized data " " */
+ uint32_t entry; /* entry pt. */
+ uint32_t text_start; /* base of text used for this file */
+ uint32_t data_start; /* base of data used for this file=
*/
}
AOUTHDR;
@@ -102,17 +102,17 @@
struct external_scnhdr {
- char s_name[8]; /* section name */
- unsigned long s_paddr; /* physical address, offset
+ uint8_t s_name[8]; /* section name */
+ uint32_t s_paddr; /* physical address, offset
of last addr in scn */
- unsigned long s_vaddr; /* virtual address */
- unsigned long s_size; /* section size */
- unsigned long s_scnptr; /* file ptr to raw data for section */
- unsigned long s_relptr; /* file ptr to relocation */
- unsigned long s_lnnoptr; /* file ptr to line numbers */
- unsigned short s_nreloc; /* number of relocation entries */
- unsigned short s_nlnno; /* number of line number entries*/
- unsigned long s_flags; /* flags */
+ uint32_t s_vaddr; /* virtual address */
+ uint32_t s_size; /* section size */
+ uint32_t s_scnptr; /* file ptr to raw data for section */
+ uint32_t s_relptr; /* file ptr to relocation */
+ uint32_t s_lnnoptr; /* file ptr to line numbers */
+ uint16_t s_nreloc; /* number of relocation entries */
+ uint16_t s_nlnno; /* number of line number entries*/
+ uint32_t s_flags; /* flags */
};
#define SCNHDR struct external_scnhdr
@@ -136,10 +136,10 @@
*/
struct external_lineno {
union {
- unsigned long l_symndx; /* function name symbol index, iff l_lnno 0 */
- unsigned long l_paddr; /* (physical) address of line number */
+ uint32_t l_symndx; /* function name symbol index, iff l_lnno 0 */
+ uint32_t l_paddr; /* (physical) address of line number */
} l_addr;
- unsigned short l_lnno; /* line number */
+ uint16_t l_lnno; /* line number */
};
#define LINENO struct external_lineno
@@ -154,18 +154,18 @@
struct __attribute__((packed)) external_syment
{
union {
- char e_name[E_SYMNMLEN];
+ uint8_t e_name[E_SYMNMLEN];
struct {
- unsigned long e_zeroes;
- unsigned long e_offset;
+ uint32_t e_zeroes;
+ uint32_t e_offset;
} e;
} e;
- unsigned long e_value;
- unsigned short e_scnum;
- unsigned short e_type;
- char e_sclass[1];
- char e_numaux[1];
-};
+ uint32_t e_value;
+ uint16_t e_scnum;
+ uint16_t e_type;
+ uint8_t e_sclass[1];
+ uint8_t e_numaux[1];
+} __attribute__((packed));
#define N_BTMASK (0xf)
#define N_TMASK (0x30)
@@ -174,47 +174,47 @@
union external_auxent {
struct {
- unsigned long x_tagndx; /* str, un, or enum tag indx */
+ uint32_t x_tagndx; /* str, un, or enum tag indx */
union {
struct {
- unsigned short x_lnno; /* declaration line number */
- unsigned short x_size; /* str/union/array size */
+ uint16_t x_lnno; /* declaration line number */
+ uint16_t x_size; /* str/union/array size */
} x_lnsz;
- unsigned long x_fsize; /* size of function */
+ uint32_t x_fsize; /* size of function */
} x_misc;
union {
struct { /* if ISFCN, tag, or .bb */
- unsigned long x_lnnoptr;/* ptr to fcn line # */
- unsigned long x_endndx; /* entry ndx past block end */
+ uint32_t x_lnnoptr; /* ptr to fcn line # */
+ uint32_t x_endndx; /* entry ndx past block end */
} x_fcn;
struct { /* if ISARY, up to 4 dimen. */
- char x_dimen[E_DIMNUM][2];
+ uint8_t x_dimen[E_DIMNUM][2];
} x_ary;
} x_fcnary;
- unsigned short x_tvndx; /* tv index */
+ uint16_t x_tvndx; /* tv index */
} x_sym;
union {
- char x_fname[E_FILNMLEN];
+ uint8_t x_fname[E_FILNMLEN];
struct {
- unsigned long x_zeroes;
- unsigned long x_offset;
+ uint32_t x_zeroes;
+ uint32_t x_offset;
} x_n;
} x_file;
struct {
- unsigned long x_scnlen; /* section length */
- unsigned short x_nreloc; /* # relocation entries */
- unsigned short x_nlinno; /* # line numbers */
- unsigned long x_checksum; /* section COMDAT checksum */
- unsigned short x_associated;/* COMDAT associated section index */
- char x_comdat[1]; /* COMDAT selection number */
+ uint32_t x_scnlen; /* section length */
+ uint16_t x_nreloc; /* # relocation entries */
+ uint16_t x_nlinno; /* # line numbers */
+ uint32_t x_checksum; /* section COMDAT checksum */
+ uint16_t x_associated;/* COMDAT associated section index */
+ uint8_t x_comdat[1]; /* COMDAT selection number */
} x_scn;
struct {
- unsigned long x_tvfill; /* tv fill value */
- unsigned short x_tvlen; /* length of .tv */
- char x_tvran[2][2]; /* tv range */
+ uint32_t x_tvfill; /* tv fill value */
+ uint16_t x_tvlen; /* length of .tv */
+ uint8_t x_tvran[2][2]; /* tv range */
} x_tv; /* info about .tv section (in auxent of symbol .tv)) */
};
@@ -229,9 +229,9 @@
/********************** RELOCATION DIRECTIVES **********************/
struct external_reloc {
- char r_vaddr[4];
- char r_symndx[4];
- char r_type[2];
+ uint8_t r_vaddr[4];
+ uint8_t r_symndx[4];
+ uint8_t r_type[2];
};
#define RELOC struct external_reloc
@@ -326,37 +326,37 @@
struct external_PE_filehdr
{
/* DOS header fields */
- unsigned short e_magic; /* Magic number, 0x5a4d */
- unsigned short e_cblp; /* Bytes on last page of file, 0x90 */
- unsigned short e_cp; /* Pages in file, 0x3 */
- unsigned short e_crlc; /* Relocations, 0x0 */
- unsigned short e_cparhdr; /* Size of header in paragraphs, 0x4 */
- unsigned short e_minalloc; /* Minimum extra paragraphs needed, 0x0 */
- unsigned short e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */
- unsigned short e_ss; /* Initial (relative) SS value, 0x0 */
- unsigned short e_sp; /* Initial SP value, 0xb8 */
- unsigned short e_csum; /* Checksum, 0x0 */
- unsigned short e_ip; /* Initial IP value, 0x0 */
- unsigned short e_cs; /* Initial (relative) CS value, 0x0 */
- unsigned short e_lfarlc; /* File address of relocation table, 0x40 */
- unsigned short e_ovno; /* Overlay number, 0x0 */
- char e_res[4][2]; /* Reserved words, all 0x0 */
- unsigned short e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */
- unsigned short e_oeminfo; /* OEM information; e_oemid specific, 0x0 */
- char e_res2[10][2]; /* Reserved words, all 0x0 */
- unsigned long e_lfanew; /* File address of new exe header, 0x80 */
- char dos_message[16][4]; /* other stuff, always follow DOS header */
- unsigned int nt_signature; /* required NT signature, 0x4550 */
+ uint16_t e_magic; /* Magic number, 0x5a4d */
+ uint16_t e_cblp; /* Bytes on last page of file, 0x90 */
+ uint16_t e_cp; /* Pages in file, 0x3 */
+ uint16_t e_crlc; /* Relocations, 0x0 */
+ uint16_t e_cparhdr; /* Size of header in paragraphs, 0x4 */
+ uint16_t e_minalloc; /* Minimum extra paragraphs needed, 0x0 */
+ uint16_t e_maxalloc; /* Maximum extra paragraphs needed, 0xFFFF */
+ uint16_t e_ss; /* Initial (relative) SS value, 0x0 */
+ uint16_t e_sp; /* Initial SP value, 0xb8 */
+ uint16_t e_csum; /* Checksum, 0x0 */
+ uint16_t e_ip; /* Initial IP value, 0x0 */
+ uint16_t e_cs; /* Initial (relative) CS value, 0x0 */
+ uint16_t e_lfarlc; /* File address of relocation table, 0x40 */
+ uint16_t e_ovno; /* Overlay number, 0x0 */
+ uint8_t e_res[4][2]; /* Reserved words, all 0x0 */
+ uint16_t e_oemid; /* OEM identifier (for e_oeminfo), 0x0 */
+ uint16_t e_oeminfo; /* OEM information; e_oemid specific, 0x0 */
+ uint8_t e_res2[10][2]; /* Reserved words, all 0x0 */
+ uint32_t e_lfanew; /* File address of new exe header, 0x80 */
+ uint8_t dos_message[16][4]; /* other stuff, always follow DOS header */
+ uint32_t nt_signature; /* required NT signature, 0x4550 */
/* From standard header */
- unsigned short f_magic; /* magic number */
- unsigned short f_nscns; /* number of sections */
- unsigned long f_timdat; /* time & date stamp */
- unsigned long f_symptr; /* file pointer to symtab */
- unsigned long f_nsyms; /* number of symtab entries */
- unsigned short f_opthdr; /* sizeof(optional hdr) */
- unsigned short f_flags; /* flags */
+ uint16_t f_magic; /* magic number */
+ uint16_t f_nscns; /* number of sections */
+ uint32_t f_timdat; /* time & date stamp */
+ uint32_t f_symptr; /* file pointer to symtab */
+ uint32_t f_nsyms; /* number of symtab entries */
+ uint16_t f_opthdr; /* sizeof(optional hdr) */
+ uint16_t f_flags; /* flags */
};
@@ -368,39 +368,39 @@
typedef struct
{
- unsigned short magic; /* type of file
*/
- unsigned short vstamp; /* version stamp */
- unsigned long tsize; /* text size in bytes, padded to FW
bdry*/
- unsigned long dsize; /* initialized data " "
*/
- unsigned long bsize; /* uninitialized data " "
*/
- unsigned long entry; /* entry pt.
*/
- unsigned long text_start; /* base of text used for this file */
- unsigned long data_start; /* base of all data used for this file */
+ uint16_t magic; /* type of file */
+ uint16_t vstamp; /* version stamp */
+ uint32_t tsize; /* text size in bytes, padded to FW bdry*/
+ uint32_t dsize; /* initialized data " " */
+ uint32_t bsize; /* uninitialized data " " */
+ uint32_t entry; /* entry pt. */
+ uint32_t text_start; /* base of text used for this file */
+ uint32_t data_start; /* base of all data used for this file */
/* NT extra fields; see internal.h for descriptions */
- unsigned long ImageBase;
- unsigned long SectionAlignment;
- unsigned long FileAlignment;
- unsigned short MajorOperatingSystemVersion;
- unsigned short MinorOperatingSystemVersion;
- unsigned short MajorImageVersion;
- unsigned short MinorImageVersion;
- unsigned short MajorSubsystemVersion;
- unsigned short MinorSubsystemVersion;
- char Reserved1[4];
- unsigned long SizeOfImage;
- unsigned long SizeOfHeaders;
- unsigned long CheckSum;
- unsigned short Subsystem;
- unsigned short DllCharacteristics;
- unsigned long SizeOfStackReserve;
- unsigned long SizeOfStackCommit;
- unsigned long SizeOfHeapReserve;
- unsigned long SizeOfHeapCommit;
- unsigned long LoaderFlags;
- unsigned long NumberOfRvaAndSizes;
+ uint32_t ImageBase;
+ uint32_t SectionAlignment;
+ uint32_t FileAlignment;
+ uint16_t MajorOperatingSystemVersion;
+ uint16_t MinorOperatingSystemVersion;
+ uint16_t MajorImageVersion;
+ uint16_t MinorImageVersion;
+ uint16_t MajorSubsystemVersion;
+ uint16_t MinorSubsystemVersion;
+ uint8_t Reserved1[4];
+ uint32_t SizeOfImage;
+ uint32_t SizeOfHeaders;
+ uint32_t CheckSum;
+ uint16_t Subsystem;
+ uint16_t DllCharacteristics;
+ uint32_t SizeOfStackReserve;
+ uint32_t SizeOfStackCommit;
+ uint32_t SizeOfHeapReserve;
+ uint32_t SizeOfHeapCommit;
+ uint32_t LoaderFlags;
+ uint32_t NumberOfRvaAndSizes;
/* IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; */
- char DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
+ uint8_t DataDirectory[16][2][4]; /* 16 entries, 2 elements/entry, 4 chars */
} PEAOUTHDR;
Index: configure
===================================================================
RCS file: /cvsroot/qemu/qemu/configure,v
retrieving revision 1.66
diff -u -r1.66 configure
--- configure 28 Apr 2005 20:41:53 -0000 1.66
+++ configure 19 May 2005 06:17:29 -0000
@@ -174,7 +174,7 @@
;;
--fmod-inc=*) fmod_inc=${opt#--fmod-inc=}
;;
- --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32-"
+ --enable-mingw32) mingw32="yes" ; cross_prefix="i386-mingw32msvc-"
;;
--disable-slirp) slirp="no"
;;