This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[Patch] use hacked fseek for mingw32 in bfd [Was:why is there a need for mingw-local patches...
- From: Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- To: binutils <binutils at sources dot redhat dot com>
- Cc: cgf at redhat dot com
- Date: Thu, 16 Oct 2003 11:42:34 +1000 (EST)
- Subject: [Patch] use hacked fseek for mingw32 in bfd [Was:why is there a need for mingw-local patches...
--- Christopher Faylor wrote: > On Thu, Oct 16, 2003 at 03:45:13AM +1000, Danny Smith wrote:
> >The outstanding mingw-local for binutils is the 'mingw-fseek' hack.
>
> Is this one that I can approve or is it too Windows-rife for
> consideration.
>
> cgf
>
One way to find out.
The comment in ther patch exlains why this is necessary. Without this
patch, or the addition of -D__USE_MINGW_FSEEK to CFLAGS, ld puts random
memory contents into executables, compromising security.
Danny
bfd/ChangeLog
2003-10-16 Danny Smith <dannysmith@users.sourceforge.net>
* sysdep.h: Define __USE_MINGW_FSEEK for mingw32.
Index: sysdep.h
===================================================================
RCS file: /cvs/src/src/bfd/sysdep.h,v
retrieving revision 1.6
diff -c -3 -p -r1.6 sysdep.h
*** sysdep.h 19 Aug 2001 23:42:47 -0000 1.6
--- sysdep.h 16 Oct 2003 01:30:49 -0000
*************** Foundation, Inc., 59 Temple Place - Suit
*** 30,35 ****
--- 30,47 ----
#include <stddef.h>
#endif
+ #ifdef __MINGW32__
+ /*
+ * Workaround limitations on win9x where a file contents are
+ * not zero'd out if you seek past the end and then write.
+ * The __USE_MINGW_FSEEK define causes the mingw runtime to replace
+ * the MSVCRT fseek with a modified version.
+ */
+ #ifndef __USE_MINGW_FSEEK
+ #define __USE_MINGW_FSEEK 1
+ #endif
+ #endif
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
http://search.yahoo.com.au - Yahoo! Search
- Looking for more? Try the new Yahoo! Search