This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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: [PATCH GOLD] [7/N mingw host] Instead of using ::mmap use CreateFileMapping/MapViewOfFile


Hey Andrew,

You forgot to attach this patch to your e-mail.

Best regards,
Viktor

----- Original Message ----- From: "Andrew Pinski" <Andrew_Pinski@playstation.sony.com>
To: "binutils" <binutils@sourceware.org>
Sent: Wednesday, October 07, 2009 12:31 PM
Subject: [PATCH GOLD] [7/N mingw host] Instead of using ::mmap use CreateFileMapping/MapViewOfFile



Hi,
 Mingw does not have the mmap function but it does have the ability
to map files into memory.  Using the CreateFileMapping/MapViewOfFile
Win32 APIs we can map the files into memory.  Or even do an anonymous
mapping.

This patch has some #ifdef _WIN32 in it, I did not have time to figure
out the best way to extract that from it but it should not be hard
with classes and such.

This is my last patch using mingw as the host OS when building gold.

Built and tested on i686-linux-gnu.

I also built and tested with 5 patches together on i686-mingw
targeting i686-linux-gnu.

Thanks,
Andrew Pinski

ChangeLog:
* fileread.cc: Don't include sys/mman.h and sys/uio.h on Win32 but do
include windows.h.
(File_read::View::~View): Use UnmapViewOfFile instead of munmap on win32.
(File_read::make_view): Use CreateFileMapping/MapViewOfFile instead of
mmap on win32.
* fileread.h (File_read::page_size): Set to 64k.
* mremap.c: Don't include sys/mman.h on Win32 but do include windows.h.
(mremap): Use CreateFileMapping/MapViewOfFile instead of mmap and
UnmapViewOfFile instead of munmap on win32.
* output.cc: Don't include sys/mman.h on Win32 but do include windows.h.
(Output_file::map_anonymous):  Use CreateFileMapping/MapViewOfFile
instead of mmap on win32..
(Output_file::map_no_anonymous): Likewise.
(Output_file::unmap): Use  UnmapViewOfFile instead of munmap on win32.



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