diff -ruN binutils-2.21//gold/descriptors.cc ../i686-gcc-4.4.3-glibc-2.3.2-0.43/build/binutils-2.21/gold/descriptors.cc --- binutils-2.21//gold/descriptors.cc 2010-07-14 14:38:59.000000000 +0400 +++ binutils-2.21/gold/descriptors.cc 2010-12-29 11:41:04.744856600 +0300 @@ -130,10 +130,12 @@ // header file but not supported by the kernel. // Unfortunately there doesn't seem to be any obvious way to // detect that, as unknown flags passed to open are ignored. +#ifndef __MINGW32__ if (O_CLOEXEC == 0 && parameters->options_valid() && parameters->options().has_plugins()) fcntl(new_descriptor, F_SETFD, FD_CLOEXEC); +#endif { Hold_optional_lock hl(this->lock_); diff -ruN binutils-2.21//gold/fileread.cc ../i686-gcc-4.4.3-glibc-2.3.2-0.43/build/binutils-2.21/gold/fileread.cc --- binutils-2.21//gold/fileread.cc 2010-10-12 19:30:24.000000000 +0400 +++ binutils-2.21/gold/fileread.cc 2010-12-29 11:41:04.994855000 +0300 @@ -26,7 +26,11 @@ #include #include #include +#ifndef __MINGW32__ #include +#else +#include "mremap.h" +#endif #ifdef HAVE_READV #include @@ -195,6 +199,7 @@ { gold_assert(this->is_locked()); +#ifndef __MINGW32__ if (!parameters->options_valid() || parameters->options().stats()) { file_counts_initialize_lock.initialize(); @@ -204,6 +209,7 @@ if (File_read::current_mapped_bytes > File_read::maximum_mapped_bytes) File_read::maximum_mapped_bytes = File_read::current_mapped_bytes; } +#endif this->mapped_bytes_ = 0; @@ -414,7 +420,9 @@ } File_read::View* v; +#ifndef __MINGW32__ if (byteshift != 0) +#endif { unsigned char* p = new unsigned char[psize + byteshift]; memset(p, 0, byteshift); @@ -422,6 +430,7 @@ v = new File_read::View(poff, psize, p, byteshift, cache, View::DATA_ALLOCATED_ARRAY); } +#ifndef __MINGW32__ else { this->reopen_descriptor(); @@ -440,6 +449,7 @@ v = new File_read::View(poff, psize, pbytes, 0, cache, View::DATA_MMAPPED); } +#endif this->add_view(v); diff -ruN binutils-2.21//gold/incremental.cc ../i686-gcc-4.4.3-glibc-2.3.2-0.43/build/binutils-2.21/gold/incremental.cc --- binutils-2.21//gold/incremental.cc 2010-10-15 02:10:22.000000000 +0400 +++ binutils-2.21/gold/incremental.cc 2010-12-29 11:41:04.776106400 +0300 @@ -117,12 +117,19 @@ void vexplain_no_incremental(const char* format, va_list args) { +#ifndef __MINGW32__ char* buf = NULL; if (vasprintf(&buf, format, args) < 0) gold_nomem(); gold_info(_("the link might take longer: " "cannot perform incremental link: %s"), buf); free(buf); +#else + char buf[4096]; + vsnprintf(buf, sizeof(buf), format, args); + gold_info(_("the link might take longer: " + "cannot perform incremental link: %s"), buf); +#endif } void diff -ruN binutils-2.21//gold/mremap.c ../i686-gcc-4.4.3-glibc-2.3.2-0.43/build/binutils-2.21/gold/mremap.c --- binutils-2.21//gold/mremap.c 2009-03-28 08:22:30.000000000 +0300 +++ binutils-2.21/gold/mremap.c 2010-12-29 11:41:04.854230900 +0300 @@ -25,7 +25,14 @@ #include #include +#ifndef __MINGW32__ #include +#else +#ifdef HAVE_STDLIB_H +#include +#endif +#include "mremap.h" +#endif /* This file implements mremap for systems which don't have it. The gold code requires support for mmap. However, there are systems @@ -57,3 +64,23 @@ (void) munmap (old_address, old_size); return ret; } + +void * +mmap64 (void *__addr, size_t __len, int __prot ATTRIBUTE_UNUSED, + int __flags, int __fd, long long __offset ATTRIBUTE_UNUSED) +{ + void *ret; + if (__addr || __fd != -1 || (__flags & MAP_SHARED)) + return MAP_FAILED; + ret = malloc(__len); + if (!ret) + return MAP_FAILED; + return ret; +} + +int +munmap (void *__addr, size_t __len ATTRIBUTE_UNUSED) +{ + free(__addr); + return 0; +} diff -ruN binutils-2.21//gold/mremap.h ../i686-gcc-4.4.3-glibc-2.3.2-0.43/build/binutils-2.21/gold/mremap.h --- binutils-2.21//gold/mremap.h 1970-01-01 03:00:00.000000000 +0300 +++ binutils-2.21/gold/mremap.h 2010-12-29 11:41:04.869855800 +0300 @@ -0,0 +1,47 @@ +#ifndef GOLD_MREMAP_H +#define GOLD_MREMAP_H + +#define PROT_READ 0x1 +#define PROT_WRITE 0x2 +#define PROT_EXEC 0x4 +#define PROT_NONE 0x0 + +#define MAP_SHARED 0x01 +#define MAP_PRIVATE 0x02 + +#define MAP_TYPE 0x0f + +#define MAP_FIXED 0x10 + +#define MAP_FILE 0 +#define MAP_ANONYMOUS 0x20 +#define MAP_ANON MAP_ANONYMOUS +#define MAP_32BIT 0x40 + +#define MAP_GROWSDOWN 0x0100 +#define MAP_DENYWRITE 0x0800 +#define MAP_EXECUTABLE 0x1000 +#define MAP_LOCKED 0x2000 +#define MAP_NORESERVE 0x4000 + +#define MREMAP_MAYMOVE 1 + +#define MAP_FAILED ((void *) -1) + +#ifndef S_ISLNK +#define S_ISLNK(x) (0) +#endif + +#ifdef __cplusplus +extern "C" { +#endif +extern void *mmap64 (void *__addr, size_t __len, int __prot, + int __flags, int __fd, long long __offset); +#define mmap(p1, p2, p3, p4, p5, p6) mmap64(p1, p2, p3, p4, p5, p6) +extern int munmap (void *__addr, size_t __len); +extern void *mremap (void *, size_t, size_t, int, ...); +#ifdef __cplusplus +} +#endif + +#endif /* !defined(GOLD_MREMAP_H) */ diff -ruN binutils-2.21//gold/output.cc ../i686-gcc-4.4.3-glibc-2.3.2-0.43/build/binutils-2.21/gold/output.cc --- binutils-2.21//gold/output.cc 2010-11-18 11:24:22.000000000 +0300 +++ binutils-2.21/gold/output.cc 2010-12-29 11:41:04.947980300 +0300 @@ -27,7 +27,11 @@ #include #include #include +#ifndef __MINGW32__ #include +#else +#include "mremap.h" +#endif #include #include #include "libiberty.h"