This is the mail archive of the cygwin-apps mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: a.out.h for 64-bit Cygwin?

On 3/10/2013 4:52 PM, Corinna Vinschen wrote:
On Mar 10 09:06, Ken Brown wrote:
On 3/10/2013 7:18 AM, Corinna Vinschen wrote:
On Mar 9 22:43, Ken Brown wrote:
It may be too soon to expect this to work, but I'm trying to build
emacs for 64-bit Cygwin.  Part of the build process involves direct
manipulation of a .exe file, based on the structures defined in
/usr/include/a.out.h.  I'm wondering whether this file needs to be
updated before it will work with 64-bit .exe files.

Yes, absolutely!

It's not very tricky.  AFAIK only a single header part is different, the
one called IMAGE_OPTIONAL_HEADER in MSDN.  Given the age of a.out.h,
there are also a couple of defines missing, all of them are documented
in MSDN and available in the Mingw headers.  Patches most welcome.

OK, I'll work on this. One question: Is it OK for a.out.h to include windows.h so that I can use macros like WORD, DWORD,... as in the Mingw headers? Or is it better to just use standard types as in the current a.out.h?

No, we shouldn't include windows.h. Some of the values are already defined using another name in a.out.h, see I386MAGIC, DOSMAGIC, or NT_SIGNATURE.

I'm pretty open to add definitions for other values, as long as they
either match the already used naimg scheme, or, if they are entirely
new, are similar, but not exactly named like the original Windows
definitions.  I don't think anything speaks against adding stuff like

   #define AMD64MAGIC 0x8664
   #define IMG_NT_OPTIONAL_HDR32_MAGIC 0x10b
   #define IMG_SUBSYS_NATIVE 1

OK, my patch is attached. I'm also attaching the program I used to test it, based on the emacs code I sent in my first post. (And I'm able to build 64-bit emacs with this patch.)

It turned out that the most important thing I had to do was change most occurrences of "unsigned long" to "uint32_t" to keep DWORDs from becoming 64 bits wide on AMD64.


Attachment: read_exe.c
Description: Text document

Attachment: a.out.h.patch
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]